mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-30 18:12:08 -07:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
24
src/main/anilist-url-guard.ts
Normal file
24
src/main/anilist-url-guard.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
const ANILIST_ALLOWED_HOSTS = new Set(['anilist.co', 'www.anilist.co']);
|
||||
|
||||
export function isAllowedAnilistExternalUrl(rawUrl: string): boolean {
|
||||
try {
|
||||
const parsedUrl = new URL(rawUrl);
|
||||
return (
|
||||
parsedUrl.protocol === 'https:' && ANILIST_ALLOWED_HOSTS.has(parsedUrl.hostname.toLowerCase())
|
||||
);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function isAllowedAnilistSetupNavigationUrl(rawUrl: string): boolean {
|
||||
if (isAllowedAnilistExternalUrl(rawUrl)) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
const parsedUrl = new URL(rawUrl);
|
||||
return parsedUrl.protocol === 'data:';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user