fix: handle ID copying separately and remove whitelist logs

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2026-07-26 20:08:22 +08:00
parent 003b9d507a
commit ce3ed5f93a
3 changed files with 10 additions and 6 deletions

View File

@@ -3124,6 +3124,15 @@ void onCopyFingerprint(String value) {
}
}
void onCopyId(String value) {
if (value.isNotEmpty) {
Clipboard.setData(ClipboardData(text: value));
showToast('$value\n${translate("Copied")}');
} else {
showToast(translate("Invalid ID"));
}
}
Future<bool> callMainCheckSuperUserPermission() async {
bool checked = await bind.mainCheckSuperUserPermission();
if (isMacOS) {

View File

@@ -352,9 +352,6 @@ void changeIdWhiteList({Function()? callback}) async {
msg = "";
isInProgress = true;
});
debugPrint(
'[id-whitelist] raw=${controller.text.replaceAll(' ', '').replaceAll('\n', r'\n')}',
);
newIdWhiteListField = controller.text.trim();
var newIdWhiteList = "";
if (newIdWhiteListField.isEmpty) {
@@ -365,7 +362,6 @@ void changeIdWhiteList({Function()? callback}) async {
.split(RegExp(r"[\s,;\n]+"))
.where((e) => e.isNotEmpty)
.toList();
debugPrint('[id-whitelist] ids=$ids');
// test id, wildcards '*' and '?' are allowed;
// '@' '.' ':' '/' '[' ']' occur in cross-server IDs and WebSocket URIs
final idMatch = RegExp(r"^[a-zA-Z0-9_*?@.:/\[\]-]+$");
@@ -383,7 +379,6 @@ void changeIdWhiteList({Function()? callback}) async {
if (newIdWhiteList.trim().isEmpty) {
newIdWhiteList = defaultOptionWhitelist;
}
debugPrint('[id-whitelist] normalized=$newIdWhiteList');
await bind.mainSetOption(
key: kOptionIdWhitelist, value: newIdWhiteList);
callback?.call();

View File

@@ -1015,7 +1015,7 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
),
leading: Icon(Icons.fingerprint)),
SettingsTile(
onPressed: (context) => onCopyFingerprint(_myId),
onPressed: (context) => onCopyId(_myId),
title: Text(translate("ID")),
value: Padding(
padding: EdgeInsets.symmetric(vertical: 8),