pub struct Builder { /* private fields */ }Expand description
Configures the plugin.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn host(self, host: impl Into<IpAddr>) -> Self
pub fn host(self, host: impl Into<IpAddr>) -> Self
Sets the address the server binds to.
Only change this if you need to reach the app from another device; the server has no authentication, so anything that can connect can run your commands.
Overridden by the DEV_INVOKE_HOST environment variable.
Sourcepub fn port(self, port: u16) -> Self
pub fn port(self, port: u16) -> Self
Sets the port the server binds to. Defaults to DEFAULT_PORT.
Overridden by the DEV_INVOKE_PORT environment variable, which is how you give each
of several dev instances its own listener without rebuilding.
Sourcepub fn window(self, label: impl Into<String>) -> Self
pub fn window(self, label: impl Into<String>) -> Self
Routes browser requests through the webview with this label.
Browser clients impersonate a single webview: commands taking a tauri::Window or
tauri::Webview receive it, and its capabilities decide what is allowed.
Sourcepub fn allow_origin(self, origin: impl Into<String>) -> Self
pub fn allow_origin(self, origin: impl Into<String>) -> Self
Allows an additional browser origin, e.g. http://localhost:5173.
Sourcepub fn allowed_origins<I, S>(self, origins: I) -> Self
pub fn allowed_origins<I, S>(self, origins: I) -> Self
Replaces the origin allowlist with exactly these origins.
Overridden by the DEV_INVOKE_ALLOWED_ORIGINS environment variable, a comma-separated
list (or * for any origin). Origins added with Builder::allow_origin still apply
on top of whichever list wins.
Sourcepub fn allow_any_origin(self) -> Self
pub fn allow_any_origin(self) -> Self
Accepts requests from any origin.
Every page you visit while the app runs can then invoke your app’s commands. Prefer
Builder::allow_origin.
Sourcepub fn serve_assets(self, enabled: bool) -> Self
pub fn serve_assets(self, enabled: bool) -> Self
Serves files for convertFileSrc() over HTTP. Enabled by default.
The endpoint reads arbitrary paths off disk, which is what the asset: protocol does
inside the webview. Disable it if you would rather not expose that on loopback.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Sets how long a single command may run before the request fails. Defaults to 10 minutes.
Sourcepub fn enabled_in_release(self, enabled: bool) -> Self
pub fn enabled_in_release(self, enabled: bool) -> Self
Runs the server in release builds too.
This has no effect unless the allow-in-release cargo feature is enabled; without it
the server is not compiled into release builds at all.
Sourcepub fn build<R: Runtime>(self) -> TauriPlugin<R>
pub fn build<R: Runtime>(self) -> TauriPlugin<R>
Builds the plugin.