Add shorts_yt_quota module, Shorts UI quota banner, overview tweaks (hide upcoming opens, align events panel height), Electron desktop client scaffold, and deploy scripts; update README. Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import Store from "electron-store";
|
|
|
|
export type DesktopConfig = {
|
|
apiBase: string;
|
|
apiPort: number;
|
|
pbPort: number;
|
|
ytPort: number;
|
|
minimizeToTray: boolean;
|
|
nativeNotify: boolean;
|
|
windowBounds?: { x?: number; y?: number; width: number; height: number };
|
|
};
|
|
|
|
const defaults: DesktopConfig = {
|
|
apiBase: "http://127.0.0.1:8014",
|
|
apiPort: 8014,
|
|
pbPort: 8090,
|
|
ytPort: 8020,
|
|
minimizeToTray: true,
|
|
nativeNotify: true,
|
|
};
|
|
|
|
export const store = new Store<DesktopConfig>({
|
|
name: "douyinweb-desktop",
|
|
defaults,
|
|
});
|
|
|
|
export function getConfig(): DesktopConfig {
|
|
return {
|
|
apiBase: store.get("apiBase", defaults.apiBase),
|
|
apiPort: store.get("apiPort", defaults.apiPort),
|
|
pbPort: store.get("pbPort", defaults.pbPort),
|
|
ytPort: store.get("ytPort", defaults.ytPort),
|
|
minimizeToTray: store.get("minimizeToTray", defaults.minimizeToTray),
|
|
nativeNotify: store.get("nativeNotify", defaults.nativeNotify),
|
|
windowBounds: store.get("windowBounds"),
|
|
};
|
|
}
|
|
|
|
export function setConfig(patch: Partial<DesktopConfig>): DesktopConfig {
|
|
for (const [k, v] of Object.entries(patch)) {
|
|
if (v !== undefined) store.set(k as keyof DesktopConfig, v as never);
|
|
}
|
|
return getConfig();
|
|
}
|