Files
mangabaka-seeder/scripts/userscript-banner.ts
T
2026-10-15 11:56:37 +02:00

22 lines
1.1 KiB
TypeScript

/** Tampermonkey/Violentmonkey metadata. @connect lists every host GM_xmlhttpRequest may reach. */
export function userscriptBanner(version: string, serverUrl?: string): string {
const connects = ["api.mangabaka.org", "webtoons.com", "pstatic.net", "tapas.io", "d30womf5coomej.cloudfront.net", "web.archive.org", "catbox.moe"];
if (serverUrl) connects.push(new URL(serverUrl).hostname);
const lines = [
"// ==UserScript==",
"// @name MangaBaka Seeder",
"// @namespace https://gitea.lucaswinther.info/lucasw89/mangabaka-seeder",
`// @version ${version}`,
"// @description Find every cover of a WEBTOON or Tapas series and turn them into a MangaBaka cover edit request",
"// @match https://mangabaka.org/*",
"// @grant GM_xmlhttpRequest",
"// @grant GM_getValue",
"// @grant GM_setValue",
"// @grant GM_deleteValue",
...connects.map((host) => `// @connect ${host}`),
"// @run-at document-idle",
"// ==/UserScript==",
];
return `${lines.join("\n")}\n\n`;
}