Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

fix: prevent duplicate UserScript injection (#1160)

KotaHv21dad5463bd8
diff --git a/lib/pages/webview/webview_controller_impel/webview_apple_controller_impel.dart b/lib/pages/webview/webview_controller_impel/webview_apple_controller_impel.dart
index 0fe06899..1ab9c5e9 100644
--- a/lib/pages/webview/webview_controller_impel/webview_apple_controller_impel.dart
+++ b/lib/pages/webview/webview_controller_impel/webview_apple_controller_impel.dart
@@ -7,6 +7,7 @@ import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_pla
class WebviewAppleItemControllerImpel
extends WebviewItemController<PlatformInAppWebViewController> {
Timer? loadingMonitorTimer;
+ bool hasInjectedScripts = false;
@override
Future<void> init() async {
@@ -17,8 +18,11 @@ class WebviewAppleItemControllerImpel
Future<void> loadUrl(String url, bool useNativePlayer, bool useLegacyParser,
{int offset = 0}) async {
await unloadPage();
- addJavaScriptHandlers(useNativePlayer, useLegacyParser);
- await addUserScripts(useNativePlayer, useLegacyParser);
+ if (!hasInjectedScripts) {
+ addJavaScriptHandlers(useNativePlayer, useLegacyParser);
+ await addUserScripts(useNativePlayer, useLegacyParser);
+ hasInjectedScripts = true;
+ }
count = 0;
this.offset = offset;
isIframeLoaded = false;