From 9193ffdb3546e833a62238c33d44000c4c1ec066 Mon Sep 17 00:00:00 2001 From: youniaogu Date: Sun, 12 Jan 2025 14:06:03 +0800 Subject: [PATCH] bug fix - #175 #172 #170 (#177) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 copy * 🔖 v0.7.6 * 🐛 disable happy plugin --- android/app/build.gradle | 4 +-- ios/MangaReader.xcodeproj/project.pbxproj | 8 ++--- ios/Podfile.lock | 2 +- package.json | 4 +-- src/plugins/copy.ts | 40 ++++++++++++++--------- src/plugins/happy.ts | 6 ++-- 6 files changed, 37 insertions(+), 27 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index e1ec909..faa9135 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -78,8 +78,8 @@ android { applicationId "com.youniaogu.mangareader" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 49 - versionName "0.7.5" + versionCode 50 + versionName "0.7.6" } signingConfigs { debug { diff --git a/ios/MangaReader.xcodeproj/project.pbxproj b/ios/MangaReader.xcodeproj/project.pbxproj index 8cf1257..4a0a89f 100644 --- a/ios/MangaReader.xcodeproj/project.pbxproj +++ b/ios/MangaReader.xcodeproj/project.pbxproj @@ -504,7 +504,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 49; + CURRENT_PROJECT_VERSION = 50; DEVELOPMENT_TEAM = VAL2KK2S94; ENABLE_BITCODE = NO; INFOPLIST_FILE = MangaReader/Info.plist; @@ -512,7 +512,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 0.7.5; + MARKETING_VERSION = 0.7.6; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -533,7 +533,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 49; + CURRENT_PROJECT_VERSION = 50; DEVELOPMENT_TEAM = VAL2KK2S94; ENABLE_BITCODE = NO; INFOPLIST_FILE = MangaReader/Info.plist; @@ -541,7 +541,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 0.7.5; + MARKETING_VERSION = 0.7.6; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 74d6981..96f77b0 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -795,7 +795,7 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: - boost: 57d2868c099736d80fcd648bf211b4431e51a558 + boost: 7dcd2de282d72e344012f7d6564d024930a6a440 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 FBLazyVector: f91d538f197fa71a7d5b77ec2069d49550c0eb96 diff --git a/package.json b/package.json index 161faeb..fcc66bb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mangareader", - "version": "0.7.5", - "publishTime": "2024-06-10", + "version": "0.7.6", + "publishTime": "2025-01-12", "private": true, "scripts": { "start": "react-native start", diff --git a/src/plugins/copy.ts b/src/plugins/copy.ts index be3b9fe..b54df84 100644 --- a/src/plugins/copy.ts +++ b/src/plugins/copy.ts @@ -1,7 +1,6 @@ import Base, { Plugin, Options } from './base'; import { MangaStatus, ErrorMessage } from '~/utils'; import { AESDecrypt } from '~/utils'; -import * as cheerio from 'cheerio'; interface BaseResponse { code: number; @@ -44,7 +43,7 @@ interface MangaInfoResponse last_chapter: { uuid: string; name: string }; }; }> {} -interface ChapterListReponse extends BaseResponse {} +interface ChapterListResponse extends BaseResponse {} interface ChapterListInfo { build: { path_word: string; @@ -52,6 +51,22 @@ interface ChapterListInfo { }; groups: Record<'default' | string, { chapters: { id: string; name: string }[] }>; } +interface ChapterInfoResponse + extends BaseResponse<{ + comic: { name: string; path_word: string }; + chapter: { + uuid: string; + count: number; + size: number; + name: string; + comic_id: string; + comic_path_word: string; + group_id: null; + group_path_word: string; + datetime_created: string; + contents: { url: string }[]; + }; + }> {} const discoveryOptions = [ { @@ -142,8 +157,6 @@ const discoveryOptions = [ }, ]; -const PATTERN_HEADER = /(.+)\/(.+)/; - class CopyManga extends Base { readonly fetchHeaders = { ...this.defaultHeaders, @@ -229,7 +242,8 @@ class CopyManga extends Base { }; prepareChapterFetch: Base['prepareChapterFetch'] = (mangaId, chapterId) => { return { - url: `https://www.mangacopy.com/comic/${mangaId}/chapter/${chapterId}`, + url: `https://api.mangacopy.com/api/v3/comic/${mangaId}/chapter/${chapterId}`, + body: { platform: 3 }, headers: new Headers({ 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36', @@ -314,7 +328,7 @@ class CopyManga extends Base { } }; - handleChapterList: Base['handleChapterList'] = (res: ChapterListReponse) => { + handleChapterList: Base['handleChapterList'] = (res: ChapterListResponse) => { if (res.code === 200) { const data: ChapterListInfo = JSON.parse(AESDecrypt(res.results || '')); const { build, groups } = data; @@ -344,26 +358,20 @@ class CopyManga extends Base { }; handleChapter: Base['handleChapter'] = ( - text: string | null, + res: ChapterInfoResponse, mangaId: string, chapterId: string ) => { - const $ = cheerio.load(text || ''); - const contentkey = $('div.imageData').first().attr('contentkey') || ''; - const images = JSON.parse(AESDecrypt(contentkey)); - const [, name = '', title = ''] = - ($('h4.header').first().text() || '').match(PATTERN_HEADER) || []; - return { canLoadMore: false, chapter: { hash: Base.combineHash(this.id, mangaId, chapterId), mangaId, chapterId, - name, - title, + name: res.results.comic.name, + title: res.results.chapter.name, headers: this.imageHeaders, - images: images.map((item: { url: string }) => ({ + images: res.results.chapter.contents.map((item: { url: string }) => ({ uri: item.url.replace(/\.c[0-9]+x\./, '.c1500x.'), })), }, diff --git a/src/plugins/happy.ts b/src/plugins/happy.ts index 1879eaf..0ee05e0 100644 --- a/src/plugins/happy.ts +++ b/src/plugins/happy.ts @@ -253,11 +253,13 @@ class HappyManga extends Base { ? 'Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36' : 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1'; super({ - score: 5, + disabled: true, + score: 0, id: Plugin.HAPPY, name: '嗨皮漫画', shortName: 'HAPPY', - description: '需要代理,图片有 CF 校验', + description: '已失效', + // description: '需要代理,图片有 CF 校验', href: 'https://m.happymh.com/', userAgent, defaultHeaders: { 'User-Agent': userAgent, Referer: 'https://m.happymh.com/', Cookie: '' },