fix: linter issues

This commit is contained in:
K1ngfish3r
2026-04-23 01:04:42 +05:00
parent 5e195b7f53
commit 2396df38bb
111 changed files with 2738 additions and 2160 deletions
+32 -22
View File
@@ -1,13 +1,13 @@
import { CheerioAPI, load as parseHTML } from 'cheerio';
import { load as parseHTML } from 'cheerio';
import { fetchApi } from '@libs/fetch';
import { Plugin } from '@/types/plugin';
import { Filters, FilterTypes } from '@libs/filterInputs';
import { Filters } from '@libs/filterInputs';
import { defaultCover } from '@libs/defaultCover';
class dilartube implements Plugin.PluginBase {
id = 'dilartube';
name = 'dilar tube';
version = '1.0.1';
version = '1.0.2';
icon = 'src/ar/dilartube/icon.png';
site = 'https://golden.rest/';
@@ -53,7 +53,7 @@ class dilartube implements Plugin.PluginBase {
async popularNovels(
page: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions<Filters>,
{ showLatestNovels }: Plugin.PopularNovelsOptions<typeof this.filters>,
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}api/releases?page=${page}`;
if (showLatestNovels) {
@@ -82,14 +82,14 @@ class dilartube implements Plugin.PluginBase {
const chapterItems: Plugin.ChapterItem[] = [];
const fullUrl = this.site + 'api/' + novelUrl;
const chapterUrl = this.site + 'api/' + novelUrl + '/releases';
const manga = await fetchApi(fullUrl).then(r => r.json());
const manga: MangaResponse = await fetchApi(fullUrl).then(r => r.json());
const chapters = await fetchApi(chapterUrl).then(r => r.json());
const mangaData = manga.mangaData;
const chapterData = chapters.releases;
const novel: Plugin.SourceNovel = {
path: novelUrl,
name: mangaData.arabic_title || 'Untitled',
name: mangaData.arabic_title ?? mangaData.title ?? 'Untitled',
author:
(mangaData.authors.length > 0 ? mangaData.authors[0].name : '') ||
'Unknown',
@@ -97,7 +97,7 @@ class dilartube implements Plugin.PluginBase {
cover: `${this.site}uploads/manga/cover/${mangaData.id}/${mangaData.cover}`,
chapters: [],
};
const translationStatusId: string = mangaData.translation_status;
const translationStatusId = mangaData.translation_status.toString();
const translationText =
{
'1': 'مستمره',
@@ -105,13 +105,15 @@ class dilartube implements Plugin.PluginBase {
'2': 'متوقفة',
'3': 'غير مترجمه',
}[translationStatusId] || 'غير معروف';
const statusWords = new Set(['مكتمل', 'جديد', 'مستمر']);
const mainGenres = mangaData.categories
.map((category: { name: any }) => category.name)
// const statusWords = new Set(['مكتمل', 'جديد', 'مستمر']);
const mainGenres = Array.from(
new Set(mangaData.categories.map(g => g.name)),
)
.filter(Boolean)
.join(',');
novel.genres = `${translationText},${mainGenres}`;
const statusId: string = mangaData.story_status;
const statusId = mangaData.story_status.toString();
const statusText =
{
'2': 'Ongoing',
@@ -138,12 +140,18 @@ class dilartube implements Plugin.PluginBase {
const parsedData = JSON.parse(jsonData as string);
const chapterText = parsedData.readerDataAction.readerData.release.content;
return chapterText;
// return html with p tags
return chapterText
.split(/\r?\n/)
.map((line: string) => line.trim())
.filter(Boolean)
.map((line: string) => `<p>${line}</p>`)
.join('');
}
async searchNovels(
searchTerm: string,
page: number,
// page: number,
): Promise<Plugin.NovelItem[]> {
const formData = new FormData();
formData.append('query', searchTerm);
@@ -156,6 +164,7 @@ class dilartube implements Plugin.PluginBase {
return this.parseNovels(data);
}
filters: Filters | undefined = undefined;
// filters = {
// types: {
// value: [],
@@ -245,8 +254,8 @@ type Manga = {
publisher_name: string | null;
discord_url: string | null;
mobile_exclusive: boolean;
authors: any[];
artists: any[];
// authors: any[];
// artists: any[];
categories: Category[];
type: Type;
};
@@ -327,7 +336,7 @@ type MangaData = {
uniq_visitors_count: number;
publisher_id: number | null;
publisher_name: string | null;
arabic_title: string;
arabic_title: string | null;
english: string;
synonyms: string;
japanese: string;
@@ -360,11 +369,12 @@ type MangaData = {
};
type MangaResponse = {
membersMentioning: any[];
memberRates: any | null;
mangaLogs: Record<string, any>;
// membersMentioning: any[];
// memberRates: any | null;
// mangaLogs: Record<string, any>;
mangaData: MangaData;
};
type ChapterRelease = {
id: number;
manga_id: number;
@@ -385,7 +395,7 @@ type ChapterRelease = {
has_rev_link: boolean;
};
type searchManga = {
filter: any;
// filter: any;
id: number;
title: string;
summary: string;
@@ -417,8 +427,8 @@ type searchManga = {
publisher_name: string | null;
discord_url: string | null;
mobile_exclusive: boolean;
authors: any[];
artists: any[];
// authors: any[];
// artists: any[];
categories: Category[];
type: Type;
};
+7 -4
View File
@@ -1,4 +1,4 @@
import { CheerioAPI, load as parseHTML } from 'cheerio';
import { load as parseHTML } from 'cheerio';
import { fetchApi } from '@libs/fetch';
import { Plugin } from '@/types/plugin';
import { Filters, FilterTypes } from '@libs/filterInputs';
@@ -7,7 +7,7 @@ import { defaultCover } from '@libs/defaultCover';
class RewayatClub implements Plugin.PagePlugin {
id = 'rewayatclub';
name = 'Rewayat Club';
version = '1.0.2';
version = '1.0.3';
icon = 'src/ar/rewayatclub/icon.png';
site = 'https://rewayat.club/';
@@ -34,7 +34,10 @@ class RewayatClub implements Plugin.PagePlugin {
async popularNovels(
page: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions<Filters>,
{
showLatestNovels,
filters,
}: Plugin.PopularNovelsOptions<typeof this.filters>,
): Promise<Plugin.NovelItem[]> {
let link = `https://api.rewayat.club/api/novels/`;
let body: NovelData = {
@@ -253,7 +256,7 @@ type ChapterEntry = {
hits: number;
id: number;
};
read: any[];
// read: any[];
};
type ChapterData = {
+4 -5
View File
@@ -7,7 +7,7 @@ import { defaultCover } from '@libs/defaultCover';
class Sunovels implements Plugin.PagePlugin {
id = 'sunovels';
name = 'Sunovels';
version = '1.0.0';
version = '1.0.1';
icon = 'src/ar/sunovels/icon.png';
site = 'https://sunovels.com/';
@@ -52,7 +52,7 @@ class Sunovels implements Plugin.PagePlugin {
async popularNovels(
page: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions<Filters>,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>,
): Promise<Plugin.NovelItem[]> {
const pageCorrected = page - 1;
let link = `${this.site}library?`;
@@ -137,7 +137,7 @@ class Sunovels implements Plugin.PagePlugin {
name: item.chapterName,
releaseTime: new Date(item.releaseTime).toISOString(),
path: item.chapterUrl,
chapterNumber: item.chapterNumber,
chapterNumber: Number(item.chapterNumber),
});
});
return chapter;
@@ -169,8 +169,7 @@ class Sunovels implements Plugin.PagePlugin {
const dateAttr = loadedCheerio(el)
.find('time.chapter-update')
.attr('datetime');
const date = new Date(dateAttr);
const releaseTime = date.toISOString();
const releaseTime = dateAttr ? new Date(dateAttr).toISOString() : '';
const chapternumber = loadedCheerio(el)
.find('strong.chapter-title')
.text()