diff --git a/dashboard/dist/index.js b/dashboard/dist/index.js index d5a8116..22ca3fb 100644 --- a/dashboard/dist/index.js +++ b/dashboard/dist/index.js @@ -110,6 +110,23 @@ React.useEffect(function(){ check(); const t=setInterval(check, 3000); return function(){clearInterval(t);} }, [check]); + // if manifest version is old, trigger plugin update via dashboard API (hermes plugins update) + React.useEffect(function(){ + const EXPECTED = "2.5.4"; + fetchJSONAllowError("/api/dashboard/plugins").then(function(list){ + try { + const p = Array.isArray(list) ? list.find(function(x){return x.name==="sshx-link";}) : null; + if (p && p.version !== EXPECTED) { + setMsg("Phát hiện plugin cũ "+p.version+" != "+EXPECTED+" — đang tự động update (hermes plugins update)..."); + fetchJSONAllowError("/api/dashboard/agent-plugins/sshx-link/update", {method:"POST"}).then(function(){ + setMsg("Đã gửi update, đợi 5s rồi rescan..."); + setTimeout(function(){ fetchJSONAllowError("/api/dashboard/plugins/rescan").then(function(){ setTimeout(check, 2000); }); }, 5000); + }).catch(function(e){ setMsg("Update failed: "+e.message); }); + } + } catch(_){} + }).catch(function(){}); + }, [check]); + // auto-start once if no link after initial check React.useEffect(function(){ if (triedAuto) return; diff --git a/dashboard/manifest.json b/dashboard/manifest.json index 423984b..91e7557 100644 --- a/dashboard/manifest.json +++ b/dashboard/manifest.json @@ -3,7 +3,7 @@ "label": "sshx.io Terminal", "description": "Auto-start sshx via systemd/nohup, pid starttime guard, gửi ntfy — dashboard ẩn", "icon": "Terminal", - "version": "2.5.3", + "version": "2.5.4", "tab": { "path": "/sshx", "position": "end", diff --git a/plugin.yaml b/plugin.yaml index 152168e..0cd7476 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,5 @@ name: sshx-link -version: 2.5.3 +version: 2.5.4 description: Auto-start sshx via nohup và gửi link về ntfy.sh/kUIJK0H1ettQ4VkR — dashboard ẩn author: sisyphus provides_tools: