fix: linter issues

This commit is contained in:
K1ngfish3r
2026-04-23 01:04:42 +05:00
parent 5e195b7f53
commit 2396df38bb
111 changed files with 2738 additions and 2160 deletions
@@ -3,9 +3,10 @@ import * as cheerio from 'cheerio';
import * as path from 'path';
import list from './sources.json' with { type: 'json' };
import { HotNovelPubMetadata } from './template';
import { Filters } from '@libs/filterInputs';
async function getFilters(sources: HotNovelPubMetadata) {
const filters: any = {
const filters: Filters = {
sort: {
type: 'Picker',
label: 'Order',
@@ -70,7 +71,7 @@ async function start() {
const result = [];
for (const sources of list) {
console.log('updating the filters in', sources.sourceName);
const NewFilters = await getFilters(sources as any);
const NewFilters = await getFilters(sources as HotNovelPubMetadata);
sources.filters = NewFilters;
result.push(sources);
}
+1 -4
View File
@@ -48,10 +48,7 @@ const generator = function generator(metadata) {
const pluginScript = `
${HotNovelPubTemplate}
const plugin = new HotNovelPubPlugin(${JSON.stringify(metadata).replace(
/"type":"([^"]+)"/g,
'"type":FilterTypes.$1',
)});
const plugin = new HotNovelPubPlugin(${JSON.stringify(metadata)});
export default plugin;
`.trim();
+11 -8
View File
@@ -1,5 +1,5 @@
import { fetchApi } from '@libs/fetch';
import { Filters, FilterTypes } from '@libs/filterInputs';
import { Filters } from '@libs/filterInputs';
import { Plugin } from '@/types/plugin';
import { NovelStatus } from '@libs/novelStatus';
@@ -15,7 +15,7 @@ type HotNovelPubOptions = {
lang?: string;
};
class HotNovelPubPlugin implements Plugin.PluginBase {
export class HotNovelPubPlugin implements Plugin.PluginBase {
id: string;
name: string;
icon: string;
@@ -38,7 +38,10 @@ class HotNovelPubPlugin implements Plugin.PluginBase {
async popularNovels(
pageNo: number,
{ filters, showLatestNovels }: Plugin.PopularNovelsOptions,
{
filters,
showLatestNovels,
}: Plugin.PopularNovelsOptions<typeof this.filters>,
): Promise<Plugin.NovelItem[]> {
let url = this.apiSite + '/books/';
url += showLatestNovels ? 'new' : filters?.sort?.value || 'hot';
@@ -52,7 +55,7 @@ class HotNovelPubPlugin implements Plugin.PluginBase {
headers: {
lang: this.lang,
},
}).then(res => res.json());
}).then((res: Response) => res.json());
const novels: Plugin.NovelItem[] = [];
if (result.status && result.data.books.data?.length) {
@@ -75,7 +78,7 @@ class HotNovelPubPlugin implements Plugin.PluginBase {
lang: this.lang,
},
},
).then(res => res.json());
).then((res: Response) => res.json());
const novel: Plugin.SourceNovel = {
name: json.data.book.name,
@@ -110,8 +113,8 @@ class HotNovelPubPlugin implements Plugin.PluginBase {
}
async parseChapter(chapterPath: string): Promise<string> {
const body = await fetchApi(this.resolveUrl(chapterPath)).then(res =>
res.text(),
const body = await fetchApi(this.resolveUrl(chapterPath)).then(
(res: Response) => res.text(),
);
let chapterText =
@@ -144,7 +147,7 @@ class HotNovelPubPlugin implements Plugin.PluginBase {
},
method: 'POST',
body: JSON.stringify({ key_search: searchTerm }),
}).then(res => res.json());
}).then((res: Response) => res.json());
const novels: Plugin.NovelItem[] = [];
if (result.status && result.data.books?.length) {