feat: move termix identity into a plugin (C6)

This commit is contained in:
LukeGus committed 2026-09-24 20:50:54 -05:00
1 parent 6e56c90aac
commit 4dbce08379
157 files changed
+20743 -5766

No files matched your search

+8
View File
@@ -42,6 +42,8 @@ import {
} from "./auth-registry";
import { pluginHostBridge, resolvePluginPermission } from "./bridge";
import { shell, tabsApi } from "./shell-bridge";
import { onRemoteServerChange, remoteServerUrl } from "./desktop";
import { isElectron } from "@/lib/electron";
import { withPluginScope } from "./scope";
import { manifestDeclares, type ViewKind } from "./view-ownership";
import { pluginKey } from "@/lib/plugin-i18n";
@@ -407,6 +409,12 @@ export function createPluginApp(
onReady: (listener) => track(tabsApi.onReady(listener)),
},
desktop: {
available: isElectron(),
remoteServerUrl,
onRemoteServerChange: (listener) => track(onRemoteServerChange(listener)),
},
onDispose(dispose) {
if (disposed) {
dispose();
+24
View File
@@ -0,0 +1,24 @@
/** app.desktop: the desktop app's remote sync connection, for plugins. */
import { isElectron } from "@/lib/electron";
export async function remoteServerUrl(): Promise<string | null> {
if (!isElectron()) return null;
try {
const config = (await window.electronAPI?.invoke?.(
"get-remote-sync-config",
)) as { serverUrl?: string } | null | undefined;
return config?.serverUrl || null;
} catch {
return null;
}
}
export function onRemoteServerChange(listener: () => void): () => void {
const unsubscribe = window.electronAPI?.onRemoteSyncStatusChanged?.(() =>
listener(),
);
return () => {
if (typeof unsubscribe === "function") unsubscribe();
};
}