Add TopLiba (#1003)

* test

* cleanup

deleted unused `fetchFile` import
replaced fetch with `fetchApi`

* eslint

* fix

* fix multi

* Hmm, what to do next.

* test URLSearchParams

* fix
This commit is contained in:
Rider21
2024-06-30 07:28:11 +03:00
committed by GitHub
parent 938e3b16a3
commit fae73534dd
121 changed files with 10534 additions and 8079 deletions
+6 -7
View File
@@ -1,7 +1,9 @@
import list from './sources.json' with { type: 'json' };
import { readFileSync } from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const folder = dirname(fileURLToPath(import.meta.url));
const FilterTypes = {
TextInput: 'Text',
Picker: 'Picker',
@@ -40,12 +42,9 @@ export const generateAll = function () {
};
const generator = function generator(metadata) {
const HotNovelPubTemplate = readFileSync(
'./scripts/multisrc/hotnovelpub/template.ts',
{
encoding: 'utf-8',
},
);
const HotNovelPubTemplate = readFileSync(join(folder, 'template.ts'), {
encoding: 'utf-8',
});
const pluginScript = `
${HotNovelPubTemplate}
+2 -6
View File
@@ -2,7 +2,6 @@ import { fetchApi } from '@libs/fetch';
import { Filters, FilterTypes } from '@libs/filterInputs';
import { Plugin } from '@typings/plugin';
import { NovelStatus } from '@libs/novelStatus';
import dayjs from 'dayjs';
export interface HotNovelPubMetadata {
id: string;
@@ -135,10 +134,7 @@ class HotNovelPubPlugin implements Plugin.PluginBase {
return chapterText.replace(/\.copy right hot novel pub/g, '');
}
async searchNovels(
searchTerm: string,
pageNo: number,
): Promise<Plugin.NovelItem[]> {
async searchNovels(searchTerm: string): Promise<Plugin.NovelItem[]> {
const result: responseSearch = await fetchApi(this.apiSite + '/search', {
headers: {
'Content-Type': 'application/json;charset=utf-8',
@@ -162,7 +158,7 @@ class HotNovelPubPlugin implements Plugin.PluginBase {
return novels;
}
resolveUrl = (path: string, isNovel?: boolean) => this.site + '/' + path;
resolveUrl = (path: string) => this.site + '/' + path;
}
interface responseNovels {