Skip to content

Commit

Permalink
fix: fix support for labeling
Browse files Browse the repository at this point in the history
  • Loading branch information
hanFengSan committed Oct 29, 2024
1 parent c13ae71 commit 0da97f8
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 17 deletions.
5 changes: 5 additions & 0 deletions core/assets/value/String.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
9 changes: 6 additions & 3 deletions core/assets/value/version.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export default {
cn: `
* 修复exhentai的缩略图显示
* 修复exhentai/ehentai的Labeling支持问题
* 目前存在缩略图尺寸自动换为Small的问题, 后续再修复
### iPad支持
* 目前在iOS 15/iPadOS 15上可以运行油猴脚本了,因此eHunter也能成功在iPad上使用
Expand All @@ -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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ehunter",
"version": "2.7.5",
"version": "2.7.6",
"description": "A Vue.js project",
"author": "Alex Chen <c360785655@gmail.com>",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
5 changes: 3 additions & 2 deletions src/platform/eh/parser/IntroHtmlParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.*$/) + '';
Expand Down Expand Up @@ -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
}

Expand Down
12 changes: 11 additions & 1 deletion src/platform/eh/service/AlbumCacheService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -85,7 +95,7 @@ export class AlbumCacheService {

async _saveAlbum(albumId: string): Promise<void> {
// 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<Array<ThumbInfo>> {
Expand Down
18 changes: 9 additions & 9 deletions update.json
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 0da97f8

Please sign in to comment.