Add proxy tag sanitization

This commit is contained in:
problematicconsumer
2023-10-05 22:48:11 +03:30
parent c96a1ebb20
commit ac670a58c3
3 changed files with 7 additions and 2 deletions

View File

@@ -1 +1 @@
core.version=0.4.1 core.version=0.5.0

View File

@@ -21,6 +21,8 @@ class OutboundGroup with _$OutboundGroup {
@freezed @freezed
class OutboundGroupItem with _$OutboundGroupItem { class OutboundGroupItem with _$OutboundGroupItem {
const OutboundGroupItem._();
@JsonSerializable(fieldRename: FieldRename.kebab) @JsonSerializable(fieldRename: FieldRename.kebab)
const factory OutboundGroupItem({ const factory OutboundGroupItem({
required String tag, required String tag,
@@ -28,6 +30,9 @@ class OutboundGroupItem with _$OutboundGroupItem {
required int urlTestDelay, required int urlTestDelay,
}) = _OutboundGroupItem; }) = _OutboundGroupItem;
String get sanitizedTag =>
tag.replaceFirst(RegExp(r"\§[^]*"), "").trimRight();
factory OutboundGroupItem.fromJson(Map<String, dynamic> json) => factory OutboundGroupItem.fromJson(Map<String, dynamic> json) =>
_$OutboundGroupItemFromJson(json); _$OutboundGroupItemFromJson(json);
} }

View File

@@ -21,7 +21,7 @@ class ProxyTile extends HookConsumerWidget {
return ListTile( return ListTile(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
title: Text( title: Text(
proxy.tag, proxy.sanitizedTag,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
leading: Padding( leading: Padding(