Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plugins/multisrc/fictioneer/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const generateAll = function () {
return list.map(source => {
console.log(
`[fictioneer] Generating: ${source.id}${' '.repeat(20 - source.id.length)}`,
source.options?.downSince ? `since: ${source.options?.downSince}` : '',
);
return generator(source);
});
Expand Down Expand Up @@ -37,5 +38,6 @@ export default plugin;
lang: source.options?.lang || 'English',
filename: source.sourceName,
pluginScript,
down: source.options?.down || false,
};
};
2 changes: 2 additions & 0 deletions plugins/multisrc/fictioneer/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Filters } from '@libs/filterInputs';

type FictioneerOptions = {
browsePage: string;
down?: boolean;
downSince?: string;
lang?: string;
versionIncrements?: number;
};
Expand Down
6 changes: 4 additions & 2 deletions plugins/multisrc/generate-multisrc-plugins.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 ? '.broken' : ''}.ts`,
);
fs.writeFileSync(filePath, pluginScript, { encoding: 'utf-8' });
}
Expand Down
9 changes: 8 additions & 1 deletion plugins/multisrc/hotnovelpub/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ export const generateAll = function () {
return { ...p, filters };
})
.map(metadata => {
console.log(`[hotnovelpub]: Generating`, metadata.id);
console.log(
`[hotnovelpub]: Generating`,
metadata.id,
metadata.options?.downSince
? `since: ${metadata.options?.downSince}`
: '',
);
return generator(metadata);
});
};
Expand All @@ -59,5 +65,6 @@ export default plugin;
lang: lang[metadata?.options?.lang || 'en'] || 'english',
filename: metadata.sourceName,
pluginScript,
down: metadata.options?.down || false,
};
};
2 changes: 2 additions & 0 deletions plugins/multisrc/hotnovelpub/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export type HotNovelPubMetadata = {

type HotNovelPubOptions = {
lang?: string;
down?: boolean;
downSince?: string;
};

class HotNovelPubPlugin implements Plugin.PluginBase {
Expand Down
9 changes: 8 additions & 1 deletion plugins/multisrc/ifreedom/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ const folder = dirname(fileURLToPath(import.meta.url));
export const generateAll = function () {
return list.map(metadata => {
metadata.filters = Object.assign(defaultSettings.filters, metadata.filters);
console.log(`[ifreedom]: Generating`, metadata.id);
console.log(
`[ifreedom]: Generating`,
metadata.id,
metadata.options?.downSince
? `since: ${metadata.options?.downSince}`
: '',
);
return generator(metadata);
});
};
Expand All @@ -32,5 +38,6 @@ export default plugin;
lang: 'russian',
filename: metadata.sourceName,
pluginScript,
down: metadata.options?.down || false,
};
};
7 changes: 7 additions & 0 deletions plugins/multisrc/ifreedom/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ export type IfreedomMetadata = {
sourceSite: string;
sourceName: string;
filters?: Filters;
options?: IfreedomOptions;
};

type IfreedomOptions = {
lang?: string;
down?: boolean;
downSince?: string;
};

class IfreedomPlugin implements Plugin.PluginBase {
Expand Down
4 changes: 3 additions & 1 deletion plugins/multisrc/lightnovelworld/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const generateAll = function () {
source.filters = JSON.parse(filters);
}
console.log(
`[lightnovelworld] Generating: ${source.id}${' '.repeat(20 - source.id.length)} ${source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
`[lightnovelworld] Generating: ${source.id}${' '.repeat(20 - source.id.length)} ${source.options?.down ? '🔽site is down🔽' : source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
source.options?.downSince ? `since: ${source.options?.downSince}` : '',
);
return generator(source);
});
Expand All @@ -36,5 +37,6 @@ export default plugin;
lang: source.options?.lang || 'English',
filename: source.sourceName,
pluginScript,
down: source.options?.down || false,
};
};
2 changes: 2 additions & 0 deletions plugins/multisrc/lightnovelworld/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import dayjs from 'dayjs';
type LightNovelWorldOptions = {
lang?: string;
versionIncrements?: number;
down?: boolean;
downSince?: string;
};

export type LightNovelWorldMetadata = {
Expand Down
10 changes: 9 additions & 1 deletion plugins/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 plugins/multisrc/lightnovelwp/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { storage } from '@libs/storage';

type LightNovelWPOptions = {
reverseChapters?: boolean;
down?: boolean;
downSince?: string;
lang?: string;
versionIncrements?: number;
seriesPath?: string;
Expand Down
10 changes: 9 additions & 1 deletion plugins/multisrc/madara/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(
`[madara] Generating: ${source.id}${' '.repeat(20 - source.id.length)} ${source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
'[madara] 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 @@ -35,5 +42,6 @@ export default plugin;
lang: source.options?.lang || 'English',
filename: source.sourceName.replace(/[^\w]/g, ''),
pluginScript,
down: source.options?.down,
};
};
2 changes: 2 additions & 0 deletions plugins/multisrc/madara/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const includesAny = (str: string, keywords: string[]) =>

