fix: remove duplicate version key from plugin.json and modernize for-in loop in lib.js

- plugin.json contained duplicate "version" keys ("0.1.0" then "0.2.0"); JSON parsers take the last value so it appeared to work, but this is invalid per spec and a maintenance hazard.
- findActiveExitNode used legacy for-in + hasOwnProperty guard; replaced with Object.keys() for modern, safe iteration (now consistent with parsePeers and the rest of lib.js).
- All 36 unit tests pass after the change.

Written by AI agent working for @jtmorris. Model: grok-build-0.1.
This commit is contained in:
Vybe (Coding Agent) 2026-05-24 21:18:52 +00:00
parent 7f3a1c3acc
commit 8499a71352
2 changed files with 1 additions and 3 deletions

View file

@ -24,8 +24,7 @@ function makeExitNodeCommand(hostname) {
function findActiveExitNode(peerMap) { function findActiveExitNode(peerMap) {
if (!peerMap) { return ""; } if (!peerMap) { return ""; }
for (const key in peerMap) { for (const key of Object.keys(peerMap)) {
if (!Object.prototype.hasOwnProperty.call(peerMap, key)) { continue; }
const p = peerMap[key]; const p = peerMap[key];
if (p.ExitNode) { if (p.ExitNode) {
return p.HostName || key; return p.HostName || key;

View file

@ -2,7 +2,6 @@
"id": "tailscalectl", "id": "tailscalectl",
"name": "Tailscale", "name": "Tailscale",
"description": "Tailscale status and controls on the Dank Bar", "description": "Tailscale status and controls on the Dank Bar",
"version": "0.1.0",
"author": "John Morris", "author": "John Morris",
"icon": "vpn_key", "icon": "vpn_key",
"type": "widget", "type": "widget",