- AddAccountDialog: полный liquid glass редизайн (saturate(2.8), призматический торец, вдавленные инпуты) - AppShell: окно приветствия приведено к тому же glass-стилю - Настройки: слайдер масштаба 50–200% через webContents.setZoomFactor() (IPC) - credential-store: fallback на plain:base64 когда safeStorage недоступен (Linux без keychain) - error-msg: user-select: text для копирования текста ошибки Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
import { app, BrowserWindow, shell, ipcMain, Menu } from 'electron'
|
|
import { join } from 'node:path'
|
|
import { AccountManager } from './services/account-manager'
|
|
import { registerAccountHandlers } from './ipc/accounts.handler'
|
|
import { registerFolderHandlers } from './ipc/folders.handler'
|
|
import { registerMessageHandlers } from './ipc/messages.handler'
|
|
import { registerOAuthHandlers } from './ipc/oauth.handler'
|
|
|
|
const accountManager = new AccountManager()
|
|
|
|
function createWindow(): BrowserWindow {
|
|
const mainWindow = new BrowserWindow({
|
|
width: 1280,
|
|
height: 800,
|
|
minWidth: 900,
|
|
minHeight: 600,
|
|
backgroundColor: '#1e1e1e',
|
|
webPreferences: {
|
|
preload: join(__dirname, '../preload/index.js'),
|
|
sandbox: false,
|
|
contextIsolation: true,
|
|
nodeIntegration: false
|
|
}
|
|
})
|
|
|
|
accountManager.setMainWindow(mainWindow)
|
|
|
|
// Open external links in browser
|
|
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
|
shell.openExternal(url)
|
|
return { action: 'deny' }
|
|
})
|
|
|
|
// Load the renderer
|
|
if (process.env.ELECTRON_RENDERER_URL) {
|
|
mainWindow.loadURL(process.env.ELECTRON_RENDERER_URL)
|
|
} else {
|
|
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
|
|
}
|
|
|
|
return mainWindow
|
|
}
|
|
|
|
Menu.setApplicationMenu(null)
|
|
|
|
ipcMain.handle('app:setZoom', (event, { factor }: { factor: number }) => {
|
|
event.sender.setZoomFactor(Math.max(0.5, Math.min(3, factor)))
|
|
})
|
|
|
|
app.whenReady().then(async () => {
|
|
await accountManager.initialize()
|
|
|
|
// Register all IPC handlers
|
|
registerAccountHandlers(accountManager)
|
|
registerFolderHandlers(accountManager)
|
|
registerMessageHandlers(accountManager)
|
|
registerOAuthHandlers()
|
|
|
|
createWindow()
|
|
|
|
app.on('activate', () => {
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
|
createWindow()
|
|
}
|
|
})
|
|
})
|
|
|
|
app.on('window-all-closed', () => {
|
|
if (process.platform !== 'darwin') {
|
|
app.quit()
|
|
}
|
|
})
|