refactor(deploy,update): drop standalone edition and add sandbox upgrade confirmation

- Remove standalone Docker edition (Dockerfile.standalone, docker-compose.standalone.yml, release.yml standalone jobs, and dual-edition env/script branches).
- Remove deploy_edition field from /api/update/check and dual-edition UI/i18n branching in UpdateCard.
- Replace window.confirm on upgrade with AlertDialog informing users of the irreversible Standalone -> Sandbox security upgrade.
This commit is contained in:
ji ruo committed 2026-12-04 15:14:06 +08:00
1 parent 8efd26b8b7
commit f5b446e3bf
15 files changed
+330 -944

No files matched your search

@@ -8,10 +8,21 @@ import {
ExternalLinkIcon,
RefreshCwIcon,
RotateCcwIcon,
ShieldCheckIcon,
TriangleAlertIcon,
} from "lucide-react";
import { toast } from "sonner";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
@@ -45,6 +56,7 @@ export function UpdateCard() {
const { t, liveT } = useLiveTranslation();
const [info, setInfo] = React.useState<UpdateCheck | null>(null);
const [checking, setChecking] = React.useState(true);
const [confirmOpen, setConfirmOpen] = React.useState(false);
const [progress, setProgress] = React.useState<UpdateProgress | null>(null);
// 与 progress 分开:暂存完成后进程就没了,SSE 会断,此时要切到轮询 /api/version。
const [restarting, setRestarting] = React.useState(false);
@@ -186,25 +198,10 @@ export function UpdateCard() {
[waitForNewVersion, liveT],
);
const isSandboxDocker = info?.mode === "docker" && info?.deploy_edition === "sandbox";
let editionBadgeLabel = t("settings.standalone");
if (info?.mode === "docker") {
editionBadgeLabel = isSandboxDocker ? t("settings.dockerSandboxEdition") : t("settings.dockerStandaloneEdition");
}
const doUpdate = () => {
const executeUpdate = () => {
if (!info) return;
const from = info.current;
let dockerWarn = "";
if (info.mode === "docker") {
dockerWarn = isSandboxDocker
? t("settings.sandboxUpdateWarning")
: t("settings.dockerUpdateWarningStart") + t("settings.dockerUpdateWarningEnd");
}
const ok = window.confirm(
t("settings.confirmUpdateVersion", { version: info.latest }) + t("settings.updateInterruptWarning") + dockerWarn,
);
if (!ok) return;
setConfirmOpen(false);
setBusy(true);
setProgress({ phase: "downloading", percent: 0, message: t("settings.preparing") });
api
@@ -221,9 +218,10 @@ export function UpdateCard() {
const doRollback = () => {
if (!info) return;
const confirmMsg = isSandboxDocker
? t("settings.confirmRollback") + t("settings.sandboxRollbackWarning")
: t("settings.confirmRollback");
const confirmMsg =
info.mode === "docker"
? t("settings.confirmRollback") + t("settings.dockerRollbackWarning")
: t("settings.confirmRollback");
if (!window.confirm(confirmMsg)) return;
const from = info.current;
setBusy(true);
@@ -303,7 +301,7 @@ export function UpdateCard() {
<Badge variant="outline" className="font-mono">
{info.os}/{info.arch}
</Badge>
<Badge variant="outline">{editionBadgeLabel}</Badge>
<Badge variant="outline">{info.mode === "docker" ? "Docker" : t("settings.standalone")}</Badge>
</>
)}
{info?.latest && (
@@ -378,23 +376,11 @@ export function UpdateCard() {
{info?.mode === "docker" && (info.has_update || info.has_backup) && (
<p className="text-muted-foreground text-xs">
{isSandboxDocker ? (
<>
{t("settings.sandboxUpdateHelpStart")}
<span className="font-mono"> ./update.sh </span>
{t("settings.sandboxUpdateHelpMiddle")}
<span className="font-mono"> ./update.sh --rollback</span>
{t("settings.sandboxUpdateHelpEnd")}
</>
) : (
<>
{t("settings.dockerUpdateHelpStart")}
<span className="font-mono"> docker compose up -d </span>
{t("settings.dockerUpdateHelpMiddle")}
<span className="font-mono"> ./update.sh</span>
{t("settings.dockerUpdateHelpEnd")}
</>
)}
{t("settings.dockerUpdateHelpStart")}
<span className="font-mono"> ./update.sh </span>
{t("settings.dockerUpdateHelpMiddle")}
<span className="font-mono"> ./update.sh --rollback</span>
{t("settings.dockerUpdateHelpEnd")}
</p>
)}
@@ -433,7 +419,7 @@ export function UpdateCard() {
</Button>
<Button
size="sm"
onClick={doUpdate}
onClick={() => setConfirmOpen(true)}
disabled={
checking ||
networkDirty ||
@@ -465,6 +451,32 @@ export function UpdateCard() {
{t("settings.restartScriptHelpEnd")}
</p>
</CardContent>
<AlertDialog open={confirmOpen} onOpenChange={setConfirmOpen}>
<AlertDialogContent className="sm:max-w-md">
<AlertDialogHeader>
<AlertDialogTitle>{t("settings.confirmUpdateVersion", { version: info?.latest ?? "" })}</AlertDialogTitle>
<AlertDialogDescription asChild>
<div className="space-y-2.5 text-left">
<p>{t("settings.updateInterruptWarning")}</p>
<div className="space-y-1 rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-amber-800 text-xs dark:text-amber-300">
<p className="flex items-center gap-1.5 font-medium">
<ShieldCheckIcon className="size-4 shrink-0" />
{t("settings.standaloneToSandboxTitle")}
</p>
<p className="leading-relaxed">{t("settings.standaloneToSandboxWarning")}</p>
</div>
{info?.mode === "docker" && (
<p className="text-muted-foreground text-xs">{t("settings.dockerUpdateWarning")}</p>
)}
</div>
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>{t("common.cancel")}</AlertDialogCancel>
<AlertDialogAction onClick={executeUpdate}>{t("settings.confirmUpgradeAction")}</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</Card>
);
}
+18 -34
View File
@@ -677,26 +677,24 @@ export const settingsMessages = {
"等待服务重启超时。请检查后端日志,或确认 artex 是通过 start.sh / start.bat 启动的。",
"Timed out waiting for the service to restart. Check the backend logs and confirm ARTEX was started with start.sh / start.bat.",
],
"settings.confirmUpdateVersion": ["确定更新到 {{version}}?\n\n", "Update to {{version}}?\n\n"],
"settings.confirmUpdateVersion": ["确定更新到 {{version}}?", "Update to {{version}}?"],
"settings.updateInterruptWarning": [
"更新会重启程序,正在运行的任务会被中断。\n",
"The application will restart and running tasks will be interrupted.\n",
"更新会重启程序,正在运行的任务会被中断。",
"The application will restart and running tasks will be interrupted.",
],
"settings.dockerUpdateWarningStart": [
"\n注意:容器内更新只替换程序本身,不会更新镜像里的 playwright / nmap 等工具链;",
"\nNote: Updating inside a container replaces only ARTEX, not tools such as playwright / nmap in the image. ",
"settings.standaloneToSandboxTitle": ["单容器版(standalone)→ 沙箱隔离版(sandbox)", "Standalone → Sandbox"],
"settings.standaloneToSandboxWarning": [
"此次升级将从单容器版(standalone)升级至沙箱隔离版(sandbox),升级后无法回滚,但会显著提高运行安全性。",
"This upgrade migrates from Standalone edition to Sandbox edition. It cannot be rolled back afterwards, but significantly improves security.",
],
"settings.dockerUpdateWarningEnd": [
"若新版本依赖新工具或需跨版本迁移,请改用 ./update.sh。",
"Use ./update.sh if the new version requires updated tools or edition migration.",
"settings.confirmUpgradeAction": ["确认升级", "Confirm upgrade"],
"settings.dockerUpdateWarning": [
"注意:Docker 容器内更新仅替换 artex 主控程序,不会同步更新 artex-gateway 与 artex-sandbox 镜像。推荐使用 ./update.sh 完成整套升级。",
"Note: In-app Docker updates replace only the artex control-plane binary and do not update artex-gateway or artex-sandbox images. Use ./update.sh for a full upgrade.",
],
"settings.sandboxUpdateWarning": [
"\n注意:当前为沙箱隔离版,容器内更新仅替换 artex 主控程序,不会同步更新 artex-gateway 透明网关与 artex-sandbox 沙箱镜像。推荐使用 ./update.sh 完成整套升级并自动生成回滚快照。",
"\nNote: In Sandbox edition, in-app updates replace only the artex control-plane binary and do not update artex-gateway or artex-sandbox images. Use ./update.sh for a full-stack upgrade with automatic rollback snapshots.",
],
"settings.sandboxRollbackWarning": [
"\n\n注意:当前为沙箱隔离版,页面回滚仅回退 artex 主控程序,不会回滚 artex-gateway 与 artex-sandbox 镜像。如需整套回滚或切回单容器版,请执行 ./update.sh --rollback。",
"\n\nNote: In Sandbox edition, in-app rollback reverts only the artex control-plane binary, not artex-gateway or artex-sandbox images. Run ./update.sh --rollback for a full-stack rollback or to switch back to standalone.",
"settings.dockerRollbackWarning": [
"\n\n注意:Docker 页面回滚仅回退 artex 主控程序,不会回滚 artex-gateway 与 artex-sandbox 镜像。如需整套回滚,请执行 ./update.sh --rollback。",
"\n\nNote: In-app Docker rollback reverts only the artex control-plane binary, not artex-gateway or artex-sandbox images. Run ./update.sh --rollback for a full rollback.",
],
"settings.preparing": ["准备中…", "Preparing…"],
"settings.updateStartFailedPrefix": ["启动更新失败:", "Could not start update: "],
@@ -722,8 +720,6 @@ export const settingsMessages = {
],
"settings.currentVersion": ["当前版本", "Current version"],
"settings.standalone": ["独立程序", "Standalone"],
"settings.dockerSandboxEdition": ["Docker · 沙箱隔离版", "Docker · Sandbox"],
"settings.dockerStandaloneEdition": ["Docker · 单容器版", "Docker · Standalone"],
"settings.latestVersion": ["最新版本", "Latest version"],
"settings.changelog": ["更新日志", "Changelog"],
"settings.githubUnavailablePrefix": ["无法连接 GitHub:", "Unable to connect to GitHub: "],
@@ -741,23 +737,11 @@ export const settingsMessages = {
],
"settings.upToDateDetail": ["当前已是最新版本。", "You are using the latest version."],
"settings.dockerUpdateHelpStart": [
"Docker 下的更新只替换程序本身,不更新镜像里的 playwright / nmap 等工具链,且",
"Updates in Docker replace only ARTEX, not tools such as playwright / nmap in the image. Running ",
"Docker 下页面一键更新/回滚仅作用于 artex 主控程序,不会同步切换 artex-gateway 与 artex-sandbox 镜像;完整升级请执行",
"In Docker, in-app update/rollback affects only the artex control-plane binary, not artex-gateway or artex-sandbox images. For a full upgrade, run ",
],
"settings.dockerUpdateHelpMiddle": [
"重建容器后会退回镜像自带的版本。需要连镜像一起升级、迁移到沙箱隔离版或回滚,请执行",
" to recreate the container restores the version in the image. To upgrade images, migrate to Sandbox edition, or roll back, run ",
],
"settings.dockerUpdateHelpEnd": [
"(回滚执行 ./update.sh --rollback)。",
" (or ./update.sh --rollback to roll back).",
],
"settings.sandboxUpdateHelpStart": [
"沙箱隔离版下页面一键更新/回滚仅作用于 artex 主控程序,不会同步切换 artex-gateway 与 artex-sandbox 镜像;完整升级、切换单容器版请执行",
"In Sandbox edition, in-app update/rollback affects only the artex control-plane binary, not artex-gateway or artex-sandbox images. For full-stack upgrades or edition switching, run ",
],
"settings.sandboxUpdateHelpMiddle": [",整套回滚请执行", ", and for full-stack rollback run "],
"settings.sandboxUpdateHelpEnd": ["。", "."],
"settings.dockerUpdateHelpMiddle": [",整套回滚请执行", ", and for a full rollback run "],
"settings.dockerUpdateHelpEnd": ["。", "."],
"settings.restarting": [
"正在重启并应用新版本,请稍候(页面会自动刷新)…",
"Restarting and applying the new version. Please wait; the page will reload automatically…",
-2
View File
@@ -1797,8 +1797,6 @@ export interface UpdateCheck {
current: string;
/** 运行形态。docker 下换装只作用于容器可写层,重建容器会退回镜像版本。 */
mode: "docker" | "binary";
/** 部署架构:sandbox(多容器沙箱隔离版)或 standalone(单容器/独立程序版)。 */
deploy_edition?: "sandbox" | "standalone";
os: string;
arch: string;
repo: string;