import { dialog, shell } from "electron"; import { createDialogService } from "./dialog-service"; import { createNotesService } from "./notes-service"; import { createShellService } from "./shell-service"; export const SHELL_ALLOWLIST = ["example.com", "www.electronjs.org"]; export function createServices(options: { dir: string; dryRun: boolean }) { return { notes: createNotesService({ dir: options.dir }), shell: createShellService({ allowlist: SHELL_ALLOWLIST, openExternal: (url) => shell.openExternal(url), dryRun: options.dryRun, }), dialog: createDialogService({ showOpenDialog: async () => dialog.showOpenDialog({ properties: ["openFile"], filters: [{ name: "Notes", extensions: ["md", "txt"] }], }), dryRun: options.dryRun, }), }; } export type Services = ReturnType;