type MadaraOptions = {
useNewChapterEndpoint?: boolean;
down?: boolean;
downSince?: string;
lang?: string;
orderBy?: string;
versionIncrements?: number;
Expand Down
8 changes: 7 additions & 1 deletion plugins/multisrc/mtlnovel/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ export const generateAll = function () {
} catch (e) {}
console.log(
`[mtlnovel] Generating: ${source.id}`.padEnd(35),
source.filters ? '🔎with filters🔍' : '🚫 no filters 🚫',
source.options?.down
? '🔽site is down🔽'
: source.filters
? '🔎with filters🔍'
: '🚫 no filters 🚫',
source.options?.downSince ? `since: ${source.options?.downSince}` : '',
);
return generator(source);
});
Expand All @@ -38,5 +43,6 @@ export default plugin;
lang: source.options?.lang || 'English',
filename: source.sourceName,
pluginScript,
down: source.options?.down || false,
};
};
2 changes: 2 additions & 0 deletions plugins/multisrc/mtlnovel/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { Filters } from '@libs/filterInputs';

type MTLNovelOptions = {
lang?: string;
down?: boolean;
downSince?: string;
};

export type MTLNovelMetadata = {
Expand Down
1 change: 1 addition & 0 deletions plugins/multisrc/novelcool/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ export default plugin;
lang: source.options.lang,
filename: source.sourceName,
pluginScript,
down: source.options?.down || false,
};
};
2 changes: 2 additions & 0 deletions plugins/multisrc/novelcool/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ type NovelCoolOptions = {
lang: string;
langCode: string;
app: Record<string, string>;
down?: boolean;
downSince?: string;
};

export type NovelCoolMetadata = {
Expand Down
9 changes: 8 additions & 1 deletion plugins/multisrc/ranobes/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ const folder = dirname(fileURLToPath(import.meta.url));

export const generateAll = function () {
return list.map(metadata => {
console.log(`[ranobes]: Generating`, metadata.id);
console.log(
`[ranobes]: Generating`,
metadata.id,
metadata.options?.downSince
? `since: ${metadata.options?.downSince}`
: '',
);
return generator(metadata);
});
};
Expand All @@ -27,5 +33,6 @@ export default plugin;
lang: metadata.options.lang,
filename: metadata.sourceName,
pluginScript,
down: metadata.options?.down || false,
};
};
2 changes: 2 additions & 0 deletions plugins/multisrc/ranobes/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { NovelStatus } from '@libs/novelStatus';
type RanobesOptions = {
lang?: string;
path: string;
down?: boolean;
downSince?: string;
};

export type RanobesMetadata = {
Expand Down
5 changes: 4 additions & 1 deletion plugins/multisrc/readnovelfull/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export const generateAll = function () {
source.filters = JSON.parse(filters).filters;
}
console.log(
`[readnovelfull] Generating: ${source.id}${' '.repeat(20 - source.id.length)} ${source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
`[readnovelfull] Generating: ${source.id}${' '.repeat(20 - source.id.length)}`,
`${source.options?.down ? '🔽site is down🔽' : source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
source.options?.downSince ? `since: ${source.options?.downSince}` : '',
);
return generator(source);
});
Expand All @@ -35,5 +37,6 @@ export default plugin;
lang: source.options?.lang || 'English',
filename: source.sourceName,
pluginScript,
down: source.options?.down || false,
};
};
2 changes: 2 additions & 0 deletions plugins/multisrc/readnovelfull/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type ReadNovelFullOptions = {
noAjax?: boolean;
noPages?: string[];
pageAsPath?: boolean;
down?: boolean;
downSince?: string;
};

export type ReadNovelFullMetadata = {
Expand Down
5 changes: 4 additions & 1 deletion plugins/multisrc/readwn/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export const generateAll = function () {
source.filters = JSON.parse(filters).filters;
}
console.log(
`[readwn] Generating: ${source.id}${' '.repeat(20 - source.id.length)} ${source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
`[readwn] Generating: ${source.id}${' '.repeat(20 - source.id.length)}`,
`${source.options?.down ? '🔽site is down🔽' : source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
source.options?.downSince ? `since: ${source.options?.downSince}` : '',
);
return generator(source);
});
Expand All @@ -36,5 +38,6 @@ export default plugin;
lang: 'english',
filename: source.sourceName,
pluginScript,
down: source.options?.down || false,
};
};
2 changes: 2 additions & 0 deletions plugins/multisrc/readwn/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import dayjs from 'dayjs';

type ReadwnOptions = {
versionIncrements?: number;
down?: boolean;
downSince?: string;
};

export type ReadwnMetadata = {
Expand Down
7 changes: 6 additions & 1 deletion plugins/multisrc/rulate/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export const generateAll = function () {
return { ...p, filters: d ? undefined : filters };
})
.map(source => {
console.log(`[rulate]: Generating`, source.id);
console.log(
`[rulate]: Generating`,
source.id,
source.options?.downSince ? `since: ${source.options?.downSince}` : '',
);
return generator(source);
});
};
Expand All @@ -58,5 +62,6 @@ export default plugin;
lang: 'russian',
filename: source.sourceName,
pluginScript,
down: source.options?.down || false,
};
};
7 changes: 7 additions & 0 deletions plugins/multisrc/rulate/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ export type RulateMetadata = {
sourceName: string;
filters?: Filters;
versionIncrements: number;
options?: RulateOptions;
};

type RulateOptions = {
lang?: string;
down?: boolean;
downSince?: string;
};

class RulatePlugin implements Plugin.PluginBase {
Expand Down
1 change: 1 addition & 0 deletions scripts/build-plugin-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,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('.broken.js'),
};

if (pluginSet.has(id)) {
Expand Down