mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-01 20:03:30 +02:00
feat: add active search space management to Electron API and UI
- Introduced IPC channels for getting and setting the active search space, enhancing user experience across the application. - Updated the preload script to expose new API methods for active search space management. - Modified the main window and quick ask functionalities to sync the active search space based on user navigation. - Enhanced the desktop and web applications to allow users to select and manage their default search space seamlessly. - Implemented automatic synchronization of the active search space during login and navigation events.
This commit is contained in:
parent
b74ac8a608
commit
7c6e52a0a5
12 changed files with 189 additions and 62 deletions
24
surfsense_desktop/src/modules/active-search-space.ts
Normal file
24
surfsense_desktop/src/modules/active-search-space.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
const STORE_KEY = 'activeSearchSpaceId';
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let store: any = null;
|
||||
|
||||
async function getStore() {
|
||||
if (!store) {
|
||||
const { default: Store } = await import('electron-store');
|
||||
store = new Store({
|
||||
name: 'active-search-space',
|
||||
defaults: { [STORE_KEY]: null as string | null },
|
||||
});
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
export async function getActiveSearchSpaceId(): Promise<string | null> {
|
||||
const s = await getStore();
|
||||
return (s.get(STORE_KEY) as string | null) ?? null;
|
||||
}
|
||||
|
||||
export async function setActiveSearchSpaceId(id: string): Promise<void> {
|
||||
const s = await getStore();
|
||||
s.set(STORE_KEY, id);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue