Feat: ImageRequestInit (#979)

* add ImageRequestInit & fix Hako

* remove multisrc fetchFile

* remove plugins fetchFile

* update docs and template file
This commit is contained in:
nyagami
2024-06-08 20:09:33 +07:00
committed by GitHub
parent 6062f51460
commit 60d95fb8d2
85 changed files with 441 additions and 692 deletions
+4 -5
View File
@@ -1,5 +1,5 @@
import { load as parseHTML } from 'cheerio';
import { fetchApi, fetchFile } from '@libs/fetch';
import { fetchApi } from '@libs/fetch';
import { Plugin } from '@typings/plugin';
import { Filters, FilterTypes } from '@libs/filterInputs';
import dayjs from 'dayjs';
@@ -27,6 +27,9 @@ class LightNovelWorld implements Plugin.PagePlugin {
Accept: 'application/json',
'Content-Type': 'application/json',
};
imageRequestInit?: Plugin.ImageRequestInit | undefined = {
headers: this.headers,
};
options?: LightNovelWorldOptions;
constructor(metadata: LightNovelWorldMetadata) {
@@ -188,10 +191,6 @@ class LightNovelWorld implements Plugin.PagePlugin {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url, { headers: this.headers });
}
filters = {
order: {
value: 'popular',