Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions plugins/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,13 @@
{
"id": "vpn",
"name": "VPN",
"version": "2.0.0",
"version": "2.1.0",
"path": "plugins/vpn",
"author": "neur0map <hello@ryoku.dev>",
"upstream": "https://github.com/ryoku-dev/ryostore/tree/main/plugins/vpn",
"discord": "https://discord.gg/8KjBmUEyKA",
"summary": "Watch and switch your VPN from the bar: a Tailscale switch with the tunnel's dossier, and your NetworkManager VPN and WireGuard profiles,...",
"description": "Watch and switch your VPN from the bar: a Tailscale switch with the tunnel's dossier, and your NetworkManager VPN and WireGuard profiles, in a bar panel or a desktop card.",
"summary": "Watch and switch your VPN from the bar: a Tailscale switch with the tunnel's dossier, an exit-node picker with automatic route acceptance...",
"description": "Watch and switch your VPN from the bar: a Tailscale switch with the tunnel's dossier, an exit-node picker with automatic route acceptance and a clean-restart that flushes stale routing tables, plus your NetworkManager VPN and WireGuard profiles, in a bar panel or a desktop card.",
"tags": [
"vpn",
"network",
Expand All @@ -440,15 +440,15 @@
"assets/preview-desktop.png"
],
"manifest": "product-manifest.json",
"manifestSha256": "5493894e33ace5e10fd4dd4db0007e9b1a666178cee5927d106d8011e758b80c",
"manifestSha256": "ae187e9406784006fcfebbe00e0d0f23bfbf283d27839ab57b5910f195293eff",
"official": false,
"tagline": "Watch and switch your VPN from the bar: a Tailscale switch with the tunnel's dossier, and your NetworkManager VPN and WireGuard profiles,...",
"tagline": "Watch and switch your VPN from the bar: a Tailscale switch with the tunnel's dossier, an exit-node picker with automatic route acceptance...",
"icon": "vpn_lock",
"hosts": [
"topbarGlyph",
"desktopWidget"
],
"lastUpdated": "2026-09-02"
"lastUpdated": "2026-12-01"
},
{
"id": "public-ip",
Expand Down
150 changes: 65 additions & 85 deletions plugins/vpn/README.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,78 @@
# VPN

A community plugin for the [Ryoku](https://ryoku.dev) desktop. It watches your
VPN and lets you switch it from the top bar (a single mark that opens a panel) or
from a card on the wallpaper. It knows two backends and shows whichever you have.
Watch and switch your VPN from the Ryoku bar. A Tailscale switch with the
tunnel's dossier, an **exit-node picker**, **automatic acceptance of advertised
routes**, and a **clean restart** that flushes stale routing tables — plus your
NetworkManager VPN and WireGuard profiles. Available as a bar panel
(`topbarGlyph`) or a desktop card (`desktopWidget`).

## Features

### Tailscale
- One-tap **turn on / off**, with the tunnel dossier: device, MagicDNS name,
IPv4/IPv6 (copy the IP), tailnet, relay, peer count, version, and any health
warnings Tailscale reports.
- **Exit-node picker** *(new in 2.1.0)* — when connected, every peer that
advertises itself as an exit node is listed; tap **USE** to route all traffic
through it (`tailscale set --exit-node=<ip> --exit-node-allow-lan-access`). The
active node is marked **IN USE**; **STOP USING** clears it.
- **Accept advertised routes automatically** *(new in 2.1.0)* — when the
*Accept advertised subnet routes automatically* setting is on (default), a
subnet route another node announces is honoured by adding `--accept-routes` on
turn-on and when an exit node is picked.
- **Clean restart** *(new in 2.1.0)* — the **CLEAN RESTART** button (two-tap
confirm) clears the exit node, brings Tailscale down, then restarts the
`tailscaled` daemon so the policy-routing table and the `ts-*` firewall chains
are torn down and rebuilt from scratch, leaving no stale route behind after a
killed session. The daemon restart goes through the edition-agnostic
`ryoku-host` init seam.
- **Operator gate** — if Tailscale refuses a switch for want of an operator, the
panel offers a one-time **AUTHORISE** that sets the current user as operator so
later switches need no password.

### NetworkManager
- Lists your VPN and WireGuard profiles (never a `tun` device or an
externally-managed connection); turn each on/off by UUID, with per-active
address, gateway and DNS.

![VPN widget on the bar](assets/preview-widget.png)
![VPN card on the desktop](assets/preview-desktop.png)
## Settings

## What it does
| Key | Type | Default | What it does |
|---|---|---|---|
| `poll` | int (3–60) | 10 | Refresh cadence in seconds. |
| `barLabel` | choice | `name` | What rides beside the bar mark: nothing, the connection name, or the IPv4. |
| `confirmOff` | toggle | on | Ask before turning off an exit-node tunnel. |
| `acceptRoutes` | toggle | on | Accept advertised subnet routes automatically. |

- **On the bar** it rides as one Material mark, `vpn_lock` in the accent when a
tunnel is up and `vpn_key_off` in the dim ink when none is, with the
connection name or IP beside it. A left click opens the plugin's bar panel; the
mark itself never changes the network.
- **The panel** (and the desktop card) show the tunnel's details and the switches
that turn it on or off.
## What it runs, reads and writes

### Backends
- **Reads** VPN state by running `tailscale status --json` and
`nmcli -t … connection/device show`. No files are read or written outside the
plugin's own state.
- **Writes** only Tailscale/NetworkManager preferences, and only on an explicit
tap: `tailscale up|down|set`, `nmcli connection up|down`.

**Tailscale** (when the `tailscale` command is present). The panel shows a switch
and the dossier: device (host name), name (MagicDNS name), IPv4 (with a COPY
button), IPv6, tailnet, exit node (with STOP USING when one is active), relay,
peers online/total, and version, plus any health warnings Tailscale reports. An
ADMIN CONSOLE button opens your machines page.
### Capabilities

**NetworkManager**. Every VPN and WireGuard profile NetworkManager knows, each
with a switch; an active profile also shows its device, IPv4 and gateway.
- **network**: `login.tailscale.com` — opening the admin console
(`xdg-open`), on the **ADMIN CONSOLE** tap only.
- **privileged** (via `pkexec`, on an explicit tap only, polkit asks once):
- `pkexec tailscale set --operator` — the one-time operator authorisation.
- `pkexec ryoku-host svc --system restart tailscaled` — the clean-restart
daemon flush, routed through the `ryoku-host` init seam so it works on any
Ryoku edition (systemd, dinit, …).

## Settings
### Dependencies

| Key | Type | Default | What it does |
|---|---|---|---|
| `poll` | int (3..60) | `10` | Seconds between refreshes. |
| `barLabel` | choice `none`/`name`/`ip` | `name` | What rides beside the bar mark. |
| `confirmOff` | toggle | `true` | Ask before turning off a VPN that is using an exit node. |

Turning off an exit-node Tailscale tunnel arms once (`TURN OFF? traffic leaves
the exit node`) and only acts on the second tap, so you never drop your exit node
by accident. The arm clears after three seconds.

## What it runs

Every external command, and exactly when:

| Command | When |
|---|---|
| `tailscale status --json` | on load, every `poll` seconds, and 1 s after any action (also the probe that decides Tailscale is installed) |
| `tailscale up` | the switch, turning Tailscale on |
| `tailscale down` | the switch, turning Tailscale off |
| `tailscale set --exit-node=` | the exit node's STOP USING button |
| `pkexec tailscale set --operator=<user>` | the panel's AUTHORISE button only (see below) |
| `nmcli -t -f NAME,UUID,TYPE,DEVICE,STATE connection show` | on load and every `poll` seconds |
| `nmcli -t -f IP4.ADDRESS,IP6.ADDRESS,IP4.GATEWAY,IP4.DNS device show <device>` | for each active profile after a poll |
| `nmcli connection up\|down uuid <uuid>` | a NetworkManager profile's switch |
| `wl-copy <ip>` | the IPv4 COPY button |
| `xdg-open https://login.tailscale.com/admin/machines` | the ADMIN CONSOLE button |

`<user>` is `$USER` from the shell's environment.

## What it never does

- **It never touches a `tun` device through `nmcli`, and never a connection
NetworkManager reports as external or unmanaged.** Those are other software's
tunnels (a Tailscale `tun`, a container link, a VPN a different tool brought
up); switching them off from here would fight whatever owns them, so the
NetworkManager backend only ever lists and toggles real `vpn` and `wireguard`
profiles.
- **No mutation ever happens on a bar-mark click.** The mark only opens the
panel; every up/down/stop is a deliberate button in the panel or the card.

## The operator note

Tailscale only lets its *operator* change its state without root. On a machine
where no operator is set, `tailscale up` (and the other switches) fail with
`Access denied: prefs write access denied`. When that happens the panel shows an
AUTHORISE button that runs `pkexec tailscale set --operator=<user>` once: polkit
asks for your password, sets you as the operator, and the action you tried is
retried automatically. After that, the switches work without a prompt. This is
the plugin's only privileged command, it runs only on that explicit click, and
it is declared in the manifest's `capabilities.privileged`.

## Requirements

- **Tailscale** (`tailscale` on `PATH`) for the Tailscale backend, and/or
**NetworkManager** (`nmcli`) for the NetworkManager backend. The plugin shows
whichever it finds; with neither, the panel says so.
- `wl-copy` (wl-clipboard) for the COPY button and `xdg-open` for ADMIN CONSOLE.

## Where it lists

This is a community plugin (`official: false`), so it appears under **QS Bar
Settings > Community** with the store's community warning, its author, its switch
and its settings.
`tailscale`, `nmcli`, `wl-copy`, `xdg-open`, and `ryoku-host` (the platform init
seam, used for the clean restart) with a `tailscaled` service.

## Credits

Created and maintained by **neur0map** `<hello@ryoku.dev>`.
Exit-node picker, automatic route acceptance and clean-restart (2.1.0)
contributed by **Jarek Armengol** ([@Glitchboi-sudo](https://github.com/Glitchboi-sudo)).

## License

MIT (c) neur0map. See [LICENSE](LICENSE).
MIT.
Binary file modified plugins/vpn/assets/preview-widget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 76 additions & 1 deletion plugins/vpn/content/Panel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ Item {
// arm state for the confirm-off flow
property bool armed: false
Timer { id: disarm; interval: 3000; repeat: false; onTriggered: tsCard.armed = false }
// arm state for the clean-restart flow (privileged, disruptive)
property bool resetArmed: false
Timer { id: resetDisarm; interval: 3000; repeat: false; onTriggered: tsCard.resetArmed = false }

Eyebrow { label: "Tailscale"; s: root.s }

Expand Down Expand Up @@ -236,6 +239,48 @@ Item {
InfoRow { s: root.s; label: qsTr("Version"); value: root.ts ? root.ts.version : "" }
}

// ── exit-node picker ──────────────────────────────────────────
// The peers that advertise themselves as exit nodes; tap USE to route
// through one (accepting advertised routes when that setting is on).
Column {
width: parent.width
spacing: 6 * root.s
visible: root.ts && root.ts.up && root.ts.exitNodes.length > 0

Divider {}
Eyebrow { label: "Exit nodes"; s: root.s }

Repeater {
model: root.ts ? root.ts.exitNodes : []
delegate: Item {
id: exrow
required property var modelData
width: parent ? parent.width : 0
height: 24 * root.s
Text {
anchors.left: parent.left
anchors.right: exBtn.left
anchors.rightMargin: 8 * root.s
anchors.verticalCenter: parent.verticalCenter
text: exrow.modelData.name
color: exrow.modelData.active ? Theme.accent : Theme.cream
font.family: Theme.font
font.pixelSize: 11.5 * root.s
font.weight: exrow.modelData.active ? Font.DemiBold : Font.Normal
elide: Text.ElideRight
}
Btn {
id: exBtn
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
enabledAction: !exrow.modelData.active
label: exrow.modelData.active ? qsTr("IN USE") : qsTr("USE")
onTapped: if (root.ts) root.ts.useExitNode(exrow.modelData.addr)
}
}
}
}

// health warnings, when tailscale reports any
Column {
width: parent.width
Expand Down Expand Up @@ -274,7 +319,8 @@ Item {

Divider {}

// footer
// footer: admin console + a clean restart that flushes the routing
// tables (clears the exit node, downs Tailscale, restarts the daemon).
Item {
width: parent.width
height: 24 * root.s
Expand All @@ -284,6 +330,35 @@ Item {
label: qsTr("ADMIN CONSOLE")
onTapped: if (root.ts) root.ts.openAdmin()
}
Btn {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
strong: tsCard.resetArmed
label: tsCard.resetArmed ? qsTr("CONFIRM RESET") : qsTr("CLEAN RESTART")
onTapped: {
if (!root.ts) return;
if (!tsCard.resetArmed) {
tsCard.resetArmed = true;
resetDisarm.restart();
} else {
tsCard.resetArmed = false;
resetDisarm.stop();
root.ts.resetClean();
}
}
}
}

// what the clean restart will do, shown only while armed
Text {
width: parent.width
visible: tsCard.resetArmed
text: qsTr("CONFIRM? downs Tailscale and restarts the daemon to clear stale routes (asks for your password)")
color: Theme.gold
font.family: Theme.mono
font.pixelSize: 9.5 * root.s
font.letterSpacing: 0.6 * root.s
wrapMode: Text.WordWrap
}
}

Expand Down
14 changes: 11 additions & 3 deletions plugins/vpn/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"id": "vpn",
"name": "VPN",
"version": "2.0.0",
"version": "2.1.0",
"author": "neur0map <hello@ryoku.dev>",
"description": "Watch and switch your VPN from the bar: a Tailscale switch with the tunnel's dossier, and your NetworkManager VPN and WireGuard profiles, in a bar panel or a desktop card.",
"description": "Watch and switch your VPN from the bar: a Tailscale switch with the tunnel's dossier, an exit-node picker with automatic route acceptance and a clean-restart that flushes stale routing tables, plus your NetworkManager VPN and WireGuard profiles, in a bar panel or a desktop card.",
"license": "MIT",
"official": false,
"tags": [
Expand Down Expand Up @@ -37,7 +37,8 @@
"login.tailscale.com"
],
"privileged": [
"pkexec tailscale set --operator"
"pkexec tailscale set --operator",
"pkexec ryoku-host svc --system restart tailscaled"
]
},
"hosts": [
Expand Down Expand Up @@ -89,6 +90,13 @@
"label": "Ask before turning off an exit-node VPN",
"group": "VPN",
"default": true
},
{
"key": "acceptRoutes",
"type": "toggle",
"label": "Accept advertised subnet routes automatically",
"group": "VPN",
"default": true
}
]
}
Expand Down
Loading