fix: auto-update when manifest version old (2.5.2 -> 2.5.4)
- frontend now checks /api/dashboard/plugins manifest version vs EXPECTED 2.5.4 - if old, auto POST /api/dashboard/agent-plugins/sshx-link/update (hermes plugins update) then rescan - ensures server pulls new code without SSH, even when backend 404 - bump v2.5.4
This commit is contained in:
parent
79c4f14ab5
commit
514b0eeae7
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue