summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
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();