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:
parent
3403bf2c15
commit
3986ee3490
2 changed files with 1 additions and 3 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue