Skip to content

Commit

Permalink
fixed native wireguard config import if there is no port in the Endpo…
Browse files Browse the repository at this point in the history
…int field
  • Loading branch information
Nethius committed Aug 25, 2023
1 parent 259eff3 commit 3f7e7f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/ui/controllers/importController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 2 additions & 0 deletions client/ui/controllers/pageController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions client/ui/controllers/sitesController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QStandardPaths>

#include "fileUtilites.h"
#include "utilities.h"

SitesController::SitesController(const std::shared_ptr<Settings> &settings,
const QSharedPointer<VpnConnection> &vpnConnection,
Expand Down

0 comments on commit 3f7e7f2

Please sign in to comment.