Fix issues with new fenrir src (#1516)
* Bruh this src is so scuffed * Small qol change dont say chap number twice sometimes
This commit is contained in:
@@ -2,15 +2,25 @@ import { fetchApi } from '@libs/fetch';
|
|||||||
import { Plugin } from '@typings/plugin';
|
import { Plugin } from '@typings/plugin';
|
||||||
import { load as loadCheerio } from 'cheerio';
|
import { load as loadCheerio } from 'cheerio';
|
||||||
import { Filters, FilterTypes } from '@libs/filterInputs';
|
import { Filters, FilterTypes } from '@libs/filterInputs';
|
||||||
|
import { storage } from '@libs/storage';
|
||||||
|
|
||||||
class FenrirRealmPlugin implements Plugin.PluginBase {
|
class FenrirRealmPlugin implements Plugin.PluginBase {
|
||||||
id = 'fenrir';
|
id = 'fenrir';
|
||||||
name = 'Fenrir Realm';
|
name = 'Fenrir Realm';
|
||||||
icon = 'src/en/fenrirrealm/icon.png';
|
icon = 'src/en/fenrirrealm/icon.png';
|
||||||
site = 'https://fenrirealm.com';
|
site = 'https://fenrirealm.com';
|
||||||
version = '1.0.7';
|
version = '1.0.8';
|
||||||
imageRequestInit?: Plugin.ImageRequestInit | undefined = undefined;
|
imageRequestInit?: Plugin.ImageRequestInit | undefined = undefined;
|
||||||
|
|
||||||
|
hideLocked = storage.get('hideLocked');
|
||||||
|
pluginSettings = {
|
||||||
|
hideLocked: {
|
||||||
|
value: '',
|
||||||
|
label: 'Hide locked chapters',
|
||||||
|
type: 'Switch',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
//flag indicates whether access to LocalStorage, SesesionStorage is required.
|
//flag indicates whether access to LocalStorage, SesesionStorage is required.
|
||||||
webStorageUtilized?: boolean;
|
webStorageUtilized?: boolean;
|
||||||
|
|
||||||
@@ -70,14 +80,24 @@ class FenrirRealmPlugin implements Plugin.PluginBase {
|
|||||||
.first()
|
.first()
|
||||||
.text();
|
.text();
|
||||||
|
|
||||||
const chapters = await fetchApi(
|
let chapters = await fetchApi(
|
||||||
this.site + '/api/novels/chapter-list/' + novelPath,
|
this.site + '/api/novels/chapter-list/' + novelPath,
|
||||||
).then(r => r.json());
|
).then(r => r.json());
|
||||||
|
|
||||||
|
if (this.hideLocked) {
|
||||||
|
chapters = chapters.filter(c => !c.locked?.price);
|
||||||
|
}
|
||||||
|
|
||||||
novel.chapters = chapters
|
novel.chapters = chapters
|
||||||
.map(c => ({
|
.map(c => ({
|
||||||
name: c.title,
|
name:
|
||||||
path: novelPath + '/' + c.slug,
|
(c.locked?.price ? '🔒 ' : '') +
|
||||||
|
'Chapter ' +
|
||||||
|
c.number +
|
||||||
|
(c.title && c.title.trim() != 'Chapter ' + c.number
|
||||||
|
? ' - ' + c.title
|
||||||
|
: ''),
|
||||||
|
path: novelPath + '/chapter-' + c.number,
|
||||||
releaseTime: c.created_at,
|
releaseTime: c.created_at,
|
||||||
chapterNumber: c.number,
|
chapterNumber: c.number,
|
||||||
}))
|
}))
|
||||||
|
|||||||
Reference in New Issue
Block a user