Skip to main content

AppIdentity

Struct AppIdentity 

Source
pub struct AppIdentity {
    pub name: &'static str,
    pub bundle_id: &'static str,
    pub log_prefix: &'static str,
    pub token_env: &'static str,
    pub token_global: &'static str,
    pub embedded_global: &'static str,
    pub spa_base: &'static str,
    pub spa_frame_src: Option<&'static str>,
}
Expand description

Who the shell is serving: the names an app shows, logs under and hands to its SPA.

The SPA reads the two globals at startup, so they are part of the app’s contract with its own web build and must never change for an app that has shipped (Ledgeline’s are __LEDGELINE_TOKEN__ and __LEDGELINE_EMBEDDED__). The shell embeds them in scripts after checking nothing, so they must be plain JavaScript identifiers.

Fields§

§name: &'static str

The product name: the window title, the macOS app menu, About.

§bundle_id: &'static str

The macOS bundle identifier (CFBundleIdentifier).

§log_prefix: &'static str

The prefix of every line the shell writes to stderr (ledgeline: …).

§token_env: &'static str

The environment variable a caller-chosen access token is read from.

§token_global: &'static str

The window global the access token is handed to the SPA in.

§embedded_global: &'static str

The window global that tells the SPA it is served embedded.

§spa_base: &'static str

The path the app’s SPA is served under, with a leading and a trailing slash: / when the SPA is the whole origin (Ledgeline), /app/ when other content shares it (the invoicer, beside MBR’s pages).

The desktop window shows only documents under it ([gui::build_webview]), and only they are handed the token (security::token_init_script). security::in_spa is the test.

§spa_frame_src: Option<&'static str>

The sources of a frame-src directive added to the SPA shell’s CSP (security::shell_csp), or None for none: then default-src 'self' governs the shell’s frames, as it does for Ledgeline, which frames nothing.

The invoicer’s note and invoice frames need https: here: WebKit checks a frame’s navigation against the parent’s frame-src before the desktop window’s navigation handler sees it, so without it an https link clicked in a frame dies silently instead of reaching [gui::build_webview]’s handler, which keeps the frame on our origin and opens the link in the browser. (mailto: does not belong here: WebKit refuses it from a sandboxed frame whatever the CSP says, so it goes through security::HANDOFF_PATH.) A static source list, with no ;.

Trait Implementations§

Source§

impl Clone for AppIdentity

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
Source§

impl Copy for AppIdentity

Source§

impl Debug for AppIdentity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for AppIdentity

Source§

impl PartialEq for AppIdentity

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AppIdentity

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<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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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<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