Skip to content

Commit 229d2c5

Browse files
fix: Add Backward Compatibility
1 parent 282e8ac commit 229d2c5

139 files changed

Lines changed: 729 additions & 704 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/docs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ It is an object representing information how to store/access the novel
349349
You can use the default `Cover not available` cover by importing
350350

351351
```ts
352-
import { defaultCover } from '@/types/constants';
352+
import { defaultCover } from '@libs/defaultCover;
353353
```
354354

355355
---
@@ -377,10 +377,10 @@ import { defaultCover } from '@/types/constants';
377377

378378
### Filters
379379

380-
`Filters` and `FilterTypes` are not in the `Plugin` namespace and are from `@/types/filters` file:
380+
`Filters` and `FilterTypes` are not in the `Plugin` namespace and are from `@libs/filterInputs` file:
381381

382382
```ts
383-
import { FilterTypes, Filters } from '@/types/filters';
383+
import { FilterTypes, Filters } from '@libs/filterInputs';
384384
```
385385

386386
There are 2 main objects when using filters:

docs/plugin-template.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { fetchApi, fetchProto, fetchText } from '@/lib/fetch';
22
import { Plugin } from '@/types/plugin';
3-
import { Filters } from '@/types/filters';
3+
import { Filters } from '@libs/filterInputs';
44
import { load as loadCheerio } from 'cheerio';
5-
import { defaultCover } from '@/types/constants';
6-
import { NovelStatus } from '@/types/constants';
7-
// import { isUrlAbsolute } from '@/lib/utils';
5+
import { defaultCover } from '@libs/defaultCover';
6+
import { NovelStatus } from '@libs/novelStatus';
7+
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
88
// import { storage, localStorage, sessionStorage } from '@/lib/storage';
99
// import { encode, decode } from 'urlencode';
1010
// import dayjs from 'dayjs';

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"clean:multisrc": "find . -type f -wholename \"*plugins*\\[*\\]*.[t,j]s\" -delete",
99
"clean:multisrc:windows": "powershell -Command \"Get-ChildItem -Recurse -Include \\\"*].ts\\\",\\\"*].js\\\" | Where-Object { $_.FullName -like \\\"*plugins*\\\" } | Remove-Item\"",
1010
"dev": "vite",
11-
"dev:start": "node scripts/generate-plugin-index.js && vite",
12-
"build:multisrc": "node ./scripts/multisrc/generate-multisrc-plugins.js",
11+
"dev:start": "node ./plugins/multisrc/generate-multisrc-plugins.js && node scripts/generate-plugin-index.js && vite",
12+
"build:multisrc": "node ./plugins/multisrc/generate-multisrc-plugins.js",
1313
"build:compile": "npx tsc --project tsconfig.production.json",
1414
"build:manifest": "node ./scripts/build-plugin-manifest.js",
1515
"build:manifest:dev": "node --env-file=.env ./scripts/build-plugin-manifest.js",

plugins/arabic/dilartube.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { CheerioAPI, load as parseHTML } from 'cheerio';
2-
import { fetchApi } from '@/lib/fetch';
2+
import { fetchApi } from '@libs/fetch';
33
import { Plugin } from '@/types/plugin';
4-
import { Filters, FilterTypes } from '@/types/filters';
5-
import { defaultCover } from '@/types/constants';
4+
import { Filters, FilterTypes } from '@libs/filterInputs';
5+
import { defaultCover } from '@libs/defaultCover';
66

