mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: webview params
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -34,6 +34,7 @@ class PiliScheme {
|
|||||||
String url, {
|
String url, {
|
||||||
bool selfHandle = false,
|
bool selfHandle = false,
|
||||||
bool off = false,
|
bool off = false,
|
||||||
|
Map? parameters,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
if (url.startsWith('//')) {
|
if (url.startsWith('//')) {
|
||||||
@@ -41,7 +42,12 @@ class PiliScheme {
|
|||||||
} else if (RegExp(r'^\S+://').hasMatch(url).not) {
|
} else if (RegExp(r'^\S+://').hasMatch(url).not) {
|
||||||
url = 'https://$url';
|
url = 'https://$url';
|
||||||
}
|
}
|
||||||
return await routePush(Uri.parse(url), selfHandle: selfHandle, off: off);
|
return await routePush(
|
||||||
|
Uri.parse(url),
|
||||||
|
selfHandle: selfHandle,
|
||||||
|
off: off,
|
||||||
|
parameters: parameters,
|
||||||
|
);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -52,6 +58,7 @@ class PiliScheme {
|
|||||||
Uri uri, {
|
Uri uri, {
|
||||||
bool selfHandle = false,
|
bool selfHandle = false,
|
||||||
bool off = false,
|
bool off = false,
|
||||||
|
Map? parameters,
|
||||||
}) async {
|
}) async {
|
||||||
final String scheme = uri.scheme;
|
final String scheme = uri.scheme;
|
||||||
final String host = uri.host.toLowerCase();
|
final String host = uri.host.toLowerCase();
|
||||||
@@ -342,7 +349,12 @@ class PiliScheme {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case 'http' || 'https':
|
case 'http' || 'https':
|
||||||
return await _fullPathPush(uri, selfHandle: selfHandle, off: off);
|
return await _fullPathPush(
|
||||||
|
uri,
|
||||||
|
selfHandle: selfHandle,
|
||||||
|
off: off,
|
||||||
|
parameters: parameters,
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
String? aid = RegExp(r'^av(\d+)', caseSensitive: false)
|
String? aid = RegExp(r'^av(\d+)', caseSensitive: false)
|
||||||
.firstMatch(path)
|
.firstMatch(path)
|
||||||
@@ -370,6 +382,7 @@ class PiliScheme {
|
|||||||
Uri uri, {
|
Uri uri, {
|
||||||
bool selfHandle = false,
|
bool selfHandle = false,
|
||||||
bool off = false,
|
bool off = false,
|
||||||
|
Map? parameters,
|
||||||
}) async {
|
}) async {
|
||||||
// https://m.bilibili.com/bangumi/play/ss39708
|
// https://m.bilibili.com/bangumi/play/ss39708
|
||||||
// https | m.bilibili.com | /bangumi/play/ss39708
|
// https | m.bilibili.com | /bangumi/play/ss39708
|
||||||
@@ -384,7 +397,7 @@ class PiliScheme {
|
|||||||
|
|
||||||
void launchURL() {
|
void launchURL() {
|
||||||
if (selfHandle.not) {
|
if (selfHandle.not) {
|
||||||
_toWebview(uri.toString(), off);
|
_toWebview(uri.toString(), off, parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,10 +617,17 @@ class PiliScheme {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _toWebview(String url, bool off) {
|
static void _toWebview(
|
||||||
|
String url,
|
||||||
|
bool off,
|
||||||
|
Map? parameters,
|
||||||
|
) {
|
||||||
Utils.toDupNamed(
|
Utils.toDupNamed(
|
||||||
'/webview',
|
'/webview',
|
||||||
parameters: {'url': url},
|
parameters: {
|
||||||
|
'url': url,
|
||||||
|
if (parameters != null) ...parameters,
|
||||||
|
},
|
||||||
off: off,
|
off: off,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -803,7 +803,7 @@ class Utils {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
PiliScheme.routePushFromUrl(url);
|
PiliScheme.routePushFromUrl(url, parameters: parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user