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
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<String, dynamic> json) =>
_$OutboundGroupItemFromJson(json);
}

View File

@@ -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(