Filters Redesign (#658)

* Add XCheckboxFilter

* Fix madara typo

* Change the branch name in config

* Add typing for madara popoularnovels filters

* Add preview and refactor PluginWrapper

* Add preview HTML sanitize and other improv.

* Web improvements + sanitizeHTML

* Add dark mode

* Add git run less to compile less

* Add less.js to remove the need for compiling less
This commit is contained in:
Marcin Majewski
2023-12-27 15:49:46 +01:00
committed by GitHub
parent 9cdace3460
commit d7a76063bf
170 changed files with 94169 additions and 80752 deletions
+15 -10
View File
@@ -1,4 +1,4 @@
import { Filter } from "@libs/filterInputs";
import { FilterToValues, Filters } from "@libs/filterInputs";
import { languages } from "@libs/languages";
export namespace Plugin {
export interface ChapterItem {
@@ -31,9 +31,11 @@ export namespace Plugin {
status?: string;
chapters?: ChapterItem[];
}
export interface PopularNovelsOptions {
export interface PopularNovelsOptions<
Q extends Filters | undefined = Filters | undefined
> {
showLatestNovels?: boolean;
filters?: Record<string, string | string[]>;
filters: Q extends undefined ? undefined : FilterToValues<Q>;
}
export interface PluginItem {
id: string;
@@ -45,26 +47,29 @@ export namespace Plugin {
}
export interface PluginBase {
id: string,
name: string,
/**
* Relative path without icon. E.g:
id: string;
name: string;
/**
* Relative path without icon. E.g:
* ```js
* "src/vi/hakolightnovel/icon.png"
* ```
*/
icon: string;
site: string;
filters?: Filter[];
filters?: Filters;
version: string;
userAgent: string;
cookieString: string;
popularNovels(pageNo: number, options: PopularNovelsOptions): Promise<NovelItem[]>;
popularNovels(
pageNo: number,
options: PopularNovelsOptions<Filters>
): Promise<NovelItem[]>;
parseNovelAndChapters(novelUrl: string): Promise<SourceNovel>;
parseChapter(chapterUrl: string): Promise<string>;
searchNovels(searchTerm: string, pageNo?: number): Promise<NovelItem[]>;
/**
*
*
* @param url Image url
* @returns {string} Base64 of image
* @example