Gateway: status route with per-route results, test push, reconnect and unpair
Gateway / check (push) Successful in 9s
Gateway / image (push) Successful in 24s

This commit is contained in:
gib committed 2026-11-01 15:04:30 -05:00
1 parent e6fd2b8f51
commit 9707daf1fe
9 files changed
+398 -55

No files matched your search

+61 -2
View File
@@ -13,6 +13,64 @@ export interface HostSummary {
error: string | null;
}
/**
* How a route reaches its host, guessed from the URL: `public` for HTTPS, `vpn` when the hostname
* says vpn, and `direct` for the rest.
*/
export type RouteKind = "direct" | "vpn" | "public";
export interface Route {
url: string;
kind: RouteKind;
/** From the latest connect. `untried` when an earlier route answered first. */
result: "ok" | "failed" | "untried";
/** Why it failed, such as `refused` or `no answer in 5 s`. */
error: string | null;
checkedAt: string | null;
}
/** One host as the status screens show it. */
export interface HostStatusDetail extends HostSummary {
/** The route in use. Null unless online. */
activeUrl: string | null;
/** Preferred first, the order the gateway tries them. */
routes: Route[];
onlineSince: string | null;
lastOnlineAt: string | null;
/** When the gateway tries again, while it waits to retry. */
nextRetryAt: string | null;
tokenExpiresAt: string | null;
serverVersion: string | null;
}
/** What Apple answered for one push. */
export interface PushResult {
ok: boolean;
at: string;
/** Apple's HTTP status, or 0 when the push never reached Apple. */
status: number;
/** Apple's reason, such as `BadDeviceToken`, or why the gateway could not send. */
reason: string | null;
}
export interface StatusResponse {
hosts: HostStatusDetail[];
gateway: {
startedAt: string;
/** False when the gateway has no APNs key, so nothing can be pushed. */
pushConfigured: boolean;
lastPush: PushResult | null;
};
/** The watch asking. */
device: {
name: string;
pairedAt: string;
/** True once the watch has sent its APNs token. */
pushRegistered: boolean;
apnsEnvironment: "sandbox" | "production" | null;
};
}
/** Something a thread is waiting on: an approval, or questions for the user. */
export interface PendingRequest {
id: string;
@@ -137,11 +195,12 @@ export interface ErrorResponse {
/** Custom keys on every push notification, beside `aps`. */
export interface PushPayload {
hostId: string;
/** Absent on `test` pushes. */
hostId?: string;
/** Absent on `host` pushes, which are about a host rather than a thread. */
threadId?: string;
requestId?: string;
}
/** Notification categories the watch registers actions for. */
export type PushCategory = "approval" | "finished" | "failed" | "input" | "host";
export type PushCategory = "approval" | "finished" | "failed" | "input" | "host" | "test";