mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
feat(ipc): improve error handling and streamline IPC initialization
This commit is contained in:
parent
ba1bf5ac58
commit
f704eebc7e
4 changed files with 19 additions and 8 deletions
|
|
@ -1,11 +1,13 @@
|
|||
import { log } from 'electron-log/main';
|
||||
import { pluginNodeExecutor } from './plugin-node-executor';
|
||||
import { initAppDataIpc } from './ipc-handlers/app-data';
|
||||
import { initAppControlIpc } from './ipc-handlers/app-control';
|
||||
import { initSystemIpc } from './ipc-handlers/system';
|
||||
import { initJiraIpc } from './ipc-handlers/jira';
|
||||
import { initGlobalShortcutsIpc } from './ipc-handlers/global-shortcuts';
|
||||
import { initExecIpc } from './ipc-handlers/exec';
|
||||
import {
|
||||
initAppControlIpc,
|
||||
initAppDataIpc,
|
||||
initExecIpc,
|
||||
initGlobalShortcutsIpc,
|
||||
initJiraIpc,
|
||||
initSystemIpc,
|
||||
} from './ipc-handlers';
|
||||
|
||||
export const initIpcInterfaces = (): void => {
|
||||
// Initialize plugin node executor (registers IPC handlers)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const execWithFrontendErrorHandlerInform = async (
|
|||
const allowedCommands: string[] = (existingData[COMMAND_MAP_PROP] as string[]) || [];
|
||||
|
||||
if (!Array.isArray(allowedCommands)) {
|
||||
throw new Error('allowedCommands is no array ???');
|
||||
throw new Error('Invalid configuration: allowedCommands must be an array');
|
||||
}
|
||||
if (allowedCommands.includes(command)) {
|
||||
exec(command, (err) => {
|
||||
|
|
|
|||
6
electron/ipc-handlers/index.ts
Normal file
6
electron/ipc-handlers/index.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export { initAppControlIpc } from './app-control';
|
||||
export { initAppDataIpc } from './app-data';
|
||||
export { initExecIpc } from './exec';
|
||||
export { initGlobalShortcutsIpc } from './global-shortcuts';
|
||||
export { initJiraIpc } from './jira';
|
||||
export { initSystemIpc } from './system';
|
||||
|
|
@ -37,6 +37,9 @@ import { SyncSafetyBackupService } from '../../imex/sync/sync-safety-backup.serv
|
|||
|
||||
const w = window as Window & { productivityTips?: string[][]; randomIndex?: number };
|
||||
|
||||
/** Delay before running deferred initialization tasks (plugins, storage checks, etc.) */
|
||||
const DEFERRED_INIT_DELAY_MS = 1000;
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
|
|
@ -114,7 +117,7 @@ export class StartupService {
|
|||
|
||||
this._handleAppStartRating();
|
||||
await this._initPlugins();
|
||||
}, 1000);
|
||||
}, DEFERRED_INIT_DELAY_MS);
|
||||
|
||||
if (IS_ELECTRON) {
|
||||
window.ea.informAboutAppReady();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue