Skip to main content

AppState

Struct AppState 

Source
pub struct AppState {
Show 21 fields pub storage: Arc<dyn Storage>, pub dotfiles: Arc<DotfileAllowlist>, pub body_cap: usize, pub nodeinfo: NodeInfoMeta, pub mashlib: MashlibConfig, pub mashlib_cdn: Option<String>, pub live_reload: bool, pub pay_config: PayConfig, pub data_root: Option<PathBuf>, pub quota: Option<Arc<dyn QuotaPolicy>>, pub pod_create_limiter: Arc<PodCreateLimiter>, pub allowed_origins: Vec<String>, pub admin_key: Option<String>, pub mcp_enabled: bool, pub mempool_url: Option<String>, pub conneg_enabled: bool, pub trust_proxy: bool, pub public_base_url: Option<String>, pub allowed_hosts: Vec<String>, pub cross_identity: Option<Arc<dyn CrossIdentityResolver>>, pub activitypub: Option<Arc<dyn ActorDocument>>,
}
Expand description

Actix-web shared state.

Fields§

§storage: Arc<dyn Storage>§dotfiles: Arc<DotfileAllowlist>§body_cap: usize§nodeinfo: NodeInfoMeta§mashlib: MashlibConfig§mashlib_cdn: Option<String>

Legacy alias — reads from mashlib.mode when Cdn. Deprecated; use mashlib directly.

§live_reload: bool

Inject a development-only WebSocket reload client into HTML responses.

§pay_config: PayConfig

Payment configuration — drives /pay/.info and the X-Balance / X-Cost / X-Pay-Currency response headers on paid resources.

§data_root: Option<PathBuf>

Absolute filesystem root of the pod storage tree. Some when the backend is FsBackend; None for in-memory or cloud-backed storage. Required by the git feature to locate pod directories for GitAutoInit (provisioning) and GitHttpService (serving).

§quota: Option<Arc<dyn QuotaPolicy>>

Optional atomic per-pod quota policy applied to every LDP mutation.

§pod_create_limiter: Arc<PodCreateLimiter>

JSS-compatible pod creation limiter: one POST /.pods per IP per day.

§allowed_origins: Vec<String>

When non-empty, CORS responses are only reflected for origins in this list. Origins not in the list receive no Access-Control-Allow-Origin header. When empty (the default), the request Origin is echoed back (wildcard-equivalent behaviour, suitable for local dev).

Configured via --allowed-origins / SOLID_ALLOWED_ORIGINS (comma-separated).

§admin_key: Option<String>

Pre-shared key for the POST /_admin/provision/{pubkey} endpoint. When None, the endpoint returns 403 unconditionally.

Configured via --admin-key / SOLID_ADMIN_KEY.

§mcp_enabled: bool

When true, the MCP (Model Context Protocol) server is mounted at POST /mcp, exposing the pod as a tool surface for agents. OFF by default — keys-on-disk and agent write access are an opt-in security tradeoff. Configured via --mcp / JSS_MCP (JSS #490).

§mempool_url: Option<String>

Optional override for the mempool REST base URL used by the MRC20 /pay/.deposit anchor verification (provenance-upgrade Phase 3). None ⇒ the handler reads JSS_PAY_MEMPOOL_URL (default testnet4). Tests point this at a local fixture server so they never reach mempool.space; production leaves it None.

§conneg_enabled: bool

Content negotiation (JSS --conneg). When on, text/n3 is accepted and advertised alongside Turtle for request bodies; when off a text/n3 body is refused with 415 as in JSS canAcceptInput.

§trust_proxy: bool

Honour X-Forwarded-Proto / cf-visitor for the request scheme and X-Forwarded-Host / Forwarded for the host. Off by default: only enable behind a proxy that overwrites them.

§public_base_url: Option<String>

Public base URL of this server (JSS_PUBLIC_BASE_URL). When set it is the origin used for NIP-98 URL matching and every generated absolute URL, whatever Host or forwarding headers say.

§allowed_hosts: Vec<String>

Hosts this server answers for (JSS_ALLOWED_HOSTS). Empty permits any Host; otherwise a request for another host gets 421.

§cross_identity: Option<Arc<dyn CrossIdentityResolver>>

did:nostr to WebID resolver applied to NIP-98 callers. None disables cross-identity (the caller is the did:nostr agent only).

§activitypub: Option<Arc<dyn ActorDocument>>

ActivityPub actor provider; Some mounts the actor route (set by the activitypub feature’s ApConfig; always None otherwise).

Implementations§

Source§

impl AppState

Source

pub fn public_origin(&self) -> Option<String>

The configured public origin (scheme://authority), if any.

Source

pub fn new(storage: Arc<dyn Storage>) -> Self

Convenience constructor for tests and the binary. Callers may replace fields after creation since AppState is a plain struct.

Trait Implementations§

Source§

impl Clone for AppState

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more