mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 11:25:56 +00:00
Fix embedded launcher startup and retry applied updates safely
This commit is contained in:
1 parent
07ec22798f
commit
cfe0889a4f
19 files changed
+268
-34
No files matched your search
@@ -361,6 +361,7 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"upd.confirmBack": "Zur vorherigen Version zurückkehren? Deine Charaktere und Konten werden nicht verändert.",
|
||||
"upd.wentBack": "Zur vorherigen Version zurückgekehrt. Deine Daten wurden nicht angetastet.",
|
||||
"upd.dialogTitle": "Wähle einen Update-Paketordner",
|
||||
"upd.retryValidation": "Serverstart erneut prüfen",
|
||||
"upd.pendingBad": "Der aktualisierte Server ist nicht korrekt gestartet",
|
||||
"upd.pendingUnfinished": "Ein früheres Update wurde nicht abgeschlossen",
|
||||
"upd.safeBack": "Du kannst sicher zur vorherigen Version zurückkehren.",
|
||||
|
||||
@@ -394,6 +394,7 @@ const en = {
|
||||
"upd.confirmBack": "Go back to the previous version? Your characters and accounts are not changed.",
|
||||
"upd.wentBack": "Went back to the previous version. Your data was not touched.",
|
||||
"upd.dialogTitle": "Choose an update package folder",
|
||||
"upd.retryValidation": "Retry server startup",
|
||||
"upd.pendingBad": "The updated server did not start correctly",
|
||||
"upd.pendingUnfinished": "An earlier update did not finish",
|
||||
"upd.safeBack": "You can safely go back to the previous version.",
|
||||
|
||||
@@ -361,6 +361,7 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"upd.confirmBack": "¿Volver a la versión anterior? Tus personajes y cuentas no se modifican.",
|
||||
"upd.wentBack": "Se volvió a la versión anterior. Tus datos no se tocaron.",
|
||||
"upd.dialogTitle": "Elige una carpeta de paquete de actualización",
|
||||
"upd.retryValidation": "Reintentar iniciar el servidor",
|
||||
"upd.pendingBad": "El servidor actualizado no se inició correctamente",
|
||||
"upd.pendingUnfinished": "Una actualización anterior no terminó",
|
||||
"upd.safeBack": "Puedes volver con seguridad a la versión anterior.",
|
||||
|
||||
@@ -361,6 +361,7 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"upd.confirmBack": "Revenir à la version précédente ? Vos personnages et comptes ne sont pas modifiés.",
|
||||
"upd.wentBack": "Retour à la version précédente effectué. Vos données n’ont pas été touchées.",
|
||||
"upd.dialogTitle": "Choisissez un dossier de paquet de mise à jour",
|
||||
"upd.retryValidation": "Réessayer de démarrer le serveur",
|
||||
"upd.pendingBad": "Le serveur mis à jour n’a pas démarré correctement",
|
||||
"upd.pendingUnfinished": "Une mise à jour précédente ne s’est pas terminée",
|
||||
"upd.safeBack": "Vous pouvez revenir en toute sécurité à la version précédente.",
|
||||
|
||||
@@ -392,6 +392,7 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"upd.confirmBack": "Вернуться к предыдущей версии? Ваши персонажи и учётные записи не изменятся.",
|
||||
"upd.wentBack": "Выполнен возврат к предыдущей версии. Ваши данные не затронуты.",
|
||||
"upd.dialogTitle": "Выберите папку с пакетом обновления",
|
||||
"upd.retryValidation": "Повторить запуск сервера",
|
||||
"upd.pendingBad": "Обновлённый сервер запустился некорректно",
|
||||
"upd.pendingUnfinished": "Предыдущее обновление не завершилось",
|
||||
"upd.safeBack": "Можно безопасно вернуться к предыдущей версии.",
|
||||
|
||||
@@ -373,6 +373,7 @@ const zh = {
|
||||
"upd.confirmBack": "是否回滚至上一个版本?你的角色与账号数据不会受到影响。",
|
||||
"upd.wentBack": "已回滚至上一个版本。你的个人数据完好无损。",
|
||||
"upd.dialogTitle": "选择更新包文件夹",
|
||||
"upd.retryValidation": "重试启动服务器",
|
||||
"upd.pendingBad": "更新后的服务器未能正常启动",
|
||||
"upd.pendingUnfinished": "先前的更新尚未完成",
|
||||
"upd.safeBack": "你可以安全回滚至先前的稳定版本。",
|
||||
|
||||
@@ -430,6 +430,7 @@ export const api = {
|
||||
applyUpdate: (id: string, resolutions: Record<string, "keep" | "replace">, source?: string) =>
|
||||
invoke<{ txn: UpdateTxn }>("apply_update", { id, source: source ?? null, resolutions }),
|
||||
rollbackUpdate: (id: string, txn: string) => invoke<UpdateTxn>("rollback_update", { id, txn }),
|
||||
retryUpdateValidation: (id: string, txn: string) => invoke<UpdateTxn>("retry_update_validation", { id, txn }),
|
||||
population: (id: string) => invoke<Population | null>("get_population", { id }),
|
||||
stopSpawning: (id: string) => invoke<{ count: number }>("companions_stop_spawning", { id }),
|
||||
takeOffline: (id: string) => invoke<{ count: number }>("companions_take_offline", { id }),
|
||||
|
||||
@@ -23,7 +23,7 @@ export function SettingsHome({ serverId }: { serverId: string }) {
|
||||
const human = useHuman();
|
||||
const [preview, setPreview] = useState<UpdatePreview | null>(null);
|
||||
const [pending, setPending] = useState<UpdateTxn | null>(null);
|
||||
const [localBusy, setBusy] = useState<"check" | "rollback" | null>(null);
|
||||
const [localBusy, setBusy] = useState<"check" | "rollback" | "retry" | null>(null);
|
||||
// an update keeps running in the background when this tab is left, so its state is the shared one
|
||||
const busy = upd.applying ? "update" : localBusy;
|
||||
const progress = upd.applying ? { step: upd.step ?? "Starting", percent: upd.percent } : null;
|
||||
@@ -85,6 +85,21 @@ export function SettingsHome({ serverId }: { serverId: string }) {
|
||||
}
|
||||
}
|
||||
|
||||
async function retryValidation(txn: UpdateTxn) {
|
||||
setBusy("retry");
|
||||
setError(null);
|
||||
try {
|
||||
const result = await api.retryUpdateValidation(serverId, txn.id);
|
||||
if (result.state === "committed") {
|
||||
setPending(null);
|
||||
setPreview(null);
|
||||
setDone(t("upd.updatedTo", { v: result.to_version }));
|
||||
clearServerUpdateResult(serverId);
|
||||
} else setPending(result);
|
||||
} catch (e) { setError(asUiError(e)); }
|
||||
finally { setBusy(null); }
|
||||
}
|
||||
|
||||
async function browse() {
|
||||
const p = await open({ directory: true, multiple: false, title: t("upd.dialogTitle") });
|
||||
if (typeof p === "string") setSource(p);
|
||||
@@ -100,7 +115,13 @@ export function SettingsHome({ serverId }: { serverId: string }) {
|
||||
<p className="font-medium text-warn">
|
||||
{pending.state === "needs-decision" ? t("upd.pendingBad") : t("upd.pendingUnfinished")}
|
||||
</p>
|
||||
<p className="mt-1 text-sm text-muted">{pending.message ?? t("upd.safeBack")}</p>
|
||||
<p className="mt-1 whitespace-pre-wrap text-sm text-muted">{pending.message ?? t("upd.safeBack")}</p>
|
||||
{pending.state === "needs-decision" && (
|
||||
<Button className="mt-3 mr-3" size="sm" disabled={!!busy} onClick={() => void retryValidation(pending)}>
|
||||
{busy === "retry" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
||||
{t("upd.retryValidation")}
|
||||
</Button>
|
||||
)}
|
||||
<p className="mt-1 text-sm text-muted">{t("upd.backNote")}</p>
|
||||
<Button className="mt-3" size="sm" disabled={!!busy} onClick={() => void rollback(pending)}>
|
||||
{busy === "rollback" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
||||
|
||||
Reference in new issue
Block a user