Skip to content

Commit

Permalink
added down status to plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
error7404 committed Oct 20, 2024
1 parent e4e3415 commit 2025ea7
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 4 deletions.
1 change: 1 addition & 0 deletions scripts/json_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ for (let language in languages) {
iconUrl: `${STATIC_LINK}/${icon || 'siteNotAvailable.png'}`,
customJS: customJS ? `${STATIC_LINK}/${customJS}` : undefined,
customCSS: customCSS ? `${STATIC_LINK}/${customCSS}` : undefined,
down: plugin.endsWith('.down.js'),
};

if (pluginSet.has(id)) {
Expand Down
6 changes: 4 additions & 2 deletions scripts/multisrc/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import fs from 'fs';
// lang: string;
// filename: string;
// pluginScript: string;
// down?: boolean;
// };

// export type ScrpitGeneratorFunction = () => GeneratedScript[];
Expand All @@ -19,7 +20,7 @@ const generate = async name => {
if (!isScriptGenerator(generateAll)) return false;
const sources = generateAll();
for (let source of sources) {
const { lang, filename, pluginScript } = source;
const { lang, filename, pluginScript, down } = source;
if (!lang || !filename || !pluginScript) {
console.warn(name, ': lang, filename, pluginScript are required!');
continue;
Expand All @@ -28,7 +29,8 @@ const generate = async name => {
const filePath = path.join(
pluginsDir,
lang.toLowerCase(),
filename.replace(/[\s-.]+/g, '') + `[${name}].ts`,
filename.replace(/[\s-\.]+/g, '') +
`[${name}]${down ? '.down' : ''}.ts`,
);
fs.writeFileSync(filePath, pluginScript, { encoding: 'utf-8' });
}
Expand Down
10 changes: 9 additions & 1 deletion scripts/multisrc/lightnovelwp/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ export const generateAll = function () {
source.filters = JSON.parse(filters).filters;
}
console.log(
`[lightnovelwp] Generating: ${source.id}${' '.repeat(20 - source.id.length)} ${source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
'[lightnovelwp] Generating:',
source.id.padEnd(20),
source.options?.down
? '🔽site is down🔽'
: source.filters
? '🔎with filters🔍'
: '🚫 no filters 🚫',
source.options?.downSince ? `since: ${source.options?.downSince}` : '',
);
return generator(source);
});
Expand All @@ -39,5 +46,6 @@ export default plugin;
lang: source.options?.lang || 'English',
filename: source.sourceName,
pluginScript,
down: source.options?.down || false,
};
};
2 changes: 2 additions & 0 deletions scripts/multisrc/lightnovelwp/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { Filters } from '@libs/filterInputs';

type LightNovelWPOptions = {
reverseChapters?: boolean;
down?: boolean;
downSince?: string;
lang?: string;
versionIncrements?: number;
seriesPath?: string;
Expand Down
12 changes: 11 additions & 1 deletion scripts/multisrc/madara/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ export const generateAll = function () {
source.filters = JSON.parse(filters).filters;
}
console.log(
`[madara] Generating: ${source.id}${' '.repeat(20 - source.id.length)} ${source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
'[madara] Generating:',
metadata.id.padEnd(20),
metadata.options?.down
? '🔽site is down🔽'
: metadata.filters
? '🔎with filters🔍'
: '🚫 no filters 🚫',
metadata.options?.downSince
? `since: ${metadata.options?.downSince}`
: '',
);
return generator(source);
});
Expand All @@ -35,5 +44,6 @@ export default plugin;
lang: source.options?.lang || 'English',
filename: source.sourceName,
pluginScript,
down: metadata.options?.down,
};
};
95 changes: 95 additions & 0 deletions scripts/multisrc/madara/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
"useNewChapterEndpoint": true
}
},
{
"id": "zinnovel",
"sourceSite": "https://zinnovel.com/",
"sourceName": "ZinnNovel",
"options": {
"down": true,
"downSince": "2024-03-04"
}
},
{
"id": "novelTL",
"sourceSite": "https://noveltranslate.com/",
Expand All @@ -30,6 +39,15 @@
"useNewChapterEndpoint": true
}
},
{
"id": "freenovel.me",
"sourceSite": "https://freenovel.me/",
"sourceName": "FreeNovelMe",
"options": {
"down": true,
"downSince": "2024-03-04"
}
},
{
"id": "1stkissnovel",
"sourceSite": "https://1stkissnovel.org/",
Expand Down Expand Up @@ -90,6 +108,15 @@
"sourceSite": "https://www.webnovelover.com/",
"sourceName": "WebNovelLover"
},
{
"id": "readwebnovels",
"sourceSite": "https://readwebnovels.net/",
"sourceName": "ReadWebNovels",
"options": {
"down": true,
"downSince": "2024-03-04"
}
},
{
"id": "wbnovel",
"sourceSite": "https://wbnovel.com/",
Expand Down Expand Up @@ -124,6 +151,16 @@
"lang": "Indonesian"
}
},
{
"id": "onlymtl",
"sourceSite": "https://www.onlymtl.com/",
"sourceName": "OnlyMTL",
"options": {
"useNewChapterEndpoint": true,
"down": true,
"downSince": "2024-03-04"
}
},
{
"id": "hizomanga",
"sourceSite": "https://hizomanga.net/",
Expand Down Expand Up @@ -168,6 +205,16 @@
"useNewChapterEndpoint": true
}
},
{
"id": "mtlnovel.club",
"sourceSite": "https://mtlnovel.club/",
"sourceName": "MTLNovel.Club",
"options": {
"useNewChapterEndpoint": true,
"down": true,
"downSince": "2024-03-04"
}
},
{
"id": "guavaread",
"sourceSite": "https://guavaread.com/",
Expand All @@ -176,6 +223,26 @@
"useNewChapterEndpoint": true
}
},
{
"id": "sweetEscapeTL",
"sourceSite": "https://sweetescapetranslations.com/",
"sourceName": "Sweet Escape Translations",
"options": {
"useNewChapterEndpoint": false,
"down": true,
"downSince": "2024-03-04"
}
},
{
"id": "novelstic",
"sourceSite": "https://novelstic.com/",
"sourceName": "Novelstic",
"options": {
"useNewChapterEndpoint": true,
"down": true,
"downSince": "2024-03-04"
}
},
{
"id": "neosekaiTLS",
"sourceSite": "https://www.neosekaitranslations.com/",
Expand All @@ -196,6 +263,34 @@
"sourceName": "Zetro Translation",
"options": {}
},
{
"id": "nocturneTLS",
"sourceSite": "https://nocturnetls.net/",
"sourceName": "Nocturne Translations",
"options": {
"down": true,
"downSince": "2024-03-04"
}
},
{
"id": "novelroom",
"sourceSite": "https://novelroom.net/",
"sourceName": "Novelroom.net",
"options": {
"down": true,
"downSince": "2024-03-04"
}
},
{
"id": "novelr18",
"sourceSite": "https://novelr18.com/",
"sourceName": "NovelR18",
"options": {
"useNewChapterEndpoint": true,
"down": true,
"downSince": "2024-03-04"
}
},
{
"id": "webnoveloku",
"sourceSite": "https://www.webnoveloku.com/",
Expand Down
2 changes: 2 additions & 0 deletions scripts/multisrc/madara/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const includesAny = (str: string, keywords: string[]) =>

type MadaraOptions = {
useNewChapterEndpoint?: boolean;
down?: boolean;
downSince?: string;
lang?: string;
orderBy?: string;
versionIncrements?: number;
Expand Down

0 comments on commit 2025ea7

Please sign in to comment.