added getting the config from the cloud service

This commit is contained in:
vladimir.kuznetsov 2023-10-12 20:48:03 +05:00
parent 5c121ea48d
commit 25f8283edd
27 changed files with 399 additions and 139 deletions

View file

@ -108,7 +108,7 @@ set(HEADERS ${HEADERS}
${CMAKE_CURRENT_LIST_DIR}/core/errorstrings.h
${CMAKE_CURRENT_LIST_DIR}/core/scripts_registry.h
${CMAKE_CURRENT_LIST_DIR}/core/server_defs.h
${CMAKE_CURRENT_LIST_DIR}/core/servercontroller.h
${CMAKE_CURRENT_LIST_DIR}/core/controllers/serverController.h
${CMAKE_CURRENT_LIST_DIR}/protocols/protocols_defs.h
${CMAKE_CURRENT_LIST_DIR}/protocols/qml_register_protocols.h
${CMAKE_CURRENT_LIST_DIR}/ui/notificationhandler.h
@ -147,7 +147,7 @@ set(SOURCES ${SOURCES}
${CMAKE_CURRENT_LIST_DIR}/core/errorstrings.cpp
${CMAKE_CURRENT_LIST_DIR}/core/scripts_registry.cpp
${CMAKE_CURRENT_LIST_DIR}/core/server_defs.cpp
${CMAKE_CURRENT_LIST_DIR}/core/servercontroller.cpp
${CMAKE_CURRENT_LIST_DIR}/core/controllers/serverController.cpp
${CMAKE_CURRENT_LIST_DIR}/protocols/protocols_defs.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/notificationhandler.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/qautostart.cpp

View file

@ -139,7 +139,8 @@ void AmneziaApplication::init()
&ConnectionController::openConnection);
connect(m_notificationHandler.get(), &NotificationHandler::disconnectRequested, m_connectionController.get(),
&ConnectionController::closeConnection);
connect(this, &AmneziaApplication::translationsUpdated, m_notificationHandler.get(), &NotificationHandler::onTranslationsUpdated);
connect(this, &AmneziaApplication::translationsUpdated, m_notificationHandler.get(),
&NotificationHandler::onTranslationsUpdated);
m_engine->load(url);
m_systemController->setQmlRoot(m_engine->rootObjects().value(0));
@ -226,14 +227,13 @@ void AmneziaApplication::loadTranslator()
updateTranslator(locale);
}
void AmneziaApplication::updateTranslator(const QLocale &locale)
{
if (!m_translator->isEmpty()) {
QCoreApplication::removeTranslator(m_translator.get());
}
QString strFileName = QString(":/translations/amneziavpn")+QLatin1String("_")+locale.name()+".qm";
QString strFileName = QString(":/translations/amneziavpn") + QLatin1String("_") + locale.name() + ".qm";
if (m_translator->load(strFileName)) {
if (QCoreApplication::installTranslator(m_translator.get())) {
m_settings->setAppLanguage(locale);
@ -330,7 +330,8 @@ void AmneziaApplication::initControllers()
m_connectionController.reset(new ConnectionController(m_serversModel, m_containersModel, m_vpnConnection));
m_engine->rootContext()->setContextProperty("ConnectionController", m_connectionController.get());
connect(this, &AmneziaApplication::translationsUpdated, m_connectionController.get(), &ConnectionController::onTranslationsUpdated);
connect(this, &AmneziaApplication::translationsUpdated, m_connectionController.get(),
&ConnectionController::onTranslationsUpdated);
m_pageController.reset(new PageController(m_serversModel, m_settings));
m_engine->rootContext()->setContextProperty("PageController", m_pageController.get());
@ -361,4 +362,10 @@ void AmneziaApplication::initControllers()
m_systemController.reset(new SystemController(m_settings));
m_engine->rootContext()->setContextProperty("SystemController", m_systemController.get());
m_cloudController.reset(new CloudController(m_serversModel, m_containersModel));
m_engine->rootContext()->setContextProperty("CloudController", m_cloudController.get());
connect(m_cloudController.get(), &CloudController::serverConfigUpdated, this,
[this]() { m_containersModel->setCurrentlyProcessedServerIndex(m_serversModel->getDefaultServerIndex()); });
}

View file

@ -24,6 +24,7 @@
#include "ui/controllers/settingsController.h"
#include "ui/controllers/sitesController.h"
#include "ui/controllers/systemController.h"
#include "ui/controllers/cloudController.h"
#include "ui/models/containers_model.h"
#include "ui/models/languageModel.h"
#include "ui/models/protocols/cloakConfigModel.h"
@ -116,6 +117,7 @@ private:
QScopedPointer<SettingsController> m_settingsController;
QScopedPointer<SitesController> m_sitesController;
QScopedPointer<SystemController> m_systemController;
QScopedPointer<CloudController> m_cloudController;
};
#endif // AMNEZIA_APPLICATION_H

View file

@ -4,7 +4,7 @@
#include <QJsonObject>
#include <QJsonDocument>
#include "core/servercontroller.h"
#include "core/controllers/serverController.h"
#include "containers/containers_defs.h"
CloakConfigurator::CloakConfigurator(std::shared_ptr<Settings> settings, QObject *parent):

View file

@ -11,7 +11,7 @@
#include "containers/containers_defs.h"
#include "core/scripts_registry.h"
#include "core/server_defs.h"
#include "core/servercontroller.h"
#include "core/controllers/serverController.h"
#include "utilities.h"
Ikev2Configurator::Ikev2Configurator(std::shared_ptr<Settings> settings, QObject *parent)

View file

@ -16,7 +16,7 @@
#include "containers/containers_defs.h"
#include "core/scripts_registry.h"
#include "core/server_defs.h"
#include "core/servercontroller.h"
#include "core/controllers/serverController.h"
#include "settings.h"
#include "utilities.h"

View file

@ -32,9 +32,9 @@ public:
ErrorCode signCert(DockerContainer container,
const ServerCredentials &credentials, QString clientId);
private:
ConnectionData createCertRequest();
static ConnectionData createCertRequest();
private:
ConnectionData prepareOpenVpnConfig(const ServerCredentials &credentials,
DockerContainer container, ErrorCode *errorCode = nullptr);

View file

@ -5,7 +5,7 @@
#include <QJsonDocument>
#include "containers/containers_defs.h"
#include "core/servercontroller.h"
#include "core/controllers/serverController.h"
ShadowSocksConfigurator::ShadowSocksConfigurator(std::shared_ptr<Settings> settings, QObject *parent):
ConfiguratorBase(settings, parent)

View file

@ -15,7 +15,7 @@
#include "containers/containers_defs.h"
#include "core/scripts_registry.h"
#include "core/server_defs.h"
#include "core/servercontroller.h"
#include "core/controllers/serverController.h"
#include "settings.h"
#include "utilities.h"

View file

@ -54,7 +54,7 @@ QVector<amnezia::Proto> ContainerProps::protocolsForContainer(amnezia::DockerCon
case DockerContainer::ShadowSocks: return { Proto::OpenVpn, Proto::ShadowSocks };
case DockerContainer::Cloak: return { Proto::OpenVpn, Proto::ShadowSocks, Proto::Cloak };
case DockerContainer::Cloak: return { Proto::OpenVpn, /*Proto::ShadowSocks,*/ Proto::Cloak };
case DockerContainer::Ipsec: return { Proto::Ikev2 /*, Protocol::L2tp */ };

View file

@ -24,8 +24,8 @@
#include "containers/containers_defs.h"
#include "logger.h"
#include "scripts_registry.h"
#include "server_defs.h"
#include "core/scripts_registry.h"
#include "core/server_defs.h"
#include "settings.h"
#include "utilities.h"

View file

@ -5,8 +5,8 @@
#include <QObject>
#include "containers/containers_defs.h"
#include "defs.h"
#include "sshclient.h"
#include "core/defs.h"
#include "core/sshclient.h"
class Settings;
class VpnConfigurator;

View file

@ -58,7 +58,7 @@ QString errorString(ErrorCode code){
case (OpenVpnTapAdapterError): return QObject::tr("Can't setup OpenVPN TAP network adapter");
case (AddressPoolError): return QObject::tr("VPN pool error: no available addresses");
case (ImportInvalidConfigError): return QObject::tr("The config does not contain any containers and credentiaks for connecting to the server");
case (ImportInvalidConfigError): return QObject::tr("The config does not contain any containers and credentials for connecting to the server");
case(InternalError):
default:

View file

@ -214,7 +214,7 @@ ErrorCode OpenVpnProtocol::start()
m_openVpnProcess->setProgram(PermittedProcess::OpenVPN);
QStringList arguments({
"--config", configPath(), "--management", m_managementHost, QString::number(mgmtPort),
"--management-client" /*, "--log", vpnLogFileNamePath */
"--management-client" , "--log", "/Users/nethius/Documents/git/log"
});
m_openVpnProcess->setArguments(arguments);

View file

@ -67,7 +67,13 @@ namespace amnezia
constexpr char cloak[] = "cloak";
constexpr char sftp[] = "sftp";
}
constexpr char configVersion[] = "config_version";
constexpr char apiEdnpoint[] = "api_endpoint";
constexpr char serviceTypeId[] = "service_type_id";
constexpr char accessToken[] = "access_token";
constexpr char certificate[] = "certificate";
constexpr char publicKey[] = "public_key";
}
namespace protocols
{

View file

@ -23,44 +23,52 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CloudController</name>
<message>
<location filename="../ui/controllers/cloudController.cpp" line="102"/>
<source>Error when retrieving configuration from cloud server</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConnectionController</name>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="55"/>
<location filename="../ui/controllers/connectionController.cpp" line="38"/>
<source>VPN Protocols is not installed.
Please install VPN container at first</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="78"/>
<location filename="../ui/controllers/connectionController.cpp" line="62"/>
<source>Connection...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="83"/>
<location filename="../ui/controllers/connectionController.cpp" line="67"/>
<source>Connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="128"/>
<location filename="../ui/controllers/connectionController.cpp" line="112"/>
<source>Settings updated successfully, Reconnnection...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="92"/>
<location filename="../ui/controllers/connectionController.cpp" line="76"/>
<source>Reconnection...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.h" line="58"/>
<location filename="../ui/controllers/connectionController.cpp" line="97"/>
<location filename="../ui/controllers/connectionController.cpp" line="111"/>
<location filename="../ui/controllers/connectionController.cpp" line="117"/>
<location filename="../ui/controllers/connectionController.cpp" line="81"/>
<location filename="../ui/controllers/connectionController.cpp" line="95"/>
<location filename="../ui/controllers/connectionController.cpp" line="101"/>
<source>Connect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="102"/>
<location filename="../ui/controllers/connectionController.cpp" line="86"/>
<source>Disconnection...</source>
<translation type="unfinished"></translation>
</message>
@ -130,7 +138,7 @@
<context>
<name>ImportController</name>
<message>
<location filename="../ui/controllers/importController.cpp" line="384"/>
<location filename="../ui/controllers/importController.cpp" line="381"/>
<source>Scanned %1 of %2.</source>
<translation type="unfinished"></translation>
</message>
@ -139,50 +147,55 @@
<name>InstallController</name>
<message>
<location filename="../ui/controllers/installController.cpp" line="110"/>
<location filename="../ui/controllers/installController.cpp" line="162"/>
<location filename="../ui/controllers/installController.cpp" line="161"/>
<source>%1 installed successfully. </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="112"/>
<location filename="../ui/controllers/installController.cpp" line="164"/>
<location filename="../ui/controllers/installController.cpp" line="163"/>
<source>%1 is already installed on the server. </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="115"/>
<location filename="../ui/controllers/installController.cpp" line="183"/>
<source>
Added containers that were already installed on the server</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="182"/>
<source>
Already installed containers were found on the server. All installed containers have been added to the application</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="264"/>
<location filename="../ui/controllers/installController.cpp" line="263"/>
<source>Settings updated successfully</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="279"/>
<location filename="../ui/controllers/installController.cpp" line="278"/>
<source>Server &apos;%1&apos; was removed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="289"/>
<location filename="../ui/controllers/installController.cpp" line="288"/>
<source>All containers from server &apos;%1&apos; have been removed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="306"/>
<location filename="../ui/controllers/installController.cpp" line="305"/>
<source>%1 has been removed from the server &apos;%2&apos;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="452"/>
<location filename="../ui/controllers/installController.cpp" line="451"/>
<source>Please login as the user</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="479"/>
<location filename="../ui/controllers/installController.cpp" line="478"/>
<source>Server added successfully</source>
<translation type="unfinished"></translation>
</message>
@ -250,12 +263,12 @@ Already installed containers were found on the server. All installed containers
<context>
<name>PageHome</name>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="193"/>
<location filename="../ui/qml/Pages2/PageHome.qml" line="324"/>
<source>VPN protocol</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="238"/>
<location filename="../ui/qml/Pages2/PageHome.qml" line="370"/>
<source>Servers</source>
<translation type="unfinished"></translation>
</message>
@ -865,71 +878,76 @@ And if you don&apos;t like the app, all the more support it - the donation will
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="52"/>
<source>Allow application screenshots</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="72"/>
<source>Auto start</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="53"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="73"/>
<source>Launch the application every time </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="53"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="73"/>
<source> starts</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="73"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="93"/>
<source>Start minimized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="74"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="94"/>
<source>Launch application minimized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="91"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="111"/>
<source>Language</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="110"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="130"/>
<source>Logging</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="111"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="131"/>
<source>Enabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="111"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="131"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="124"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="144"/>
<source>Reset settings and remove all data from the application</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="128"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="148"/>
<source>Reset settings and remove all data from the application?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="129"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="149"/>
<source>All settings will be reset to default. All installed AmneziaVPN services will still remain on the server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="130"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="150"/>
<source>Continue</source>
<translation type="unfinished">Продолжить</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="131"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="151"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
@ -1525,17 +1543,17 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<context>
<name>PageSetupWizardEasy</name>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="66"/>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="67"/>
<source>What is the level of internet control in your region?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="136"/>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="137"/>
<source>Set up a VPN yourself</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="137"/>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="138"/>
<source>I want to choose a VPN protocol</source>
<translation type="unfinished"></translation>
</message>
@ -1545,7 +1563,7 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<translation type="unfinished">Продолжить</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="186"/>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="197"/>
<source>Set up later</source>
<translation type="unfinished"></translation>
</message>
@ -1765,13 +1783,17 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="306"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="222"/>
<source>File with accessing settings to </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="309"/>
<source>Connection to </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="222"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="307"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="310"/>
<source>File with connection settings to </source>
<translation type="unfinished"></translation>
</message>
@ -1801,23 +1823,19 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="248"/>
<source>Protocols</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="249"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="251"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="252"/>
<source>Protocol</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="340"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="341"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="343"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="344"/>
<source>Connection format</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="379"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="382"/>
<source>Share</source>
<translation type="unfinished"></translation>
</message>
@ -2264,7 +2282,7 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
</message>
<message>
<location filename="../core/errorstrings.cpp" line="61"/>
<source>The config does not contain any containers and credentiaks for connecting to the server</source>
<source>The config does not contain any containers and credentials for connecting to the server</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -2433,6 +2451,16 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<source>error 0x%1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/wireguard-tools/contrib/highlighter/gui/highlight.cpp" line="39"/>
<source>WireGuard Configuration Highlighter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/wireguard-tools/contrib/highlighter/gui/highlight.cpp" line="82"/>
<source>&amp;Randomize colors</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SelectLanguageDrawer</name>
@ -2459,22 +2487,22 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<context>
<name>SettingsController</name>
<message>
<location filename="../ui/controllers/settingsController.cpp" line="20"/>
<location filename="../ui/controllers/settingsController.cpp" line="25"/>
<source>Software version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/settingsController.cpp" line="117"/>
<location filename="../ui/controllers/settingsController.cpp" line="136"/>
<source>All settings have been reset to default values</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/settingsController.cpp" line="123"/>
<location filename="../ui/controllers/settingsController.cpp" line="142"/>
<source>Cached profiles cleared</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/settingsController.cpp" line="102"/>
<location filename="../ui/controllers/settingsController.cpp" line="121"/>
<source>Backup file is corrupted</source>
<translation type="unfinished"></translation>
</message>
@ -2504,7 +2532,7 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
</message>
<message>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="126"/>
<source>Show content</source>
<source>Show connection settings</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -2592,7 +2620,7 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<context>
<name>VpnConnection</name>
<message>
<location filename="../vpnconnection.cpp" line="405"/>
<location filename="../vpnconnection.cpp" line="403"/>
<source>Mbps</source>
<translation type="unfinished"></translation>
</message>

View file

@ -23,44 +23,52 @@
<translation type="unfinished">VPN已连接</translation>
</message>
</context>
<context>
<name>CloudController</name>
<message>
<location filename="../ui/controllers/cloudController.cpp" line="102"/>
<source>Error when retrieving configuration from cloud server</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConnectionController</name>
<message>
<location filename="../ui/controllers/connectionController.h" line="58"/>
<location filename="../ui/controllers/connectionController.cpp" line="97"/>
<location filename="../ui/controllers/connectionController.cpp" line="111"/>
<location filename="../ui/controllers/connectionController.cpp" line="117"/>
<location filename="../ui/controllers/connectionController.cpp" line="81"/>
<location filename="../ui/controllers/connectionController.cpp" line="95"/>
<location filename="../ui/controllers/connectionController.cpp" line="101"/>
<source>Connect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="55"/>
<location filename="../ui/controllers/connectionController.cpp" line="38"/>
<source>VPN Protocols is not installed.
Please install VPN container at first</source>
<translation type="unfinished">VPN协议</translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="78"/>
<location filename="../ui/controllers/connectionController.cpp" line="62"/>
<source>Connection...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="83"/>
<location filename="../ui/controllers/connectionController.cpp" line="67"/>
<source>Connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="92"/>
<location filename="../ui/controllers/connectionController.cpp" line="76"/>
<source>Reconnection...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="102"/>
<location filename="../ui/controllers/connectionController.cpp" line="86"/>
<source>Disconnection...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/connectionController.cpp" line="128"/>
<location filename="../ui/controllers/connectionController.cpp" line="112"/>
<source>Settings updated successfully, Reconnnection...</source>
<translation type="unfinished"></translation>
</message>
@ -130,7 +138,7 @@
<context>
<name>ImportController</name>
<message>
<location filename="../ui/controllers/importController.cpp" line="384"/>
<location filename="../ui/controllers/importController.cpp" line="381"/>
<source>Scanned %1 of %2.</source>
<translation type="unfinished"> %1 of %2.</translation>
</message>
@ -147,41 +155,46 @@
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="110"/>
<location filename="../ui/controllers/installController.cpp" line="162"/>
<location filename="../ui/controllers/installController.cpp" line="161"/>
<source>%1 installed successfully. </source>
<translation type="unfinished">%1 </translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="112"/>
<location filename="../ui/controllers/installController.cpp" line="164"/>
<location filename="../ui/controllers/installController.cpp" line="163"/>
<source>%1 is already installed on the server. </source>
<translation type="unfinished"> %1</translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="115"/>
<location filename="../ui/controllers/installController.cpp" line="183"/>
<source>
Added containers that were already installed on the server</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="182"/>
<source>
Already installed containers were found on the server. All installed containers have been added to the application</source>
<translation type="unfinished">
</translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="264"/>
<location filename="../ui/controllers/installController.cpp" line="263"/>
<source>Settings updated successfully</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="279"/>
<location filename="../ui/controllers/installController.cpp" line="278"/>
<source>Server &apos;%1&apos; was removed</source>
<translation type="unfinished"> &apos;%1&apos;</translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="289"/>
<location filename="../ui/controllers/installController.cpp" line="288"/>
<source>All containers from server &apos;%1&apos; have been removed</source>
<translation type="unfinished"> &apos;%1&apos; </translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="306"/>
<location filename="../ui/controllers/installController.cpp" line="305"/>
<source>%1 has been removed from the server &apos;%2&apos;</source>
<translation type="unfinished">%1 &apos;%2&apos; </translation>
</message>
@ -202,12 +215,12 @@ Already installed containers were found on the server. All installed containers
<translation type="obsolete"> </translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="452"/>
<location filename="../ui/controllers/installController.cpp" line="451"/>
<source>Please login as the user</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="479"/>
<location filename="../ui/controllers/installController.cpp" line="478"/>
<source>Server added successfully</source>
<translation type="unfinished"></translation>
</message>
@ -275,12 +288,12 @@ Already installed containers were found on the server. All installed containers
<context>
<name>PageHome</name>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="193"/>
<location filename="../ui/qml/Pages2/PageHome.qml" line="324"/>
<source>VPN protocol</source>
<translation type="unfinished">VPN协议</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="238"/>
<location filename="../ui/qml/Pages2/PageHome.qml" line="370"/>
<source>Servers</source>
<translation type="unfinished"></translation>
</message>
@ -892,71 +905,76 @@ And if you don&apos;t like the app, all the more support it - the donation will
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="52"/>
<source>Allow application screenshots</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="72"/>
<source>Auto start</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="53"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="73"/>
<source>Launch the application every time </source>
<translation type="unfinished"> </translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="53"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="73"/>
<source> starts</source>
<translation type="unfinished"> </translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="73"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="93"/>
<source>Start minimized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="74"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="94"/>
<source>Launch application minimized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="91"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="111"/>
<source>Language</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="110"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="130"/>
<source>Logging</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="111"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="131"/>
<source>Enabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="111"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="131"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="124"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="144"/>
<source>Reset settings and remove all data from the application</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="128"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="148"/>
<source>Reset settings and remove all data from the application?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="129"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="149"/>
<source>All settings will be reset to default. All installed AmneziaVPN services will still remain on the server.</source>
<translation type="unfinished">AmneziaVPN服务</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="130"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="150"/>
<source>Continue</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="131"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="151"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
@ -1561,17 +1579,17 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<context>
<name>PageSetupWizardEasy</name>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="66"/>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="67"/>
<source>What is the level of internet control in your region?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="136"/>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="137"/>
<source>Set up a VPN yourself</source>
<translation type="unfinished">VPN</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="137"/>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="138"/>
<source>I want to choose a VPN protocol</source>
<translation type="unfinished">VPN协议</translation>
</message>
@ -1581,7 +1599,7 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="186"/>
<location filename="../ui/qml/Pages2/PageSetupWizardEasy.qml" line="197"/>
<source>Set up later</source>
<translation type="unfinished"></translation>
</message>
@ -1827,33 +1845,37 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="222"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="307"/>
<source>File with accessing settings to </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="310"/>
<source>File with connection settings to </source>
<translation type="unfinished">:</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="248"/>
<source>Protocols</source>
<translation type="unfinished"></translation>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="249"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="251"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="252"/>
<source>Protocol</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="306"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="309"/>
<source>Connection to </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="340"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="341"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="343"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="344"/>
<source>Connection format</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="379"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="382"/>
<source>Share</source>
<translation type="unfinished"></translation>
</message>
@ -2305,8 +2327,12 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
</message>
<message>
<location filename="../core/errorstrings.cpp" line="61"/>
<source>The config does not contain any containers and credentials for connecting to the server</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The config does not contain any containers and credentiaks for connecting to the server</source>
<translation type="unfinished"></translation>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../core/errorstrings.cpp" line="65"/>
@ -2469,6 +2495,16 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<source>error 0x%1: %2</source>
<translation type="unfinished"> 0x%1: %2</translation>
</message>
<message>
<location filename="../3rd/wireguard-tools/contrib/highlighter/gui/highlight.cpp" line="39"/>
<source>WireGuard Configuration Highlighter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/wireguard-tools/contrib/highlighter/gui/highlight.cpp" line="82"/>
<source>&amp;Randomize colors</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SelectLanguageDrawer</name>
@ -2495,22 +2531,22 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<context>
<name>SettingsController</name>
<message>
<location filename="../ui/controllers/settingsController.cpp" line="20"/>
<location filename="../ui/controllers/settingsController.cpp" line="25"/>
<source>Software version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/settingsController.cpp" line="102"/>
<location filename="../ui/controllers/settingsController.cpp" line="121"/>
<source>Backup file is corrupted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/settingsController.cpp" line="117"/>
<location filename="../ui/controllers/settingsController.cpp" line="136"/>
<source>All settings have been reset to default values</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/controllers/settingsController.cpp" line="123"/>
<location filename="../ui/controllers/settingsController.cpp" line="142"/>
<source>Cached profiles cleared</source>
<translation type="unfinished"></translation>
</message>
@ -2540,8 +2576,12 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
</message>
<message>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="126"/>
<source>Show connection settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show content</source>
<translation type="unfinished"></translation>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="250"/>
@ -2628,7 +2668,7 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<context>
<name>VpnConnection</name>
<message>
<location filename="../vpnconnection.cpp" line="405"/>
<location filename="../vpnconnection.cpp" line="403"/>
<source>Mbps</source>
<translation type="unfinished"></translation>
</message>

View file

@ -0,0 +1,109 @@
#include "cloudController.h"
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QEventLoop>
#include "configurators/openvpn_configurator.h"
CloudController::CloudController(const QSharedPointer<ServersModel> &serversModel,
const QSharedPointer<ContainersModel> &containersModel, QObject *parent)
: QObject(parent), m_serversModel(serversModel), m_containersModel(containersModel)
{
}
QString CloudController::genPublicKey(ServiceTypeId serviceTypeId)
{
switch (serviceTypeId)
{
case ServiceTypeId::AmneziaFreeRuWG: return ".";
case ServiceTypeId::AmneziaFreeRuCloak: return ".";
case ServiceTypeId::AmneziaFreeRuAWG: return ".";
case ServiceTypeId::AmneziaFreeRuReverseWG: return ".";
case ServiceTypeId::AmneziaFreeRuReverseCloak: return ".";
case ServiceTypeId::AmneziaFreeRuReverseAWG: return ".";
}
}
QString CloudController::genCertificateRequest(ServiceTypeId serviceTypeId)
{
switch (serviceTypeId)
{
case ServiceTypeId::AmneziaFreeRuWG: return "";
case ServiceTypeId::AmneziaFreeRuCloak: {
auto data = OpenVpnConfigurator::createCertRequest();
return data.request;
}
case ServiceTypeId::AmneziaFreeRuAWG: return "";
case ServiceTypeId::AmneziaFreeRuReverseWG: return "";
case ServiceTypeId::AmneziaFreeRuReverseCloak: return "";
case ServiceTypeId::AmneziaFreeRuReverseAWG: return "";
}
}
bool CloudController::updateServerConfigFromCloud()
{
auto serverConfig = m_serversModel->getDefaultServerConfig();
auto containerConfig = serverConfig.value(config_key::containers).toArray();
if (serverConfig.value(config_key::configVersion).toInt() && containerConfig.isEmpty()) {
QNetworkAccessManager manager;
QNetworkRequest request;
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QString endpoint = serverConfig.value(config_key::apiEdnpoint).toString();
request.setUrl(endpoint.replace("https", "http")); //
ServiceTypeId serviceTypeId = static_cast<ServiceTypeId>(serverConfig.value(config_key::serviceTypeId).toInt());
QJsonObject obj;
obj[config_key::serviceTypeId] = serviceTypeId;
obj[config_key::accessToken] = serverConfig.value(config_key::accessToken);
obj[config_key::publicKey] = genPublicKey(serviceTypeId);
obj[config_key::certificate] = genCertificateRequest(serviceTypeId);
QByteArray requestBody = QJsonDocument(obj).toJson();
QScopedPointer<QNetworkReply> reply;
reply.reset(manager.post(request, requestBody));
QEventLoop wait;
QObject::connect(reply.get(), &QNetworkReply::finished, &wait, &QEventLoop::quit);
wait.exec();
if(reply->error() == QNetworkReply::NoError){
QString contents = QString::fromUtf8(reply->readAll());
auto data = QJsonDocument::fromJson(contents.toUtf8()).object().value(config_key::config).toString();
data.replace("vpn://", "");
QByteArray ba = QByteArray::fromBase64(data.toUtf8(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
QByteArray ba_uncompressed = qUncompress(ba);
if (!ba_uncompressed.isEmpty()) {
ba = ba_uncompressed;
}
QJsonObject cloudConfig = QJsonDocument::fromJson(ba).object();
serverConfig.insert("cloudConfig", cloudConfig);
serverConfig.insert(config_key::dns1, cloudConfig.value(config_key::dns1));
serverConfig.insert(config_key::dns2, cloudConfig.value(config_key::dns2));
serverConfig.insert(config_key::containers, cloudConfig.value(config_key::containers));
serverConfig.insert(config_key::hostName, cloudConfig.value(config_key::hostName));
serverConfig.insert(config_key::defaultContainer, cloudConfig.value(config_key::defaultContainer));
m_serversModel->editServer(serverConfig);
emit serverConfigUpdated();
} else{
QString err = reply->errorString();
qDebug() << reply->error();
qDebug() << err;
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
emit errorOccurred(tr("Error when retrieving configuration from cloud server"));
return false;
}
}
return true;
}

View file

@ -0,0 +1,43 @@
#ifndef CLOUDCONTROLLER_H
#define CLOUDCONTROLLER_H
#include <QObject>
#include "ui/models/containers_model.h"
#include "ui/models/servers_model.h"
class CloudController : public QObject
{
Q_OBJECT
enum ServiceTypeId
{
AmneziaFreeRuWG = 0,
AmneziaFreeRuCloak,
AmneziaFreeRuAWG,
AmneziaFreeRuReverseWG,
AmneziaFreeRuReverseCloak,
AmneziaFreeRuReverseAWG
};
public:
explicit CloudController(const QSharedPointer<ServersModel> &serversModel,
const QSharedPointer<ContainersModel> &containersModel, QObject *parent = nullptr);
public slots:
bool updateServerConfigFromCloud();
signals:
void errorOccurred(const QString &errorMessage);
void serverConfigUpdated();
private:
QString genPublicKey(ServiceTypeId serviceTypeId);
QString genCertificateRequest(ServiceTypeId serviceTypeId);
QSharedPointer<ServersModel> m_serversModel;
QSharedPointer<ContainersModel> m_containersModel;
};
#endif // CLOUDCONTROLLER_H

View file

@ -40,6 +40,7 @@ void ConnectionController::openConnection()
}
qApp->processEvents();
emit connectToVpn(serverIndex, credentials, container, containerConfig);
}

View file

@ -141,7 +141,9 @@ void ImportController::importConfig()
credentials.userName = m_config.value(config_key::userName).toString();
credentials.secretData = m_config.value(config_key::password).toString();
if (credentials.isValid() || m_config.contains(config_key::containers)) {
if (credentials.isValid()
|| m_config.contains(config_key::containers)
|| m_config.contains(config_key::configVersion)) { // todo
m_serversModel->addServer(m_config);
m_serversModel->setDefaultServerIndex(m_serversModel->getServersCount() - 1);
@ -167,7 +169,11 @@ QJsonObject ImportController::extractAmneziaConfig(QString &data)
ba = ba_uncompressed;
}
return QJsonDocument::fromJson(ba).object();
QJsonObject config = QJsonDocument::fromJson(ba).object();
qDebug() << config;
return config;
}
QJsonObject ImportController::extractOpenVpnConfig(const QString &data)

View file

@ -7,7 +7,7 @@
#include <QStandardPaths>
#include "core/errorstrings.h"
#include "core/servercontroller.h"
#include "core/controllers/serverController.h"
#include "utilities.h"
namespace

View file

@ -1,6 +1,6 @@
#include "containers_model.h"
#include "core/servercontroller.h"
#include "core/controllers/serverController.h"
ContainersModel::ContainersModel(std::shared_ptr<Settings> settings, QObject *parent)
: m_settings(settings), QAbstractListModel(parent)

View file

@ -168,6 +168,14 @@ void ServersModel::addServer(const QJsonObject &server)
endResetModel();
}
void ServersModel::editServer(const QJsonObject &server)
{
beginResetModel();
m_settings->editServer(m_currentlyProcessedServerIndex, server);
m_servers = m_settings->serversArray();
endResetModel();
}
void ServersModel::removeServer()
{
beginResetModel();
@ -219,3 +227,8 @@ ServerCredentials ServersModel::serverCredentials(int index) const
return credentials;
}
QJsonObject ServersModel::getDefaultServerConfig()
{
return m_servers.at(m_defaultServerIndex).toObject();
}

View file

@ -55,10 +55,13 @@ public slots:
QString getCurrentlyProcessedServerHostName();
void addServer(const QJsonObject &server);
void editServer(const QJsonObject &server);
void removeServer();
bool isDefaultServerConfigContainsAmneziaDns();
QJsonObject getDefaultServerConfig();
protected:
QHash<int, QByteArray> roleNames() const override;

View file

@ -138,6 +138,10 @@ Button {
}
onClicked: {
if (!CloudController.updateServerConfigFromCloud()) {
return
}
if (!ContainersModel.isAnyContainerInstalled()) {
PageController.setTriggeredBtConnectButton(true)

View file

@ -10,7 +10,7 @@
#include <configurators/shadowsocks_configurator.h>
#include <configurators/vpn_configurator.h>
#include <configurators/wireguard_configurator.h>
#include <core/servercontroller.h>
#include "core/controllers/serverController.h"
#ifdef AMNEZIA_DESKTOP
#include "core/ipcclient.h"
@ -258,9 +258,7 @@ QJsonObject VpnConnection::createVpnConfiguration(int serverIndex, const ServerC
for (ProtocolEnumNS::Proto proto : ContainerProps::protocolsForContainer(container)) {
QJsonObject vpnConfigData =
QJsonDocument::fromJson(createVpnConfigurationForProto(serverIndex, credentials, container,
containerConfig, proto, errorCode)
.toUtf8())
.object();
containerConfig, proto, errorCode).toUtf8()).object();
if (errorCode && *errorCode) {
return {};