From 0da97f8382b763844fcc6172cb2e49124777d721 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 29 Oct 2024 10:41:06 +0800 Subject: [PATCH] fix: fix support for labeling --- core/assets/value/String.js | 5 +++++ core/assets/value/version.js | 9 ++++++--- package.json | 2 +- src/config.js | 2 +- src/platform/eh/parser/IntroHtmlParser.ts | 5 +++-- src/platform/eh/service/AlbumCacheService.ts | 12 +++++++++++- update.json | 18 +++++++++--------- 7 files changed, 36 insertions(+), 17 deletions(-) diff --git a/core/assets/value/String.js b/core/assets/value/String.js index 2376802..ec66119 100644 --- a/core/assets/value/String.js +++ b/core/assets/value/String.js @@ -284,6 +284,11 @@ export default { en: 'Changing to `"Normal"` mode failed, because of poor network. You can reload this page or go back to previous page and change the mode of thumbnails to `"Normal"`', jp: 'ネットワークが不十分であるため、`「Normal」`モードに変更できませんでした。 このページをリロードするか、前のページに戻ってサムネイルのモードを`「Normal」`に変更することができます' }, + parseFailed: { + cn: '解析错误, 可能是因为 Thumbnail Settings 不是`"Normal"`或`"Small"`, 可前往 Settings 页面修改配置后重试。详细错误如下:', + en: 'Parsing failed, may be because the `Thumbnail Settings` is not `"Normal"` or `"Small"`. You can go to the Settings Page to change and try again. error detail:', + jp: '解析に失敗しました。Thumbnail Settings が「Normal」または「Small」ではない可能性があります。設定ページに移動して変更し、もう一度試してください。エラーの詳細:' + }, loadingTip: { cn: '在前页采用Normal模式查看缩略图可加速加载', en: 'You can use "Normal" mode of thumbnail in previous page to accelerate the load.', diff --git a/core/assets/value/version.js b/core/assets/value/version.js index b7665b9..2c930ba 100644 --- a/core/assets/value/version.js +++ b/core/assets/value/version.js @@ -1,6 +1,7 @@ export default { cn: ` -* 修复exhentai的缩略图显示 +* 修复exhentai/ehentai的Labeling支持问题 +* 目前存在缩略图尺寸自动换为Small的问题, 后续再修复 ### iPad支持 * 目前在iOS 15/iPadOS 15上可以运行油猴脚本了,因此eHunter也能成功在iPad上使用 @@ -14,7 +15,8 @@ eHunter-local是eHunter的本地版本, 支持Windows和MacOS. [项目主页](ht `, en: ` -* Fixed thumbnail problem in the exhentai +* Fixed the Labeling support issue of exhentai/ehentai +* There is currently an issue where the thumbnail size is automatically changed to Small, which will be fixed later. ### Use in iPad * The greasymonkey/tampermonkey script can run on iOS 15/iPadOS 15, so the eHunter also can run on iPad now @@ -28,7 +30,8 @@ The eHunter-local is local version of eHunter, supporting Windows and MacOS. [Ho `, jp: ` -* Fixed thumbnail problem in the exhentai +* exhentai/ehentaiのlabelingの問題を修正しました。 +* 現在、サムネイルのサイズが自動的に「Small」に変更される問題が発生していますが、これは後で修正される予定です。 ### Use in iPad * The greasymonkey/tampermonkey script can run on iOS 15/iPadOS 15, so the eHunter also can run on iPad now. diff --git a/package.json b/package.json index a6ec0e0..ab90ff8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ehunter", - "version": "2.7.5", + "version": "2.7.6", "description": "A Vue.js project", "author": "Alex Chen ", "private": true, diff --git a/src/config.js b/src/config.js index b67bb8b..9b565ab 100644 --- a/src/config.js +++ b/src/config.js @@ -1,5 +1,5 @@ module.exports = { - version: '2.7.5', + version: '2.7.6', homePage: 'https://github.com/hanFengSan/eHunter', email: 'c360785655@gmail.com', updateServer1: 'https://jp.animesales.xyz/ehunter/update.json', diff --git a/src/platform/eh/parser/IntroHtmlParser.ts b/src/platform/eh/parser/IntroHtmlParser.ts index 2edeabd..4fc2289 100644 --- a/src/platform/eh/parser/IntroHtmlParser.ts +++ b/src/platform/eh/parser/IntroHtmlParser.ts @@ -18,7 +18,7 @@ export class IntroHtmlParser { let isNew = this.html.querySelectorAll('#gdt>.gdtm').length == 0 if (isNew) { return Array.prototype.slice.call(this.html.querySelector('#gdt')!.children).map(item => { - item.children[0].getAttribute('style').match(/width:(.*?)px;height:(.*?)px;/g); + item.innerHTML.match(/width:(.*?)px;height:(.*?)px;/g); const thumbHeight = Number(RegExp.$2); const thumbWidth = Number(RegExp.$1); let pageUrl = item.getAttribute('href').match(/\/s.*$/) + ''; @@ -59,7 +59,8 @@ export class IntroHtmlParser { } _getThumbKeyId() { - let key = this.html.querySelector('#gdt')!.children![0].children![0].getAttribute('style')!.match(/https:.*?\/cm\/.*?\//g)![0] + let key = this.html.querySelector('#gdt')!.children[0].innerHTML.match(/url\(https:.*?\/cm\/.*?\//g)![0] + key = key.replace('url(', '') return key } diff --git a/src/platform/eh/service/AlbumCacheService.ts b/src/platform/eh/service/AlbumCacheService.ts index 2b4fc1c..7f57404 100644 --- a/src/platform/eh/service/AlbumCacheService.ts +++ b/src/platform/eh/service/AlbumCacheService.ts @@ -70,6 +70,16 @@ export class AlbumCacheService { if (this._album) { return this._album; } else { + // disable cache to avoid cache problem + let now = new Date().getTime() + if (now < 1732757677943) { // before 2024-11-28, disable cache + this._album = { + title: '', + thumbInfos: [], + imgPageInfos: [] + }; + return this._album!; + } try { this._album = await storage.load({ key: this.storageName, id: albumId }); } catch (e) { @@ -85,7 +95,7 @@ export class AlbumCacheService { async _saveAlbum(albumId: string): Promise { // L.o('save', this._album); - await storage.save({ key: this.storageName, id: albumId, data: await this._getAlbum(albumId), expires: 1000 }); + await storage.save({ key: this.storageName, id: albumId, data: await this._getAlbum(albumId), expires: 1000 * 60 * 60 }); } async getThumbInfos(albumId: string, introUrl, sumOfPage): Promise> { diff --git a/update.json b/update.json index 1af65ed..2030afd 100644 --- a/update.json +++ b/update.json @@ -1,8 +1,8 @@ { "cn":{ - "title":"新版本: v2.7.5", - "version":"2.7.5", - "text":"1. 修复exhentai/ehentai的解析问题", + "title":"新版本: v2.7.6", + "version":"2.7.6", + "text":"1. 修复exhentai/ehentai的Labeling支持问题", "time":1690647347098, "duration":60000, "always":true, @@ -14,9 +14,9 @@ ] }, "en":{ - "title":"New version: v2.7.5", - "version":"2.7.5", - "text":"1. Fixed the parser of exhentai/ehentai", + "title":"New version: v2.7.6", + "version":"2.7.6", + "text":"1. Fixed the Labeling support issue of exhentai/ehentai", "time":1690647347098, "duration":60000, "always":true, @@ -28,9 +28,9 @@ ] }, "jp":{ - "title":"新しいバージョン: v2.7.5", - "version":"2.7.5", - "text":"1. Fixed the parser of exhentai/ehentai", + "title":"新しいバージョン: v2.7.6", + "version":"2.7.6", + "text":"1. exhentai/ehentaiのlabelingの問題を修正しました", "time":1690647347098, "duration":60000, "always":true,