Skip to content

Commit fc42137

Browse files
error7404Rojikku
authored andcommitted
added down status to plugins
modified: plugins/multisrc/generate-multisrc-plugins.js modified: plugins/multisrc/lightnovelwp/generator.js modified: plugins/multisrc/lightnovelwp/template.ts modified: plugins/multisrc/madara/generator.js modified: plugins/multisrc/madara/template.ts
1 parent e358ad5 commit fc42137

File tree

6 files changed

+112
-4
lines changed

6 files changed

+112
-4
lines changed

plugins/multisrc/generate-multisrc-plugins.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import fs from 'fs';
55
// lang: string;
66
// filename: string;
77
// pluginScript: string;
8+
// down?: boolean;
89
// };
910

1011
// export type ScrpitGeneratorFunction = () => GeneratedScript[];
@@ -19,7 +20,7 @@ const generate = async name => {
1920
if (!isScriptGenerator(generateAll)) return false;
2021
const sources = generateAll();
2122
for (let source of sources) {
22-
const { lang, filename, pluginScript } = source;
23+
const { lang, filename, pluginScript, down } = source;
2324
if (!lang || !filename || !pluginScript) {
2425
console.warn(name, ': lang, filename, pluginScript are required!');
2526
continue;
@@ -28,7 +29,8 @@ const generate = async name => {
2829
const filePath = path.join(
2930
pluginsDir,
3031
lang.toLowerCase(),
31-
filename.replace(/[\s-.]+/g, '') + `[${name}].ts`,
32+
filename.replace(/[\s-\.]+/g, '') +
33+
`[${name}]${down ? '.down' : ''}.ts`,
3234
);
3335
fs.writeFileSync(filePath, pluginScript, { encoding: 'utf-8' });
3436
}

plugins/multisrc/lightnovelwp/generator.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ export const generateAll = function () {
1515
source.filters = JSON.parse(filters).filters;
1616
}
1717
console.log(
18-
`[lightnovelwp] Generating: ${source.id}${' '.repeat(20 - source.id.length)} ${source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
18+
'[lightnovelwp] Generating:',
19+
source.id.padEnd(20),
20+
source.options?.down
21+
? '🔽site is down🔽'
22+
: source.filters
23+
? '🔎with filters🔍'
24+
: '🚫 no filters 🚫',
25+
source.options?.downSince ? `since: ${source.options?.downSince}` : '',
1926
);
2027
return generator(source);
2128
});
@@ -39,5 +46,6 @@ export default plugin;
3946
lang: source.options?.lang || 'English',
4047
filename: source.sourceName,
4148
pluginScript,
49+
down: source.options?.down || false,
4250
};
4351
};

plugins/multisrc/lightnovelwp/template.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { storage } from '@libs/storage';
99

1010
type LightNovelWPOptions = {
1111
reverseChapters?: boolean;
12+
down?: boolean;
13+
downSince?: string;
1214
lang?: string;
1315
versionIncrements?: number;
1416
seriesPath?: string;

plugins/multisrc/madara/generator.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ export const generateAll = function () {
1515
source.filters = JSON.parse(filters).filters;
1616
}
1717
console.log(
18-
`[madara] Generating: ${source.id}${' '.repeat(20 - source.id.length)} ${source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
18+
'[madara] Generating:',
19+
source.id.padEnd(20),
20+
source.options?.down
21+
? '🔽site is down🔽'
22+
: source.filters
23+
? '🔎with filters🔍'
24+
: '🚫 no filters 🚫',
25+
source.options?.downSince ? `since: ${source.options?.downSince}` : '',
1926
);
2027
return generator(source);
2128
});
@@ -35,5 +42,6 @@ export default plugin;
3542
lang: source.options?.lang || 'English',
3643
filename: source.sourceName.replace(/[^\w]/g, ''),
3744
pluginScript,
45+
down: source.options?.down,
3846
};
3947
};

