fix: Update Plugins (#677)
* typo * update * fix * fix * update * ifreedom * fix * fix ranobelib * ...
This commit is contained in:
@@ -13,7 +13,7 @@ export const generateAll: ScrpitGeneratorFunction = function (name) {
|
||||
let d = false;
|
||||
const filters: Filters = {};
|
||||
for (const k in p.filters) {
|
||||
const f = p.filters[k as "sort" | "genres"];
|
||||
const f = p.filters[k as keyof typeof p.filters];
|
||||
if (f) {
|
||||
filters[k] = {
|
||||
...f,
|
||||
@@ -39,10 +39,9 @@ const generator = function generator(metadata: MadaraMetadata) {
|
||||
|
||||
const pluginScript = `
|
||||
${madaraTemplate}
|
||||
const plugin = new MadaraPlugin(${JSON.stringify(metadata).replace(
|
||||
/"type":"Picker"/g,
|
||||
`"type":FilterTypes.Picker`
|
||||
)});
|
||||
const plugin = new MadaraPlugin(${
|
||||
JSON.stringify(metadata).replace(/"type":"([^"]+)"/g, '"type":FilterTypes.$1')
|
||||
});
|
||||
export default plugin;
|
||||
`;
|
||||
return {
|
||||
|
||||
@@ -14,7 +14,8 @@ interface MadaraOptionPath {
|
||||
chapter?: string;
|
||||
}
|
||||
|
||||
const MadaraDefaultPath: MadaraOptionPath = {
|
||||
const MadaraDefaultPath = {
|
||||
genres: "novel-genre",
|
||||
novels: "novel",
|
||||
novel: "novel",
|
||||
chapter: "novel",
|
||||
@@ -69,12 +70,12 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
let url = this.site;
|
||||
if (filters?.genres && this.options?.path?.genres) {
|
||||
url += this.options?.path?.genres + filters.genres;
|
||||
if (filters?.genres?.value) {
|
||||
url += (this.options?.path?.genres || MadaraDefaultPath.genres) +
|
||||
"/" +
|
||||
filters.genres.value;
|
||||
} else {
|
||||
url += this.options?.path?.novels
|
||||
? this.options.path.novels
|
||||
: MadaraDefaultPath.novels;
|
||||
url += this.options?.path?.novels || MadaraDefaultPath.novels;
|
||||
}
|
||||
|
||||
url +=
|
||||
@@ -82,7 +83,7 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
pageNo +
|
||||
"/" +
|
||||
"?m_orderby=" +
|
||||
(showLatestNovels ? "latest" : filters?.sort || "rating");
|
||||
(showLatestNovels ? "latest" : filters?.sort?.value || "rating");
|
||||
|
||||
const body = await fetchApi(url).then((res) => res.text());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user