diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/api.md | 6 | ||||
-rw-r--r-- | gui/backend.go | 5 | ||||
-rw-r--r-- | gui/components/Preferences.qml | 63 | ||||
-rw-r--r-- | gui/gui.qrc | 1 | ||||
-rw-r--r-- | gui/handlers.cpp | 5 | ||||
-rw-r--r-- | gui/handlers.h | 1 |
6 files changed, 66 insertions, 15 deletions
diff --git a/gui/api.md b/gui/api.md new file mode 100644 index 0000000..eb11ec6 --- /dev/null +++ b/gui/api.md @@ -0,0 +1,6 @@ +# how to add an action to the api + +1. declare it in `handlers.h` +2. define it in `handlers.cpp` +3. export it in `backend.go` +4. move to `pkg/backend/api.go` and implement what's needed from there diff --git a/gui/backend.go b/gui/backend.go index 5c07cda..516ef4a 100644 --- a/gui/backend.go +++ b/gui/backend.go @@ -58,6 +58,11 @@ func SetUDP(udp bool) { backend.SetUDP(udp) } +//export SetSnowflake +func SetSnowflake(snowflake bool) { + backend.SetSnowflake(snowflake) +} + //export Quit func Quit() { backend.Quit() diff --git a/gui/components/Preferences.qml b/gui/components/Preferences.qml index f205358..fcd742f 100644 --- a/gui/components/Preferences.qml +++ b/gui/components/Preferences.qml @@ -91,10 +91,23 @@ ThemedPage { } } + Label { + text: qsTr("Traffic is obfuscated to bypass blocks.") + font.family: "Monospace" + color: "gray" + visible: true + wrapMode: Text.Wrap + font.pixelSize: Theme.fontSize - 4 + Layout.leftMargin: 35 + Layout.rightMargin: 15 + Layout.bottomMargin: 5 + Layout.preferredWidth: 240 + } + MaterialCheckBox { id: useSnowflake - //wrapMode: Label.Wrap - text: qsTr("Use Snowflake (experimental)") + //wrapMode: Text.Wrap + text: qsTr("Use Snowflake bootstrap") enabled: false checked: false HoverHandler { @@ -102,6 +115,23 @@ ThemedPage { } Layout.leftMargin: 10 Layout.rightMargin: 10 + Layout.preferredWidth: 240 + onClicked: { + doUseSnowflake(checked) + } + } + + Label { + text: qsTr("Snowflake needs Tor installed in your system.") + font.family: "Monospace" + color: "gray" + visible: true + wrapMode: Text.Wrap + font.pixelSize: Theme.fontSize - 4 + Layout.leftMargin: 35 + Layout.rightMargin: 15 + Layout.bottomMargin: 5 + Layout.preferredWidth: 240 } Label { @@ -109,10 +139,11 @@ ThemedPage { font.bold: true Layout.leftMargin: 10 Layout.rightMargin: 10 + Layout.topMargin: 8 } Label { - text: qsTr("UDP can make the VPN faster, but it might be blocked on certain networks") + text: qsTr("UDP can make the VPN faster. It might be blocked on certain networks.") width: parent.width color: "gray" visible: true @@ -200,22 +231,18 @@ ThemedPage { function useBridges(value) { if (value == true) { - console.debug("use obfs4") backend.setTransport("obfs4") } else { - console.debug("use regular") backend.setTransport("openvpn") } } function doUseUDP(value) { - if (value == true) { - console.debug("use udp") - backend.setUDP(true) - } else { - console.debug("use tcp") - backend.setUDP(false) - } + backend.setUDP(value) + } + + function doUseSnowflake(value) { + backend.setSnowflake(value) } function getBoxHeight() { @@ -226,11 +253,17 @@ ThemedPage { if (ctx && ctx.transport == "obfs4") { useBridgesCheckBox.checked = true } - if (ctx && ctx.udp == "true") { - useUDP.checked = true - } if (ctx && ctx.offersUdp == "false") { useUDP.enabled = false } + if (ctx && ctx.offersUdp && ctx.udp == "true") { + useUDP.checked = true + } + if (ctx && ctx.hasTor == "true") { + useSnowflake.enabled = true + } + if (ctx && ctx.hasTor && ctx.snowflake == "true") { + useSnowflake.checked = true + } } } diff --git a/gui/gui.qrc b/gui/gui.qrc index b32c708..c36f5c5 100644 --- a/gui/gui.qrc +++ b/gui/gui.qrc @@ -34,6 +34,7 @@ <file>components/VPNState.qml</file> <file>components/InitErrors.qml</file> <file>components/ErrorBox.qml</file> + <file>components/MotdBox.qml</file> <!-- resources, assets --> <file>resources/icon-noshield.svg</file> diff --git a/gui/handlers.cpp b/gui/handlers.cpp index b1d060b..4f855ef 100644 --- a/gui/handlers.cpp +++ b/gui/handlers.cpp @@ -62,6 +62,11 @@ void Backend::setUDP(bool udp) SetUDP(udp); } +void Backend::setSnowflake(bool snowflake) +{ + SetSnowflake(snowflake); +} + QString Backend::getTransport() { return QString(GetTransport()); diff --git a/gui/handlers.h b/gui/handlers.h index 55dd32d..82678c0 100644 --- a/gui/handlers.h +++ b/gui/handlers.h @@ -40,6 +40,7 @@ public slots: void useAutomaticGateway(); void setTransport(QString transport); void setUDP(bool udp); + void setSnowflake(bool snowflake); QString getTransport(); void login(QString username, QString password); void resetError(QString errlabel); |