Skip to content

Commit

Permalink
Fix the bug of 509 recognition error in some cases
Browse files Browse the repository at this point in the history
修复部分情况下509识别错误的bug
  • Loading branch information
jiangtian616 committed Mar 9, 2024
1 parent c67a847 commit 3540869
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
5 changes: 5 additions & 0 deletions changelog/v7.4.12+172.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- 修复部分情况下509识别错误的bug

------------------------------------------------------------------------------------------

- Fix the bug of 509 recognition error in some cases
4 changes: 3 additions & 1 deletion changelog/v7.4.13.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- 修复部分情况下无法超分图片的bug
- 修复在关闭标签搜索继承时点击tag搜索时的路由bug
- 修复下载页列表布局下暂停时进度条颜色显示不正确的bug
- 修复部分情况下509识别错误的bug

------------------------------------------------------------------------------------------

Expand All @@ -30,4 +31,5 @@
- Fix the bug that super-resolution images cannot be deleted
- Fix the bug that super-resolution images cannot be generated in some cases
- Fix the routing bug when clicking tag search when closing tag search inheritance
- Fix the bug that the progress bar color is displayed incorrectly when pausing in the download page list layout
- Fix the bug that the progress bar color is displayed incorrectly when pausing in the download page list layout
- Fix the bug of 509 recognition error in some cases
50 changes: 27 additions & 23 deletions lib/src/consts/eh_consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,67 +5,71 @@ class EHConsts {

static String get EIndex => EHSetting.site.value == 'EH' ? EHIndex : EXIndex;

static String get EHIndex => 'https://e-hentai.org';
static const String EHIndex = 'https://e-hentai.org';

static String get EXIndex => 'https://exhentai.org';
static const String EXIndex = 'https://exhentai.org';

static String get EPopular => EHSetting.site.value == 'EH' ? EHPopular : EXPopular;

static String get EHPopular => 'https://e-hentai.org/popular';
static const String EHPopular = 'https://e-hentai.org/popular';

static String get EXPopular => 'https://exhentai.org/popular';
static const String EXPopular = 'https://exhentai.org/popular';

static String get EApi => EHSetting.site.value == 'EH' ? EHApi : EXApi;

static String get EHApi => 'https://api.e-hentai.org/api.php';
static const String EHApi = 'https://api.e-hentai.org/api.php';

static String get EXApi => 'https://exhentai.org/api.php';
static const String EXApi = 'https://exhentai.org/api.php';

static String get EHome => 'https://e-hentai.org/home.php';
static const String EHome = 'https://e-hentai.org/home.php';

static String get ERanklist => 'https://e-hentai.org/toplist.php';
static const String ERanklist = 'https://e-hentai.org/toplist.php';

static String get EWatched => EHSetting.site.value == 'EH' ? EHWatched : EXWatched;

static String get EHWatched => 'https://e-hentai.org/watched';
static const String EHWatched = 'https://e-hentai.org/watched';

static String get EXWatched => 'https://exhentai.org/watched';
static const String EXWatched = 'https://exhentai.org/watched';

static String get EForums => 'https://forums.e-hentai.org/index.php';
static const String EForums = 'https://forums.e-hentai.org/index.php';

static String get EPopup => EHSetting.site.value == 'EH' ? 'https://e-hentai.org/gallerypopups.php' : 'https://exhentai.org/gallerypopups.php';

static String get EFavorite => EHSetting.site.value == 'EH' ? 'https://e-hentai.org/favorites.php' : 'https://exhentai.org/favorites.php';

static String get ETorrent => EHSetting.site.value == 'EH' ? EHTorrent : EXTorrent;

static String get EHTorrent => 'https://e-hentai.org/gallerytorrents.php';
static const String EHTorrent = 'https://e-hentai.org/gallerytorrents.php';

static String get EXTorrent => 'https://exhentai.org/gallerytorrents.php';
static const String EXTorrent = 'https://exhentai.org/gallerytorrents.php';

static String get EArchive => EHSetting.site.value == 'EH' ? EHArchive : EXArchive;

static String get EHArchive => 'https://e-hentai.org/archiver.php';
static const String EHArchive = 'https://e-hentai.org/archiver.php';

static String get EXArchive => 'https://exhentai.org/archiver.php';
static const String EXArchive = 'https://exhentai.org/archiver.php';

static String get ELogin => 'https://forums.e-hentai.org/index.php?act=Login&CODE=00';
static const String ELogin = 'https://forums.e-hentai.org/index.php?act=Login&CODE=00';

static String get EUconfig => EHSetting.site.value == 'EH' ? EHUconfig : EXUconfig;

static String get EHUconfig => 'https://e-hentai.org/uconfig.php';
static const String EHUconfig = 'https://e-hentai.org/uconfig.php';

static String get EXUconfig => 'https://exhentai.org/uconfig.php';
static const String EXUconfig = 'https://exhentai.org/uconfig.php';

static String get EStat => 'https://e-hentai.org/stats.php';
static const String EStat = 'https://e-hentai.org/stats.php';

static String get ELookup => EHSetting.site.value == 'EH' ? EHLookup : EXLookup;

static String get EHLookup => 'https://upld.e-hentai.org/image_lookup.php';
static const String EHLookup = 'https://upld.e-hentai.org/image_lookup.php';

static String get EXLookup => 'https://exhentai.org/upld/image_lookup.php';
static const String EXLookup = 'https://exhentai.org/upld/image_lookup.php';

static String get EMyTags => 'https://e-hentai.org/mytags';
static const String EMyTags = 'https://e-hentai.org/mytags';

static String get EExchange => 'https://e-hentai.org/exchange.php?t=gp';
static const String EExchange = 'https://e-hentai.org/exchange.php?t=gp';

static const String EH509ImageUrl = 'https://ehgt.org/g/509.gif';

static const String EX509ImageUrl = 'https://exhentai.org/img/509.gif';
}
5 changes: 3 additions & 2 deletions lib/src/utils/eh_spider_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import 'package:jhentai/src/setting/site_setting.dart';
import 'package:jhentai/src/utils/color_util.dart';
import 'package:jhentai/src/utils/string_uril.dart';

import '../consts/eh_consts.dart';
import '../database/database.dart';
import '../exception/eh_parse_exception.dart';
import '../model/gallery.dart';
Expand Down Expand Up @@ -471,7 +472,7 @@ class EHSpiderParser {
/// height: 1600px; width: 1124px;
String style = img!.attributes['style']!;
String url = img.attributes['src']!;
if (url.contains('509.gif')) {
if (url == EHConsts.EH509ImageUrl || url == EHConsts.EX509ImageUrl) {
throw EHParseException(type: EHParseExceptionType.exceedLimit, message: 'exceedImageLimits'.tr);
}
double height = double.parse(RegExp(r'height:(\d+)px').firstMatch(style)!.group(1)!);
Expand Down Expand Up @@ -507,7 +508,7 @@ class EHSpiderParser {
/// height: 1600px; width: 1124px;
String style = img!.attributes['style']!;
String url = img.attributes['src']!;
if (url.contains('509.gif')) {
if (url == EHConsts.EH509ImageUrl || url == EHConsts.EX509ImageUrl) {
throw EHParseException(type: EHParseExceptionType.exceedLimit, message: 'exceedImageLimits'.tr);
}
double height = double.parse(RegExp(r'height:(\d+)px').firstMatch(style)!.group(1)!);
Expand Down

0 comments on commit 3540869

Please sign in to comment.