summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-08-11 22:38:13 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-08-11 22:38:13 +0200
commit5ba62c56b2a94b9f5ae06b150713f84d5a3144fa (patch)
tree5f572c3a06dbd91a144efb63a4dba55535fdd65a /gui
parent33b9ba9abadb8cea8f5840bb11fb9de489b120e3 (diff)
[refactor] simplify, make port optional
Diffstat (limited to 'gui')
-rw-r--r--gui/backend.go4
-rw-r--r--gui/main.cpp11
2 files changed, 11 insertions, 4 deletions
diff --git a/gui/backend.go b/gui/backend.go
index 875706d..af29ec6 100644
--- a/gui/backend.go
+++ b/gui/backend.go
@@ -67,8 +67,8 @@ func InitializeTestBitmaskContext() {
}
//export EnableWebAPI
-func EnableWebAPI() {
- backend.EnableWebAPI()
+func EnableWebAPI(port string) {
+ backend.EnableWebAPI(port)
}
//export RefreshContext
diff --git a/gui/main.cpp b/gui/main.cpp
index 6d01d49..2a300e2 100644
--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -69,7 +69,7 @@ int main(int argc, char **argv) {
{"w", "web-api"},
QApplication::translate(
"main",
- "Enable web api (on port 8080)."),
+ "Enable web api."),
},
{
{"i", "install-helpers"},
@@ -78,11 +78,14 @@ int main(int argc, char **argv) {
"Install helpers (linux only, requires sudo)."),
},
});
+ QCommandLineOption webPortOption("web-port", QApplication::translate("main", "Web api port (default: 8080)"), "port", "8080");
+ parser.addOption(webPortOption);
parser.process(app);
bool hideSystray = parser.isSet("no-systray");
bool installHelpers = parser.isSet("install-helpers");
bool webAPI = parser.isSet("web-api");
+ QString webPort = parser.value("web-port");
if (hideSystray) {
qDebug() << "Not showing systray icon because --no-systray option is set.";
@@ -140,7 +143,11 @@ int main(int argc, char **argv) {
InitializeBitmaskContext();
/* if requested, enable web api for controlling the VPN */
- if (webAPI) { EnableWebAPI(); };
+ if (webAPI) {
+ char* wp = webPort.toLocal8Bit().data();
+ GoString p = {wp, (long int)strlen(wp)};
+ EnableWebAPI(p);
+ };
/* kick off your shoes, put your feet up */
return app.exec();