feat(ai-proxy): Update 9router button — shut down, npm update, relaunch hidden

Settings → AI Proxy gains an admin-only Update 9router button beside
Config 9router. One in-memory job (server/lib/nine-router-update.js) stops
9router (its user unit, else this account's own 9router processes), runs
npm install -g --prefix <its prefix> 9router@latest (sudo -n only when
sudoers already allows it, probed before anything stops), then relaunches
it hidden only if it was running. A failed update still relaunches the old
version. Nothing in the request names a command, path or package.
This commit is contained in:
2026-10-26 17:00:33 +07:00
parent 631ea96f19
commit 569b68ec98
13 changed files with 1318 additions and 2 deletions
+23
View File
@@ -759,6 +759,29 @@
"description": "For example 9Router, OpenRouter or a self-hosted gateway. Save one here, then pick it for a session in the workspace prompt box.",
"add": "Add profile",
"config9router": "Config 9router",
"update9router": "Update 9router",
"update9routerAvailable": "A newer 9router is available",
"update9routerCurrent": "Installed",
"update9routerLatest": "Latest",
"update9routerState": "State",
"update9routerRunning": "Running",
"update9routerRunningUnit": "Running (9router.service)",
"update9routerStopped": "Not running",
"update9routerExplain": "Every session using 9router is disconnected while it updates: 9router is shut down, updated with npm, then started again hidden (tray, no browser).",
"update9routerExplainStopped": "9router is not running: it is updated with npm and left off.",
"update9routerStep": {
"shutdown": "Disconnect and shut down 9router",
"update": "Run the update (npm install -g 9router@latest)",
"relaunch": "Start 9router again, hidden"
},
"update9routerDone": "9router {{version}} is running.",
"update9routerDoneStopped": "9router {{version}} is installed and left off, as it was.",
"update9routerFailed": "The update did not finish — see the steps and the log.",
"update9routerLog": "npm output",
"update9routerUpToDate": "9router is already the latest version.",
"update9routerCopy": "Copy command",
"update9routerClose": "Close",
"update9routerStart": "Update now",
"edit": "Edit",
"remove": "Remove",
"empty": "No proxy profile saved yet. Native runs against the vendor's own API.",
+23
View File
@@ -747,6 +747,29 @@
"description": "Ví dụ 9Router, OpenRouter hoặc gateway tự dựng. Lưu ở đây rồi chọn cho từng session ở ô nhập prompt của workspace.",
"add": "Thêm profile",
"config9router": "Config 9router",
"update9router": "Cập nhật 9router",
"update9routerAvailable": "Đã có bản 9router mới",
"update9routerCurrent": "Đang cài",
"update9routerLatest": "Mới nhất",
"update9routerState": "Trạng thái",
"update9routerRunning": "Đang chạy",
"update9routerRunningUnit": "Đang chạy (9router.service)",
"update9routerStopped": "Không chạy",
"update9routerExplain": "Mọi session đang dùng 9router sẽ bị ngắt kết nối trong lúc cập nhật: 9router được tắt, cập nhật bằng npm rồi mở lại ở chế độ ẩn (khay hệ thống, không mở trình duyệt).",
"update9routerExplainStopped": "9router đang không chạy: chỉ cập nhật bằng npm và giữ nguyên trạng thái tắt.",
"update9routerStep": {
"shutdown": "Ngắt kết nối và tắt 9router",
"update": "Chạy cập nhật (npm install -g 9router@latest)",
"relaunch": "Mở lại 9router ở chế độ ẩn"
},
"update9routerDone": "9router {{version}} đang chạy.",
"update9routerDoneStopped": "Đã cài 9router {{version}}, giữ nguyên trạng thái tắt như trước.",
"update9routerFailed": "Cập nhật chưa hoàn tất — xem các bước và log.",
"update9routerLog": "Output của npm",
"update9routerUpToDate": "9router đã là bản mới nhất.",
"update9routerCopy": "Sao chép lệnh",
"update9routerClose": "Đóng",
"update9routerStart": "Cập nhật ngay",
"edit": "Sửa",
"remove": "Xoá",
"empty": "Chưa lưu profile proxy nào. Native là chạy thẳng vào API của hãng.",