Skip to content

Port to Plasma 6 and switch to the local zerotier-one API - #5

Open
Hafikan wants to merge 2 commits into
Duoslow:masterfrom
Hafikan:plasma6-local-api
Open

Port to Plasma 6 and switch to the local zerotier-one API#5
Hafikan wants to merge 2 commits into
Duoslow:masterfrom
Hafikan:plasma6-local-api

Conversation

@Hafikan

@Hafikan Hafikan commented Aug 5, 2026

Copy link
Copy Markdown

Zerotier Central's API needs an account token that is not available on the free plan, so the widget now talks to the local zerotier-one service on localhost:9993 instead. That trades the full membership roster of a network for what this machine actually sees: the networks it joined and the peers it is talking to, with latency and direct/relayed state.

A peer's address on the virtual network -- the one you connect to -- is not in the local API, since it is the controller that hands it out. It is recovered instead by deriving each peer's MAC from the network id and node id, then looking that up in the interface's neighbour table.

The port itself: metadata.json, PlasmoidItem, Kirigami units and theme, PlasmaExtras.Representation with a PlasmoidHeading, and KCM.SimpleKCM config pages. Emoji status markers became theme-coloured dots, the panel icon is now a symbolic SVG that follows the panel colour, and the separate network selector window is gone -- networks are picked inline in the settings.

Fixes carried over from the old Central code:

  • Stale replies landing after a clear() duplicated the list; requests now carry a generation and late ones are dropped.
  • With no token configured, a retry timer restarted itself every 5s forever. Reloads are driven by configuration changes instead.
  • The online count summed the server's onlineMemberCount on every reply, so it grew without bound and disagreed with the list next to it.
  • ConfigGeneral declared cfg_zerotierToken twice and used string literals as ids, and its network selector window was parented to an undefined id.
  • Removing a network from the selection used a regex over the comma separated list and could leave stray commas behind.

Note for anyone debugging this: Qt 6 blocks local file reads over XMLHttpRequest unless QML_XHR_ALLOW_FILE_READ=1 is set, and it fails silently -- the request never completes and no error is raised. The auth token is read through the executable data engine because of it.

Hafikan added 2 commits August 5, 2026 17:04
Zerotier Central's API needs an account token that is not available on the
free plan, so the widget now talks to the local zerotier-one service on
localhost:9993 instead. That trades the full membership roster of a network
for what this machine actually sees: the networks it joined and the peers it
is talking to, with latency and direct/relayed state.

A peer's address on the virtual network -- the one you connect to -- is not
in the local API, since it is the controller that hands it out. It is
recovered instead by deriving each peer's MAC from the network id and node
id, then looking that up in the interface's neighbour table.

The port itself: metadata.json, PlasmoidItem, Kirigami units and theme,
PlasmaExtras.Representation with a PlasmoidHeading, and KCM.SimpleKCM config
pages. Emoji status markers became theme-coloured dots, the panel icon is now
a symbolic SVG that follows the panel colour, and the separate network
selector window is gone -- networks are picked inline in the settings.

Fixes carried over from the old Central code:

- Stale replies landing after a clear() duplicated the list; requests now
  carry a generation and late ones are dropped.
- With no token configured, a retry timer restarted itself every 5s forever.
  Reloads are driven by configuration changes instead.
- The online count summed the server's onlineMemberCount on every reply, so
  it grew without bound and disagreed with the list next to it.
- ConfigGeneral declared cfg_zerotierToken twice and used string literals as
  ids, and its network selector window was parented to an undefined id.
- Removing a network from the selection used a regex over the comma
  separated list and could leave stray commas behind.

Note for anyone debugging this: Qt 6 blocks local file reads over
XMLHttpRequest unless QML_XHR_ALLOW_FILE_READ=1 is set, and it fails silently
-- the request never completes and no error is raised. The auth token is read
through the executable data engine because of it.
The plugin id is what Plasma installs a package under, so reusing the
original one would overwrite the upstream widget on anyone who already has
it. Take a distinct id, credit both authors in the metadata, and point the
links at this fork. The original copyright notice stays in LICENSE as MIT
requires.
@Duoslow

Duoslow commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Port to plasma 6 and other things okay but for the zerotier api there is no change needed zerotier still gives us the "API Access Tokens"
image
i'm on free plan and can generate new token and still acces the api succesfully?
also i was designed this way because if we use "Zerotier Central's API" user can access the network/user list without the zerotier installed.
maybe we can create a branch for this version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants