/** App + ATProto configuration. */ // ATProto identifiers + the OAuth scope live in a build-tool-safe module (no // `import.meta`) so vite.config.ts can import them to generate // oauth-client-metadata.json. // Re-exported here so the rest of the app keeps importing them from "./config". export { OCCURRENCE_COLLECTION, CONFIG_COLLECTION, CONFIG_RKEY, SPACE_TYPE, SPACE_SKEY, OAUTH_SCOPE, } from "./oauth-scope"; export const APP_NAME = "chalky.town"; /** * Handle resolver: turns a handle (you@tyler.fun) into a DID + PDS during OAuth. * bsky.social resolves any atproto handle; swap for your own appview/PDS if you * prefer to keep resolution in-house. */ export const HANDLE_RESOLVER = "https://bsky.social"; /** PLC directory, where `did:plc:` DID documents are published. Read (never * written) by the public/demo path to find an account's PDS without a session. */ export const PLC_DIRECTORY = "https://plc.directory"; /** How often the background sync loop runs while online, in ms. */ export const SYNC_INTERVAL_MS = 20_000; /** Ops per `listRepoOps` page. A cycle that finds changes usually finds a * handful, so this is sized for the catch-up case — a client returning after a * long absence — where fewer, larger pages beat more round trips. */ export const OPS_PAGE_SIZE = 500; /** Records per batched push. Keeps one request's body to a sane size while * still collapsing a bulk edit (paste a checklist, drag a week's worth of * tasks) from one request per record into one or two. */ export const PUSH_BATCH_SIZE = 50; /** Ceiling for the sync loop's retry backoff, in ms. A backend that is down * stays down for minutes, not seconds, so a failed cycle doubles its wait up to * this — often enough to notice a recovery, rarely enough that an outage isn't * a request every 20s (and a console full of the same error). */ export const SYNC_RETRY_MAX_MS = 5 * 60_000; /** How long a sync cycle may run before the watchdog gives up on it and * rearms the loop anyway. A healthy cycle settles in well under a second; this * is sized for a slow network, not the normal case. It exists for the case a * normal timeout can't cover: a request that neither resolves nor rejects — * the observed behavior of a dead IndexedDB connection under iOS WebKit after * the app is backgrounded and resumed (see `SyncEngine`'s `abandon` and * `auth.ts`'s `reopenSession`). Without this, `running` stays true forever and * every later cycle() call returns immediately without rearming. */ export const CYCLE_TIMEOUT_MS = 45_000; /** Press-and-hold duration before a task lifts into a drag — no movement needed. * Long enough not to fire on a tap (which opens the task) or the first moment of * a scroll, short enough to feel immediate. ~250ms is the common long-press-to- * drag sweet spot (matches dnd-kit's default touch activation delay). Applies to * touch input; a mouse still starts a drag on a few px of movement, the desktop- * native gesture that coexists with click-to-open. */ export const DRAG_HOLD_MS = 250; /** Scale factor for the `malleable` sort's pinned `movedRank` axis (see * TaskStore.move/placeInDay and colorRank in tasks.svelte.ts). Ranks live on * the same numeric axis as `colorRank(...) * RANK_SCALE`, so pinning a task * between two color groups still has integer headroom to halve into as more * drags land between the same neighbours — same reasoning as ORDER_STEP for * `order`. Also the conversion factor from the wire's legacy (pre-scale, * fractional-prone) `movedRank` field to the current integer `rank` field — * see records.ts's `toRecord`/`fromRecord`. */ export const RANK_SCALE = 1024; /** IndexedDB database name (also the shared base word for the app's * localStorage keys, `chalky:*`). */ export const DB_NAME = "chalky"; export const DB_VERSION = 3; /** * OAuth `client_id` for the app's client — a URL to this app's client-metadata * document (`/oauth-client-metadata.json`). Build-time env so the dev site * (dev.chalky.town, built with `--mode dev`) can be its own client. Blank in * local dev: `atproto/auth.ts` falls back to a loopback client_id built from * the dev origin at runtime. * * Everything — sign-in, public repo writes, and the private space — now runs * against the user's own PDS with this one client; there is no HappyView * instance (or any other intermediary) in the path anymore. */ export const OAUTH_CLIENT_ID: string = import.meta.env.VITE_OAUTH_CLIENT_ID ?? "";