Mounts Threadline's operator interface in a Phoenix router with host-owned authorization and query scoping.
This module enforces a secure-by-default mount by requiring either:
- A
pipe_throughdirective in the enclosing router scope. - An explicit
:authorize_fnoption. - An explicit
:adopter_acknowledges_unauthenticatedoption.
HTTP endpoints
When Phoenix is available at compile time, the macro emits a sibling
POST <path>/theme route and a sibling scope <path>/exports block with
GET routes for /changes.csv, /changes.json, /changes.ndjson, and
completed export downloads. These HTTP endpoints use the mount's
authorization callbacks independently from the LiveView session.
The HTTP scopes remain outside live_session :threadline because LiveView
on_mount callbacks do not apply to controller routes. Route helper names
and the host router's alias namespace remain untouched.
Summary
Functions
Adds the Threadline operator LiveView and sibling HTTP routes to the host router.
Functions
Adds the Threadline operator LiveView and sibling HTTP routes to the host router.
The macro requires a secure enclosing pipeline, :authorize_fn, or an
explicit acknowledgement that the mount is unauthenticated.
Mount options
:exports— boolean; defaults totrue. Set tofalseto suppress the sibling export-controller scope (rare LV-only adopters).:scope_query_fn—(Ecto.Query.t(), scope, %{surface: atom(), params: map()} -> Ecto.Query.t()); optional. This host-owned query transform is used when:authorize_fnreturns{:ok, scope}. Threadline treatsscopeas opaque data and calls this function for timeline, actor-history, transaction, and export flows.:export_authorize_fn—(Plug.Conn.t() -> :ok | true | {:ok, scope} | _); defaults to delegating to:authorize_fnvia a synthetic%{assigns: conn.assigns}mirror. Use a separate callback when HTTP authorization needs more than the assigns inspected by the LiveView callback; the synthetic mirror is sufficient when authorization only reads values such asassigns.current_user.:coverage_authorize_fn—(%{assigns: map()} -> boolean | :ok | {:ok, scope} | _); optional. Explicitly gates the coverage dashboard and related badge, and defaults to fail closed.:policy_authorize_fn—(%{assigns: map()} -> boolean | :ok | {:ok, scope} | _); optional. Explicitly gates policy and retention surfaces, and defaults to fail closed.:evidence_authorize_fn—(%{assigns: map()} -> boolean | :ok | {:ok, scope} | _); optional. Explicitly gates the mounted evidence surface, and defaults to fail closed.:theme—:dark | :light | :system; defaults to:dark. Selects the default server-rendered operator-surface theme lane.:systemfollows the visitor's OS preference through scoped CSS only. A runtime dark/light/system theme picker is available in the shell (session-backed and resolved server-side; a response cookie mirrors the choice); Threadline adds no JavaScript and no local storage.