Skip to content

Commit

Permalink
超出图片配额509时不缓存页面
Browse files Browse the repository at this point in the history
Not cache page when exceed image limits
  • Loading branch information
jiangtian616 committed Aug 15, 2022
1 parent 98c52b9 commit 8545166
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/src/utils/eh_spider_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'dart:ui';

import 'package:collection/collection.dart';
import 'package:dio/dio.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:get/get_instance/get_instance.dart';
import 'package:get/get_utils/src/extensions/internacionalization.dart';
import 'package:html/dom.dart';
import 'package:html/parser.dart';
Expand All @@ -25,6 +27,7 @@ import 'package:jhentai/src/utils/color_util.dart';

import '../database/database.dart';
import '../model/gallery.dart';
import '../network/eh_cache_interceptor.dart';
import 'log.dart';

T noOpParser<T>(v) => v as T;
Expand Down Expand Up @@ -265,6 +268,7 @@ class EHSpiderParser {
String url = img.attributes['src']!;

if (url.contains('509.gif')) {
Get.find<EHCacheInterceptor>().removeCacheByUrl(response.requestOptions.path);
throw DioError(
requestOptions: response.requestOptions,
error: EHException(type: EHExceptionType.exceedLimit, msg: 'exceedImageLimits'.tr),
Expand Down Expand Up @@ -296,6 +300,7 @@ class EHSpiderParser {
String url = img.attributes['src']!;

if (url.contains('509.gif')) {
Get.find<EHCacheInterceptor>().removeCacheByUrl(response.requestOptions.path);
throw DioError(
requestOptions: response.requestOptions,
error: EHException(type: EHExceptionType.exceedLimit, msg: 'exceedImageLimits'.tr),
Expand Down

0 comments on commit 8545166

Please sign in to comment.