this repo has no description
1import { createDefine } from "fresh";
2import type { Locale } from "./i18n/locales.ts";
3import type { RememberedAccount } from "./lib/remembered-accounts.ts";
4import type { AccountType } from "./lib/account-types.ts";
5
6export interface SessionUser {
7 did: string;
8 handle: string;
9}
10
11/**
12 * Per-page social/Open Graph overrides. Routes can set `state.pageMeta`
13 * inside their handler to make `_app.tsx` emit page-specific OG tags
14 * (page title, description, share image). Used by project pages so the
15 * project's banner becomes the link-card preview when the URL is shared.
16 */
17export interface PageMeta {
18 /** Replaces the document <title>. */
19 title?: string;
20 /** Replaces meta[name=description] and og:description. */
21 description?: string;
22 /** Absolute (or root-relative) URL of the share image. */
23 imageUrl?: string;
24 /** Alt text for the share image. */
25 imageAlt?: string;
26 /** MIME type for og:image:type (defaults to "image/jpeg"). */
27 imageType?: string;
28 /** OG image dimensions, when known. Defaults match the site-wide OG image. */
29 imageWidth?: number;
30 imageHeight?: number;
31 /** Override og:type (defaults to "website"). */
32 ogType?: string;
33 /**
34 * Canonical page URL for og:url and link[rel=canonical]. Use on share-heavy
35 * pages so crawlers dedupe trailing-slash vs non-slash variants.
36 */
37 canonicalUrl?: string;
38}
39
40export interface State {
41 /** Active locale for this request. Set by the locale middleware. */
42 locale: Locale;
43 /** Logged-in registry account, or null when signed out. Set by sessionMiddleware. */
44 user: SessionUser | null;
45 /** Local account role: users manage reviews, projects manage registry profiles. */
46 accountType: AccountType | null;
47 /** Accounts that have completed OAuth on this device, in
48 * most-recently-used order. Populated by sessionMiddleware so
49 * routes can hand the list to AccountMenu for the switcher. */
50 rememberedAccounts: RememberedAccount[];
51 /** Optional per-page social/OG meta overrides; see {@link PageMeta}. */
52 pageMeta?: PageMeta;
53 // deno-lint-ignore no-explicit-any
54 [key: string]: any;
55}
56
57export const define = createDefine<State>();