From 88e73c40893c994ce4ae013c719826a8d67605a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=85=B1=E5=A4=A9=E5=B0=8F=E7=A6=BD=E5=85=BD?= Date: Mon, 1 Jan 2024 02:52:00 +0800 Subject: [PATCH] v7.4.10+149 --- changelog/v7.4.10+149.md | 5 +++++ lib/src/pages/details/details_page_logic.dart | 6 +++--- lib/src/widget/eh_gallery_stat_dialog.dart | 16 +++++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 changelog/v7.4.10+149.md diff --git a/changelog/v7.4.10+149.md b/changelog/v7.4.10+149.md new file mode 100644 index 00000000..40cce664 --- /dev/null +++ b/changelog/v7.4.10+149.md @@ -0,0 +1,5 @@ +- 修复v7.4.8中引入的里站访问bug + +------------------------------------------------------------------------------------------ + +- Fix the bug of accessing the EX site introduced in v7.4.8 \ No newline at end of file diff --git a/lib/src/pages/details/details_page_logic.dart b/lib/src/pages/details/details_page_logic.dart index ee9c7b70..e4d8bd12 100644 --- a/lib/src/pages/details/details_page_logic.dart +++ b/lib/src/pages/details/details_page_logic.dart @@ -754,8 +754,8 @@ class DetailsPageLogic extends GetxController with LoginRequiredMixin, Scroll2To ); state.gallery?.galleryUrl = state.galleryUrl = firstLink; return galleryAndDetailAndApikey; - } on DioError catch (e) { - if (e.response?.statusCode != 404) { + } on EHException catch (e) { + if (e.type != EHExceptionType.galleryDeleted) { rethrow; } Log.verbose('Can\'t find gallery, firstLink: $firstLink'); @@ -770,7 +770,7 @@ class DetailsPageLogic extends GetxController with LoginRequiredMixin, Scroll2To ); state.gallery?.galleryUrl = state.galleryUrl = secondLink; return galleryAndDetailAndApikey; - } on DioError catch (_) { + } on EHException catch (_) { Log.verbose('Can\'t find gallery, secondLink: $secondLink'); rethrow; } diff --git a/lib/src/widget/eh_gallery_stat_dialog.dart b/lib/src/widget/eh_gallery_stat_dialog.dart index 8c9be975..4cd2a14e 100644 --- a/lib/src/widget/eh_gallery_stat_dialog.dart +++ b/lib/src/widget/eh_gallery_stat_dialog.dart @@ -88,20 +88,18 @@ class _EHGalleryStatDialogState extends State { parser: EHSpiderParser.statPage2GalleryStats, ); } on DioError catch (e) { - if (e.response?.statusCode == 404) { - Log.info('invisible2UserWithoutDonation'.tr); - if (mounted) { - setState(() => loadingState = LoadingState.noData); - } - return; - } - Log.error('getGalleryStatisticsFailed'.tr, e.message); snack('getGalleryStatisticsFailed'.tr, e.message); setStateSafely(() => loadingState = LoadingState.error); - return; } on EHException catch (e) { + if (e.type == EHExceptionType.galleryDeleted) { + Log.error('invisible2UserWithoutDonation'.tr); + snack('invisible2UserWithoutDonation'.tr, e.message); + setStateSafely(() => loadingState = LoadingState.noData); + return; + } + Log.error('getGalleryStatisticsFailed'.tr, e.message); snack('getGalleryStatisticsFailed'.tr, e.message); setStateSafely(() => loadingState = LoadingState.error);