plugins/multisrc/madara/sources.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@
2525
"useNewChapterEndpoint": true
2626
}
2727
},
28+
{
29+
"id": "freenovel.me",
30+
"sourceSite": "https://freenovel.me/",
31+
"sourceName": "FreeNovelMe",
32+
"options": {
33+
"down": true,
34+
"downSince": "2024-03-04"
35+
}
36+
},
2837
{
2938
"id": "1stkissnovel",
3039
"sourceSite": "https://1stkissnovel.org/",
@@ -90,6 +99,15 @@
9099
"downSince": 1768289212967
91100
}
92101
},
102+
{
103+
"id": "readwebnovels",
104+
"sourceSite": "https://readwebnovels.net/",
105+
"sourceName": "ReadWebNovels",
106+
"options": {
107+
"down": true,
108+
"downSince": "2024-03-04"
109+
}
110+
},
93111
{
94112
"id": "wbnovel",
95113
"sourceSite": "https://wbnovel.com/",
@@ -124,6 +142,16 @@
124142
"lang": "Indonesian"
125143
}
126144
},
145+
{
146+
"id": "onlymtl",
147+
"sourceSite": "https://www.onlymtl.com/",
148+
"sourceName": "OnlyMTL",
149+
"options": {
150+
"useNewChapterEndpoint": true,
151+
"down": true,
152+
"downSince": "2024-03-04"
153+
}
154+
},
127155
{
128156
"id": "hizomanga",
129157
"sourceSite": "https://hizomanga.net/",
@@ -169,6 +197,16 @@
169197
"useNewChapterEndpoint": true
170198
}
171199
},
200+
{
201+
"id": "mtlnovel.club",
202+
"sourceSite": "https://mtlnovel.club/",
203+
"sourceName": "MTLNovel.Club",
204+
"options": {
205+
"useNewChapterEndpoint": true,
206+
"down": true,
207+
"downSince": "2024-03-04"
208+
}
209+
},
172210
{
173211
"id": "guavaread",
174212
"sourceSite": "https://guavaread.com/",
@@ -179,6 +217,26 @@
179217
"downSince": 1768289212912
180218
}
181219
},
220+
{
221+
"id": "sweetEscapeTL",
222+
"sourceSite": "https://sweetescapetranslations.com/",
223+
"sourceName": "Sweet Escape Translations",
224+
"options": {
225+
"useNewChapterEndpoint": false,
226+
"down": true,
227+
"downSince": "2024-03-04"
228+
}
229+
},
230+
{
231+
"id": "novelstic",
232+
"sourceSite": "https://novelstic.com/",
233+
"sourceName": "Novelstic",
234+
"options": {
235+
"useNewChapterEndpoint": true,
236+
"down": true,
237+
"downSince": "2024-03-04"
238+
}
239+
},
182240
{
183241
"id": "neosekaiTLS",
184242
"sourceSite": "https://www.neosekaitranslations.com/",
@@ -203,6 +261,34 @@
203261
"hasLocked": true
204262
}
205263
},
264+
{
265+
"id": "nocturneTLS",
266+
"sourceSite": "https://nocturnetls.net/",
267+
"sourceName": "Nocturne Translations",
268+
"options": {
269+
"down": true,
270+
"downSince": "2024-03-04"
271+
}
272+
},
273+
{
274+
"id": "novelroom",
275+
"sourceSite": "https://novelroom.net/",
276+
"sourceName": "Novelroom.net",
277+
"options": {
278+
"down": true,
279+
"downSince": "2024-03-04"
280+
}
281+
},
282+
{
283+
"id": "novelr18",
284+
"sourceSite": "https://novelr18.com/",
285+
"sourceName": "NovelR18",
286+
"options": {
287+
"useNewChapterEndpoint": true,
288+
"down": true,
289+
"downSince": "2024-03-04"
290+
}
291+
},
206292
{
207293
"id": "webnoveloku",
208294
"sourceSite": "https://www.webnoveloku.com/",

plugins/multisrc/madara/template.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const includesAny = (str: string, keywords: string[]) =>
1212

1313
type MadaraOptions = {
1414
useNewChapterEndpoint?: boolean;
15+
down?: boolean;
16+
downSince?: string;
1517
lang?: string;
1618
orderBy?: string;
1719
versionIncrements?: number;

0 commit comments

Comments
 (0)