From ac670a58c313a3eaf874aaa14beeb85697d86a56 Mon Sep 17 00:00:00 2001 From: problematicconsumer Date: Thu, 5 Oct 2023 22:48:11 +0330 Subject: [PATCH] Add proxy tag sanitization --- dependencies.properties | 2 +- lib/domain/singbox/outbounds.dart | 5 +++++ lib/features/proxies/widgets/proxy_tile.dart | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dependencies.properties b/dependencies.properties index 631acaac..9bc4ec32 100644 --- a/dependencies.properties +++ b/dependencies.properties @@ -1 +1 @@ -core.version=0.4.1 \ No newline at end of file +core.version=0.5.0 \ No newline at end of file diff --git a/lib/domain/singbox/outbounds.dart b/lib/domain/singbox/outbounds.dart index f934ab7e..a9871256 100644 --- a/lib/domain/singbox/outbounds.dart +++ b/lib/domain/singbox/outbounds.dart @@ -21,6 +21,8 @@ class OutboundGroup with _$OutboundGroup { @freezed class OutboundGroupItem with _$OutboundGroupItem { + const OutboundGroupItem._(); + @JsonSerializable(fieldRename: FieldRename.kebab) const factory OutboundGroupItem({ required String tag, @@ -28,6 +30,9 @@ class OutboundGroupItem with _$OutboundGroupItem { required int urlTestDelay, }) = _OutboundGroupItem; + String get sanitizedTag => + tag.replaceFirst(RegExp(r"\ยง[^]*"), "").trimRight(); + factory OutboundGroupItem.fromJson(Map json) => _$OutboundGroupItemFromJson(json); } diff --git a/lib/features/proxies/widgets/proxy_tile.dart b/lib/features/proxies/widgets/proxy_tile.dart index 251038be..e4ed134a 100644 --- a/lib/features/proxies/widgets/proxy_tile.dart +++ b/lib/features/proxies/widgets/proxy_tile.dart @@ -21,7 +21,7 @@ class ProxyTile extends HookConsumerWidget { return ListTile( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), title: Text( - proxy.tag, + proxy.sanitizedTag, overflow: TextOverflow.ellipsis, ), leading: Padding(