mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-12 20:49:53 +08:00
- delete electron/settings, the settings preload and window, the config-presets IPC channels, the Configuration menu and the preset watcher in scripts/electron-dev.mjs; config-manager.ts keeps only the user locale (still read from config-presets.json so the saved language survives) - electron/main/env-loader.ts parses .env with dotenv instead of a hand-written parser; electron:compile bundles dependencies - drop the unreachable development branches in port-manager.ts and next-server.ts, the duplicated locale normalisation in menu-i18n.ts, the unused electronAPI members, resources/entitlements.mac.plist - scripts/copy-dereferenced.cjs shared by afterPack and prepare-electron-build - CI: delete ci.yml, move type check and concurrency into test.yml, Node 24 everywhere, docker-build only on main - remove unused dependencies (@xmldom/xmldom, remark-gfm, @anthropic-ai/tokenizer, @testing-library/user-event, concurrently, wait-on, eslint, eslint-config-next, @vitest/coverage-v8, shx), .eslintrc.json and the vitest coverage block
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
/**
|
|
* Type declarations for Electron API exposed via preload script
|
|
*/
|
|
|
|
/** Proxy configuration interface */
|
|
interface ProxyConfig {
|
|
httpProxy?: string
|
|
httpsProxy?: string
|
|
}
|
|
|
|
/** Result of setting proxy */
|
|
interface SetProxyResult {
|
|
success: boolean
|
|
error?: string
|
|
}
|
|
|
|
/** Result of setting user locale */
|
|
interface SetUserLocaleResult {
|
|
success: boolean
|
|
error?: string
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
/** Main window Electron API */
|
|
electronAPI?: {
|
|
/** Whether running in Electron environment */
|
|
isElectron: boolean
|
|
/** Get proxy configuration */
|
|
getProxy: () => Promise<ProxyConfig>
|
|
/** Set proxy configuration (saves and restarts server) */
|
|
setProxy: (config: ProxyConfig) => Promise<SetProxyResult>
|
|
/** Set user's preferred locale */
|
|
setUserLocale: (locale: string) => Promise<SetUserLocaleResult>
|
|
/**
|
|
* Call back after the server restarted on the same port (proxy
|
|
* change); returns a function that stops the calls
|
|
*/
|
|
onServerRestarted?: (callback: () => void) => () => void
|
|
/** A chat was saved: open this port next launch */
|
|
chatSaved?: () => Promise<void>
|
|
/** The page loaded with this many chats */
|
|
chatsLoaded?: (count: number) => Promise<void>
|
|
}
|
|
}
|
|
}
|
|
|
|
export type { ProxyConfig }
|