summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2021-05-31 02:34:21 +0200
committerkali kaneko (leap communications) <kali@leap.se>2021-06-01 12:34:07 +0200
commit3fdbb895b8372caa080044cade00f2de6b00ce91 (patch)
treed7415f43414a42135ed7dde190a1d66cf2501acc /gui
parent00be891d3b0cb401e642a5331aedcc399641b8ef (diff)
[feat] obfs4 selectable from gui
Diffstat (limited to 'gui')
-rw-r--r--gui/backend.go6
-rw-r--r--gui/handlers.cpp4
-rw-r--r--gui/handlers.h2
-rw-r--r--gui/qml/BridgesItem.qml9
-rw-r--r--gui/qml/main.qml8
5 files changed, 21 insertions, 8 deletions
diff --git a/gui/backend.go b/gui/backend.go
index 38f40a8..04d1293 100644
--- a/gui/backend.go
+++ b/gui/backend.go
@@ -43,9 +43,9 @@ func UseAutomaticGateway() {
backend.UseAutomaticGateway()
}
-//export UseTransport
-func UseTransport(transport string) {
- backend.UseTransport(transport)
+//export SetTransport
+func SetTransport(transport string) {
+ backend.SetTransport(string(transport))
}
//export GetTransport
diff --git a/gui/handlers.cpp b/gui/handlers.cpp
index cec43ca..29fecf1 100644
--- a/gui/handlers.cpp
+++ b/gui/handlers.cpp
@@ -52,9 +52,9 @@ void Backend::useAutomaticGateway()
UseAutomaticGateway();
}
-void Backend::useTransport(QString transport)
+void Backend::setTransport(QString transport)
{
- UseTransport(toGoStr(transport));
+ SetTransport(toGoStr(transport));
}
QString Backend::getTransport()
diff --git a/gui/handlers.h b/gui/handlers.h
index 9c11b60..a3812c5 100644
--- a/gui/handlers.h
+++ b/gui/handlers.h
@@ -38,7 +38,7 @@ public slots:
void donateSeen();
void useLocation(QString username);
void useAutomaticGateway();
- void useTransport(QString transport);
+ void setTransport(QString transport);
QString getTransport();
void login(QString username, QString password);
void resetError(QString errlabel);
diff --git a/gui/qml/BridgesItem.qml b/gui/qml/BridgesItem.qml
index 1cf152c..1343403 100644
--- a/gui/qml/BridgesItem.qml
+++ b/gui/qml/BridgesItem.qml
@@ -9,6 +9,8 @@ Item {
anchors.centerIn: parent
width: parent.width
property alias displayReconnect: bridgeReconnect.visible
+ // TODO get obfs4Available from backend, in case provider doesn't have it
+ visible: true
Column {
@@ -26,11 +28,13 @@ Item {
if (checked) {
Logic.setNeedsReconnect(true);
bridgeReconnect.visible = true;
+ app.useBridges(true);
} else {
// This would also need a "needs reconnect" for de-selecting bridges the next time.
// better to wait and see the new connection widgets though
Logic.setNeedsReconnect(false);
bridgeReconnect.visible = false;
+ app.useBridges(false);
}
}
}
@@ -42,6 +46,7 @@ Item {
text: qsTr("Select a bridge only if you know that you need it to evade censorship in your country or local network.")
anchors.horizontalCenter: parent.horizontalCenter
wrapMode: Text.WordWrap
+ visible: !bridgeReconnect.visible
}
Text {
@@ -49,10 +54,10 @@ Item {
width: 250
font.pixelSize: 12
color: "red"
- text: qsTr("We will attempt to connect to a bridge the next time you connect to the VPN.")
+ text: qsTr("An obfs4 bridge will be used the next time you connect to the VPN.")
anchors.horizontalCenter: parent.horizontalCenter
wrapMode: Text.WordWrap
- visible: false;
+ visible: false
}
}
}
diff --git a/gui/qml/main.qml b/gui/qml/main.qml
index f75a121..cef3344 100644
--- a/gui/qml/main.qml
+++ b/gui/qml/main.qml
@@ -507,6 +507,14 @@ ApplicationWindow {
return ctx.currentLocation + ", " + ctx.currentCountry
}
+ function useBridges(value) {
+ if (value==true) {
+ backend.setTransport("obfs4")
+ } else {
+ backend.setTransport("openvpn")
+ }
+ }
+
property alias brReconnect:bridgesTab.displayReconnect
}