Move to Zustand and add Filters to web_test (#1077)

* Moved to zustand and started refactored filters

- Move from redux to zustand
- Refactor Filters typings and add some helper types
- Add Filters button and Picker/Switch filter options
- Fixed Syosetu typings

* Add rule consistent-type-definitions

- Add consistent-type-definitions eslint rule to force consistent use of types instead of interfaces
- Run eslint to auto-change every interface to types

https://dev.to/atheodosiou/types-vs-interfaces-in-typescript-making-the-right-choice-48a4
https://www.youtube.com/watch?v=zM9UPcIyyhQ

* Add other filters and refactor

- Move Dialog to FiltersDialog
- CheckboxFilter, TextFilter, XCheckboxFilter added
- Added TripleCheckbox and TripleSwitch as tri-state checkbox/switch items using Mui stylings

* TriStateCheckbox/Switch refactor

- Change name of TripleSwitch and TripleCheckbox to TriState
- Change slightly TriStateSwitch and StyledSwitch styles
- Add option to change into TriStateSwitches via `localStorage` value `useSwitches`

* Refactor code and fix issues

* fix: prettier

---------

Co-authored-by: nyagami <hoangquan05112002@gmail.com>
This commit is contained in:
Marcin Majewski
2024-08-18 17:31:41 +02:00
committed by GitHub
parent eb5522b066
commit b2caf26da3
73 changed files with 1914 additions and 916 deletions
+4 -4
View File
@@ -367,14 +367,14 @@ class LnMTLPlugin implements Plugin.PagePlugin {
export default new LnMTLPlugin();
interface ChapterEntry {
type ChapterEntry = {
number: number;
title: string;
slug: string;
created_at: string;
}
};
interface VolumeEntry {
type VolumeEntry = {
id: string;
title: string;
}
};
+2 -2
View File
@@ -369,9 +369,9 @@ class RanobesPlugin implements Plugin.PagePlugin {
}
export default new RanobesPlugin();
interface ChapterEntry {
type ChapterEntry = {
id: number;
title: string;
date: string;
link: string;
}
};
+2 -2
View File
@@ -6,10 +6,10 @@ import { defaultCover } from '@libs/defaultCover';
import { NovelItem } from '../../test_web/static/js';
// import { isUrlAbsolute } from "@libs/isAbsoluteUrl";
interface FuzzySearchOptions {
type FuzzySearchOptions = {
caseSensitive: boolean;
sort: boolean;
}
};
// Shamelessly stolen from 'https://raw.githubusercontent.com/wouterrutgers/fuzzy-search/master/src/FuzzySearch.mjs'
// I did modify the code a fair bit, but the algorithm is still the same under the hood.
+4 -4
View File
@@ -722,18 +722,18 @@ class RoyalRoad implements Plugin.PluginBase {
export default new RoyalRoad();
interface ChapterEntry {
type ChapterEntry = {
id: number;
volumeId: number;
title: string;
date: string;
order: number;
url: string;
}
};
interface VolumeEntry {
type VolumeEntry = {
id: number;
title: string;
cover: string;
order: number;
}
};
+22 -22
View File
@@ -205,22 +205,22 @@ class WTRLAB implements Plugin.PluginBase {
} satisfies Filters;
}
interface NovelJson {
type NovelJson = {
props: Props;
page: string;
}
};
interface Props {
type Props = {
pageProps: PageProps;
__N_SSP: boolean;
}
};
interface PageProps {
type PageProps = {
serie: Serie;
server_time: Date;
}
};
interface Serie {
type Serie = {
serie_data: SerieData;
chapters: Chapter[];
recommendation: SerieData[];
@@ -231,9 +231,9 @@ interface Serie {
data: Data;
is_default: boolean;
raw_type: string;
}
};
interface Chapter {
type Chapter = {
serie_id: number;
id: number;
order: number;
@@ -242,16 +242,16 @@ interface Chapter {
name: string;
created_at: string;
updated_at: string;
}
interface ChapterData {
};
type ChapterData = {
data: ChapterContent;
}
interface ChapterContent {
};
type ChapterContent = {
title: string;
body: string;
}
};
interface SerieData {
type SerieData = {
serie_id?: number;
recommendation_id?: number;
score?: string;
@@ -273,26 +273,26 @@ interface SerieData {
from: null;
raw_id: number;
genres?: number[];
}
};
interface Data {
type Data = {
title: string;
author: string;
description: string;
image: string;
}
};
interface JsonNovel {
type JsonNovel = {
success: boolean;
data: Datum[];
}
interface Datum {
};
type Datum = {
serie: Serie;
chapters: Chapter[];
updated_at: Date;
raw_id: number;
slug: string;
data: Data;
}
};
export default new WTRLAB();
+28 -28
View File
@@ -4,35 +4,35 @@ import { Plugin } from '@typings/plugin';
import { Filters } from '@libs/filterInputs';
import { NovelStatus } from '@libs/novelStatus';
interface StringValue {
type StringValue = {
value: string;
}
};
interface BoolValue {
type BoolValue = {
value: boolean;
}
};
interface DecimalValue {
type DecimalValue = {
units: bigint;
nanos: number;
}
};
interface Timestamp {
type Timestamp = {
seconds: number;
nanos: number;
}
};
interface NovelEntry {
type NovelEntry = {
name: string;
coverUrl: string;
slug: string;
}
};
interface RelatedChapterUserInfo {
type RelatedChapterUserInfo = {
isChapterUnlocked?: BoolValue;
}
};
interface ChapterItem {
type ChapterItem = {
entityId: number;
name: string;
slug: string;
@@ -41,19 +41,19 @@ interface ChapterItem {
relatedUserInfo?: RelatedChapterUserInfo;
offset: number;
publishedAt?: Timestamp;
}
};
interface GetChapterResponse {
type GetChapterResponse = {
item?: ChapterItem;
}
};
interface ChapterGroupCounts {
type ChapterGroupCounts = {
total: number;
advance: number;
normal: number;
}
};
interface ChapterGroupItem {
type ChapterGroupItem = {
id: number;
title: string;
order: number;
@@ -61,11 +61,11 @@ interface ChapterGroupItem {
toChapterNumber?: DecimalValue;
chapterList: ChapterItem[];
counts?: ChapterGroupCounts;
}
};
interface GetChapterListResponse {
type GetChapterListResponse = {
items: ChapterGroupItem[];
}
};
enum NovelItem_Status {
Finished = 0,
@@ -74,14 +74,14 @@ enum NovelItem_Status {
All = -1,
}
interface NovelKarmaInfo {
type NovelKarmaInfo = {
isActive: boolean;
isFree: boolean;
maxFreeChapter?: DecimalValue;
canUnlockWithVip: boolean;
}
};
interface NovelItem {
type NovelItem = {
id: number;
name: string;
slug: string;
@@ -94,11 +94,11 @@ interface NovelItem {
authorName?: StringValue;
karmaInfo?: NovelKarmaInfo;
genres: string[];
}
};
interface GetNovelResponse {
type GetNovelResponse = {
item?: NovelItem;
}
};
class WuxiaWorld implements Plugin.PluginBase {
id = 'wuxiaworld';
+3 -2
View File
@@ -1,3 +1,4 @@
import { Plugin } from '@typings/plugin';
import { Plugin } from '../types/plugin';
export default [] as Plugin.PluginBase[];
declare const PLUGINS: Plugin.PluginItem[];
export default PLUGINS;
+5 -6
View File
@@ -3,7 +3,6 @@ import { fetchApi } from '@libs/fetch';
import { Plugin } from '@typings/plugin';
import { defaultCover } from '@libs/defaultCover';
import { FilterTypes, Filters } from '@libs/filterInputs';
import { NovelItem } from '../../test_web/static/js';
// const novelStatus = require('@libs/novelStatus');
// const isUrlAbsolute = require('@libs/isAbsoluteUrl');
// const parseDate = require('@libs/parseDate');
@@ -52,13 +51,13 @@ class Syosetu implements Plugin.PluginBase {
if (parseInt(loadedCheerio('.is-current').html() || '1') !== pagenumber)
return [];
const novels: NovelItem[] = [];
const novels: Plugin.NovelItem[] = [];
loadedCheerio('.c-card').each((_, e) => {
const anchor = loadedCheerio(e).find('.p-ranklist-item__title a');
const url = anchor.attr('href');
if (!url) return;
const name = anchor.text();
const novel: NovelItem = {
const novel: Plugin.NovelItem = {
path: url.replace(this.novelPrefix, ''),
name,
cover: defaultCover,
@@ -93,12 +92,12 @@ class Syosetu implements Plugin.PluginBase {
novel.summary = loadedCheerio('#novel_ex')
.text()
.replace(/<\s*br.*?>/g, '\n');
cqGetChapters.each(() => {
const chapterA = loadedCheerio(this).find('a');
cqGetChapters.each((_, e) => {
const chapterA = loadedCheerio(e).find('a');
const [chapterName, releaseDate, chapterUrl] = [
// set the variables
chapterA.text(),
loadedCheerio(this)
loadedCheerio(e)
.find('dt') // get title
.text() // get text
.replace(/(.)/g, '') // remove "(edited)" mark
+8 -8
View File
@@ -181,12 +181,12 @@ class Agitoon implements Plugin.PluginBase {
export default new Agitoon();
interface response {
type response = {
list_limit: number;
list?: ListEntity[] | null;
list_count: number;
}
interface ListEntity {
};
type ListEntity = {
wr_id: string;
wr_subject: string;
np_dir: string;
@@ -200,13 +200,13 @@ interface ListEntity {
np_country: string;
np_age: string;
is_scrap: number;
}
};
interface responseBook {
type responseBook = {
list?: ListEntity2[] | null;
download_time: string;
}
interface ListEntity2 {
};
type ListEntity2 = {
wr_id: string;
wr_subject: string;
wr_datetime: string;
@@ -214,4 +214,4 @@ interface ListEntity2 {
novel_c_style1: string;
novel_c_str1: string;
data_novel_c_view: string;
}
};
+22 -22
View File
@@ -368,14 +368,14 @@ function decrypt(
return text;
}
interface authorization {
type authorization = {
userId: number;
token: string;
issued: string;
expires: string;
}
};
interface currentUser {
type currentUser = {
id: number;
userName: string;
fio: string;
@@ -391,9 +391,9 @@ interface currentUser {
emailConfirmed: boolean;
isDeleted: boolean;
isDisabled: boolean;
}
};
interface response {
type response = {
searchResults?: SearchResultsEntity[] | null;
realTotalCount: number;
code?: string;
@@ -402,8 +402,8 @@ interface response {
format: Format;
duration: Duration;
isWorkMarkEnabled: boolean;
}
interface SearchResultsEntity {
};
type SearchResultsEntity = {
id: number;
title: string;
annotation: string;
@@ -446,20 +446,20 @@ interface SearchResultsEntity {
isLiked: boolean;
isWorkMarkEnabled: boolean;
workInLibraryState: string;
}
interface Format {
};
type Format = {
enumValue: string;
value: string;
title: string;
mobileTitle: string;
}
interface Duration {
};
type Duration = {
value: string;
title: string;
mobileTitle: string;
}
};
interface responseBook {
type responseBook = {
message?: string;
chapters?: ChaptersEntity[] | null;
allowDownloads: boolean;
@@ -543,8 +543,8 @@ interface responseBook {
purchaseTime?: null;
likeTime?: null;
markTime?: null;
}
interface ChaptersEntity {
};
type ChaptersEntity = {
id: number;
workId: number;
title: string;
@@ -554,16 +554,16 @@ interface ChaptersEntity {
lastModificationTime: string;
textLength: number;
isAvailable: boolean;
}
};
interface GalleryImagesEntity {
type GalleryImagesEntity = {
id: string;
caption?: null;
url: string;
height: number;
width: number;
}
interface RecommendationsEntity {
};
type RecommendationsEntity = {
title: string;
coverUrl: string;
authorId: number;
@@ -590,9 +590,9 @@ interface RecommendationsEntity {
removalReason?: null;
removalReasonComment?: null;
id: number;
}
};
interface encryptedСhapter {
type encryptedСhapter = {
id: number;
title: string;
isDraft: boolean;
@@ -602,4 +602,4 @@ interface encryptedСhapter {
key: string;
code?: string;
message?: string;
}
};
+12 -12
View File
@@ -226,7 +226,7 @@ class Bookriver implements Plugin.PluginBase {
}
export default new Bookriver();
interface response {
type response = {
props: {
pageProps: {
state: {
@@ -241,9 +241,9 @@ interface response {
};
};
};
}
};
interface BooksEntity {
type BooksEntity = {
name: string;
coverImages: { url: string }[];
slug: string;
@@ -256,17 +256,17 @@ interface BooksEntity {
chapters: Chapter[];
};
statusComplete: string;
}
};
interface Chapter {
type Chapter = {
name: string;
available: boolean;
firstPublishedAt?: Date | null;
createdAt?: Date | null;
chapterId: number | string;
}
};
interface responseChapter {
type responseChapter = {
data: {
id: number;
bookId: number;
@@ -288,12 +288,12 @@ interface responseChapter {
};
publicationScheduledFor?: null;
};
}
};
interface responseSearch {
type responseSearch = {
data: Data;
total: number;
}
interface Data {
};
type Data = {
books?: BooksEntity[] | null;
}
};
+4 -4
View File
@@ -2650,11 +2650,11 @@ class ficbook implements Plugin.PluginBase {
export default new ficbook();
interface Data {
type Data = {
data?: DataEntity[] | null;
more: boolean;
}
interface DataEntity {
};
type DataEntity = {
id: string;
slug: string;
author_id: number;
@@ -2673,4 +2673,4 @@ interface DataEntity {
readedDate?: string | null;
reward_cnt: number;
cover?: string | null;
}
};
+38 -38
View File
@@ -213,13 +213,13 @@ class Neobook implements Plugin.PluginBase {
export default new Neobook();
interface BundleBooks {
type BundleBooks = {
categories: any[];
topSection: any[];
feed: Novels[];
}
};
interface BottomSection {
type BottomSection = {
id: string;
boost: string;
preferenceid: string;
@@ -230,9 +230,9 @@ interface BottomSection {
more: string;
part: string;
items: Novels[];
}
};
interface Novels {
type Novels = {
status?: string;
error?: string;
login?: Login;
@@ -290,9 +290,9 @@ interface Novels {
carouselItems?: Novels[];
book?: Novels;
activeChapterIndex?: number;
}
};
interface Attachment {
type Attachment = {
has: string;
id: string;
typeid: string;
@@ -304,16 +304,16 @@ interface Attachment {
video: string;
origin: string;
ext: string;
}
};
interface Image {
type Image = {
s: string;
m: string;
l: string;
has?: string;
}
};
interface Chapter {
type Chapter = {
id: string;
token: string;
status: string;
@@ -324,9 +324,9 @@ interface Chapter {
access: string;
loaded: string;
data?: Data;
}
};
interface Data {
type Data = {
available: string;
access: string;
id: string;
@@ -339,27 +339,27 @@ interface Data {
datePublish: string;
attachment: Attachment;
lastComments: any[];
}
};
interface NovelsCounters {
type NovelsCounters = {
impressions: Bookmarks;
views: Bookmarks;
likes: Bookmarks;
comments: Bookmarks;
bookmarks: Bookmarks;
}
};
interface Bookmarks {
type Bookmarks = {
value: string;
formatted: string;
}
};
interface Feed {
type Feed = {
name: string;
canRemoved: string;
}
};
interface Login {
type Login = {
uid: string;
utoken: string;
has: string;
@@ -376,14 +376,14 @@ interface Login {
deposit: any[];
affiliate: any[];
preferences: any[];
}
};
interface LoginCounters {
type LoginCounters = {
notifications: string;
messages: string;
}
};
interface LoginUser {
type LoginUser = {
id: string;
username: string;
firstname: string;
@@ -392,39 +392,39 @@ interface LoginUser {
status: string;
balance: Balance;
connectedService: string;
}
};
interface Balance {
type Balance = {
neo: Price;
}
};
interface Price {
type Price = {
has: string;
value: string;
currency: Currency;
formatted: string;
deadline: string;
}
};
type Currency = 'NEO';
interface Rating {
type Rating = {
value: string;
count: string;
my: string;
}
};
interface ReadProgress {
type ReadProgress = {
chapter: string;
progress: string;
}
};
interface ReadTime {
type ReadTime = {
hours: string;
minutes: string;
}
};
interface NovelsUser {
type NovelsUser = {
available: string;
boosted: string;
id: string;
@@ -452,4 +452,4 @@ interface NovelsUser {
isSubscription: string;
isBlock: string;
gr: string;
}
};
+38 -38
View File
@@ -183,7 +183,7 @@ class novelOvh implements Plugin.PluginBase {
export default new novelOvh();
interface BooksEntity {
type BooksEntity = {
id: string;
slug: string;
type: string;
@@ -211,18 +211,18 @@ interface BooksEntity {
chaptersCount: number;
createdAt: string;
updatedAt: string;
}
interface Name {
};
type Name = {
ru: string;
original: string;
en: string;
}
interface AltNamesEntity {
};
type AltNamesEntity = {
language: string;
name: string;
}
};
interface responseNovel {
type responseNovel = {
book: Book;
branches: BranchesEntity[];
chapters: ChaptersEntity[];
@@ -233,8 +233,8 @@ interface responseNovel {
promotionVideos?: null[] | null;
folderItems?: null[] | null;
contentNotices?: null[] | null;
}
interface Book {
};
type Book = {
id: string;
slug: string;
type: string;
@@ -273,17 +273,17 @@ interface Book {
createdAt: string;
updatedAt: string;
rating?: null;
}
interface LabelsEntity {
};
type LabelsEntity = {
id: string;
slug: string;
name: string;
}
interface RelationsEntity {
};
type RelationsEntity = {
type: string;
publisher: Publisher;
}
interface Publisher {
};
type Publisher = {
id: string;
kind: string;
slug: string;
@@ -298,8 +298,8 @@ interface Publisher {
tonAddress?: null;
createdAt: string;
updatedAt: string;
}
interface BranchesEntity {
};
type BranchesEntity = {
id: string;
licensed: boolean;
editorsChoice: boolean;
@@ -309,8 +309,8 @@ interface BranchesEntity {
publishers?: PublishersEntity[] | null;
subscription?: null;
bookmark?: null;
}
interface PublishersEntity {
};
type PublishersEntity = {
id: string;
kind: string;
slug: string;
@@ -324,8 +324,8 @@ interface PublishersEntity {
tonAddress?: null;
createdAt: string;
updatedAt: string;
}
interface ChaptersEntity {
};
type ChaptersEntity = {
id: string;
name?: string | null;
title?: string | null;
@@ -341,8 +341,8 @@ interface ChaptersEntity {
createdAt: string;
expiredAt: string;
updatedAt: string;
}
interface RelatedEntityOrBook {
};
type RelatedEntityOrBook = {
id: string;
type: string;
slug: string;
@@ -361,23 +361,23 @@ interface RelatedEntityOrBook {
averageRating: number;
createdAt: string;
updatedAt: string;
}
interface AssociatedEntity {
};
type AssociatedEntity = {
id: string;
kind: string;
createdAt: string;
updatedAt: string;
book: RelatedEntityOrBook;
}
interface CoversEntity {
};
type CoversEntity = {
id: string;
volume: number;
image: string;
createdAt: string;
updatedAt: string;
}
};
interface responseChapter {
type responseChapter = {
id: string;
name?: string;
title: string;
@@ -397,22 +397,22 @@ interface responseChapter {
createdAt: string;
expiredAt: string;
updatedAt: string;
}
interface Content {
};
type Content = {
type: string;
content?: ContentEntity[] | null;
}
interface ContentEntity {
};
type ContentEntity = {
text?: string | null;
type: string;
attrs?: Attrs | null;
content?: Content[] | null;
}
interface Attrs {
};
type Attrs = {
textAlign?: string;
pages?: [string];
}
interface PagesEntity {
};
type PagesEntity = {
id: string;
image: string;
index: number;
@@ -420,4 +420,4 @@ interface PagesEntity {
height: number;
width: number;
createdAt: string;
}
};
+32 -32
View File
@@ -851,25 +851,25 @@ class TL implements Plugin.PluginBase {
export default new TL();
interface response {
type response = {
data: Data;
}
};
interface Data {
type Data = {
projects?: Projects;
project?: Project;
chapter?: DataChapter;
}
};
interface DataChapter {
type DataChapter = {
text: Text;
}
};
interface Text {
type Text = {
text: string;
}
};
interface Project {
type Project = {
title: string;
translationStatus: string;
fullUrl: string;
@@ -879,58 +879,58 @@ interface Project {
tags: Genre[];
annotation: Text;
subprojects: Subprojects;
}
};
interface Cover {
type Cover = {
url: string;
}
};
interface Genre {
type Genre = {
nameRu: string;
nameEng: string;
}
};
interface Person {
type Person = {
role: string;
name: Name;
}
};
interface Name {
type Name = {
firstName: string;
lastName: string;
}
};
interface Subprojects {
type Subprojects = {
content: SubprojectsContent[];
}
};
interface SubprojectsContent {
type SubprojectsContent = {
title: null | string;
volumes: Volumes;
}
};
interface Volumes {
type Volumes = {
content: VolumesContent[];
}
};
interface VolumesContent {
type VolumesContent = {
shortName: null | string;
chapters: ChapterElement[];
}
};
interface ChapterElement {
type ChapterElement = {
title: null | string;
publishDate: Date;
fullUrl: string;
published: boolean;
}
};
interface Projects {
type Projects = {
content: ProjectsContent[];
}
};
interface ProjectsContent {
type ProjectsContent = {
title: string;
fullUrl: string;
covers: Cover[];
}
};
+40 -42
View File
@@ -1147,7 +1147,7 @@ class RNBH implements Plugin.PluginBase {
export default new RNBH();
interface responseNovels {
type responseNovels = {
id: number;
names: Names;
rating: number;
@@ -1158,27 +1158,27 @@ interface responseNovels {
status: string;
user?: User;
counts: Counts;
}
interface Names {
};
type Names = {
eng?: string;
rus?: string;
original: string;
}
interface Poster {
};
type Poster = {
medium: string;
small: string;
color: string;
}
interface User {
};
type User = {
status?: null;
liked: boolean;
}
interface Counts {
};
type Counts = {
volumes: string;
chapters: string;
}
};
interface responseNovel {
type responseNovel = {
id: number;
names: Names;
rating: number;
@@ -1195,55 +1195,53 @@ interface responseNovel {
start_reading_url: string;
html: string;
tags: Tags;
}
interface Posters {
};
type Posters = {
big: string;
medium: string;
small: string;
tiny: string;
color: string;
}
interface AuthorsEntity {
};
type AuthorsEntity = {
name_eng: string;
pivot: Pivot;
}
interface Pivot {
};
type Pivot = {
ranobe_id: number;
author_id?: number;
translator_id?: number;
}
interface TranslatorsEntity {
};
type TranslatorsEntity = {
name: string;
pivot: Pivot;
}
interface Status {
};
type Status = {
id: number;
title: string;
}
interface Tags {
name: string;
};
type Tags = {
events?: GenresOrEntity[] | null;
genres?: GenresOrEntity[] | null;
}
interface GenresOrEntity {
};
type GenresOrEntity = {
id: number;
names: Names;
url: string;
title: string;
description?: string | null;
}
};
interface VolumesEntity {
type VolumesEntity = {
id: number;
num: number;
name: string;
status: Status;
chapters?: ChaptersEntity[] | null;
}
interface Status {
id: number;
name: string;
}
interface ChaptersEntity {
};
type ChaptersEntity = {
id: number;
name: string;
num: number;
@@ -1252,18 +1250,18 @@ interface ChaptersEntity {
has_images: boolean;
changed_at: string;
comments_count: string;
}
};
interface responseSearch {
type responseSearch = {
meta: Meta;
collections?: DataEntity[] | null;
data?: DataEntity[] | null;
}
interface Meta {
};
type Meta = {
key: string;
title: string;
}
interface DataEntity {
};
type DataEntity = {
id: number;
names?: Names | null;
description?: string | null;
@@ -1275,10 +1273,10 @@ interface DataEntity {
roles?: null[] | null;
avatar?: Avatar | null;
has_plus?: boolean | null;
}
interface Avatar {
};
type Avatar = {
big: string;
color: string;
thumb: string;
is_default: boolean;
}
};
+44 -44
View File
@@ -526,82 +526,82 @@ function jsonToHtml(json: HTML[], images, html = '') {
return html;
}
interface HTML {
type HTML = {
type: string;
content?: HTML[];
attrs?: Attrs;
text?: string;
}
};
interface Attrs {
type Attrs = {
src: string;
alt: string | null;
title: string | null;
}
};
interface authorization {
type authorization = {
token: Token;
auth: Auth;
timestamp: number;
}
interface Token {
};
type Token = {
token_type: string;
expires_in: number;
access_token: string;
refresh_token: string;
timestamp: number;
}
interface Auth {
};
type Auth = {
id: number;
username: string;
avatar: Cover;
last_online_at: string;
metadata: Metadata;
}
interface Metadata {
};
type Metadata = {
auth_domains: string;
}
};
interface TopLevel {
type TopLevel = {
data: DataClass | DataClass[];
links?: Links;
meta?: Meta;
}
};
interface AgeRestriction {
type AgeRestriction = {
id: number;
label: string;
}
};
interface Branch {
type Branch = {
id: number;
branch_id: null;
created_at: string;
teams: BranchTeam[];
user: User;
}
};
interface BranchTeam {
type BranchTeam = {
id: number;
slug: string;
slug_url: string;
model: string;
name: string;
cover: Cover;
}
};
interface Cover {
type Cover = {
filename: null | string;
thumbnail: string;
default: string;
}
};
interface User {
type User = {
username: string;
id: number;
}
};
interface DataClass {
type DataClass = {
id: number;
name: string;
rus_name?: string;
@@ -633,9 +633,9 @@ interface DataClass {
likes_count?: number;
content?: any;
attachments?: Attachment[];
}
};
interface Artist {
type Artist = {
id: number;
slug: string;
slug_url: string;
@@ -648,16 +648,16 @@ interface Artist {
confirmed: null;
user_id: number;
titles_count_details: null;
}
};
interface Subscription {
type Subscription = {
is_subscribed: boolean;
source_type: string;
source_id: number;
relation: null;
}
};
interface Attachment {
type Attachment = {
id?: string;
filename: string;
name: string;
@@ -665,14 +665,14 @@ interface Attachment {
url: string;
width: number;
height: number;
}
};
interface Genre {
type Genre = {
id: number;
name: string;
}
};
interface DataTeam {
type DataTeam = {
id: number;
slug: string;
slug_url: string;
@@ -682,22 +682,22 @@ interface DataTeam {
details?: Details;
vk?: string;
discord?: null;
}
};
interface Details {
type Details = {
branch_id: null;
is_active: boolean;
subscriptions_count: null;
}
};
interface Links {
type Links = {
first: string;
last: null;
prev: null;
next: string;
}
};
interface Meta {
type Meta = {
current_page?: number;
from?: number;
path?: string;
@@ -707,9 +707,9 @@ interface Meta {
has_next_page?: boolean;
seed?: string;
country?: string;
}
};
interface DataChapter {
type DataChapter = {
id: number;
index: number;
item_number: number;
@@ -719,4 +719,4 @@ interface DataChapter {
name: string;
branches_count: number;
branches: Branch[];
}
};
+54 -54
View File
@@ -143,7 +143,7 @@ class RNRF implements Plugin.PluginBase {
export default new RNRF();
interface response {
type response = {
props: Props;
page: string;
query: Query;
@@ -152,25 +152,25 @@ interface response {
gssp: boolean;
appGip: boolean;
dynamicIds?: string[];
}
};
interface Props {
type Props = {
pageProps: PageProps;
isMobile: boolean;
theme: string;
__N_SSP: boolean;
}
};
interface PageProps {
type PageProps = {
initialReduxState: InitialReduxState;
book?: PagePropsBook;
totalData?: TotalData;
layoutViewCookies?: string;
displayBanner?: boolean;
chapter?: PagePropsChapter;
}
};
interface PagePropsBook {
type PagePropsBook = {
id: number;
countryId: number;
creatorId: number;
@@ -215,9 +215,9 @@ interface PagePropsBook {
verticalImage: Image;
horizontalImage: Image;
squareImage: Image;
}
};
interface ChapterElement {
type ChapterElement = {
id: number;
bookId: number;
title: string;
@@ -233,35 +233,35 @@ interface ChapterElement {
price: number;
views: number;
isUserPaid?: boolean;
}
};
interface Country {
type Country = {
id: number;
title: string;
code: string;
}
};
interface Genre {
type Genre = {
id: number;
title: string;
slug: string;
}
};
interface Image {
type Image = {
id: number;
alt: string;
path: string;
name: string;
url: string;
}
};
interface Timer {
type Timer = {
value: null;
for: null;
message: string;
}
};
interface PagePropsChapter {
type PagePropsChapter = {
id: number;
bookId: number;
editorId: null;
@@ -289,94 +289,94 @@ interface PagePropsChapter {
nextChapter: null;
previousChapter: PreviousChapter;
corrections: null;
}
};
interface ChapterBook {
type ChapterBook = {
id: number;
title: string;
titleEn: string;
url: string;
}
};
interface Content {
type Content = {
id: number;
text: string;
symbolsCount: number;
}
};
interface PreviousChapter {
type PreviousChapter = {
id: number;
title: string;
views: number;
publishedAt: Date;
url: string;
numberChapter: string;
}
};
interface InitialReduxState {
type InitialReduxState = {
data?: Data;
auth: Auth;
banners?: Banners;
corrections?: Corrections;
readerSettings?: ReaderSettings;
}
};
interface Auth {
type Auth = {
isAuth: boolean;
user: null;
}
};
interface Banners {
type Banners = {
displaySale: boolean;
}
};
interface Corrections {
type Corrections = {
items: null;
data: null;
}
};
interface Data {
type Data = {
bookPage: BookPage | null;
chapterPage: ChapterPage | null;
}
};
interface BookPage {
type BookPage = {
bookId: number;
bookmark: null;
}
};
interface ChapterPage {
type ChapterPage = {
chapterId: number;
bookId: number;
bookmark: null;
}
};
interface ReaderSettings {
type ReaderSettings = {
fontSize: number;
lineHeight: number;
textIndent: number;
sidebarHide: number;
textAlign: string;
}
};
interface TotalData {
type TotalData = {
items: Item[];
_links: Links;
pagesData: PagesData;
}
};
interface Links {
type Links = {
self: First;
first: First;
last: First;
next: First;
}
};
interface First {
type First = {
href: string;
}
};
interface Item {
type Item = {
id: number;
title: string;
description: string;
@@ -390,16 +390,16 @@ interface Item {
verticalImage: Image;
horizontalImage: Image;
squareImage: Image;
}
};
interface PagesData {
type PagesData = {
totalCount: number;
pageCount: number;
currentPage: number;
perPage: number;
}
};
interface Query {
type Query = {
book?: string;
chapter?: string;
}
};
+20 -20
View File
@@ -946,7 +946,7 @@ class ReN implements Plugin.PluginBase {
export default new ReN();
interface responseNovels {
type responseNovels = {
id: number;
secondary_name: string;
main_name: string;
@@ -969,15 +969,15 @@ interface responseNovels {
categories?: ItemEntity[] | null;
rus_name?: string;
en_name?: string;
}
};
interface Img {
type Img = {
high?: string;
mid?: string;
low: string;
}
};
interface responseNovel {
type responseNovel = {
id: number;
img: Img;
secondary_name: string;
@@ -1010,42 +1010,42 @@ interface responseNovel {
uploaded: number;
can_post_comments: boolean;
adaptation: Adaptation | null;
}
};
interface Adaptation {
type Adaptation = {
main_name: string;
secondary_name: string;
dir: string;
img: string;
}
};
interface ItemEntity {
type ItemEntity = {
id: number;
name: string;
}
interface PublishersEntity {
};
type PublishersEntity = {
id: number;
name: string;
img: string;
dir: string;
tagline: string;
type: string;
}
interface BranchesEntity {
};
type BranchesEntity = {
id: number;
img: string;
publishers?: PublishersEntity[] | null;
subscribed: boolean;
total_votes: number;
count_chapters: number;
}
interface FirstChapter {
};
type FirstChapter = {
id: number;
tome: number;
chapter: string;
}
};
interface responseСhapters {
type responseСhapters = {
id: number;
rated?: null;
viewed?: null;
@@ -1060,9 +1060,9 @@ interface responseСhapters {
pub_date?: null;
upload_date: string;
is_paid: boolean;
}
};
interface responseСhapter {
type responseСhapter = {
id: number;
chapter: string;
name: string;
@@ -1078,4 +1078,4 @@ interface responseСhapter {
index: number;
publishers?: PublishersEntity[] | null;
tome: number;
}
};
+4 -4
View File
@@ -125,7 +125,7 @@ class RV implements Plugin.PluginBase {
export default new RV();
interface book {
type book = {
id: number;
name: string;
original_name: string;
@@ -151,9 +151,9 @@ interface book {
updated_at: string;
slug: string;
chapters_count: number;
}
};
interface chapters {
type chapters = {
id: number;
name: string;
number: string;
@@ -173,7 +173,7 @@ interface chapters {
is_new: boolean;
purchased_by_user: boolean;
book_slug: string;
}
};
function unicodeToUtf8(unicode: string) {
return unicode.replace(/\\u([\d\w]{4})/gi, (match, hex) =>
+28 -28
View File
@@ -111,10 +111,10 @@ class SkyNovels implements Plugin.PluginBase {
export default new SkyNovels();
interface response {
type response = {
novels?: NovelsEntity[] | null;
}
interface NovelsEntity {
};
type NovelsEntity = {
id: number;
nvl_author?: number | null;
nvl_content: string;
@@ -135,16 +135,16 @@ interface NovelsEntity {
nvl_rating?: number | null;
nvl_ratings_count: number;
genres?: GenresEntity[] | null;
}
interface GenresEntity {
};
type GenresEntity = {
id: number;
genre_name: string;
}
};
interface responseBook {
type responseBook = {
novel?: NovelEntity[] | null;
}
interface NovelEntity {
};
type NovelEntity = {
id: number;
nvl_author: number;
nvl_content: string;
@@ -168,29 +168,29 @@ interface NovelEntity {
novel_ratings?: NovelRatingsEntity[] | null;
collaborators?: CollaboratorsEntity[] | null;
genres?: GenresEntity[] | null;
}
interface BookmarksEntity {
};
type BookmarksEntity = {
id: number;
user_id: number;
chp_id: number;
chp_name: string;
}
interface VolumesEntity {
};
type VolumesEntity = {
vlm_title: string;
id: number;
nvl_id: number;
user_id?: number | null;
chapters?: ChaptersEntity[] | null;
}
interface ChaptersEntity {
};
type ChaptersEntity = {
id: number;
chp_index_title: string;
chp_name: string;
chp_number: number;
chp_status: string;
createdAt: string;
}
interface NovelRatingsEntity {
};
type NovelRatingsEntity = {
user_id: number;
rate_value: number;
rate_comment: string;
@@ -201,21 +201,21 @@ interface NovelRatingsEntity {
user_login: string;
image?: string | null;
likes?: (LikesEntity | null)[] | null;
}
interface LikesEntity {
};
type LikesEntity = {
id: number;
user_id: number;
user_login: string;
}
interface CollaboratorsEntity {
};
type CollaboratorsEntity = {
user_id: number;
user_login: string;
}
};
interface responseChapter {
type responseChapter = {
chapter?: ChapterEntity[] | null;
}
interface ChapterEntity {
};
type ChapterEntity = {
id: number;
chp_author: number;
chp_translator?: null;
@@ -237,9 +237,9 @@ interface ChapterEntity {
comments?: null[] | null;
reactions?: null[] | null;
total_reactions?: TotalReactionsEntity[] | null;
}
interface TotalReactionsEntity {
};
type TotalReactionsEntity = {
reaction_id: number;
reaction_name: string;
reaction_count: number;
}
};
+1 -1
View File
@@ -140,7 +140,7 @@ class LSHNovel implements Plugin.PluginBase {
async searchNovels(
searchTerm: string,
pageNo?: number | undefined,
//pageNo?: number | undefined,
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
+26 -26
View File
@@ -142,55 +142,55 @@ function jsonToHtml(json: HTML[], html = '') {
return html;
}
interface response {
type response = {
projects?: TopLevelProject[];
updates?: Update[];
project?: TopLevelProject;
books?: BookElement[];
chapter?: TopLevelChapter;
}
};
interface BookElement {
type BookElement = {
id: number;
rank: number;
title: string;
chapters: PurpleChapter[];
}
};
interface PurpleChapter {
type PurpleChapter = {
id: number;
title: string;
rank: string;
modifiedAt: Date;
}
};
interface TopLevelChapter {
type TopLevelChapter = {
id: number;
title: string;
rank: string;
content: string;
modifiedAt: Date;
book: ChapterBook;
}
};
interface ChapterBook {
type ChapterBook = {
id: number;
rank: number;
title: string;
chapters: FluffyChapter[];
project: BookProject;
}
};
interface FluffyChapter {
type FluffyChapter = {
id: number;
rank: string;
}
};
interface BookProject {
type BookProject = {
id: number;
}
};
interface TopLevelProject {
type TopLevelProject = {
id: number;
title: string;
description: string;
@@ -205,37 +205,37 @@ interface TopLevelProject {
image: Image;
tags?: Genre[];
genres?: Genre[];
}
};
interface Genre {
type Genre = {
id: number;
title: string;
}
};
interface Image {
type Image = {
id: number;
url: string;
name: string;
}
};
interface Update {
type Update = {
id: number;
title: string;
author: string;
translator: string;
modifiedAt: Date;
image: Image;
}
};
interface HTML {
type HTML = {
type: string;
content?: HTML[];
attrs?: Attrs;
text?: string;
}
};
interface Attrs {
type Attrs = {
src: string;
alt: string | null;
title: string | null;
}
};
+6 -6
View File
@@ -4,21 +4,21 @@ import { Plugin } from '@typings/plugin';
import { FilterTypes, Filters } from '@libs/filterInputs';
import { NovelStatus } from '@libs/novelStatus';
interface VolumeData {
type VolumeData = {
story: string;
navigation: string;
value: string;
}
};
interface ChapterSelect {
type ChapterSelect = {
chap_selector: string;
eps_selector: boolean | string;
}
};
interface VolumeList {
type VolumeList = {
chapters: Plugin.ChapterItem[];
volumes?: VolumeData[];
}
};
class TruyenConect implements Plugin.PagePlugin {
id = 'truyenconect';
+4 -4
View File
@@ -4,14 +4,14 @@ import { Plugin } from '@typings/plugin';
import { Filters } from '@libs/filterInputs';
import { NovelStatus } from '@libs/novelStatus';
interface SearchedNovel {
type SearchedNovel = {
name: string;
slug: string;
coverUrl: string;
}
interface SearchedResult {
};
type SearchedResult = {
data?: SearchedNovel[];
}
};
class LightNovelVN implements Plugin.PagePlugin {
id = 'lightnovel.vn';