Compare commits
17 commits
d5a1ea2aca
...
daab2379e4
| Author | SHA1 | Date | |
|---|---|---|---|
| daab2379e4 | |||
| 779c298fc4 | |||
| 2cee873419 | |||
| c3ebe842ca | |||
| 07982c28eb | |||
| 326728c706 | |||
| 48740715a2 | |||
| f0850487fc | |||
| 215bd39601 | |||
| 40e1e18a7f | |||
| 09d53b02da | |||
| f20837ada9 | |||
| 4c172e9c8a | |||
| 79e33eccc0 | |||
| 37613a6ca5 | |||
| 5be38df67e | |||
| ac1669f990 |
2 changed files with 7 additions and 2 deletions
|
|
@ -12,6 +12,7 @@ PluginComponent {
|
||||||
|
|
||||||
property bool isConnected: false
|
property bool isConnected: false
|
||||||
property string tailscaleIP: ""
|
property string tailscaleIP: ""
|
||||||
|
property string _pendingToggleAction: ""
|
||||||
property string currentExitNode: ""
|
property string currentExitNode: ""
|
||||||
property var peers: []
|
property var peers: []
|
||||||
property string cachedClipboardTool: ""
|
property string cachedClipboardTool: ""
|
||||||
|
|
@ -41,10 +42,11 @@ PluginComponent {
|
||||||
|
|
||||||
onExited: (code, status) => {
|
onExited: (code, status) => {
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
var action = root.isConnected ? "disconnect" : "connect"
|
var action = root._pendingToggleAction || (root.isConnected ? "disconnect" : "connect")
|
||||||
var detail = toggleProcess.stderr.text.trim().slice(0, 120)
|
var detail = toggleProcess.stderr.text.trim().slice(0, 120)
|
||||||
ToastService.showError("tailscalectl", TailscaleLib.errorMessage(action) + (detail ? " — " + detail : ""))
|
ToastService.showError("tailscalectl", TailscaleLib.errorMessage(action) + (detail ? " — " + detail : ""))
|
||||||
}
|
}
|
||||||
|
root._pendingToggleAction = ""
|
||||||
statusCheck.running = true
|
statusCheck.running = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -112,11 +114,14 @@ PluginComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleTailscale() {
|
function toggleTailscale() {
|
||||||
|
if (toggleProcess.running) return
|
||||||
|
root._pendingToggleAction = root.isConnected ? "disconnect" : "connect"
|
||||||
toggleProcess.command = TailscaleLib.buildToggleCommand(root.isConnected)
|
toggleProcess.command = TailscaleLib.buildToggleCommand(root.isConnected)
|
||||||
toggleProcess.running = true
|
toggleProcess.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function setExitNode(hostname) {
|
function setExitNode(hostname) {
|
||||||
|
if (exitNodeProcess.running) return
|
||||||
exitNodeProcess.command = TailscaleLib.makeExitNodeCommand(hostname)
|
exitNodeProcess.command = TailscaleLib.makeExitNodeCommand(hostname)
|
||||||
exitNodeProcess.running = true
|
exitNodeProcess.running = true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,5 @@
|
||||||
"icon": "vpn_key",
|
"icon": "vpn_key",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
"component": "./TailscaleWidget.qml",
|
"component": "./TailscaleWidget.qml",
|
||||||
"permissions": ["settings_read", "settings_write", "process"]
|
"permissions": ["process"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue