refactor: Classes for Plugins (#631)

* set target to ES5

* refactor types

* use .gitkeep

* use dot to make dist/js dirs on top

* add hako

* add Hako

* add madara

* fix: url path js -> .js

* fix: branch

* freestyle for using UA, cookie

* add parseNovels for Hako

* update readme

* fix: conflict types

* add Kolnovel, remove node-fetch

* add bestlightnovel

* add plugins

* WQMangaStreamScraper
* PandaMTL
* NobleMTL
* LightNovelBrasil
* WPMangaStream

* add filters for popularNovels

* fix undefined json

* Linovelib (#26)

* linovelib CN

* icon for linovelib

* fix undefined chapter

* add check

* fix: add artist

* TuNovelaLigera ES + Madara Fix (#28)

* app repo test

* POST is now working

* update madara template + run generator

* template fix didnt get pushed commited idk why

* template update POST

* generated

* fix: useNewChapterEndpoint update (#29)

* useNewChapterEndpoint update

* Update Selectors

---------

Co-authored-by: K1ngfish3r <trulyihu@gmail.com>
This commit is contained in:
nyagami
2023-11-04 17:15:49 +07:00
committed by GitHub
parent 538841ddee
commit 20efcf404c
295 changed files with 67636 additions and 57286 deletions
+10 -11
View File
@@ -24,9 +24,9 @@ export const all_plugins = (): PluginList => {
const requirePath = `@plugins/${languageEnglish.toLowerCase()}/${
plugin.split(".")[0]
}`;
const instance = require(requirePath);
const instance = require(requirePath).default;
const { id, name, version, icon } = instance;
const info: Plugin.Info = {
const info: Plugin.PluginItem = {
id,
name,
lang: languageNative,
@@ -42,21 +42,20 @@ export const all_plugins = (): PluginList => {
const getPlugin = async (
requirePath: string
): Promise<Plugin.instance | null> => {
const plugin = await require(requirePath);
): Promise<Plugin.PluginBase | null> => {
const plugin = await require(requirePath).default;
if (isPlugin(plugin)) return plugin;
return null;
};
export const getFilter = async (
pluginRequirePath: string
) => (await getPlugin(pluginRequirePath))?.filters;
export const popularNovels = async (
pluginRequirePath: string,
options: Plugin.Options
) => {
const plugin = await getPlugin(pluginRequirePath);
if (!plugin) return null;
const popularNovels = await plugin.popularNovels(1, options);
return popularNovels;
};
options: Plugin.PopularNovelsOptions
) => (await getPlugin(pluginRequirePath))?.popularNovels(1, options);
export const searchNovels = async (
pluginRequirePath: string,