Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(backup): translate the restart notice and say when it takes long

Bugfixer 24c38d7a60c62
diff --git a/src/components/WorkspaceBackupSettings.test.ts b/src/components/WorkspaceBackupSettings.test.ts
index 6ad7bcabdf..b13afe1131 100644
--- a/src/components/WorkspaceBackupSettings.test.ts
+++ b/src/components/WorkspaceBackupSettings.test.ts
@@ -175,6 +175,21 @@ describe("Settings full backups", () => {
expect(storage.get("omb-pending-workspace-restore")).toBe("stage-id");
});
+ it("on a server that restarts itself, says so when the restart takes much longer, and keeps waiting", async () => {
+ storage.set("omb-pending-workspace-restore", "stage-id");
+ vi.useFakeTimers();
+ try {
+ expect(render("cloud").html).not.toContain("longer than usual");
+ const stop = fixture.effects[0]() as () => void;
+ fixture.api.mockRejectedValue(new Error("Server unavailable"));
+ await vi.advanceTimersByTimeAsync(180_000);
+ expect(render("cloud").html).toContain("longer than usual");
+ expect(window.location.reload).not.toHaveBeenCalled();
+ stop();
+ } finally { vi.useRealTimers(); }
+ expect(storage.get("omb-pending-workspace-restore")).toBe("stage-id");
+ });
+
it("on a server that restarts itself, reloads to sign-in when the restored workspace does not know this browser", async () => {
vi.useFakeTimers();
try {
diff --git a/src/components/WorkspaceBackupSettings.tsx b/src/components/WorkspaceBackupSettings.tsx
index b61b9f38cc..eda8ffab22 100644
--- a/src/components/WorkspaceBackupSettings.tsx
+++ b/src/components/WorkspaceBackupSettings.tsx
@@ -16,6 +16,7 @@ const validPassword = (value: string) => value.length >= 12 && value.length <= 1
export function WorkspaceBackupRestartNotice({ onRetry, serverRestarts = false }: { onRetry?: () => void; serverRestarts?: boolean } = {}) {
const [restarting, setRestarting] = useState(false);
const [error, setError] = useState(false);
+ const [slow, setSlow] = useState(false);
const lock = useRef(false);
const retry = useRef(onRetry);
retry.current = onRetry;
@@ -33,10 +34,13 @@ export function WorkspaceBackupRestartNotice({ onRetry, serverRestarts = false }
else window.location.reload();
});
timer = setTimeout(check, 3_000);
- return () => { alive = false; clearTimeout(timer); };
+ // Keeps waiting (and keeps the restore marker), but says so when the restart takes much longer than usual.
+ const slowTimer = setTimeout(() => { if (alive) setSlow(true); }, 180_000);
+ return () => { alive = false; clearTimeout(timer); clearTimeout(slowTimer); };
}, [serverRestarts]);
if (serverRestarts) return <div role="status" className="flex max-w-lg items-center gap-3 text-[14px]">
- <Loader2 aria-hidden="true" size={15} className="animate-spin" /><p>{t("backup.serverRestarting")}</p>
+ <Loader2 aria-hidden="true" size={15} className="shrink-0 animate-spin" />
+ <div className="flex flex-col gap-2"><p>{t("backup.serverRestarting")}</p>{slow && <p>{t("backup.serverRestartSlow")}</p>}</div>
</div>;
const relaunch = typeof window !== "undefined" && !window.ogb?.remoteClient?.active ? window.ogb?.relaunch : undefined;
const restart = async () => {
diff --git a/src/locales/en.json b/src/locales/en.json
index 216e56acb1..c8c180f08f 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -6003,6 +6003,7 @@
"backup.replace": "Replace installation",
"backup.restoring": "Preparing replacement…",
"backup.serverRestarting": "The backup is ready to restore. {app} is restarting to finish it. This page carries on by itself in a minute or two.",
+ "backup.serverRestartSlow": "This is taking longer than usual. If this page has not carried on in a few more minutes, reload it.",
"backup.restart": "The backup is ready to restore. Fully quit {app} and reopen it to finish. For a self-hosted server, restart the server process, then reload this browser. Do not just close this window.",
"backup.restartDesktop": "Your backup is ready. Restart {app} to finish restoring it. Closing this window will not restart the server.",
"backup.restartAction": "Restart and restore",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 0aa15f115e..ba4b6962bf 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -5743,6 +5743,8 @@
"backup.restartDesktop": "O backup está pronto. Reinicie o app {app} para concluir a restauração. Fechar esta janela não reinicia o servidor.",
"backup.restartAction": "Reiniciar e restaurar",
"backup.restartFailed": "Não foi possível reiniciar o app {app}. Encerre o app completamente e abra novamente para concluir a restauração.",
+ "backup.serverRestarting": "O backup está pronto para ser restaurado. O {app} está reiniciando para concluir. Esta página continua sozinha em um ou dois minutos.",
+ "backup.serverRestartSlow": "Isso está demorando mais do que o normal. Se esta página não continuar em mais alguns minutos, recarregue-a.",
"backup.recovering": "Restaurando os rascunhos e preferências salvos neste navegador…",
"backup.skipDrafts": "Continuar sem restaurar rascunhos",
"backup.skipDraftsHint": "Mantém os rascunhos e preferências atuais deste navegador. Isso não desfaz a restauração da instalação.",
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index a099a054d0..f552ac591f 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -6004,6 +6004,8 @@
"backup.restartDesktop": "你的備份已準備就緒。請重新啟動 {app} 以完成還原。關閉這個視窗不會重新啟動伺服器。",
"backup.restartAction": "重新啟動並還原",
"backup.restartFailed": "無法重新啟動 {app}。請完全結束應用程式後重新開啟,以完成還原。",
+ "backup.serverRestarting": "備份已準備好還原。{app} 正在重新啟動以完成還原。此頁面會在一兩分鐘內自動繼續。",
+ "backup.serverRestartSlow": "這比平常花更久的時間。如果此頁面在幾分鐘後仍未繼續,請重新載入。",
"backup.recovering": "正在還原此瀏覽器已儲存的草稿與偏好設定…",
"backup.skipDrafts": "繼續,但不還原草稿",
"backup.skipDraftsHint": "保留此瀏覽器目前的草稿與偏好設定。這不會復原安裝實例的還原。",