mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
committed by
GitHub
parent
f1d998243a
commit
079b1cc06e
5
.changes/fix-dev-path-origin.md
Normal file
5
.changes/fix-dev-path-origin.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch
|
||||
---
|
||||
|
||||
Initialize Tauri script when `devPath` is an external URL with path.
|
||||
@@ -39,7 +39,7 @@ pub(crate) struct IpcJavascript<'a> {
|
||||
#[derive(Template)]
|
||||
#[default_template("../scripts/isolation.js")]
|
||||
pub(crate) struct IsolationJavascript<'a> {
|
||||
pub(crate) origin: &'a str,
|
||||
pub(crate) origin: String,
|
||||
pub(crate) isolation_src: &'a str,
|
||||
pub(crate) style: &'a str,
|
||||
}
|
||||
|
||||
@@ -362,16 +362,10 @@ impl<R: Runtime> WindowManager<R> {
|
||||
}
|
||||
|
||||
/// Get the origin as it will be seen in the webview.
|
||||
fn get_browser_origin(&self) -> Cow<'_, str> {
|
||||
fn get_browser_origin(&self) -> String {
|
||||
match self.base_path() {
|
||||
AppUrl::Url(WindowUrl::External(url)) => {
|
||||
let mut url = url.to_string();
|
||||
if url.ends_with('/') {
|
||||
url.pop();
|
||||
}
|
||||
Cow::Owned(url)
|
||||
}
|
||||
_ => Cow::Owned(format_real_schema("tauri")),
|
||||
AppUrl::Url(WindowUrl::External(url)) => url.origin().ascii_serialization(),
|
||||
_ => format_real_schema("tauri"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,7 +444,7 @@ impl<R: Runtime> WindowManager<R> {
|
||||
if let Pattern::Isolation { schema, .. } = self.pattern() {
|
||||
webview_attributes = webview_attributes.initialization_script(
|
||||
&IsolationJavascript {
|
||||
origin: &self.get_browser_origin(),
|
||||
origin: self.get_browser_origin(),
|
||||
isolation_src: &crate::pattern::format_real_schema(schema),
|
||||
style: tauri_utils::pattern::isolation::IFRAME_STYLE,
|
||||
}
|
||||
@@ -883,7 +877,7 @@ impl<R: Runtime> WindowManager<R> {
|
||||
#[derive(Template)]
|
||||
#[default_template("../scripts/init.js")]
|
||||
struct InitJavascript<'a> {
|
||||
origin: Cow<'a, str>,
|
||||
origin: String,
|
||||
#[raw]
|
||||
pattern_script: &'a str,
|
||||
#[raw]
|
||||
|
||||
Reference in New Issue
Block a user