mirror of
https://github.com/outbackdingo/amnezia-client.git
synced 2026-01-27 02:18:09 +00:00
chore: fixed qr code with vpnkey processing
This commit is contained in:
@@ -155,9 +155,9 @@ bool ImportController::extractConfigFromData(QString data)
|
||||
if (m_configType == ConfigTypes::Invalid) {
|
||||
config.replace("vpn://", "");
|
||||
QByteArray ba = QByteArray::fromBase64(config.toUtf8(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
||||
QByteArray ba_uncompressed = qUncompress(ba);
|
||||
if (!ba_uncompressed.isEmpty()) {
|
||||
ba = ba_uncompressed;
|
||||
QByteArray baUncompressed = qUncompress(ba);
|
||||
if (!baUncompressed.isEmpty()) {
|
||||
ba = baUncompressed;
|
||||
}
|
||||
|
||||
config = ba;
|
||||
@@ -228,6 +228,21 @@ bool ImportController::extractConfigFromQr(const QByteArray &data)
|
||||
return true;
|
||||
}
|
||||
|
||||
m_configType = checkConfigFormat(data);
|
||||
if (m_configType == ConfigTypes::Invalid) {
|
||||
QByteArray ba = QByteArray::fromBase64(data, QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
||||
QByteArray baUncompressed = qUncompress(ba);
|
||||
|
||||
if (!baUncompressed.isEmpty()) {
|
||||
ba = baUncompressed;
|
||||
}
|
||||
|
||||
if (!ba.isEmpty()) {
|
||||
m_config = QJsonDocument::fromJson(ba).object();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user