Skip to the content

Capsid menu

app/lib/admin-actor.server.ts

18 lines and 0 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.

Functions

None: it only declares types or values.

Imports

It imports no other module of this repo. Imported by app/kb/editor-route.server.ts, app/routes/admin.mentions.tsx, app/routes/admin.posts.$slug.edit.tsx, app/routes/admin.posts._index.tsx, app/routes/admin.posts.new.tsx, app/routes/admin.tsx.

Source

import { createContext } from "react-router";

/**
 * The part of a session the admin plane reads: who. Cloudflare Access fills it for a person.
 *
 * Set for the human admin only: the smoke credential has no session, so reading this asserts a
 * human is present, and a write path reached by a machine throws rather than attributing to nobody.
 * Code that only needs to know who is asking reads `adminActorContext`.
 */
export type AdminSession = { user: { email: string } };

export const adminSessionContext = createContext<AdminSession>();

/**
 * `email` is a realistic length for the smoke actor too, so the smoke render is the page Dustin sees
 * and layout numbers measured through it are true.
 */
type AdminActor =
  | { kind: "admin"; email: string }
  | { kind: "smoke"; id: string; email: string };

export const adminActorContext = createContext<AdminActor>();