mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
fixed native wireguard config import if there is no port in the Endpoint field
This commit is contained in:
@@ -225,12 +225,17 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data)
|
||||
QJsonObject lastConfig;
|
||||
lastConfig[config_key::config] = data;
|
||||
|
||||
const static QRegularExpression hostNameAndPortRegExp("Endpoint = (.*):([0-9]*)");
|
||||
const static QRegularExpression hostNameAndPortRegExp("Endpoint = (.*)(?::([0-9]*))?");
|
||||
QRegularExpressionMatch hostNameAndPortMatch = hostNameAndPortRegExp.match(data);
|
||||
QString hostName;
|
||||
QString port;
|
||||
if (hostNameAndPortMatch.hasMatch()) {
|
||||
if (hostNameAndPortMatch.hasCaptured(1)) {
|
||||
hostName = hostNameAndPortMatch.captured(1);
|
||||
} /*else {
|
||||
qDebug() << "send error?"
|
||||
}*/
|
||||
|
||||
if (hostNameAndPortMatch.hasCaptured(2)) {
|
||||
port = hostNameAndPortMatch.captured(2);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,10 @@ PageController::PageController(const QSharedPointer<ServersModel> &serversModel,
|
||||
});
|
||||
#endif
|
||||
|
||||
#if defined Q_OS_MACX
|
||||
connect(this, &PageController::raiseMainWindow, []() { setDockIconVisible(true); });
|
||||
connect(this, &PageController::hideMainWindow, []() { setDockIconVisible(false); });
|
||||
#endif
|
||||
}
|
||||
|
||||
QString PageController::getInitialPage()
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include "fileUtilites.h"
|
||||
#include "utilities.h"
|
||||
|
||||
SitesController::SitesController(const std::shared_ptr<Settings> &settings,
|
||||
const QSharedPointer<VpnConnection> &vpnConnection,
|
||||
|
||||
Reference in New Issue
Block a user