diff --git a/app/common/config-schemata.ts b/app/common/config-schemata.ts index e2db7b80f..5cab99305 100644 --- a/app/common/config-schemata.ts +++ b/app/common/config-schemata.ts @@ -36,6 +36,7 @@ export const configSchemata = { useManualProxy: z.boolean(), useProxy: z.boolean(), useSystemProxy: z.boolean(), + whitelistedProtocols: z.string().array(), }; export const enterpriseConfigSchemata = { diff --git a/app/common/link-util.ts b/app/common/link-util.ts index bfd2157fa..87305e5e7 100644 --- a/app/common/link-util.ts +++ b/app/common/link-util.ts @@ -3,10 +3,20 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; +import * as ConfigUtil from "./config-util.js"; import {html} from "./html.js"; +/* Fetches the current protocolLaunchers from settings.json */ +const whitelistedProtocols = ConfigUtil.getConfigItem("whitelistedProtocols", [ + "http:", + "https:", + "mailto:", + "tel:", + "sip:", +]); + export async function openBrowser(url: URL): Promise { - if (["http:", "https:", "mailto:"].includes(url.protocol)) { + if (whitelistedProtocols.includes(url.protocol)) { await shell.openExternal(url.href); } else { // For security, indirect links to non-whitelisted protocols