22 lines
1.0 KiB
TypeScript
22 lines
1.0 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", "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 WEBTOON cover of a 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`;
|
|
}
|