fix(electron): create doc shortcut should follow default type in settings (#14678)

This commit is contained in:
DarkSky
2026-03-18 14:58:22 +08:00
committed by GitHub
parent c1a09b951f
commit d6d5ae6182
18 changed files with 156 additions and 81 deletions
@@ -0,0 +1,25 @@
export const mainHost = '.';
export const anotherHost = 'another-host';
export const internalHosts = new Set([mainHost, anotherHost]);
export const mainWindowOrigin = `assets://${mainHost}`;
export const anotherOrigin = `assets://${anotherHost}`;
export const onboardingViewUrl = `${mainWindowOrigin}/onboarding`;
export const shellViewUrl = `${mainWindowOrigin}/shell.html`;
export const backgroundWorkerViewUrl = `${mainWindowOrigin}/background-worker.html`;
export const customThemeViewUrl = `${mainWindowOrigin}/theme-editor`;
// mitigate the issue that popup window share the same zoom level of the main window
// Notes from electron official docs:
// "The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window."
export const popupViewUrl = `${anotherOrigin}/popup.html`;
export const isInternalUrl = (url: string) => {
try {
const parsed = new URL(url);
return parsed.protocol === 'assets:' && internalHosts.has(parsed.hostname);
} catch {
return false;
}
};