Files
lnreader-plugins/plugins/multisrc/novelcool/generator.js
T
Rajarshee Chatterjee 20c2b75b01 refactor: Overhaul Plugin Architecture & Playground UI (#1846)
* refactor: Move Plugins Out and Consolidate with Multisrc

* feat: Overhaul Playground UI

* feat: Add Filters to New UI

* feat: Persist Selected Plugin

* feat: Add Direct Parse Novel/Chapter Options and Feedback Toasts

[skip ci]

* feat: UX Improvements

* chore: Update Plugin Path in Publish Workflow

* fix: Add Backward Compatibility

* chore: Update Plugin Publishing Script
2025-10-20 22:54:08 +05:30

41 lines
1.1 KiB
JavaScript

import list from './sources.json' with { type: 'json' };
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// https://app.novelcool.com/
const app = {
userAgent:
'Android/Package:com.zuoyou.novel - Version Name:2.3 - Phone Info:sdk_gphone_x86_64(Android Version:13)',
package_name: 'com.zuoyou.novel',
appId: '202201290625004',
secret: 'c73a8590641781f203660afca1d37ada',
};
export const generateAll = function () {
list.sort((a, b) => a.id.length - b.id.length);
return list.map(source => generator(source));
};
const generator = function generator(source) {
const NovelCoolTemplate = readFileSync(__dirname + '/template.ts', {
encoding: 'utf-8',
});
source.options.app = app;
const pluginScript = `
${NovelCoolTemplate}
const plugin = new NovelCoolPlugin(${JSON.stringify(source)});
export default plugin;
`.trim();
return {
lang: source.options.lang,
filename: source.sourceName,
pluginScript,
};
};