diff --git a/.changes/dev-fn.md b/.changes/dev-fn.md new file mode 100644 index 000000000..7b0b12901 --- /dev/null +++ b/.changes/dev-fn.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:enhance +--- + +Added `tauri::dev()` to determine whether we are running in development mode or not. diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index 873d7b212..7c78fcf8d 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -333,6 +333,11 @@ macro_rules! tauri_build_context { pub use pattern::Pattern; +/// Whether we are running in development mode or not. +pub fn dev() -> bool { + !cfg!(feature = "custom-protocol") +} + /// User supplied data required inside of a Tauri application. /// /// # Stability diff --git a/core/tauri/src/manager/mod.rs b/core/tauri/src/manager/mod.rs index a1b49d09e..fa70ccd06 100644 --- a/core/tauri/src/manager/mod.rs +++ b/core/tauri/src/manager/mod.rs @@ -320,7 +320,7 @@ impl AppManager { } fn csp(&self) -> Option { - if cfg!(feature = "custom-protocol") { + if !crate::dev() { self.config.app.security.csp.clone() } else { self