Skip to content

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

Cloud updating screen: never over a failed Cloud, a hard end, asks with back-off, true words

milind-soni9f5e90515eac
diff --git a/electron/cloud-account.d.mts b/electron/cloud-account.d.mts
index 7c4705e5da..23b9f03d52 100644
--- a/electron/cloud-account.d.mts
+++ b/electron/cloud-account.d.mts
@@ -292,6 +292,8 @@ export interface CloudAccountClient {
reopen(): Promise<CloudAccountState>;
cancel(): Promise<CloudAccountState>;
refresh(): Promise<CloudAccountState>;
+ /** While the Admin's session read keeps failing, when this client tries it again by itself (epoch ms); 0 otherwise. */
+ failingUntil?(): number;
signOut(): Promise<CloudAccountState>;
openDashboard(): Promise<CloudAccountState>;
offer(): Promise<import("./cloud-home.mjs").CloudOffer | null>;
diff --git a/electron/cloud-account.mjs b/electron/cloud-account.mjs
index 02e20287ce..66772c66db 100644
--- a/electron/cloud-account.mjs
+++ b/electron/cloud-account.mjs
@@ -108,7 +108,7 @@ export function createCloudAccountClient({ store, openBrowser, platform, deviceN
let resetUsed = false, unsaved = false, stuckSince = null, reading = null;
const save = record => (unsaved ? Promise.resolve() : store.write(record));
let value = { status: "signed-out", message: "restoring" }, generation = 0, timer = null, closed = false, clearing = null, refreshing = null;
- let verifiedUntil = 0, restoring = false, controller = new AbortController(), failures = 0;
+ let verifiedUntil = 0, restoring = false, controller = new AbortController(), failures = 0, failingUntil = 0;
let plan = null, savedHint = null;
/** The plan's own Cloud that Cancel and Keep act on, as the last verified session names it. */
let renewalCloud = null;
@@ -151,7 +151,7 @@ export function createCloudAccountClient({ store, openBrowser, platform, deviceN
stopTimer();
if (!closed) { timer = setTimer(() => { timer = null; void work().catch(() => {}); }, Math.max(1, delay)); timer?.unref?.(); }
};
- const reset = () => { generation++; stopTimer(); controller.abort(); controller = new AbortController(); pending = null; emailed = null; verifiedUntil = 0; failures = 0; return generation; };
+ const reset = () => { generation++; stopTimer(); controller.abort(); controller = new AbortController(); pending = null; emailed = null; verifiedUntil = 0; failures = 0; failingUntil = 0; return generation; };
// `quiet`: another account is taking over (quiesce to reload): this sign-in's grant is still in memory, and nothing may ask for
// it or write it over the one taking its place, whoever asks (a window coming to the front, Settings' Refresh).
let quiet = false;
@@ -287,7 +287,7 @@ export function createCloudAccountClient({ store, openBrowser, platform, deviceN
}
plan = hint ? { accountId: grant.account.id, ...hint } : null;
renewalCloud = renewingCloud;
- failures = 0;
+ failures = 0; failingUntil = 0;
// A checkout the Admin still holds open, with none kept here (this app restarted mid-checkout): watched as this
// app's own from first sight, so payment, setup and "ready" are followed as closely as before the restart.
if (!opened && offer?.checkout && offer.checkout.openUntil > now() && access.status !== "active") {
@@ -313,10 +313,10 @@ export function createCloudAccountClient({ store, openBrowser, platform, deviceN
} catch (error) {
if (!current(stamp)) return state();
if (signInEnded(error)) { verifiedUntil = 0; failures = 0; stopTimer(); return publish(view("reauth-required", "access-ended")); }
- failures++;
+ failures++; const wait = Math.min(retryDelay(failures), grant.expiresAt - now()); failingUntil = now() + Math.max(0, wait); // `failingUntil` below
if (value.status === "connected") publish(value);
else publish(view("unavailable", "unreachable"));
- schedule(refresh, Math.min(retryDelay(failures), grant.expiresAt - now()));
+ schedule(refresh, wait);
}
return state();
}
@@ -525,7 +525,7 @@ export function createCloudAccountClient({ store, openBrowser, platform, deviceN
return state();
},
cancel: () => { if (!pending && value.status !== "connecting") return Promise.resolve(state()); opened = null; return signOut(); },
- refresh, signOut,
+ refresh, signOut, failingUntil: () => (failures > 0 ? failingUntil : 0), // a failing session read's next try: a caller waits for it
/** Clear and sign in again: a saved sign-in this computer can't read or remove goes (never a working one), and isn't read again
* this run. One that still can't be removed stays on disk; this run's next sign-in is kept in memory if it can't be saved. */
async resetSaved() {
diff --git a/electron/cloud-account.node-test.mjs b/electron/cloud-account.node-test.mjs
index dfd8a36a78..5c21b6a047 100644
--- a/electron/cloud-account.node-test.mjs
+++ b/electron/cloud-account.node-test.mjs
@@ -59,9 +59,10 @@ test("a failed check keeps the last verified answer (never a malformed one), say
test("a check that fails is asked again after 15 s, 30 s, then each minute", async t => {
const f = await fixture(t); await f.connect();
- f.sessionStatus = 503; await f.client.refresh(); assert.equal(f.delay, 15_000);
+ assert.equal(f.client.failingUntil(), 0); f.sessionStatus = 503; await f.client.refresh(); assert.equal(f.delay, 15_000);
+ assert.equal(f.client.failingUntil(), f.now + 15_000, "a caller that would read it sooner (the Cloud's page) is told when it is tried again");
for (const delay of [30_000, 60_000, 60_000]) { f.tick(); await until(() => f.timer); assert.equal(f.delay, delay); }
- f.sessionStatus = 200; f.tick(); await until(() => f.timer);
+ f.sessionStatus = 200; f.tick(); await until(() => f.timer); assert.equal(f.client.failingUntil(), 0);
f.sessionStatus = 503; f.tick(); await until(() => f.timer);
assert.equal(f.delay, 15_000, "an answer starts the count again");
});
diff --git a/electron/cloud-home.mjs b/electron/cloud-home.mjs
index 447805dcc2..9c9a2577f7 100644
--- a/electron/cloud-home.mjs
+++ b/electron/cloud-home.mjs
@@ -78,8 +78,9 @@ export function parseCloudSummary(input) {
const homecoming = record(input.hold) ? parseHomecoming(input.hold.homecoming) : null;
const hold = record(input.hold) && moment(input.hold.until) ? { until: input.hold.until, ...(homecoming ? { homecoming } : {}) } : null;
const formerOrigins = parseFormerOrigins(input.formerOrigins, origin);
- // Additive: an operation of the Admin's own has it down now (an update, resize, move, restore or start: cloud-operation.mjs).
- const operation = ["ready", "provisioning", "failed"].includes(status) ? parseCloudOperation(input.operation) : null;
+ // Additive: an operation of the Admin's own has it down now (an update, its rollback, a resize, a move, a restore or a start:
+ // cloud-operation.mjs). Never on a failed Cloud, whatever an Admin sends: that keeps its own screen and its Try again.
+ const operation = ["ready", "provisioning"].includes(status) ? parseCloudOperation(input.operation) : null;
return { status, ...(origin ? { origin } : {}), ...(formerOrigins.length ? { formerOrigins } : {}), ...(setup ? { setup } : {}), ...(retryAt ? { retryAt } : {}), ...(disk ? { disk } : {}), ...(unreachable ? { unreachable } : {}), ...(power ? { power } : {}),
...(input.moves === true ? { moves: true } : {}), ...(hold ? { hold } : {}), ...(operation ? { operation } : {}) };
}
diff --git a/electron/cloud-operation.d.mts b/electron/cloud-operation.d.mts
index 3b45df21c0..f93936e10c 100644
--- a/electron/cloud-operation.d.mts
+++ b/electron/cloud-operation.d.mts
@@ -1,11 +1,15 @@
/** What the Admin says while an operation of its own has a Cloud down (cloud-operation.mjs). `kind`: one of
* CLOUD_OPERATION_KINDS, or a newer one this app reads as "restarting"; `until`: its own deadline, past which the Admin's alert
- * has gone out; `expectedAt`: when it is usually back, only where the Admin measured it; `backup`: the update backs the whole
+ * has gone out; `expectedAt`: its usual time (an update, its rollback or a resize), past which it is "taking longer than usual"; `backup`: the update backs the whole
* Cloud up first; `bigger`: a resize to a bigger size. Times in epoch ms. */
export interface CloudOperation { kind: string; since: number; until: number; expectedAt?: number; backup?: true; bigger?: true }
export declare const CLOUD_OPERATION_KINDS: readonly string[];
export declare const OPERATION_REFRESH_MS: number;
export declare const OPERATION_FRESH_MS: number;
+export declare const OPERATION_ASK_MS: readonly number[];
+export declare const OPERATION_GRACE_MS: number;
+export declare function operationEndsAt(operation: CloudOperation, firstSeenAt: number): number;
+export declare function createOperationOutages(now?: () => number): { shown(place: string, operation: CloudOperation | null): CloudOperation | null; clear(place: string): void; endsAt(place: string): number | null };
export declare function parseCloudOperation(input: unknown): CloudOperation | null;
export declare function cloudOperationAt(state: unknown, origin: string | null | undefined): CloudOperation | null;
export declare function anyOperation(machine: { operation?: CloudOperation } | null | undefined, clouds: unknown): boolean;
diff --git a/electron/cloud-operation.mjs b/electron/cloud-operation.mjs
index ada7193063..122604e8f4 100644
--- a/electron/cloud-operation.mjs
+++ b/electron/cloud-operation.mjs
@@ -1,14 +1,19 @@
-// What the Admin says while an operation of its own has a Cloud down: an update, a resize, a move, a disk move, a restore or
-// a start (the session's `cloud.operation` and each `clouds[].operation`, additive). The window then says what is happening
+// What the Admin says while an operation of its own has a Cloud down: an update, its rollback, a resize, a move, a disk move, a
+// restore or a start (the session's `cloud.operation` and each `clouds[].operation`, additive). The window then says what is happening
// instead of "can't be reached", and goes on looking by itself. Display only: it never opens, wakes or pairs anything.
/** The kinds this app has its own words for; another kind the Admin adds later reads as "restarting". */
-export const CLOUD_OPERATION_KINDS = Object.freeze(["update", "resize", "move", "disk", "restore", "start"]);
+export const CLOUD_OPERATION_KINDS = Object.freeze(["update", "rollback", "resize", "move", "disk", "restore", "start"]);
/** While the Admin says an operation has a Cloud down, its session is read this often, so the window follows it closely. */
export const OPERATION_REFRESH_MS = 15_000;
-/** The Cloud's own page asks every 10 s while its live stream is down (src/lib/cloud-work.ts): a session older than this is read
- * again first, so each ask gets a fresh word. */
+/** The Cloud's own page asks while its live stream is down, at most this often (src/lib/cloud-work.ts): a session older than this
+ * is read again first, so an ask gets a fresh word, unless the Admin itself is failing (then its own retry wait is kept). */
export const OPERATION_FRESH_MS = 8_000;
+/** How long the Cloud's own page waits between asks while its live stream stays down: 10 s, then 20, 40 and 60 s from then on. */
+export const OPERATION_ASK_MS = Object.freeze([10_000, 20_000, 40_000, 60_000]);
+/** A screen that says what has a Cloud down stops by itself this long past the operation's own deadline (the Admin's alert has
+ * gone out by then), whatever the Admin says: it is the plain "couldn't reach" again, with Try again. */
+export const OPERATION_GRACE_MS = 15 * 60_000;
const KIND = /^[a-z][a-z-]{0,23}$/;
const record = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -22,14 +27,41 @@ export function parseCloudOperation(input) {
}
/** The operation the Admin says has the Cloud at `origin` down: My Cloud's own (the session's `cloud`), else that Cloud's in the
- * session's list (a team's Cloud, another of the person's own). Null while signed out, for any other address, or when none. */
+ * session's list (a team's Cloud, another of the person's own). Null while signed out, for any other address, or when none.
+ * Never for a Cloud whose setup or update failed: that keeps its own screen and its Try again. */
export function cloudOperationAt(state, origin) {
if (state?.status !== "connected" || typeof origin !== "string" || !origin) return null;
const mine = state.machine;
- if (mine?.origin === origin && mine.operation) return mine.operation;
+ if (mine?.origin === origin && mine.operation) return mine.status === "failed" ? null : mine.operation;
const listed = Array.isArray(state.clouds) ? state.clouds.find((cloud) => cloud.origin === origin) : null;
return listed?.operation ?? null;
}
/** Whether any Cloud in the session is down for an operation now (its session is then read every OPERATION_REFRESH_MS). */
export const anyOperation = (machine, clouds) => Boolean(machine?.operation) || (Array.isArray(clouds) && clouds.some((cloud) => Boolean(cloud?.operation)));
+
+/** When a screen that says what has a Cloud down ends by itself: by this computer's clock, from `firstSeenAt` (when it was first
+ * shown for this outage), the time then left to the operation's deadline, never more than the operation's whole span (so a
+ * clock ahead of or behind the Admin's moves it by at most that), plus OPERATION_GRACE_MS. */
+export function operationEndsAt(operation, firstSeenAt) {
+ const span = Math.max(0, operation.until - operation.since);
+ return firstSeenAt + Math.min(span, Math.max(0, operation.until - firstSeenAt)) + OPERATION_GRACE_MS;
+}
+
+/** Each place's outage, from the first time its operation is shown until `clear` (the place answered): its hard end is fixed
+ * then (`operationEndsAt`), so an Admin that keeps sending one, or one whose `since` moves, never keeps the screen up past it. */
+export function createOperationOutages(now = Date.now) {
+ const ends = new Map();
+ return {
+ /** `operation` while its outage's end hasn't passed; null past it, or for none. */
+ shown(place, operation) {
+ if (!operation) return null;
+ if (!ends.has(place)) ends.set(place, operationEndsAt(operation, now()));
+ return now() < ends.get(place) ? operation : null;
+ },
+ /** The place answered: its next operation is a new outage. */
+ clear(place) { ends.delete(place); },
+ /** When the outage at `place` ends, or null for none. */
+ endsAt: (place) => ends.get(place) ?? null,
+ };
+}
diff --git a/electron/cloud-operation.node-test.mjs b/electron/cloud-operation.node-test.mjs
index ca77745ef5..9ea0d95275 100644
--- a/electron/cloud-operation.node-test.mjs
+++ b/electron/cloud-operation.node-test.mjs
@@ -5,9 +5,9 @@ import test from "node:test";
import { parseCloudSummary } from "./cloud-home.mjs";
import { parseCloudList } from "./cloud-list.mjs";
-import { anyOperation, cloudOperationAt, OPERATION_REFRESH_MS, parseCloudOperation } from "./cloud-operation.mjs";
+import { anyOperation, cloudOperationAt, OPERATION_GRACE_MS, OPERATION_REFRESH_MS, operationEndsAt, parseCloudOperation } from "./cloud-operation.mjs";
import { HOME_SCREEN_PATH } from "./home-window.mjs";
-import { CLIENT, CLIENT_A, CLOUD, connected, LOCAL, world } from "./fixtures/home-window-world.mjs";
+import { ACME, CLIENT, CLIENT_A, CLOUD, connected, LOCAL, TEAM, world } from "./fixtures/home-window-world.mjs";
const UPDATE = { kind: "update", since: 1_000_000, until: 2_080_000, expectedAt: 1_180_000 };
@@ -52,18 +52,55 @@ test("My Cloud being updated: this computer's screen says so, never \"can't reac
assert.equal(plain.home.view().screen, "offline");
});
-test("a Cloud the Admin is starting again says so, never its setup or a failure, and its address is never looked up", async () => {
+test("a Cloud the Admin is starting again says so, never its setup, and its address is never looked up; a failed one keeps its own screen", async () => {
const start = { kind: "start", since: 1_000_000, until: 2_800_000 };
- for (const machine of [{ status: "provisioning", setup: { step: "starting" }, operation: start }, { status: "failed", operation: start }]) {
- const w = world({ state: connected(machine) });
- await w.home.show();
- assert.deepEqual(w.home.view(), { screen: "working", operation: start }, machine.status);
- assert.deepEqual(w.fetched, [], machine.status);
- }
+ const w = world({ state: connected({ status: "provisioning", setup: { step: "starting" }, operation: start }) });
+ await w.home.show();
+ assert.deepEqual(w.home.view(), { screen: "working", operation: start });
+ assert.deepEqual(w.fetched, []);
// Without the Admin's word: its setup, as before.
const before = world({ state: connected({ status: "provisioning", setup: { step: "starting" } }) });
await before.home.show();
assert.equal(before.home.view().screen, "setup");
+ // Its start failed for good: the failed screen with its own words and its Try again, whatever an Admin sends with it.
+ assert.equal("operation" in parseCloudSummary({ state: "failed", operation: start }), false, "a failed Cloud has no operation");
+ const failed = world({ state: connected({ status: "failed", operation: start }) });
+ await failed.home.show();
+ assert.deepEqual(failed.home.view(), { screen: "plan", machine: "failed" });
+ assert.equal(cloudOperationAt(connected({ status: "failed", operation: start }), CLOUD), null);
+});
+
+test("the screen ends by itself 15 minutes past the operation's deadline by this computer's clock, whatever the Admin keeps saying", async () => {
+ const update = { kind: "update", since: 1_000_000, until: 1_000_000 + 18 * 60_000, expectedAt: 1_000_000 + 3 * 60_000 };
+ assert.equal(operationEndsAt(update, 1_000_000), update.until + OPERATION_GRACE_MS);
+ // A clock far ahead of the Admin's: never past its own span; far behind: still at most the span plus the grace.
+ assert.equal(operationEndsAt(update, update.until + 60 * 60_000), update.until + 60 * 60_000 + OPERATION_GRACE_MS);
+ assert.equal(operationEndsAt(update, 0), 18 * 60_000 + OPERATION_GRACE_MS);
+ const w = world({ cloud: { down: true }, state: connected({ operation: update }) });
+ const settle = async () => { for (let i = 0; i < 10; i++) await new Promise((resolve) => setImmediate(resolve)); };
+ const look = async () => { await w.home.show(); await settle(); };
+ w.clock = update.since;
+ await look();
+ assert.equal(w.home.view().screen, "working");
+ // The Admin goes on saying it, and its `since` even moves on with each read: the end was fixed when it was first shown.
+ await w.later(update.until - w.clock + OPERATION_GRACE_MS - 60_000);
+ w.state = connected({ operation: { ...update, since: w.clock, until: w.clock + 18 * 60_000 } });
+ await look();
+ assert.equal(w.home.view().screen, "working", "inside its hard end");
+ await w.later(2 * 60_000);
+ w.state = connected({ operation: { ...update, since: w.clock, until: w.clock + 18 * 60_000 } });
+ await look();
+ assert.equal(w.home.view().screen, "offline", "past it: the plain \"couldn't reach\", with Try again");
+ // Once the Cloud answers, its next operation is a new outage.
+ w.cloud.down = false;
+ w.state = connected();
+ await look();
+ assert.equal(w.went.at(-1)[1], CLOUD);
+ w.cloud.down = true;
+ w.url = "";
+ w.state = connected({ operation: { ...update, since: w.clock, until: w.clock + 18 * 60_000 } });
+ await look();
+ assert.equal(w.home.view().screen, "working", "a new outage");
});
test("another Cloud of the person's own being moved: its screen names it", async () => {
@@ -73,7 +110,7 @@ test("another Cloud of the person's own being moved: its screen names it", async
assert.deepEqual(w.home.view(), { screen: "working", operation: move, name: "Client A" });
});
-test("the Cloud's own page asks what has it down: the Admin's word for the place on screen only, read again when it is old", async () => {
+test("the Cloud's own page asks what has it down: the Admin's word for the place on screen only, read again when it is old, never while the Admin is failing", async () => {
const w = world({ state: { ...connected({ operation: UPDATE }), verifiedAt: 1_000_000 } });
await w.home.refresh();
assert.deepEqual(await w.home.operation(), UPDATE);
@@ -86,6 +123,26 @@ test("the Cloud's own page asks what has it down: the Admin's word for the place
stale.refreshed = { ...connected({ operation: UPDATE }), verifiedAt: stale.clock };
assert.deepEqual(await stale.home.operation(), UPDATE);
assert.equal(stale.refreshes, 1);
+ // The Admin itself failing: the account's own retry wait is kept, however often the page asks.
+ const failing = world({ state: { ...connected(), verifiedAt: 1 } });
+ await failing.home.refresh();
+ failing.failingUntil = failing.clock + 30_000;
+ for (let i = 0; i < 3; i++) assert.equal(await failing.home.operation(), null);
+ assert.equal(failing.refreshes, 0);
+ failing.clock += 30_000;
+ await failing.home.operation();
+ assert.equal(failing.refreshes, 1, "read again once its wait is over");
const signedOut = world({ state: { status: "signed-out" } });
assert.equal(await signedOut.home.operation(), null);
});
+
+test("a team's Cloud's own page is told its name with what has it down", async () => {
+ const move = { kind: "move", since: 1_000_000, until: 4_600_000 };
+ const w = world({ state: { ...connected(), teams: [ACME], clouds: [{ ...CLIENT_A, id: "t-acme", name: "Acme", teamId: ACME.id, origin: TEAM, operation: move }], verifiedAt: 1_000_000 } });
+ await w.home.show({ place: { team: ACME.id } });
+ assert.deepEqual(await w.home.operation(), { ...move, name: "Acme" });
+});
+
+test("a rollback is its own kind", () => {
+ assert.deepEqual(parseCloudOperation({ kind: "rollback", since: 5, until: 9, expectedAt: 7 }), { kind: "rollback", since: 5, until: 9, expectedAt: 7 });
+});
diff --git a/electron/fixtures/home-window-world.mjs b/electron/fixtures/home-window-world.mjs
index 73f855ab18..d9842baac0 100644
--- a/electron/fixtures/home-window-world.mjs
+++ b/electron/fixtures/home-window-world.mjs
@@ -49,6 +49,8 @@ export function world({ clean = null, journal = done(), marker = null, state = c
state: () => w.state,
/** The session read again (cloud-account.mjs `refresh`): `w.refreshed`, when set, is what the Admin says then. */
refresh: async () => { w.refreshes++; if (w.refreshed) w.state = w.refreshed; return w.state; },
+ /** While the Admin's session read keeps failing (`w.failingUntil`), when the account tries it again by itself. */
+ failingUntil: () => w.failingUntil ?? 0,
power: () => w.power,
powerOf: (origin) => (origin === CLOUD ? w.power : (w.state?.clouds ?? []).find((cloud) => cloud.origin === origin)?.power ?? null),
async wakeHome() { w.wakes++; await w.cloud.wakeGate; if (w.cloud.wakes) w.power = { ...w.power, state: "awake" }; return "awake"; },
diff --git a/electron/home-window.d.mts b/electron/home-window.d.mts
index 3879680e5f..29806d1a88 100644
--- a/electron/home-window.d.mts
+++ b/electron/home-window.d.mts
@@ -36,8 +36,9 @@ export interface HomeBridge {
repair(): Promise<void>;
/** My Cloud's own page only: the window reloaded it just now for its newer version. */
updating?: boolean;
- /** The place's own page only (absent elsewhere, and in an app before it): what the Admin says has it down now, or null. */
- operation?(): Promise<import("./cloud-operation.mjs").CloudOperation | null>;
+ /** The place's own page only (absent elsewhere, and in an app before it): what the Admin says has it down now, with a team's or
+ * other Cloud's `name`, or null. */
+ operation?(): Promise<(import("./cloud-operation.mjs").CloudOperation & { name?: string }) | null>;
}
export type Home = ({ kind: "computer" } | { kind: "cloud"; origin: string } | { kind: "signin"; other?: true })
@@ -113,7 +114,7 @@ export interface HomeWindow {
navigated(url: string): void;
failed(url: string, code?: number): boolean;
homePage(event: unknown): boolean;
- operation(): Promise<import("./cloud-operation.mjs").CloudOperation | null>;
+ operation(): Promise<(import("./cloud-operation.mjs").CloudOperation & { name?: string }) | null>;
/** Asked once by the home page as it loads: the window reloaded it just now for its newer version. */
updating(event: unknown): boolean;
screenPage(event: unknown): boolean;
diff --git a/electron/home-window.mjs b/electron/home-window.mjs
index 467087a5d5..1b34714ed9 100644
--- a/electron/home-window.mjs
+++ b/electron/home-window.mjs
@@ -10,7 +10,7 @@
// Admin's team pairing (its claims are the Admin's), never an address a page supplied.
import { cloudHomeConnectUrl, cloudSetupOf, cloudUnreachableCause, cloudUnreachableText, machineSetup, readyCloudOrigin } from "./cloud-home.mjs";
import { cloudMachine, cloudState, myCloudOf, otherOwnClouds, ownCloud } from "./cloud-list.mjs";
-import { cloudOperationAt, OPERATION_FRESH_MS, OPERATION_REFRESH_MS } from "./cloud-operation.mjs";
+import { cloudOperationAt, createOperationOutages, OPERATION_FRESH_MS, OPERATION_REFRESH_MS } from "./cloud-operation.mjs";
import { asleepAnswer, BACKGROUND_HEADERS, openSleepingCloud, SIGNED_IN_MS } from "./cloud-power.mjs";
import nativeText from "./native-text.cjs";
import { createPairWait, nameNotFound } from "./home-pairing.mjs";
@@ -256,6 +256,9 @@ export function createHomeWindow(deps) {
* `naming`: since when, and how often, a brand-new My Cloud's name was not found. */
let asked = null, naming = null;
const clock = createReadyClock({ store: readyStore, now });
+ /** Each place's outage while this computer's screen says what has it down: it ends by itself past its hard end
+ * (cloud-operation.mjs `operationEndsAt`), and starts over once the place answers. */
+ const outages = createOperationOutages(now);
/** The place the window was last sent to (My Cloud, or a team's Cloud), and the one being opened now. */
let shown = null, opening = null, renewal = null, updatingAt = null;
/** The window shows a place or this computer's screen, which this computer's page replaces once home is here again. */
@@ -358,9 +361,9 @@ export function createHomeWindow(deps) {
goScreen();
}
- /** The operation the Admin says has the place being opened down now (an update, resize, move, restore or start:
- * cloud-operation.mjs), else null. */
- const operationNow = () => cloudOperationAt(state(), otherPlace(opening) ? opening.origin : cloudOrigin());
+ /** The operation the Admin says has the place being opened down now (an update, its rollback, a resize, a move, a restore or
+ * a start: cloud-operation.mjs), else null; null too past its outage's hard end, whatever the Admin says then. */
+ const operationNow = () => { const origin = otherPlace(opening) ? opening.origin : cloudOrigin(); return origin ? outages.shown(origin, cloudOperationAt(state(), origin)) : null; };
/** While an operation of the Admin's own has the place down, this computer's screen says what it is, never "can't be
* reached" or a plan problem, and looks again by itself (the session is read every OPERATION_REFRESH_MS meanwhile). True
* when it showed that screen. */
@@ -503,8 +506,9 @@ export function createHomeWindow(deps) {
// My Cloud the session's list says isn't running: its own screen, never its address, and nothing to look again for.
const listed = place.kind === "cloud" ? cloudScreen(myListed()) : null;
if (listed && NOT_RUNNING.has(listed.screen)) { clearRetry(); return toScreen(listed); }
- // A Cloud the Admin is starting again (a resume) reads as its setup or a failure otherwise: say what it is.
- if (machine?.operation && machine.status !== "ready" && !machine.hold && working(token)) return;
+ // A Cloud the Admin is starting again (a resume) reads as its setup otherwise: say what it is. Never a failed one: it keeps
+ // its own screen and its Try again.
+ if (machine?.operation && machine.status === "provisioning" && !machine.hold && working(token)) return;
if (machine && (PLAN_PROBLEMS.has(machine.status) || (place.kind === "team" && machine.hold))) {
toScreen(planScreen(PLAN_PROBLEMS.has(machine.status) ? machine.status : "stopped", place)); later(); return;
}
@@ -522,6 +526,7 @@ export function createHomeWindow(deps) {
if (naming) await forgetNames();
const look = await answers(origin);
waits.looked(origin, look);
+ if (look === "yes") outages.clear(origin);
if (look === "no" || look === "failing") return unreachable(place, token);
if (look === "asleep" && otherPlace(place)) return offline(token);
if (look === "asleep") { power.hold(); asleep = true; if (wanted(token)) say("waking"); }
@@ -555,6 +560,7 @@ export function createHomeWindow(deps) {
new Promise((done) => { slow = timers.set(() => done(false), OPEN_MS); })]);
timers.clear(slow);
if (!loaded) { log(`home: ${otherPlace(place) ? place.name : "My Cloud"} didn't load in ${OPEN_MS / 1000} s`); return offline(token); }
+ outages.clear(origin);
if (place.kind === "cloud") { clearRenewal(); power.woke(); }
else if (place.kind === "team") renewLater(place, grant || !session?.expiresAt ? TEAM_RENEW_MS : session.expiresAt - now() - TEAM_RENEW_EARLY_MS);
else clearRenewal();
@@ -850,14 +856,18 @@ export function createHomeWindow(deps) {
},
/** `event` came from the shown place's own page in this window (My Cloud's while it is home, or a team's Cloud's). */
homePage,
- /** The operation the Admin says has the place on screen down now (cloud-operation.mjs), else null: its own page asks while
- * its live stream is down, so it can say "Updating My Cloud" instead of "unable to connect". The session is read again
- * first when the last read is OPERATION_FRESH_MS old or more (the Admin is the one that knows; the place doesn't answer). */
+ /** The operation the Admin says has the place on screen down now (cloud-operation.mjs), with a team's or other Cloud's
+ * `name`, else null: its own page asks while its live stream is down (backing off by itself), so it can say "Updating My
+ * Cloud" instead of "unable to connect"; the page keeps its own hard end. The session is read again first when the last
+ * read is OPERATION_FRESH_MS old or more (the Admin is the one that knows; the place doesn't answer), never while the Admin
+ * itself is failing: the account's own retry wait is kept then (cloud-account.mjs `failingUntil`). */
async operation() {
const origin = placeOrigin(), current = state();
if (!origin || current?.status !== "connected") return null;
- if (!(now() - (current.verifiedAt ?? 0) < OPERATION_FRESH_MS)) await Promise.resolve(account()?.refresh?.()).catch(() => {});
- return cloudOperationAt(state(), origin);
+ const client = account(), failing = Number(client?.failingUntil?.() ?? 0);
+ if (!(now() - (current.verifiedAt ?? 0) < OPERATION_FRESH_MS) && !(failing > now())) await Promise.resolve(client?.refresh?.()).catch(() => {});
+ const operation = cloudOperationAt(state(), origin), name = otherPlace(shown) && shown.origin === origin ? shown.name : null;
+ return operation ? { ...operation, ...(name ? { name } : {}) } : null;
},
updating(event) {
if (!homePage(event)) return false;
diff --git a/src/components/ChatErrorBanner.tsx b/src/components/ChatErrorBanner.tsx
index 0d8daafc7b..511329be7a 100644
--- a/src/components/ChatErrorBanner.tsx
+++ b/src/components/ChatErrorBanner.tsx
@@ -1,6 +1,6 @@
import { useEffect, useState } from "react";
import { X } from "lucide-react";
-import { cloudWorkNow, cloudWorkTitle, onCloudWork } from "@/lib/cloud-work";
+import { cloudWorkNow, cloudWorkTitle, noteCloudUnanswered, onCloudWork, type CloudWork } from "@/lib/cloud-work";
import { t } from "@/lib/i18n";
import { plainErrorLine } from "@/lib/plain-error";
import type { AppState } from "@/state/store";
@@ -26,17 +26,37 @@ export function ChatNotice({ notice }: { notice: AppState["notice"] }) {
/** A send that failed because the Cloud didn't answer: while an operation of ours has it down, that is expected, not an error. */
const NOT_ANSWERED = /Failed to fetch|NetworkError|Load failed|fetch failed|ECONN(?:RESET|REFUSED|ABORTED)|socket hang up|\b50[234]\b|bad gateway|service unavailable|timed? ?out/i;
+/**
+ * What the chat's error line is for `message`: `calm` while an operation of ours has the Cloud down and the send just didn't
+ * reach it; `gone` for the same message once that is over (`calmFor`: the message last said calmly), which goes away rather
+ * than turn into a red "couldn't reach" now that the Cloud is back; `error` otherwise; `none` with no message.
+ */
+export function chatErrorShape(message: string | null, work: CloudWork | null, calmFor: string | null): "none" | "calm" | "gone" | "error" {
+ if (!message) return "none";
+ if (work && NOT_ANSWERED.test(message)) return "calm";
+ return message === calmFor ? "gone" : "error";
+}
+
export function ChatErrorBanner({ message, onDismiss }: { message: string | null; onDismiss: () => void }) {
const member = useTeamPeople()?.admin === false;
const [work, setWork] = useState(cloudWorkNow);
+ const [calmFor, setCalmFor] = useState<string | null>(null);
// Follows the window's word on an operation of ours (lib/cloud-work.ts), which lives outside React.
useEffect(() => onCloudWork(setWork), []);
- if (!message) return null;
- if (work && NOT_ANSWERED.test(message)) {
+ const shape = chatErrorShape(message, work, calmFor);
+ // A send that didn't reach the Cloud: the page asks what has it down now. Said calmly once: kept so that it goes away, rather
+ // than turn red, when the Cloud is back.
+ useEffect(() => {
+ if (message && NOT_ANSWERED.test(message)) noteCloudUnanswered();
+ if (shape === "calm") setCalmFor(message);
+ if (shape === "gone") { setCalmFor(null); onDismiss(); }
+ }, [shape, message, onDismiss]);
+ if (!message || shape === "none" || shape === "gone") return null;
+ if (shape === "calm" && work) {
return (
<div className="w-full px-5">
<div role="status" data-chat-cloud-work className="mb-2 flex items-start gap-2 rounded-lg border border-hairline/40 bg-panel px-3 py-2 text-[13px] text-ink-secondary">
- <p className="min-w-0 flex-1 break-words">{`${cloudWorkTitle(work)}. ${t("cloudWork.notSent")}`}</p>
+ <p className="min-w-0 flex-1 break-words">{`${cloudWorkTitle(work, work.name ?? null)}. ${t("cloudWork.notSent")}`}</p>
<button type="button" onClick={onDismiss} aria-label={t("chat.error.dismiss")} title={t("chat.error.dismiss")} className="shrink-0 rounded p-0.5 hover:bg-raised">
<X size={13} />
</button>
diff --git a/src/components/LiveConnectionStrip.cloud-work.test.ts b/src/components/LiveConnectionStrip.cloud-work.test.ts
new file mode 100644
index 0000000000..37a73bcbfd
--- /dev/null
+++ b/src/components/LiveConnectionStrip.cloud-work.test.ts
@@ -0,0 +1,77 @@
+// @vitest-environment happy-dom
+import { act, createElement } from "react";
+import { createRoot, type Root } from "react-dom/client";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+// The strip's own session check at 4 s and 20 s reads the page's server: not here.
+vi.mock("@/lib/session-ended", () => ({ noteRefusedRequest: () => {} }));
+
+import { endCloudWork, noteCloudUnanswered } from "@/lib/cloud-work";
+import { setLocale } from "@/lib/i18n";
+import { LiveConnectionStrip, RECONNECTING_AFTER_MS } from "./LiveConnectionStrip";
+
+// The Cloud's own page asks the window what has its Cloud down only once its live stream has been down long enough to say so,
+// then less and less often: a page load or a short dropout costs the Admin nothing.
+(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+const MINUTE = 60_000;
+let host: HTMLDivElement, root: Root | null = null;
+const asks = vi.fn(async () => ({ kind: "update", since: Date.now() - 40_000, until: Date.now() + 17 * MINUTE, expectedAt: Date.now() + 2 * MINUTE }));
+
+beforeEach(() => {
+ vi.useFakeTimers();
+ setLocale("en");
+ asks.mockClear();
+ Object.assign(window, { ogb: { home: { operation: asks } } });
+ host = document.createElement("div");
+ document.body.append(host);
+ root = createRoot(host);
+});
+afterEach(async () => {
+ await act(async () => root?.unmount());
+ root = null; host.remove(); endCloudWork();
+ delete (window as { ogb?: unknown }).ogb;
+ vi.useRealTimers();
+});
+
+const show = (connected: boolean) => act(async () => root!.render(createElement(LiveConnectionStrip, { connected, hydrated: true })));
+const pass = (ms: number) => act(async () => { await vi.advanceTimersByTimeAsync(ms); });
+const strip = () => host.querySelector("[data-live-connection]");
+
+describe("asking what has the Cloud down", () => {
+ it("asks nothing on a page load or a dropout shorter than the strip's 4 s", async () => {
+ await show(false);
+ await pass(RECONNECTING_AFTER_MS - 1_000);
+ await show(true);
+ await pass(5 * MINUTE);
+ expect(asks).not.toHaveBeenCalled();
+ expect(strip()).toBeNull();
+ });
+
+ it("asks at 4 s, then after 10, 20, 40 and every 60 s; nothing more once the stream is back", async () => {
+ await show(true);
+ await show(false);
+ await pass(RECONNECTING_AFTER_MS - 1);
+ expect(asks).toHaveBeenCalledTimes(0);
+ await pass(1);
+ expect(asks).toHaveBeenCalledTimes(1);
+ expect(strip()?.getAttribute("data-live-connection")).toBe("working");
+ expect(strip()?.textContent).toBe("Updating My Cloud to the latest version. Back in a minute or two.");
+ const counts: number[] = [];
+ for (const wait of [10_000, 20_000, 40_000, 60_000, 60_000]) { await pass(wait - 1); counts.push(asks.mock.calls.length); await pass(1); counts.push(asks.mock.calls.length); }
+ expect(counts).toEqual([1, 2, 2, 3, 3, 4, 4, 5, 5, 6]);
+ await show(true);
+ expect(strip()).toBeNull();
+ await pass(5 * MINUTE);
+ expect(asks).toHaveBeenCalledTimes(6);
+ });
+
+ it("asks at once when a send got no answer while the stream is down", async () => {
+ await show(true);
+ await show(false);
+ await pass(1_000);
+ expect(asks).not.toHaveBeenCalled();
+ await act(async () => noteCloudUnanswered());
+ await pass(0);
+ expect(asks).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/src/components/LiveConnectionStrip.tsx b/src/components/LiveConnectionStrip.tsx
index e731baaa7b..d38467f99a 100644
--- a/src/components/LiveConnectionStrip.tsx
+++ b/src/components/LiveConnectionStrip.tsx
@@ -39,7 +39,8 @@ export function LiveConnectionStrip({ connected, hydrated }: { connected: boolea
const helpTimer = setTimeout(() => { setHelp(true); noteRefusedRequest(); }, CONNECTION_HELP_AFTER_MS);
return () => { clearTimeout(probe); clearTimeout(timer); clearTimeout(helpTimer); };
}, [connected, asleep, online]);
- const work = useCloudWork(!connected && !asleep && online);
+ // Asked only once the drop is long enough to say so (or a send got no answer), then less and less often (lib/cloud-work.ts).
+ const work = useCloudWork(!connected && !asleep && online, late);
const now = useNow(Boolean(work));
if (asleep) return null;
const notice = !online ? "offline" : !connected && work ? "working" : !connected && late && (hydrated || help) ? "reconnecting" : null;
diff --git a/src/lib/cloud-work.test.ts b/src/lib/cloud-work.test.ts
index 44a8a3f67c..f99d6c5821 100644
--- a/src/lib/cloud-work.test.ts
+++ b/src/lib/cloud-work.test.ts
@@ -1,10 +1,12 @@
import { createElement } from "react";
import { renderToStaticMarkup } from "react-dom/server";
-import { afterEach, beforeEach, describe, expect, it } from "vitest";
-import { ChatErrorBanner } from "@/components/ChatErrorBanner";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { ChatErrorBanner, chatErrorShape } from "@/components/ChatErrorBanner";
import { homeScreenText } from "@/components/HomeScreen";
import { setLocale, t } from "@/lib/i18n";
-import { cloudWorkLine, cloudWorkText, cloudWorkTitle, cloudWorkWhen, setCloudWork } from "./cloud-work";
+import en from "@/locales/en.json";
+import { OPERATION_GRACE_MS } from "../../electron/cloud-operation.mjs";
+import { cloudWorkLine, cloudWorkNow, cloudWorkText, cloudWorkTitle, cloudWorkWhen, endCloudWork, setCloudWork } from "./cloud-work";
// While an operation of the Admin's own has the person's Cloud down (electron/cloud-operation.mjs), every place that would say
// "can't be reached" says what is happening and when it is back, in plain words, with nothing to press.
@@ -12,7 +14,7 @@ const MINUTE = 60_000, AT = Date.parse("2026-11-25T03:10:00Z");
const update = { kind: "update", since: AT - 40_000, until: AT + 17 * MINUTE, expectedAt: AT + 2 * MINUTE };
beforeEach(() => setLocale("en"));
-afterEach(() => setCloudWork(null));
+afterEach(() => { endCloudWork(); vi.useRealTimers(); });
describe("the words", () => {
it("say what each operation is, for My Cloud or a Cloud by its name; a kind this app doesn't know is \"restarting\"", () => {
@@ -22,6 +24,15 @@ describe("the words", () => {
expect(cloudWorkTitle({ ...update, kind: "resize", bigger: true })).toBe("Giving My Cloud more power");
expect(cloudWorkTitle({ ...update, kind: "resize" })).toBe("Changing My Cloud's size for its plan");
expect(cloudWorkTitle(update, "Acme")).toBe("Updating Acme to the latest version");
+ // A rollback after a failed update is never "the latest version".
+ expect(cloudWorkTitle({ ...update, kind: "rollback" })).toBe("Putting My Cloud back to the version that worked");
+ expect(cloudWorkTitle({ ...update, kind: "rollback" }, "Acme")).toBe("Putting Acme back to the version that worked");
+ });
+
+ it("never claim bots' work is safe or starts again by itself", () => {
+ const said = Object.entries(en).filter(([key]) => key.startsWith("cloudWork.")).map(([, text]) => text);
+ for (const text of said) expect(text).not.toMatch(/\bsafe\b|starts again by itself|nothing (?:is|was) lost/i);
+ expect(t("cloudWork.bots")).toBe("Bots pick up where they can once it's back.");
});
it("say when it is back as honestly as the Admin knows: its usual time, then a little longer, then that we've been told", () => {
@@ -41,13 +52,38 @@ describe("the words", () => {
it("this computer's screen: the title, when it is back, that the window reconnects, and one line about the bots; nothing to press", () => {
const text = homeScreenText({ screen: "working", operation: update } as never, AT);
expect(text).toEqual({ title: "Updating My Cloud to the latest version", body: "Back in a minute or two. This window reconnects by itself.",
- reason: "Unfinished bot work starts again by itself once it's back.", action: null, busy: true });
+ reason: "Bots pick up where they can once it's back.", action: null, busy: true });
expect(homeScreenText({ screen: "working", operation: update, name: "Acme" } as never, AT).title).toBe("Updating Acme to the latest version");
for (const words of Object.values(text)) expect(String(words)).not.toMatch(/can't|unable|error|Try again|Fly|Hetzner/i);
});
- it("the strip on the Cloud's own page is one line", () => {
+ it("the strip on the Cloud's own page is one line, naming a team's Cloud by its name", () => {
expect(cloudWorkLine(update, AT)).toBe("Updating My Cloud to the latest version. Back in a minute or two.");
+ expect(cloudWorkLine({ ...update, name: "Acme" }, AT)).toBe("Updating Acme to the latest version. Back in a minute or two.");
+ });
+
+ it("\"longer than usual\" only past the usual time the Admin sent; a long usual time names when it is expected instead", () => {
+ // A Hetzner update: its usual time is the Admin's own 20-minute window, so at 13 minutes it is not late.
+ const hetzner = { kind: "update", since: AT, until: AT + 30 * MINUTE, expectedAt: AT + 20 * MINUTE };
+ expect(cloudWorkWhen(hetzner, AT + 13 * MINUTE)).toMatch(/^Expected back around/);
+ expect(cloudWorkWhen(hetzner, AT + 20 * MINUTE)).toBe("Taking a little longer than usual.");
+ });
+
+ it("the page's words end by themselves 15 minutes past the deadline, by this computer's clock since first shown", () => {
+ vi.useFakeTimers();
+ vi.setSystemTime(update.since);
+ setCloudWork(update);
+ expect(cloudWorkNow()).toEqual(update);
+ vi.setSystemTime(update.until + OPERATION_GRACE_MS - 1);
+ // The window keeps saying it, its `since` moving on: the end was fixed when it was first shown.
+ setCloudWork({ ...update, since: Date.now(), until: Date.now() + 18 * MINUTE });
+ expect(cloudWorkNow()).not.toBeNull();
+ vi.setSystemTime(update.until + OPERATION_GRACE_MS);
+ expect(cloudWorkNow()).toBeNull();
+ // The stream back: the next operation is a new outage.
+ endCloudWork();
+ setCloudWork({ ...update, since: Date.now(), until: Date.now() + 18 * MINUTE });
+ expect(cloudWorkNow()).not.toBeNull();
});
it("every language has every sentence, with its placeholders", () => {
@@ -55,6 +91,8 @@ describe("the words", () => {
setLocale(locale);
expect(cloudWorkTitle(update), locale).not.toBe("Updating My Cloud to the latest version");
expect(cloudWorkTitle(update, "Acme"), locale).toContain("Acme");
+ expect(cloudWorkTitle({ ...update, kind: "rollback" }, "Acme"), locale).toContain("Acme");
+ expect(cloudWorkTitle({ ...update, kind: "rollback" }), locale).not.toBe(cloudWorkTitle(update));
expect(t("cloudWork.backAround", { time: "15:40" }), locale).toContain("15:40");
}
});
@@ -69,7 +107,18 @@ describe("a send that failed while the Cloud is being updated", () => {
expect(calm).not.toContain("text-danger");
const other = renderToStaticMarkup(createElement(ChatErrorBanner, { message: "forbidden: not yours", onDismiss: () => {} }));
expect(other).toContain("text-danger");
- setCloudWork(null);
+ setCloudWork({ ...update, name: "Acme" });
+ expect(renderToStaticMarkup(createElement(ChatErrorBanner, { message: "TypeError: Failed to fetch", onDismiss: () => {} }))).toContain("Updating Acme to the latest version.");
+ endCloudWork();
expect(renderToStaticMarkup(createElement(ChatErrorBanner, { message: "TypeError: Failed to fetch", onDismiss: () => {} }))).toContain("text-danger");
});
+
+ it("goes away once the Cloud is back, never turning into the red \"couldn't reach\" line", () => {
+ const failed = "TypeError: Failed to fetch";
+ expect(chatErrorShape(failed, update, null)).toBe("calm");
+ expect(chatErrorShape(failed, null, failed), "the same message, said calmly before").toBe("gone");
+ expect(chatErrorShape(failed, null, null), "never said calmly: as before").toBe("error");
+ expect(chatErrorShape("forbidden: not yours", update, null)).toBe("error");
+ expect(chatErrorShape(null, update, failed)).toBe("none");
+ });
});
diff --git a/src/lib/cloud-work.ts b/src/lib/cloud-work.ts
index b21e1b6bdf..9416540c66 100644
--- a/src/lib/cloud-work.ts
+++ b/src/lib/cloud-work.ts
@@ -1,7 +1,7 @@
import { useEffect, useState } from "react";
import { activeLocale, t } from "@/lib/i18n";
import type { LocaleKey } from "@/locales";
-import type { CloudOperation } from "../../electron/cloud-operation.mjs";
+import { createOperationOutages, OPERATION_ASK_MS, type CloudOperation } from "../../electron/cloud-operation.mjs";
// What the person reads while an operation of the Admin's own has their Cloud down (electron/cloud-operation.mjs): what is
// happening and when it is usually back, never "can't be reached". This computer's screen (HomeScreen) shows it whole; the
@@ -10,11 +10,12 @@ import type { CloudOperation } from "../../electron/cloud-operation.mjs";
const MINUTE = 60_000;
/** A typical wait this short reads "a minute or two"; up to SOON_MAX_MS, "a few minutes"; longer, the time it is expected. */
const SOON_MS = 3 * MINUTE, SOON_MAX_MS = 10 * MINUTE;
-/** The Cloud's own page asks the window this often while its live stream is down. */
-export const CLOUD_WORK_ASK_MS = 10_000;
+/** What the window says has this Cloud down, and the name of a team's or other Cloud (absent for My Cloud). */
+export type CloudWork = CloudOperation & { name?: string };
const TITLES: Record<string, readonly [LocaleKey, LocaleKey]> = {
update: ["cloudWork.update", "cloudWork.updateNamed"],
+ rollback: ["cloudWork.rollback", "cloudWork.rollbackNamed"],
resize: ["cloudWork.resize", "cloudWork.resizeNamed"],
resizeUp: ["cloudWork.resizeUp", "cloudWork.resizeUpNamed"],
move: ["cloudWork.move", "cloudWork.moveNamed"],
@@ -51,22 +52,46 @@ export function cloudWorkText(operation: CloudOperation, now = Date.now(), name:
return { title: cloudWorkTitle(operation, name), backup: operation.backup && !late ? t("cloudWork.backup") : null, when: cloudWorkWhen(operation, now), bots: t("cloudWork.bots") };
}
-/** The strip's one line on the Cloud's own page: "Updating My Cloud to the latest version. Back in a minute or two." */
-export const cloudWorkLine = (operation: CloudOperation, now = Date.now()) => `${cloudWorkTitle(operation)}. ${cloudWorkWhen(operation, now)}`;
+/** The strip's one line on the Cloud's own page: "Updating My Cloud to the latest version. Back in a minute or two.", with a
+ * team's or other Cloud's own name. */
+export const cloudWorkLine = (operation: CloudWork, now = Date.now()) => `${cloudWorkTitle(operation, operation.name ?? null)}. ${cloudWorkWhen(operation, now)}`;
-let current: CloudOperation | null = null;
-const listeners = new Set<(operation: CloudOperation | null) => void>();
-/** What the window last said has this Cloud down, while the page's live stream is down; null otherwise. */
-export const cloudWorkNow = () => current;
-export function setCloudWork(next: CloudOperation | null) {
- if (next === current || (next && current && next.kind === current.kind && next.since === current.since && next.until === current.until && next.expectedAt === current.expectedAt)) return;
+const PAGE = "page";
+/** This page's outage: from the first time it shows what has its Cloud down until its live stream is back. Past its hard end
+ * (electron/cloud-operation.mjs `operationEndsAt`) it says nothing more, whatever the window says, and the strip is the plain
+ * "reconnecting" again. */
+const outages = createOperationOutages(() => Date.now());
+let current: CloudWork | null = null;
+let unanswered = false;
+const listeners = new Set<(operation: CloudWork | null) => void>();
+const unansweredListeners = new Set<() => void>();
+/** What the window last said has this Cloud down, while the page's live stream is down and its outage's hard end hasn't
+ * passed; null otherwise. */
+export const cloudWorkNow = (): CloudWork | null => (current && outages.shown(PAGE, current) ? current : null);
+/** When this page's outage ends by itself (epoch ms), or null while none is shown. */
+export const cloudWorkEndsAt = () => (current ? outages.endsAt(PAGE) : null);
+export function setCloudWork(next: CloudWork | null) {
+ if (next) outages.shown(PAGE, next);
+ if (next === current || (next && current && next.kind === current.kind && next.since === current.since && next.until === current.until && next.expectedAt === current.expectedAt && next.name === current.name)) return;
current = next;
- for (const listener of listeners) listener(next);
+ for (const listener of listeners) listener(cloudWorkNow());
}
-export function onCloudWork(listener: (operation: CloudOperation | null) => void) {
+/** The live stream is back: the Cloud answers, so its next operation is a new outage. */
+export function endCloudWork() {
+ outages.clear(PAGE);
+ setCloudWork(null);
+}
+export function onCloudWork(listener: (operation: CloudWork | null) => void) {
listeners.add(listener);
return () => { listeners.delete(listener); };
}
+/** Something this page sent got no answer from its Cloud (a send that failed to reach it): while its live stream is down, the
+ * page asks what has it down at once instead of after the strip's own wait. */
+export function noteCloudUnanswered() {
+ if (unanswered) return;
+ unanswered = true;
+ for (const listener of unansweredListeners) listener();
+}
/** The window's bridge on the Cloud's own page (absent in a browser, on another server, and in an app before it). */
const ask = () => {
@@ -74,25 +99,53 @@ const ask = () => {
return typeof operation === "function" ? operation : null;
};
+/** How long the page waits before its `n`th ask after the first (n from 0): OPERATION_ASK_MS, 60 s from then on. */
+export const cloudWorkAskDelay = (n: number) => OPERATION_ASK_MS[Math.min(n, OPERATION_ASK_MS.length - 1)]!;
+
/**
- * While `down` (the page's live stream is down), what the window says has the Cloud down, asked now and every
- * CLOUD_WORK_ASK_MS; null otherwise, and at once when the stream is back. Shared through `cloudWorkNow` with the chat's
- * error line. A page with no bridge (a browser) says what it says today.
+ * While `down` (the page's live stream is down), what the window says has the Cloud down; null otherwise, at once when the stream
+ * is back, and past this outage's hard end. It asks only once the stream has been down long enough to say so (`late`: the strip's
+ * own 4 s) or once a send got no answer (`noteCloudUnanswered`), so a page load or a short dropout asks nothing; then again after
+ * 10, 20, 40 and every 60 s. Shared through `cloudWorkNow` with the chat's error line. A page with no bridge (a browser) says
+ * what it says today.
*/
-export function useCloudWork(down: boolean): CloudOperation | null {
- const [operation, setOperation] = useState<CloudOperation | null>(cloudWorkNow);
- // Keeps this page's copy in step with the window's word, which lives outside React.
+export function useCloudWork(down: boolean, late: boolean): CloudWork | null {
+ const [operation, setOperation] = useState<CloudWork | null>(cloudWorkNow);
+ const [early, setEarly] = useState(unanswered);
+ // Keeps this page's copy in step with the window's word and a send that got no answer, which live outside React.
useEffect(() => onCloudWork(setOperation), []);
+ useEffect(() => {
+ const heard = () => setEarly(true);
+ unansweredListeners.add(heard);
+ return () => { unansweredListeners.delete(heard); };
+ }, []);
+ // A send that got no answer counts for this drop only; the stream back ends the outage.
+ useEffect(() => {
+ unanswered = false;
+ setEarly(false);
+ if (!down) endCloudWork();
+ }, [down]);
+ const asking = down && (late || early) && Boolean(ask());
useEffect(() => {
const read = ask();
- if (!down || !read) { setCloudWork(null); return; }
- let alive = true;
- const look = () => { void read().then((next) => { if (alive) setCloudWork(next ?? null); }, () => {}); };
+ if (!asking || !read) return;
+ let alive = true, timer: ReturnType<typeof setTimeout> | null = null, asked = 0;
+ const look = () => {
+ void read().then((next) => { if (alive) setCloudWork((next as CloudWork | null) ?? null); }, () => {});
+ timer = setTimeout(look, cloudWorkAskDelay(asked++));
+ };
look();
- const timer = setInterval(look, CLOUD_WORK_ASK_MS);
- return () => { alive = false; clearInterval(timer); };
- }, [down]);
- return operation;
+ return () => { alive = false; if (timer) clearTimeout(timer); };
+ }, [asking]);
+ // The hard end: the words go by themselves when it passes, with nothing more asked of the window.
+ const [, setEnded] = useState(0);
+ const endsAt = operation ? cloudWorkEndsAt() : null;
+ useEffect(() => {
+ if (endsAt === null) return;
+ const timer = setTimeout(() => setEnded((n) => n + 1), Math.max(0, endsAt - Date.now()));
+ return () => clearTimeout(timer);
+ }, [endsAt]);
+ return operation && cloudWorkNow() ? operation : null;
}
/** Re-renders every `everyMs` while `on`, so words that depend on the time ("taking longer than usual") change by themselves. */
diff --git a/src/locales/de.json b/src/locales/de.json
index 9243852738..c7cc8c5898 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -735,6 +735,8 @@
"cloudHome.waking": "Die Cloud wird geweckt…",
"cloudWork.update": "My Cloud wird auf die neueste Version aktualisiert",
"cloudWork.updateNamed": "{name} wird auf die neueste Version aktualisiert",
+ "cloudWork.rollback": "My Cloud wird auf die Version zurückgesetzt, die funktioniert hat",
+ "cloudWork.rollbackNamed": "{name} wird auf die Version zurückgesetzt, die funktioniert hat",
"cloudWork.resizeUp": "My Cloud bekommt mehr Leistung",
"cloudWork.resizeUpNamed": "{name} bekommt mehr Leistung",
"cloudWork.resize": "Die Größe von My Cloud wird an den Tarif angepasst",
@@ -757,7 +759,7 @@
"cloudWork.longer": "Dauert etwas länger als üblich.",
"cloudWork.late": "Das dauert länger als üblich, und wir wurden benachrichtigt.",
"cloudWork.reconnects": "Dieses Fenster verbindet sich von selbst neu.",
- "cloudWork.bots": "Unerledigte Arbeit der Bots startet von selbst neu, sobald es zurück ist.",
+ "cloudWork.bots": "Die Bots machen dort weiter, wo sie können, sobald es zurück ist.",
"cloudWork.notSent": "Deine Nachricht wurde nicht gesendet und steht noch im Eingabefeld.",
"cloudHome.unreachableHost": "Unser Hosting-Anbieter startet den Rechner neu, auf dem die Cloud läuft. Die Cloud und ihre Dateien sind sicher, und sie kommt von selbst zurück, meist innerhalb von etwa 20 Minuten.",
"cloudHome.unreachable": "Die Cloud antwortet seit ein paar Minuten nicht. Es ging nichts verloren, und wir wurden benachrichtigt.",
diff --git a/src/locales/en.json b/src/locales/en.json
index 656a59b283..aa897b8812 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -1677,6 +1677,8 @@
"cloudHome.waking": "Waking the Cloud…",
"cloudWork.update": "Updating My Cloud to the latest version",
"cloudWork.updateNamed": "Updating {name} to the latest version",
+ "cloudWork.rollback": "Putting My Cloud back to the version that worked",
+ "cloudWork.rollbackNamed": "Putting {name} back to the version that worked",
"cloudWork.resizeUp": "Giving My Cloud more power",
"cloudWork.resizeUpNamed": "Giving {name} more power",
"cloudWork.resize": "Changing My Cloud's size for its plan",
@@ -1699,7 +1701,7 @@
"cloudWork.longer": "Taking a little longer than usual.",
"cloudWork.late": "This is taking longer than usual, and we've been told.",
"cloudWork.reconnects": "This window reconnects by itself.",
- "cloudWork.bots": "Unfinished bot work starts again by itself once it's back.",
+ "cloudWork.bots": "Bots pick up where they can once it's back.",
"cloudWork.notSent": "Your message wasn't sent and is still in the box.",
"cloudHome.unreachableHost": "Our hosting provider is restarting the machine the Cloud runs on. The Cloud and its files are safe, and it comes back on its own, usually within about 20 minutes.",
"cloudHome.unreachable": "The Cloud hasn't answered for a few minutes. Nothing was lost, and we've been told.",
diff --git a/src/locales/es.json b/src/locales/es.json
index 392c418535..0f34086e20 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -1039,6 +1039,8 @@
"cloudHome.waking": "Despertando la Cloud…",
"cloudWork.update": "Actualizando My Cloud a la última versión",
"cloudWork.updateNamed": "Actualizando {name} a la última versión",
+ "cloudWork.rollback": "Devolviendo My Cloud a la versión que funcionaba",
+ "cloudWork.rollbackNamed": "Devolviendo {name} a la versión que funcionaba",
"cloudWork.resizeUp": "Dando más potencia a My Cloud",
"cloudWork.resizeUpNamed": "Dando más potencia a {name}",
"cloudWork.resize": "Ajustando el tamaño de My Cloud a su plan",
@@ -1061,7 +1063,7 @@
"cloudWork.longer": "Está tardando un poco más de lo normal.",
"cloudWork.late": "Está tardando más de lo normal y ya nos han avisado.",
"cloudWork.reconnects": "Esta ventana se vuelve a conectar sola.",
- "cloudWork.bots": "El trabajo sin terminar de los bots vuelve a empezar solo en cuanto vuelva.",
+ "cloudWork.bots": "Los bots siguen donde puedan en cuanto vuelva.",
"cloudWork.notSent": "Tu mensaje no se envió y sigue en el cuadro.",
"cloudHome.unreachableHost": "Nuestro proveedor de hosting está reiniciando la máquina en la que funciona la Cloud. La Cloud y sus archivos están a salvo, y volverá automáticamente, normalmente en unos 20 minutos.",
"cloudHome.unreachable": "La Cloud lleva unos minutos sin responder. No se perdió nada y ya estamos avisados.",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index 0cbdb473c5..4553522841 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -519,6 +519,8 @@
"cloudHome.waking": "Réveil du Cloud…",
"cloudWork.update": "Mise à jour de My Cloud vers la dernière version",
"cloudWork.updateNamed": "Mise à jour de {name} vers la dernière version",
+ "cloudWork.rollback": "Retour de My Cloud à la version qui fonctionnait",
+ "cloudWork.rollbackNamed": "Retour de {name} à la version qui fonctionnait",
"cloudWork.resizeUp": "My Cloud reçoit plus de puissance",
"cloudWork.resizeUpNamed": "{name} reçoit plus de puissance",
"cloudWork.resize": "Ajustement de la taille de My Cloud à son forfait",
@@ -541,7 +543,7 @@
"cloudWork.longer": "C'est un peu plus long que d'habitude.",
"cloudWork.late": "C'est plus long que d'habitude, et nous avons été prévenus.",
"cloudWork.reconnects": "Cette fenêtre se reconnecte toute seule.",
- "cloudWork.bots": "Le travail inachevé des bots reprend tout seul dès son retour.",
+ "cloudWork.bots": "Les bots reprennent là où ils le peuvent dès son retour.",
"cloudWork.notSent": "Votre message n'a pas été envoyé et est toujours dans le champ de saisie.",
"cloudHome.unreachableHost": "Notre hébergeur redémarre la machine sur laquelle tourne le Cloud. Le Cloud et ses fichiers sont en sécurité, et il revient tout seul, en général en 20 minutes environ.",
"cloudHome.unreachable": "Le Cloud ne répond plus depuis quelques minutes. Rien n'a été perdu, et nous avons été prévenus.",
diff --git a/src/locales/hi.json b/src/locales/hi.json
index e4ad87283f..8cc36524c4 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -517,6 +517,8 @@
"cloudHome.waking": "Cloud जगाया जा रहा है…",
"cloudWork.update": "My Cloud को नवीनतम संस्करण पर अपडेट किया जा रहा है",
"cloudWork.updateNamed": "{name} को नवीनतम संस्करण पर अपडेट किया जा रहा है",
+ "cloudWork.rollback": "My Cloud को उस संस्करण पर वापस लाया जा रहा है जो ठीक चल रहा था",
+ "cloudWork.rollbackNamed": "{name} को उस संस्करण पर वापस लाया जा रहा है जो ठीक चल रहा था",
"cloudWork.resizeUp": "My Cloud को और ताकत दी जा रही है",
"cloudWork.resizeUpNamed": "{name} को और ताकत दी जा रही है",
"cloudWork.resize": "My Cloud का आकार उसके प्लान के अनुसार बदला जा रहा है",
@@ -539,7 +541,7 @@
"cloudWork.longer": "सामान्य से थोड़ा ज़्यादा समय लग रहा है।",
"cloudWork.late": "इसमें सामान्य से ज़्यादा समय लग रहा है, और हमें सूचना मिल गई है।",
"cloudWork.reconnects": "यह विंडो अपने-आप फिर से जुड़ जाएगी।",
- "cloudWork.bots": "बॉट्स का अधूरा काम वापस आते ही अपने-आप फिर से शुरू हो जाता है।",
+ "cloudWork.bots": "वापस आते ही बॉट्स जहाँ तक हो सके वहीं से आगे बढ़ते हैं।",
"cloudWork.notSent": "आपका संदेश नहीं भेजा गया और अभी भी बॉक्स में है।",
"cloudHome.unreachableHost": "हमारा होस्टिंग प्रदाता उस मशीन को रीस्टार्ट कर रहा है जिस पर Cloud चलता है। Cloud और उसकी फ़ाइलें सुरक्षित हैं, और यह अपने-आप लौट आता है, आमतौर पर लगभग 20 मिनट में।",
"cloudHome.unreachable": "Cloud ने कुछ मिनटों से जवाब नहीं दिया है। कुछ भी खोया नहीं है, और हमें सूचना मिल गई है।",
diff --git a/src/locales/it.json b/src/locales/it.json
index be0dd218ec..86e77ac726 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -1675,6 +1675,8 @@
"cloudHome.waking": "Risveglio del Cloud…",
"cloudWork.update": "Aggiornamento di My Cloud all'ultima versione",
"cloudWork.updateNamed": "Aggiornamento di {name} all'ultima versione",
+ "cloudWork.rollback": "Ripristino di My Cloud alla versione che funzionava",
+ "cloudWork.rollbackNamed": "Ripristino di {name} alla versione che funzionava",
"cloudWork.resizeUp": "My Cloud riceve più potenza",
"cloudWork.resizeUpNamed": "{name} riceve più potenza",
"cloudWork.resize": "Adeguamento delle dimensioni di My Cloud al suo piano",
@@ -1697,7 +1699,7 @@
"cloudWork.longer": "Ci vuole un po' più del solito.",
"cloudWork.late": "Ci vuole più del solito e siamo stati avvisati.",
"cloudWork.reconnects": "Questa finestra si ricollega da sola.",
- "cloudWork.bots": "Il lavoro non finito dei bot riparte da solo appena torna.",
+ "cloudWork.bots": "I bot riprendono da dove possono appena torna.",
"cloudWork.notSent": "Il tuo messaggio non è stato inviato ed è ancora nella casella.",
"cloudHome.unreachableHost": "Il fornitore di hosting sta riavviando la macchina su cui gira il Cloud. Il Cloud e i suoi file sono al sicuro e torna da solo, di solito entro circa 20 minuti.",
"cloudHome.unreachable": "Il Cloud non risponde da qualche minuto. Non è andato perso nulla e siamo stati avvisati.",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 88d30dfcdc..47a5a4ac00 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -1336,6 +1336,8 @@
"cloudHome.waking": "Cloud を起動しています…",
"cloudWork.update": "My Cloud を最新バージョンに更新しています",
"cloudWork.updateNamed": "{name} を最新バージョンに更新しています",
+ "cloudWork.rollback": "My Cloud を正常に動いていたバージョンに戻しています",
+ "cloudWork.rollbackNamed": "{name} を正常に動いていたバージョンに戻しています",
"cloudWork.resizeUp": "My Cloud の性能を上げています",
"cloudWork.resizeUpNamed": "{name} の性能を上げています",
"cloudWork.resize": "My Cloud のサイズをプランに合わせて変更しています",
@@ -1358,7 +1360,7 @@
"cloudWork.longer": "いつもより少し時間がかかっています。",
"cloudWork.late": "いつもより時間がかかっています。こちらにも通知が届いています。",
"cloudWork.reconnects": "このウィンドウは自動的に再接続します。",
- "cloudWork.bots": "ボットの終わっていない作業は、戻りしだい自動的に再開します。",
+ "cloudWork.bots": "戻りしだい、ボットはできるところから続けます。",
"cloudWork.notSent": "メッセージは送信されず、入力欄に残っています。",
"cloudHome.unreachableHost": "Cloud が稼働しているマシンを、ホスティングプロバイダーが再起動しています。Cloud とそのファイルは安全で、通常は約20分以内に自動的に復旧します。",
"cloudHome.unreachable": "Cloud から数分間応答がありません。失われたものはなく、こちらにも通知が届いています。",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 24bb0adbe2..d2843227cc 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -1259,6 +1259,8 @@
"cloudHome.waking": "클라우드를 깨우는 중…",
"cloudWork.update": "내 클라우드를 최신 버전으로 업데이트하는 중",
"cloudWork.updateNamed": "{name}을(를) 최신 버전으로 업데이트하는 중",
+ "cloudWork.rollback": "내 클라우드를 잘 작동하던 버전으로 되돌리는 중",
+ "cloudWork.rollbackNamed": "{name}을(를) 잘 작동하던 버전으로 되돌리는 중",
"cloudWork.resizeUp": "내 클라우드 성능을 높이는 중",
"cloudWork.resizeUpNamed": "{name} 성능을 높이는 중",
"cloudWork.resize": "내 클라우드 크기를 요금제에 맞게 바꾸는 중",
@@ -1281,7 +1283,7 @@
"cloudWork.longer": "평소보다 조금 더 걸리고 있어요.",
"cloudWork.late": "평소보다 오래 걸리고 있어요. 저희에게도 알림이 왔어요.",
"cloudWork.reconnects": "이 창은 알아서 다시 연결돼요.",
- "cloudWork.bots": "봇이 끝내지 못한 작업은 돌아오면 알아서 다시 시작돼요.",
+ "cloudWork.bots": "돌아오면 봇이 할 수 있는 곳부터 이어서 해요.",
"cloudWork.notSent": "메시지가 전송되지 않았고 입력란에 그대로 있어요.",
"cloudHome.unreachableHost": "호스팅 업체가 클라우드가 돌아가는 머신을 다시 시작하고 있어요. 클라우드와 파일은 안전하고, 보통 20분 안에 알아서 돌아와요.",
"cloudHome.unreachable": "클라우드가 몇 분째 응답하지 않아요. 잃은 것은 없으며, 저희도 알림을 받았어요.",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 164f13d084..c49dc01af4 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -1198,6 +1198,8 @@
"cloudHome.waking": "Budzenie Chmury…",
"cloudWork.update": "Aktualizowanie My Cloud do najnowszej wersji",
"cloudWork.updateNamed": "Aktualizowanie {name} do najnowszej wersji",
+ "cloudWork.rollback": "Przywracanie My Cloud do wersji, która działała",
+ "cloudWork.rollbackNamed": "Przywracanie {name} do wersji, która działała",
"cloudWork.resizeUp": "My Cloud dostaje więcej mocy",
"cloudWork.resizeUpNamed": "{name} dostaje więcej mocy",
"cloudWork.resize": "Dopasowywanie rozmiaru My Cloud do planu",
@@ -1220,7 +1222,7 @@
"cloudWork.longer": "Trwa to nieco dłużej niż zwykle.",
"cloudWork.late": "Trwa to dłużej niż zwykle i już nas powiadomiono.",
"cloudWork.reconnects": "To okno połączy się ponownie samo.",
- "cloudWork.bots": "Niedokończona praca botów zacznie się ponownie sama, gdy tylko wróci.",
+ "cloudWork.bots": "Gdy tylko wróci, boty kontynuują tam, gdzie mogą.",
"cloudWork.notSent": "Twoja wiadomość nie została wysłana i nadal jest w polu.",
"cloudHome.unreachableHost": "Nasz dostawca hostingu uruchamia ponownie maszynę, na której działa Chmura. Chmura i jej pliki są bezpieczne; wróci sama, zwykle w ciągu około 20 minut.",
"cloudHome.unreachable": "Chmura nie odpowiada od kilku minut. Nic nie zostało utracone, a my zostaliśmy o tym powiadomieni.",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index d5e63a9ffb..b8204bdd9c 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -1483,6 +1483,8 @@
"cloudHome.waking": "Acordando o Cloud…",
"cloudWork.update": "Atualizando o Cloud para a versão mais recente",
"cloudWork.updateNamed": "Atualizando {name} para a versão mais recente",
+ "cloudWork.rollback": "Voltando o Cloud para a versão que funcionava",
+ "cloudWork.rollbackNamed": "Voltando {name} para a versão que funcionava",
"cloudWork.resizeUp": "Dando mais potência ao Cloud",
"cloudWork.resizeUpNamed": "Dando mais potência a {name}",
"cloudWork.resize": "Ajustando o tamanho do Cloud ao plano",
@@ -1505,7 +1507,7 @@
"cloudWork.longer": "Está demorando um pouco mais que o normal.",
"cloudWork.late": "Está demorando mais que o normal, e já fomos avisados.",
"cloudWork.reconnects": "Esta janela se reconecta sozinha.",
- "cloudWork.bots": "O trabalho inacabado dos bots recomeça sozinho assim que ele voltar.",
+ "cloudWork.bots": "Os bots continuam de onde puderem assim que ele voltar.",
"cloudWork.notSent": "Sua mensagem não foi enviada e continua na caixa.",
"cloudHome.unreachableHost": "Nosso provedor de hospedagem está reiniciando a máquina onde o Cloud roda. O Cloud e os arquivos dele estão seguros, e ele volta sozinho, normalmente em cerca de 20 minutos.",
"cloudHome.unreachable": "O Cloud não responde há alguns minutos. Nada foi perdido, e já fomos avisados.",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 15c295f760..5cdfe91209 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -1204,6 +1204,8 @@
"cloudHome.waking": "Пробуждаем облако…",
"cloudWork.update": "Обновляем My Cloud до последней версии",
"cloudWork.updateNamed": "Обновляем {name} до последней версии",
+ "cloudWork.rollback": "Возвращаем My Cloud к версии, которая работала",
+ "cloudWork.rollbackNamed": "Возвращаем {name} к версии, которая работала",
"cloudWork.resizeUp": "Даём My Cloud больше мощности",
"cloudWork.resizeUpNamed": "Даём {name} больше мощности",
"cloudWork.resize": "Меняем размер My Cloud под тариф",
@@ -1226,7 +1228,7 @@
"cloudWork.longer": "Занимает чуть больше времени, чем обычно.",
"cloudWork.late": "Это занимает больше времени, чем обычно, и мы уже в курсе.",
"cloudWork.reconnects": "Это окно переподключится само.",
- "cloudWork.bots": "Незаконченная работа ботов сама начнётся заново, как только оно вернётся.",
+ "cloudWork.bots": "Как только оно вернётся, боты продолжат с того места, где смогут.",
"cloudWork.notSent": "Сообщение не отправлено и осталось в поле ввода.",
"cloudHome.unreachableHost": "Наш хостинг-провайдер перезагружает машину, на которой работает Cloud. Cloud и его файлы в безопасности, и он вернётся сам, обычно примерно в течение 20 минут.",
"cloudHome.unreachable": "Cloud не отвечает уже несколько минут. Ничего не потеряно, нас уже уведомили.",
diff --git a/src/locales/tr.json b/src/locales/tr.json
index d7de48dfda..e967f601d4 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -791,6 +791,8 @@
"cloudHome.waking": "Cloud uyandırılıyor…",
"cloudWork.update": "Cloud'um en son sürüme güncelleniyor",
"cloudWork.updateNamed": "{name} en son sürüme güncelleniyor",
+ "cloudWork.rollback": "Cloud'um çalışan sürüme geri alınıyor",
+ "cloudWork.rollbackNamed": "{name} çalışan sürüme geri alınıyor",
"cloudWork.resizeUp": "Cloud'uma daha fazla güç veriliyor",
"cloudWork.resizeUpNamed": "{name} için daha fazla güç veriliyor",
"cloudWork.resize": "Cloud'umun boyutu planına göre değiştiriliyor",
@@ -813,7 +815,7 @@
"cloudWork.longer": "Her zamankinden biraz uzun sürüyor.",
"cloudWork.late": "Bu her zamankinden uzun sürüyor ve bize haber verildi.",
"cloudWork.reconnects": "Bu pencere kendiliğinden yeniden bağlanır.",
- "cloudWork.bots": "Botların bitmemiş işleri, geri döndüğünde kendiliğinden yeniden başlar.",
+ "cloudWork.bots": "Geri döndüğünde botlar kaldıkları yerden, yapabildikleri kadarıyla devam eder.",
"cloudWork.notSent": "Mesajın gönderilmedi ve hâlâ kutuda.",
"cloudHome.unreachableHost": "Barındırma sağlayıcımız, Cloud'un çalıştığı makineyi yeniden başlatıyor. Cloud ve dosyaları güvende; genellikle yaklaşık 20 dakika içinde kendiliğinden geri gelir.",
"cloudHome.unreachable": "Cloud birkaç dakikadır yanıt vermiyor. Hiçbir şey kaybolmadı ve bize haber verildi.",
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 7c2020bd6b..60f78ee60b 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -609,6 +609,8 @@
"cloudHome.waking": "Будимо Cloud…",
"cloudWork.update": "Оновлюємо My Cloud до останньої версії",
"cloudWork.updateNamed": "Оновлюємо {name} до останньої версії",
+ "cloudWork.rollback": "Повертаємо My Cloud до версії, яка працювала",
+ "cloudWork.rollbackNamed": "Повертаємо {name} до версії, яка працювала",
"cloudWork.resizeUp": "Даємо My Cloud більше потужності",
"cloudWork.resizeUpNamed": "Даємо {name} більше потужності",
"cloudWork.resize": "Змінюємо розмір My Cloud під тариф",
@@ -631,7 +633,7 @@
"cloudWork.longer": "Триває трохи довше, ніж зазвичай.",
"cloudWork.late": "Це триває довше, ніж зазвичай, і ми вже знаємо.",
"cloudWork.reconnects": "Це вікно перепідключиться саме.",
- "cloudWork.bots": "Незавершена робота ботів сама почнеться знову, щойно воно повернеться.",
+ "cloudWork.bots": "Щойно воно повернеться, боти продовжать з того місця, де зможуть.",
"cloudWork.notSent": "Повідомлення не надіслано, і воно залишилося в полі введення.",
"cloudHome.unreachableHost": "Наш хостинг-провайдер перезапускає машину, на якій працює Cloud. Cloud і його файли в безпеці, і він повернеться сам, зазвичай приблизно за 20 хвилин.",
"cloudHome.unreachable": "Cloud не відповідає вже кілька хвилин. Нічого не втрачено, і нас уже сповіщено.",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index f7228258fb..66ca109167 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -791,6 +791,8 @@
"cloudHome.waking": "Đang đánh thức Cloud…",
"cloudWork.update": "Đang cập nhật My Cloud lên phiên bản mới nhất",
"cloudWork.updateNamed": "Đang cập nhật {name} lên phiên bản mới nhất",
+ "cloudWork.rollback": "Đang đưa My Cloud về phiên bản đã chạy ổn",
+ "cloudWork.rollbackNamed": "Đang đưa {name} về phiên bản đã chạy ổn",
"cloudWork.resizeUp": "Đang tăng sức mạnh cho My Cloud",
"cloudWork.resizeUpNamed": "Đang tăng sức mạnh cho {name}",
"cloudWork.resize": "Đang đổi kích thước My Cloud theo gói",
@@ -813,7 +815,7 @@
"cloudWork.longer": "Đang lâu hơn bình thường một chút.",
"cloudWork.late": "Việc này đang lâu hơn bình thường và chúng tôi đã được báo.",
"cloudWork.reconnects": "Cửa sổ này sẽ tự kết nối lại.",
- "cloudWork.bots": "Công việc dang dở của bot sẽ tự bắt đầu lại ngay khi nó trở lại.",
+ "cloudWork.bots": "Khi nó trở lại, bot sẽ tiếp tục ở chỗ có thể.",
"cloudWork.notSent": "Tin nhắn của bạn chưa được gửi và vẫn còn trong ô soạn.",
"cloudHome.unreachableHost": "Nhà cung cấp dịch vụ lưu trữ của chúng tôi đang khởi động lại máy chạy Cloud. Cloud và các tệp vẫn an toàn, và Cloud sẽ tự hoạt động trở lại, thường trong khoảng 20 phút.",
"cloudHome.unreachable": "Cloud không phản hồi trong vài phút. Không có gì bị mất, và chúng tôi đã được thông báo.",
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index caf982ae5c..47c44bb802 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -1451,6 +1451,8 @@
"cloudHome.waking": "正在喚醒 Cloud…",
"cloudWork.update": "正在將 My Cloud 更新到最新版本",
"cloudWork.updateNamed": "正在將 {name} 更新到最新版本",
+ "cloudWork.rollback": "正在將 My Cloud 恢復到之前正常運作的版本",
+ "cloudWork.rollbackNamed": "正在將 {name} 恢復到之前正常運作的版本",
"cloudWork.resizeUp": "正在為 My Cloud 提升效能",
"cloudWork.resizeUpNamed": "正在為 {name} 提升效能",
"cloudWork.resize": "正在依方案調整 My Cloud 的規格",
@@ -1473,7 +1475,7 @@
"cloudWork.longer": "比平常稍久一些。",
"cloudWork.late": "比平常久了不少,我們已收到通知。",
"cloudWork.reconnects": "此視窗會自動重新連線。",
- "cloudWork.bots": "機器人未完成的工作會在回來後自動重新開始。",
+ "cloudWork.bots": "回來後,機器人會盡可能從中斷處繼續。",
"cloudWork.notSent": "你的訊息沒有送出,仍在輸入框中。",
"cloudHome.unreachableHost": "我們的託管服務供應商正在重新啟動 Cloud 所在的機器。Cloud 和它的檔案都很安全,通常約 20 分鐘內就會自動恢復。",
"cloudHome.unreachable": "Cloud 已有幾分鐘沒有回應。沒有遺失任何內容,我們也已收到通知。",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 392eecd86b..dfea6c003b 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -1591,6 +1591,8 @@
"cloudHome.waking": "正在唤醒 Cloud…",
"cloudWork.update": "正在将 My Cloud 更新到最新版本",
"cloudWork.updateNamed": "正在将 {name} 更新到最新版本",
+ "cloudWork.rollback": "正在将 My Cloud 恢复到之前正常运行的版本",
+ "cloudWork.rollbackNamed": "正在将 {name} 恢复到之前正常运行的版本",
"cloudWork.resizeUp": "正在为 My Cloud 提升性能",
"cloudWork.resizeUpNamed": "正在为 {name} 提升性能",
"cloudWork.resize": "正在按套餐调整 My Cloud 的规格",
@@ -1613,7 +1615,7 @@
"cloudWork.longer": "比平时稍慢一些。",
"cloudWork.late": "比平时慢了不少,我们已收到通知。",
"cloudWork.reconnects": "此窗口会自动重新连接。",
- "cloudWork.bots": "机器人未完成的工作会在恢复后自动重新开始。",
+ "cloudWork.bots": "恢复后,机器人会尽可能从中断处继续。",
"cloudWork.notSent": "你的消息没有发送,仍在输入框中。",
"cloudHome.unreachableHost": "我们的托管服务商正在重启 Cloud 所在的机器。Cloud 及其文件都很安全,通常会在大约 20 分钟内自动恢复。",
"cloudHome.unreachable": "Cloud 已有几分钟没有响应。没有丢失任何内容,我们也已收到通知。",