feat: Introduce multi-platform architecture for Electron and Web clients with shared UI components, Convex backend for messaging, and integrated search functionality.
Some checks failed
Build and Release / build-and-release (push) Has been cancelled
Some checks failed
Build and Release / build-and-release (push) Has been cancelled
This commit is contained in:
@@ -603,6 +603,43 @@ app.whenReady().then(async () => {
|
||||
});
|
||||
});
|
||||
|
||||
// --- Search DB file storage ---
|
||||
const SEARCH_DIR = path.join(app.getPath('userData'), 'search');
|
||||
|
||||
ipcMain.handle('search-db-load', (event, userId) => {
|
||||
try {
|
||||
const filePath = path.join(SEARCH_DIR, `search-${userId}.db.enc`);
|
||||
if (!fs.existsSync(filePath)) return null;
|
||||
return new Uint8Array(fs.readFileSync(filePath));
|
||||
} catch (err) {
|
||||
console.error('Search DB load error:', err.message);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('search-db-save', (event, userId, data) => {
|
||||
try {
|
||||
if (!fs.existsSync(SEARCH_DIR)) fs.mkdirSync(SEARCH_DIR, { recursive: true });
|
||||
const filePath = path.join(SEARCH_DIR, `search-${userId}.db.enc`);
|
||||
fs.writeFileSync(filePath, Buffer.from(data));
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error('Search DB save error:', err.message);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('search-db-clear', (event, userId) => {
|
||||
try {
|
||||
const filePath = path.join(SEARCH_DIR, `search-${userId}.db.enc`);
|
||||
if (fs.existsSync(filePath)) fs.unlinkSync(filePath);
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error('Search DB clear error:', err.message);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// AFK voice channel: expose system idle time to renderer
|
||||
ipcMain.handle('get-system-idle-time', () => powerMonitor.getSystemIdleTime());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user