mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-09 07:42:39 +02:00
feat(desktop): expose agent filesystem IPC APIs
This commit is contained in:
parent
1eadecee23
commit
5c3a327a0c
3 changed files with 31 additions and 0 deletions
|
|
@ -51,4 +51,8 @@ export const IPC_CHANNELS = {
|
||||||
ANALYTICS_RESET: 'analytics:reset',
|
ANALYTICS_RESET: 'analytics:reset',
|
||||||
ANALYTICS_CAPTURE: 'analytics:capture',
|
ANALYTICS_CAPTURE: 'analytics:capture',
|
||||||
ANALYTICS_GET_CONTEXT: 'analytics:get-context',
|
ANALYTICS_GET_CONTEXT: 'analytics:get-context',
|
||||||
|
// Agent filesystem mode
|
||||||
|
AGENT_FILESYSTEM_GET_SETTINGS: 'agent-filesystem:get-settings',
|
||||||
|
AGENT_FILESYSTEM_SET_SETTINGS: 'agent-filesystem:set-settings',
|
||||||
|
AGENT_FILESYSTEM_PICK_ROOT: 'agent-filesystem:pick-root',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@ import {
|
||||||
resetUser as analyticsReset,
|
resetUser as analyticsReset,
|
||||||
trackEvent,
|
trackEvent,
|
||||||
} from '../modules/analytics';
|
} from '../modules/analytics';
|
||||||
|
import {
|
||||||
|
getAgentFilesystemSettings,
|
||||||
|
pickAgentFilesystemRoot,
|
||||||
|
setAgentFilesystemSettings,
|
||||||
|
} from '../modules/agent-filesystem';
|
||||||
|
|
||||||
let authTokens: { bearer: string; refresh: string } | null = null;
|
let authTokens: { bearer: string; refresh: string } | null = null;
|
||||||
|
|
||||||
|
|
@ -191,4 +196,18 @@ export function registerIpcHandlers(): void {
|
||||||
platform: process.platform,
|
platform: process.platform,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle(IPC_CHANNELS.AGENT_FILESYSTEM_GET_SETTINGS, () =>
|
||||||
|
getAgentFilesystemSettings()
|
||||||
|
);
|
||||||
|
|
||||||
|
ipcMain.handle(
|
||||||
|
IPC_CHANNELS.AGENT_FILESYSTEM_SET_SETTINGS,
|
||||||
|
(_event, settings: { mode?: 'cloud' | 'desktop_local_folder'; localRootPath?: string | null }) =>
|
||||||
|
setAgentFilesystemSettings(settings)
|
||||||
|
);
|
||||||
|
|
||||||
|
ipcMain.handle(IPC_CHANNELS.AGENT_FILESYSTEM_PICK_ROOT, () =>
|
||||||
|
pickAgentFilesystemRoot()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,4 +101,12 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||||
analyticsCapture: (event: string, properties?: Record<string, unknown>) =>
|
analyticsCapture: (event: string, properties?: Record<string, unknown>) =>
|
||||||
ipcRenderer.invoke(IPC_CHANNELS.ANALYTICS_CAPTURE, { event, properties }),
|
ipcRenderer.invoke(IPC_CHANNELS.ANALYTICS_CAPTURE, { event, properties }),
|
||||||
getAnalyticsContext: () => ipcRenderer.invoke(IPC_CHANNELS.ANALYTICS_GET_CONTEXT),
|
getAnalyticsContext: () => ipcRenderer.invoke(IPC_CHANNELS.ANALYTICS_GET_CONTEXT),
|
||||||
|
// Agent filesystem mode
|
||||||
|
getAgentFilesystemSettings: () =>
|
||||||
|
ipcRenderer.invoke(IPC_CHANNELS.AGENT_FILESYSTEM_GET_SETTINGS),
|
||||||
|
setAgentFilesystemSettings: (settings: {
|
||||||
|
mode?: "cloud" | "desktop_local_folder";
|
||||||
|
localRootPath?: string | null;
|
||||||
|
}) => ipcRenderer.invoke(IPC_CHANNELS.AGENT_FILESYSTEM_SET_SETTINGS, settings),
|
||||||
|
pickAgentFilesystemRoot: () => ipcRenderer.invoke(IPC_CHANNELS.AGENT_FILESYSTEM_PICK_ROOT),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue