Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

web: clarify legacy kit wait display

Neeraj Gupta1e5cfb85a73f
diff --git a/web/apps/legacy/src/features/legacy-kit/recovery.ts b/web/apps/legacy/src/features/legacy-kit/recovery.ts
index b12d49f509..9b89affd2e 100644
--- a/web/apps/legacy/src/features/legacy-kit/recovery.ts
+++ b/web/apps/legacy/src/features/legacy-kit/recovery.ts
@@ -9,6 +9,8 @@ export const LegacyKitRecoverySessionSchema = z.object({
id: z.string(),
kitID: z.string(),
status: z.enum(["WAITING", "READY", "BLOCKED", "CANCELLED", "RECOVERED"]),
+ // Matches the existing legacy contact recovery API: remaining microseconds,
+ // not an epoch timestamp.
waitTill: z.number(),
createdAt: z.number(),
});
@@ -52,12 +54,12 @@ export const changeLegacyKitPassword = async (
password: string,
) => handle.change_password(password);
-export const formatRecoveryWait = (waitTillMicros: number) => {
- if (waitTillMicros <= 0) {
+export const formatRecoveryWait = (waitRemainingMicros: number) => {
+ if (waitRemainingMicros <= 0) {
return "ready now";
}
- const totalMinutes = Math.ceil(waitTillMicros / (1000 * 1000 * 60));
+ const totalMinutes = Math.ceil(waitRemainingMicros / (1000 * 1000 * 60));
if (totalMinutes >= 60 * 24) {
const days = Math.ceil(totalMinutes / (60 * 24));
return `${days} day${days === 1 ? "" : "s"}`;
diff --git a/web/apps/legacy/src/pages/index.tsx b/web/apps/legacy/src/pages/index.tsx
index 0ba29d47b7..d032e070d2 100644
--- a/web/apps/legacy/src/pages/index.tsx
+++ b/web/apps/legacy/src/pages/index.tsx
@@ -71,12 +71,12 @@ const parseSlotCode = (rawCode: string): Pick<SheetSlot, "error" | "share"> => {
}
};
-const displayWaitTarget = (waitTillMicros: number) => {
- if (waitTillMicros <= 0) {
+const displayWaitTarget = (waitRemainingMicros: number) => {
+ if (waitRemainingMicros <= 0) {
return "now";
}
- const target = new Date(Date.now() + waitTillMicros / 1000);
+ const target = new Date(Date.now() + waitRemainingMicros / 1000);
return new Intl.DateTimeFormat(undefined, {
day: "numeric",
hour: "numeric",