2025-12-22 09:18:21 +08:00
|
|
|
/**
|
|
|
|
|
* Type declarations for Electron API exposed via preload script
|
|
|
|
|
*/
|
|
|
|
|
|
2026-01-09 09:26:19 +09:00
|
|
|
/** Proxy configuration interface */
|
|
|
|
|
interface ProxyConfig {
|
|
|
|
|
httpProxy?: string
|
|
|
|
|
httpsProxy?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Result of setting proxy */
|
|
|
|
|
interface SetProxyResult {
|
|
|
|
|
success: boolean
|
|
|
|
|
error?: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-17 23:10:57 +05:30
|
|
|
/** Result of setting user locale */
|
|
|
|
|
interface SetUserLocaleResult {
|
|
|
|
|
success: boolean
|
|
|
|
|
error?: string
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-22 09:18:21 +08:00
|
|
|
declare global {
|
|
|
|
|
interface Window {
|
|
|
|
|
/** Main window Electron API */
|
|
|
|
|
electronAPI?: {
|
|
|
|
|
/** Whether running in Electron environment */
|
|
|
|
|
isElectron: boolean
|
2026-01-09 09:26:19 +09:00
|
|
|
/** Get proxy configuration */
|
|
|
|
|
getProxy: () => Promise<ProxyConfig>
|
|
|
|
|
/** Set proxy configuration (saves and restarts server) */
|
|
|
|
|
setProxy: (config: ProxyConfig) => Promise<SetProxyResult>
|
2026-01-17 23:10:57 +05:30
|
|
|
/** Set user's preferred locale */
|
|
|
|
|
setUserLocale: (locale: string) => Promise<SetUserLocaleResult>
|
2026-10-05 22:39:32 +09:00
|
|
|
/**
|
2026-10-12 12:35:55 +09:00
|
|
|
* Call back after the server restarted on the same port (proxy
|
|
|
|
|
* change); returns a function that stops the calls
|
2026-10-05 22:39:32 +09:00
|
|
|
*/
|
|
|
|
|
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>
|
2025-12-22 09:18:21 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-12 12:35:55 +09:00
|
|
|
export type { ProxyConfig }
|