mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-22 02:01:08 +07:00
added error handling for importing a native config
This commit is contained in:
@@ -103,15 +103,15 @@ bool ImportController::extractConfigFromData(QString data)
|
||||
switch (configFormat) {
|
||||
case ConfigTypes::OpenVpn: {
|
||||
m_config = extractOpenVpnConfig(config);
|
||||
return true;
|
||||
return m_config.empty() ? false : true;
|
||||
}
|
||||
case ConfigTypes::WireGuard: {
|
||||
m_config = extractWireGuardConfig(config);
|
||||
return true;
|
||||
return m_config.empty() ? false : true;
|
||||
}
|
||||
case ConfigTypes::Amnezia: {
|
||||
m_config = QJsonDocument::fromJson(config.toUtf8()).object();
|
||||
return true;
|
||||
return m_config.empty() ? false : true;
|
||||
}
|
||||
case ConfigTypes::Backup: {
|
||||
if (!m_serversModel->getServersCount()) {
|
||||
|
||||
@@ -77,8 +77,9 @@ PageType {
|
||||
text: qsTr("Continue")
|
||||
|
||||
clickedFunc: function() {
|
||||
ImportController.extractConfigFromData(textKey.textFieldText)
|
||||
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
|
||||
if (ImportController.extractConfigFromData(textKey.textFieldText)) {
|
||||
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user