77
class dilartube implements Plugin.PluginBase {
88
id = 'dilartube';
@@ -80,8 +80,8 @@ class dilartube implements Plugin.PluginBase {
8080

8181
async parseNovel(novelUrl: string): Promise<Plugin.SourceNovel> {
8282
const chapterItems: Plugin.ChapterItem[] = [];
83-
let fullUrl = this.site + 'api/' + novelUrl;
84-
let chapterUrl = this.site + 'api/' + novelUrl + '/releases';
83+
const fullUrl = this.site + 'api/' + novelUrl;
84+
const chapterUrl = this.site + 'api/' + novelUrl + '/releases';
8585
const manga = await fetchApi(fullUrl).then(r => r.json());
8686
const chapters = await fetchApi(chapterUrl).then(r => r.json());
8787
const mangaData = manga.mangaData;
@@ -199,21 +199,21 @@ class dilartube implements Plugin.PluginBase {
199199

200200
export default new dilartube();
201201

202-
interface Category {
202+
type Category = {
203203
id: number;
204204
name: string;
205205
icon: string | null;
206206
manga_id: number;
207-
}
207+
};
208208

209-
interface Type {
209+
type Type = {
210210
id: number;
211211
name: string;
212212
reading_direction: string;
213213
title: string;
214-
}
214+
};
215215

216-
interface Manga {
216+
type Manga = {
217217
id: number;
218218
title: string;
219219
summary: string;
@@ -249,8 +249,8 @@ interface Manga {
249249
artists: any[];
250250
categories: Category[];
251251
type: Type;
252-
}
253-
interface Release {
252+
};
253+
type Release = {
254254
id: number;
255255
manga_id: number;
256256
created_at: string;
@@ -272,11 +272,11 @@ interface Release {
272272
team_paypal: string | null;
273273
has_rev_link: boolean;
274274
manga: Manga;
275-
}
276-
interface ApiResponse {
275+
};
276+
type ApiResponse = {
277277
releases: Release[];
278278
data: searchManga[];
279-
}
279+
};
280280
type MangaCategory = {
281281
id: number;
282282
name: string;
@@ -384,7 +384,7 @@ type ChapterRelease = {
384384
team_name: string;
385385
has_rev_link: boolean;
386386
};
387-
interface searchManga {
387+
type searchManga = {
388388
filter: any;
389389
id: number;
390390
title: string;
@@ -421,4 +421,4 @@ interface searchManga {
421421
artists: any[];
422422
categories: Category[];
423423
type: Type;
424-
}
424+
};

plugins/arabic/rewayatclub.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { CheerioAPI, load as parseHTML } from 'cheerio';
2-
import { fetchApi } from '@/lib/fetch';
2+
import { fetchApi } from '@libs/fetch';
33
import { Plugin } from '@/types/plugin';
4-
import { Filters, FilterTypes } from '@/types/filters';
5-
import { defaultCover } from '@/types/constants';
4+
import { Filters, FilterTypes } from '@libs/filterInputs';
5+
import { defaultCover } from '@libs/defaultCover';
66

77
class RewayatClub implements Plugin.PagePlugin {
88
id = 'rewayatclub';
@@ -141,7 +141,7 @@ class RewayatClub implements Plugin.PagePlugin {
141141
};
142142
}
143143
async parseChapter(chapterUrl: string): Promise<string> {
144-
let link = this.site + 'api/chapters/' + chapterUrl.slice(6);
144+
const link = this.site + 'api/chapters/' + chapterUrl.slice(6);
145145
const result = await fetchApi(link).then(r => r.json());
146146
let chapterText = result.content
147147
.flat()
@@ -211,7 +211,7 @@ class RewayatClub implements Plugin.PagePlugin {
211211

212212
export default new RewayatClub();
213213

214-
interface NovelEntry {
214+
type NovelEntry = {
215215
arabic: string;
216216
english: string;
217217
about: string;
@@ -234,14 +234,14 @@ interface NovelEntry {
234234
poster_url: string;
235235
original: boolean;
236236
};
237-
}
238-
interface NovelData {
237+
};
238+
type NovelData = {
239239
count?: number;
240240
next?: string;
241241
previous?: string;
242242
results: NovelEntry[];
243-
}
244-
interface ChapterEntry {
243+
};
244+
type ChapterEntry = {
245245
number: number;
246246
title: string;
247247
date: string;
@@ -254,11 +254,11 @@ interface ChapterEntry {
254254
id: number;
255255
};
256256
read: any[];
257-
}
257+
};
258258

259-
interface ChapterData {
259+
type ChapterData = {
260260
count: number;
261261
next: string;
262262
previous: string;
263263
results: ChapterEntry[];
264-
}
264+
};

plugins/arabic/sunovels.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { CheerioAPI, load as parseHTML } from 'cheerio';
2-
import { fetchApi } from '@/lib/fetch';
2+
import { fetchApi } from '@libs/fetch';
33
import { Plugin } from '@/types/plugin';
4-
import { Filters, FilterTypes } from '@/types/filters';
5-
import { defaultCover } from '@/types/constants';
4+
import { Filters, FilterTypes } from '@libs/filterInputs';
5+
import { defaultCover } from '@libs/defaultCover';
66

77
class Sunovels implements Plugin.PagePlugin {
88
id = 'sunovels';
@@ -22,7 +22,7 @@ class Sunovels implements Plugin.PagePlugin {
2222
imageUrlList.push(...imageUrlMatched);
2323
}
2424
});
25-
let counter: number = 0;
25+
let counter = 0;
2626
loadedCheerio('.list-item').each((idx, ele) => {
2727
loadedCheerio(ele)
2828
.find('a')
@@ -150,7 +150,7 @@ class Sunovels implements Plugin.PagePlugin {
150150
const pageUrl = firstUrl + '?activeTab=chapters&page=' + pageCorrected;
151151
const body = await fetchApi(pageUrl).then(r => r.text());
152152
const loadedCheerio = parseHTML(body);
153-
let dataJson: {
153+
const dataJson: {
154154
pages_count: string;
155155
chapters: ChapterEntry[];
156156
} = { pages_count: '', chapters: [] };
@@ -298,9 +298,9 @@ class Sunovels implements Plugin.PagePlugin {
298298

299299
export default new Sunovels();
300300

301-
interface ChapterEntry {
301+
type ChapterEntry = {
302302
chapterName: string;
303303
chapterUrl: string;
304304
releaseTime: string;
305305
chapterNumber: string | number;
306-
}
306+
};

plugins/chinese/69shu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { load as parseHTML } from 'cheerio';
22
import { fetchText } from '@/lib/fetch';
3-
import { FilterTypes, Filters } from '@/types/filters';
3+
import { FilterTypes, Filters } from '@libs/filterInputs';
44
import { Plugin } from '@/types/plugin';
5-
import { NovelStatus } from '@/types/constants';
5+
import { NovelStatus } from '@libs/novelStatus';
66

77
class Shu69 implements Plugin.PluginBase {
88
private fetchOptions = {

plugins/chinese/69xinshu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { load as parseHTML } from 'cheerio';
22
import { fetchText } from '@/lib/fetch';
3-
import { FilterTypes, Filters } from '@/types/filters';
3+
import { FilterTypes, Filters } from '@libs/filterInputs';
44
import { Plugin } from '@/types/plugin';
55
import { encode } from 'urlencode';
6-
import { NovelStatus } from '@/types/constants';
6+
import { NovelStatus } from '@libs/novelStatus';
77

88
class XinShu69 implements Plugin.PluginBase {
99
id = '69xinshu';

plugins/chinese/Quanben.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Plugin } from '@/types/plugin';
2-
import { FilterTypes, Filters } from '@/types/filters';
2+
import { FilterTypes, Filters } from '@libs/filterInputs';
33
import { fetchApi, fetchFile } from '@/lib/fetch';
4-
import { NovelStatus } from '@/types/constants';
4+
import { NovelStatus } from '@libs/novelStatus';
55
import { load as parseHTML } from 'cheerio';
6-
import { defaultCover } from '@/types/constants';
6+
import { defaultCover } from '@libs/defaultCover';
77

88
const getStandardNovelPath = (url: string | undefined): string | undefined => {
99
if (!url) return undefined;
@@ -207,7 +207,7 @@ class QuanbenPlugin implements Plugin.PluginBase {
207207
const chapterListHtml = await chapterListResult.text();
208208
const $ = parseHTML(chapterListHtml);
209209

210-
let chapters: Plugin.ChapterItem[] = [];
210+
const chapters: Plugin.ChapterItem[] = [];
211211
// Extract standard novel name from AMP path for chapter path storage
212212
const standardNovelPathMatch = novelPath.match(/(\/n\/[^\/]+\/)/);
213213
if (!standardNovelPathMatch || !standardNovelPathMatch[1]) {
@@ -385,7 +385,7 @@ class QuanbenPlugin implements Plugin.PluginBase {
385385

386386
const novelName = nameLink.text().trim();
387387
const novelHref = nameLink.attr('href');
388-
let novelCover = img.attr('src') || img.attr('data-src');
388+
const novelCover = img.attr('src') || img.attr('data-src');
389389

390390
if (novelHref && novelName) {
391391
const absoluteUrl = makeAbsolute(novelHref, this.site);

plugins/chinese/ixdzs8.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { load as parseHTML } from 'cheerio';
22
import { fetchApi, fetchFile } from '@/lib/fetch';
33
import { Plugin } from '@/types/plugin';
4-
import { defaultCover } from '@/types/constants';
5-
import { NovelStatus } from '@/types/constants';
4+
import { defaultCover } from '@libs/defaultCover';
5+
import { NovelStatus } from '@libs/novelStatus';
66

77
const makeAbsolute = (
88
relativeUrl: string | undefined,
@@ -39,7 +39,7 @@ class ixdzs8Plugin implements Plugin.PluginBase {
3939
};
4040

4141
async popularNovels(pageNo: number): Promise<Plugin.NovelItem[]> {
42-
let url = `${this.site}hot/?page=${pageNo}`;
42+
const url = `${this.site}hot/?page=${pageNo}`;
4343
const result = await fetchApi(url);
4444
if (!result.ok) return [];
4545

@@ -146,7 +146,7 @@ class ixdzs8Plugin implements Plugin.PluginBase {
146146
const bookId = String(bid);
147147

148148
// POST request to fetch chapter list JSON
149-
let url = `${this.site}novel/clist/`;
149+
const url = `${this.site}novel/clist/`;
150150
const res = await fetch(url, {
151151
method: 'POST',
152152
headers: {

0 commit comments

Comments
 (0)