This commit is contained in:
rustdesk 2023-03-19 16:33:33 +08:00
parent e278a80e89
commit 83814e5842

View File

@ -1817,10 +1817,14 @@ class ServerConfig {
/// also see [encode]
/// throw when decoding failure
ServerConfig.decode(String msg) {
final input = msg.split('').reversed.join('');
final bytes = base64Decode(base64.normalize(input));
final json = jsonDecode(utf8.decode(bytes));
var json = {};
try {
json = jsonDecode(msg);
} catch (err) {
final input = msg.split('').reversed.join('');
final bytes = base64Decode(base64.normalize(input));
json = jsonDecode(utf8.decode(bytes));
}
idServer = json['host'] ?? '';
relayServer = json['relay'] ?? '';
apiServer = json['api'] ?? '';