2025-12-07 19:32:53 +02:00
|
|
|
import type { Express } from "express";
|
|
|
|
|
import type { Server } from "http";
|
|
|
|
|
|
|
|
|
|
export interface WebUiServerController {
|
|
|
|
|
expressApp: Express;
|
|
|
|
|
httpServer: Server;
|
|
|
|
|
getPort: () => number | null;
|
|
|
|
|
getOpenCodePort: () => number | null;
|
|
|
|
|
isReady: () => boolean;
|
|
|
|
|
restartOpenCode: () => Promise<void>;
|
|
|
|
|
stop: (options?: { exitProcess?: boolean }) => Promise<void>;
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-08 01:26:59 +08:00
|
|
|
export interface DesktopUpdateInfo {
|
|
|
|
|
available: boolean;
|
|
|
|
|
currentVersion?: string;
|
|
|
|
|
version?: string | null;
|
|
|
|
|
body?: string | null;
|
|
|
|
|
date?: string | null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface DesktopUpdater {
|
|
|
|
|
check: () => Promise<DesktopUpdateInfo>;
|
|
|
|
|
install: () => Promise<DesktopUpdateInfo>;
|
|
|
|
|
restart: () => Promise<void> | void;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-07 19:32:53 +02:00
|
|
|
export interface StartWebUiServerOptions {
|
|
|
|
|
port?: number;
|
2026-03-23 15:07:16 +02:00
|
|
|
host?: string;
|
2025-12-07 19:32:53 +02:00
|
|
|
attachSignals?: boolean;
|
|
|
|
|
exitOnShutdown?: boolean;
|
|
|
|
|
uiPassword?: string | null;
|
2026-09-08 01:26:59 +08:00
|
|
|
desktopUpdater?: DesktopUpdater;
|
2025-12-07 19:32:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export declare function startWebUiServer(
|
|
|
|
|
options?: StartWebUiServerOptions
|
|
|
|
|
): Promise<WebUiServerController>;
|
|
|
|
|
|
|
|
|
|
export declare function gracefulShutdown(options?: { exitProcess?: boolean }): Promise<void>;
|
|
|
|
|
export declare function setupProxy(app: Express): void;
|
|
|
|
|
export declare function restartOpenCode(): Promise<void>;
|
2026-03-12 19:40:22 +02:00
|
|
|
export declare function parseArgs(argv?: string[]): {
|
|
|
|
|
port: number;
|
2026-03-23 15:07:16 +02:00
|
|
|
host?: string;
|
2026-03-12 19:40:22 +02:00
|
|
|
uiPassword: string | null;
|
|
|
|
|
tryCfTunnel: boolean;
|
|
|
|
|
tunnelProvider?: string;
|
|
|
|
|
tunnelMode?: string;
|
|
|
|
|
tunnelConfigPath?: string | null;
|
|
|
|
|
tunnelToken?: string;
|
|
|
|
|
tunnelHostname?: string;
|
|
|
|
|
};
|