mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: 同步上游评论区点击容错更改
This commit is contained in:
@@ -286,7 +286,7 @@ class ReplyItem extends StatelessWidget {
|
|||||||
value['data'] != null &&
|
value['data'] != null &&
|
||||||
addReply != null)
|
addReply != null)
|
||||||
{
|
{
|
||||||
addReply!(value['data'])
|
addReply?.call(value['data'])
|
||||||
// replyControl.replies.add(value['data']),
|
// replyControl.replies.add(value['data']),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -537,8 +537,8 @@ InlineSpan buildContent(
|
|||||||
spanChilds.add(TextSpan(
|
spanChilds.add(TextSpan(
|
||||||
text: str,
|
text: str,
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap =
|
..onTap = () =>
|
||||||
() => replyReply(replyItem.root == 0 ? replyItem : fReplyItem)));
|
replyReply?.call(replyItem.root == 0 ? replyItem : fReplyItem)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分割文本并处理每个部分
|
// 分割文本并处理每个部分
|
||||||
@@ -649,6 +649,11 @@ InlineSpan buildContent(
|
|||||||
} else {
|
} else {
|
||||||
final String redirectUrl =
|
final String redirectUrl =
|
||||||
await UrlUtils.parseRedirectUrl(matchStr);
|
await UrlUtils.parseRedirectUrl(matchStr);
|
||||||
|
if (redirectUrl == matchStr) {
|
||||||
|
Clipboard.setData(ClipboardData(text: matchStr));
|
||||||
|
SmartDialog.showToast('地址可能有误');
|
||||||
|
return;
|
||||||
|
}
|
||||||
final String pathSegment = Uri.parse(redirectUrl).path;
|
final String pathSegment = Uri.parse(redirectUrl).path;
|
||||||
final String lastPathSegment =
|
final String lastPathSegment =
|
||||||
pathSegment.split('/').last;
|
pathSegment.split('/').last;
|
||||||
@@ -967,6 +972,7 @@ class MorePanel extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Color errorColor = Theme.of(context).colorScheme.error;
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -14,19 +14,23 @@ class UrlUtils {
|
|||||||
dio.options.validateStatus = (status) {
|
dio.options.validateStatus = (status) {
|
||||||
return status == 200 || status == 301 || status == 302;
|
return status == 200 || status == 301 || status == 302;
|
||||||
};
|
};
|
||||||
final response = await dio.get(url);
|
try {
|
||||||
if (response.statusCode == 302) {
|
final response = await dio.get(url);
|
||||||
redirectUrl = response.headers['location']?.first as String;
|
if (response.statusCode == 302) {
|
||||||
if (redirectUrl.endsWith('/')) {
|
redirectUrl = response.headers['location']?.first as String;
|
||||||
redirectUrl = redirectUrl.substring(0, redirectUrl.length - 1);
|
if (redirectUrl.endsWith('/')) {
|
||||||
}
|
redirectUrl = redirectUrl.substring(0, redirectUrl.length - 1);
|
||||||
} else {
|
}
|
||||||
if (url.endsWith('/')) {
|
} else {
|
||||||
url = url.substring(0, url.length - 1);
|
if (url.endsWith('/')) {
|
||||||
|
url = url.substring(0, url.length - 1);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
}
|
}
|
||||||
|
return redirectUrl;
|
||||||
|
} catch (err) {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
return redirectUrl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 匹配url路由跳转
|
// 匹配url路由跳转
|
||||||
|
|||||||
Reference in New Issue
Block a user