Unverified Commit 26092db4 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[ui] give feedback about gateway selection

-Resolves: #524
parent 0d1d4116
{
"default": "floatdemo",
"default": "riseup",
"providers": [
{
"name": "floatdemo",
"applicationName": "FloatDemoVPN",
"binaryName": "floatdemo-vpn",
"name": "Riseup",
"applicationName": "RiseupVPN",
"binaryName": "riseup-vpn",
"auth": "anon",
"authEmptyPass": false,
"providerURL": "float.bitmask.net",
"tosURL": "https://float.bitmask.net/",
"helpURL": "https://float.bitmask.net/",
"providerURL": "riseup.net",
"tosURL": "https://riseup.net/tos",
"helpURL": "https://riseup.net/support",
"askForDonations": true,
"donateURL": "",
"apiURL": "https://api.float.bitmask.net:4430/",
"geolocationAPI": "https://menshen.float.bitmask.net/json",
"caCertString": "-----BEGIN CERTIFICATE-----\nMIIBQjCB6aADAgECAgEBMAoGCCqGSM49BAMCMBcxFTATBgNVBAMTDExFQVAgUm9v\ndCBDQTAeFw0yMTA0MDYxODIzMzVaFw0yNjA0MDYxODI4MzVaMBcxFTATBgNVBAMT\nDExFQVAgUm9vdCBDQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLiY2PRd7sct\n/d0qy0EHjP+MLA+bUOV2RjMErxZrQfok9bMAFFLza9dg0LTbsdLjved1f7ezraa1\nyTYD3i2NncWjJjAkMA4GA1UdDwEB/wQEAwICpDASBgNVHRMBAf8ECDAGAQH/AgEB\nMAoGCCqGSM49BAMCA0gAMEUCIEq2RG2egV566bOFzAL68qoOTVA3+58YYssn+Jrg\nadPSAiEAkYbYV5JLlA54lXy6XlZEmCCcVb7u/Domsk9smMQzWq4=\n-----END CERTIFICATE-----",
"timeStamp": "2021-07-07 19:38:08"
"donateURL": "https://riseup.net/vpn/donate",
"apiURL": "https://api.black.riseup.net/",
"geolocationAPI": "https://api.black.riseup.net:9001/json",
"caCertString": "-----BEGIN CERTIFICATE-----\nMIIFjTCCA3WgAwIBAgIBATANBgkqhkiG9w0BAQ0FADBZMRgwFgYD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K4AGliaet5KkcgwDgYDVR0PAQH/BAQDAgIEMAwGA1UdEwQFMAMBAf8wHwYD\nVR0jBBgwFoAUC4tdmLVuf9hwfK4AGliaet5KkcgwDQYJKoZIhvcNAQENBQADggIB\nAGzL+GRnYu99zFoy0bXJKOGCF5XUXP/3gIXPRDqQf5g7Cu/jYMID9dB3No4Zmf7v\nqHjiSXiS8jx1j/6/Luk6PpFbT7QYm4QLs1f4BlfZOti2KE8r7KRDPIecUsUXW6P/\n3GJAVYH/+7OjA39za9AieM7+H5BELGccGrM5wfl7JeEz8in+V2ZWDzHQO4hMkiTQ\n4ZckuaL201F68YpiItBNnJ9N5nHr1MRiGyApHmLXY/wvlrOpclh95qn+lG6/2jk7\n3AmihLOKYMlPwPakJg4PYczm3icFLgTpjV5sq2md9bRyAg3oPGfAuWHmKj2Ikqch\nTd5CHKGxEEWbGUWEMP0s1A/JHWiCbDigc4Cfxhy56CWG4q0tYtnc2GMw8OAUO6Wf\nXu5pYKNkzKSEtT/MrNJt44tTZWbKV/Pi/N2Fx36my7TgTUj7g3xcE9eF4JV2H/sg\ntsK3pwE0FEqGnT4qMFbixQmc8bGyuakr23wjMvfO7eZUxBuWYR2SkcP26sozF9PF\ntGhbZHQVGZUTVPyvwahMUEhbPGVerOW0IYpxkm0x/eaWdTc4vPpf/rIlgbAjarnJ\nUN9SaWRlWKSdP4haujnzCoJbM7dU9bjvlGZNyXEekgeT0W2qFeGGp+yyUWw8tNsp\n0BuC1b7uW/bBn/xKm319wXVDvBgZgcktMolak39V7DVO\n-----END CERTIFICATE-----",
"timeStamp": "2021-07-09 20:10:58"
}
]
}
\ No newline at end of file
......@@ -5,27 +5,10 @@ import QtQuick.Controls 2.4
SwitchDelegate {
//id: vpntoggle
text: qsTr("")
checked: false
anchors.horizontalCenter: parent.horizontalCenter
/*
Connections {
function onCheckedChanged() {
if (vpntoggle.checked == true
&& ctx.status == "off") {
backend.switchOn()
}
if (vpntoggle.checked === false
&& ctx.status == "on") {
backend.switchOff()
}
}
}
*/
contentItem: Text {
rightPadding: vpntoggle.indicator.width + vpntoggle.spacing
text: vpntoggle.text
......
......@@ -24,6 +24,7 @@ StateGroup {
PropertyChanges {
target: vpntoggle
checked: false
checkable: true
}
PropertyChanges {
target: statusItem
......@@ -65,6 +66,7 @@ StateGroup {
PropertyChanges {
target: vpntoggle
checked: true
checkable: true
}
PropertyChanges {
target: statusItem
......@@ -122,6 +124,11 @@ StateGroup {
target: mainCurrentGateway
text: ""
}
PropertyChanges {
target: vpntoggle
checked: true
checkable: false
}
},
State {
name: "stopping"
......@@ -147,6 +154,11 @@ StateGroup {
target: mainCurrentGateway
text: ""
}
PropertyChanges {
target: vpntoggle
checked: false
checkable: false
}
},
State {
name: "failed"
......@@ -172,6 +184,11 @@ StateGroup {
target: mainCurrentGateway
text: ""
}
PropertyChanges {
target: vpntoggle
checked: false
checkable: true
}
}
]
}
......@@ -88,10 +88,12 @@ ApplicationWindow {
if (vpntoggle.checked == true
&& ctx.status == "off") {
backend.switchOn()
vpntoggle.checkable = false
}
if (vpntoggle.checked === false
&& ctx.status == "on") {
backend.switchOff()
vpntoggle.checkable = false
}
}
}
......@@ -114,6 +116,7 @@ ApplicationWindow {
anchors.centerIn: parent
spacing: 10
//width: parent.width
RadioButton {
id: autoSelectionButton
......@@ -124,12 +127,14 @@ ApplicationWindow {
manualSelectionItem.checked = false
}
}
RadioButton {
id: manualSelectionButton
checked: isManualLocation()
text: qsTr("Manual")
onClicked: setGwSelection()
}
ComboBox {
id: gwSelector
editable: false
......@@ -139,6 +144,12 @@ ApplicationWindow {
model: [qsTr("Recommended")]
onActivated: {
console.debug("Selected gateway:", currentText)
if (ctx.status == "off") {
gwNextConnectionText.visible = true
}
if (ctx.status == "on") {
gwReconnectText.visible = true
}
backend.useLocation(currentText.toString())
manualSelectionItem.checked = true
}
......@@ -170,7 +181,31 @@ ApplicationWindow {
color: "#000000"
}
}
}
Text {
id: gwReconnectText
anchors.horizontalCenter: parent.horizontalCenter
width: 180
font.pixelSize: 12
color: "green"
wrapMode: Text.WordWrap
text: qsTr("Reconnecting to the selected gateway…")
visible: false
}
Text {
id: gwNextConnectionText
anchors.horizontalCenter: parent.horizontalCenter
width: 180
font.pixelSize: 12
color: "green"
wrapMode: Text.WordWrap
text: qsTr("This gateway will be used for next connection.")
visible: false
}
} // end column
} // end item
......@@ -214,6 +249,11 @@ ApplicationWindow {
if (ctx.donateURL) {
donateItem.visible = true
}
if (ctx.status == "on") {
gwNextConnectionText.visible = false
gwReconnectText.visible = false
}
}
}
......
......@@ -121,6 +121,7 @@ func (b *Bitmask) listenShapeErr() {
func (b *Bitmask) startOpenVPN() error {
arg := []string{}
b.statusCh <- Starting
if b.GetTransport() == "obfs4" {
gateways, err := b.bonafide.GetGateways("obfs4")
if err != nil {
......@@ -251,8 +252,9 @@ func (b *Bitmask) Reconnect() error {
if err != nil {
return err
}
log.Println("reconnect")
log.Println("DEBUG Reconnecting")
if status != Off {
b.statusCh <- Stopping
if b.shapes != nil {
b.shapes.Close()
b.shapes = nil
......@@ -264,6 +266,7 @@ func (b *Bitmask) Reconnect() error {
}
err = b.launch.firewallStop()
// FIXME - there's a window in which we might leak traffic here!
if err != nil {
return err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment