mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: webview: intercept refresh url
Closes #587 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -189,21 +189,21 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
||||
_webViewController?.addJavaScriptHandler(
|
||||
handlerName: 'finishButtonClicked',
|
||||
callback: (args) {
|
||||
_webViewController?.evaluateJavascript(source: """
|
||||
Array.from(document.querySelectorAll('.ql-editor > p')).map(p => p.textContent).join('\\n');
|
||||
""").then((value) {
|
||||
// try {
|
||||
// String? summary = (value as String?);
|
||||
// if (summary?.isNotEmpty == true) {
|
||||
// VideoHttp.addNote(
|
||||
// oid: widget.oid!,
|
||||
// title: widget.title!,
|
||||
// summary: summary!,
|
||||
// );
|
||||
// }
|
||||
// } catch (_) {}
|
||||
Get.back();
|
||||
});
|
||||
Get.back();
|
||||
// _webViewController?.evaluateJavascript(source: """
|
||||
// Array.from(document.querySelectorAll('.ql-editor > p')).map(p => p.textContent).join('\\n');
|
||||
// """).then((value) {
|
||||
// try {
|
||||
// String? summary = (value as String?);
|
||||
// if (summary?.isNotEmpty == true) {
|
||||
// VideoHttp.addNote(
|
||||
// oid: widget.oid!,
|
||||
// title: widget.title!,
|
||||
// summary: summary!,
|
||||
// );
|
||||
// }
|
||||
// } catch (_) {}
|
||||
// });
|
||||
},
|
||||
);
|
||||
_webViewController?.addJavaScriptHandler(
|
||||
@@ -294,6 +294,14 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
||||
_progressStream.add(1);
|
||||
}
|
||||
: null,
|
||||
shouldInterceptRequest: (controller, request) async {
|
||||
String url = request.url.toString();
|
||||
if (url.startsWith(
|
||||
'https://passport.bilibili.com/x/passport-login/web')) {
|
||||
return WebResourceResponse();
|
||||
}
|
||||
return null;
|
||||
},
|
||||
shouldOverrideUrlLoading: (controller, navigationAction) async {
|
||||
if (_inApp == true) {
|
||||
return NavigationActionPolicy.ALLOW;
|
||||
|
||||
Reference in New Issue
Block a user