mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: reply jump
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -720,6 +720,9 @@ class ReplyItem extends StatelessWidget {
|
||||
// ?.call(replyItem.root == 0 ? replyItem : fReplyItem)))));
|
||||
}
|
||||
|
||||
late final bool enableWordRe =
|
||||
GStorage.setting.get(SettingBoxKey.enableWordRe, defaultValue: false);
|
||||
|
||||
// 分割文本并处理每个部分
|
||||
message.splitMapJoin(
|
||||
pattern,
|
||||
@@ -808,8 +811,6 @@ class ReplyItem extends StatelessWidget {
|
||||
);
|
||||
} else {
|
||||
String appUrlSchema = '';
|
||||
final bool enableWordRe = GStorage.setting
|
||||
.get(SettingBoxKey.enableWordRe, defaultValue: false) as bool;
|
||||
if (content.jumpUrl[matchStr] != null &&
|
||||
!matchedStrs.contains(matchStr)) {
|
||||
appUrlSchema = content.jumpUrl[matchStr]['app_url_schema'];
|
||||
@@ -990,6 +991,11 @@ class ReplyItem extends StatelessWidget {
|
||||
if (unmatchedItems.isNotEmpty) {
|
||||
for (int i = 0; i < unmatchedItems.length; i++) {
|
||||
String patternStr = unmatchedItems[i];
|
||||
if (content.jumpUrl?[patternStr]?['extra']?['is_word_search'] ==
|
||||
true &&
|
||||
enableWordRe.not) {
|
||||
continue;
|
||||
}
|
||||
spanChildren.addAll(
|
||||
[
|
||||
if (content.jumpUrl[patternStr]?['prefix_icon'] != null) ...[
|
||||
@@ -1009,6 +1015,19 @@ class ReplyItem extends StatelessWidget {
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
String? cvid = RegExp(r'note-app/view\?cvid=(\d+)')
|
||||
.firstMatch(patternStr)
|
||||
?.group(1);
|
||||
if (cvid != null) {
|
||||
Get.toNamed('/htmlRender', parameters: {
|
||||
'url': 'https://www.bilibili.com/read/cv$cvid',
|
||||
'title': '',
|
||||
'id': 'cv$cvid',
|
||||
'dynamicType': 'read'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Utils.handleWebview(patternStr);
|
||||
},
|
||||
)
|
||||
|
||||
@@ -761,6 +761,9 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
// ?.call(replyItem.root == 0 ? replyItem : fReplyItem)))));
|
||||
}
|
||||
|
||||
late final bool enableWordRe =
|
||||
GStorage.setting.get(SettingBoxKey.enableWordRe, defaultValue: false);
|
||||
|
||||
// 分割文本并处理每个部分
|
||||
message.splitMapJoin(
|
||||
pattern,
|
||||
@@ -849,8 +852,6 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
);
|
||||
} else {
|
||||
String appUrlSchema = '';
|
||||
final bool enableWordRe = GStorage.setting
|
||||
.get(SettingBoxKey.enableWordRe, defaultValue: false) as bool;
|
||||
if (content.url[matchStr] != null &&
|
||||
!matchedStrs.contains(matchStr)) {
|
||||
appUrlSchema = content.url[matchStr]!.appUrlSchema;
|
||||
@@ -1030,6 +1031,10 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
if (unmatchedItems.isNotEmpty) {
|
||||
for (int i = 0; i < unmatchedItems.length; i++) {
|
||||
String patternStr = unmatchedItems[i];
|
||||
if (content.url[patternStr]?.extra.isWordSearch == true &&
|
||||
enableWordRe.not) {
|
||||
continue;
|
||||
}
|
||||
spanChildren.addAll(
|
||||
[
|
||||
if (content.url[patternStr]?.hasPrefixIcon() == true) ...[
|
||||
@@ -1048,6 +1053,19 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
String? cvid = RegExp(r'note-app/view\?cvid=(\d+)')
|
||||
.firstMatch(patternStr)
|
||||
?.group(1);
|
||||
if (cvid != null) {
|
||||
Get.toNamed('/htmlRender', parameters: {
|
||||
'url': 'https://www.bilibili.com/read/cv$cvid',
|
||||
'title': '',
|
||||
'id': 'cv$cvid',
|
||||
'dynamicType': 'read'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Utils.handleWebview(patternStr);
|
||||
},
|
||||
)
|
||||
|
||||
@@ -24,6 +24,9 @@ class UrlUtils {
|
||||
if (response.statusCode == 302 || response.statusCode == 301) {
|
||||
String? redirectUrl = response.headers['location']?.first;
|
||||
if (redirectUrl != null) {
|
||||
if (redirectUrl.startsWith('/')) {
|
||||
return url;
|
||||
}
|
||||
if (redirectUrl.endsWith('/')) {
|
||||
redirectUrl = redirectUrl.substring(0, redirectUrl.length - 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user