mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-28 20:48:52 +03:00
fix: asset protocol CORS on Windows
This commit is contained in:
parent
26dab690b7
commit
d56a7fc7f7
@ -304,16 +304,21 @@ impl<R: Runtime> WindowManager<R> {
|
||||
}
|
||||
if !registered_scheme_protocols.contains(&"asset".into()) {
|
||||
let window_url = Url::parse(&pending.url).unwrap();
|
||||
let window_origin = format!(
|
||||
"{}://{}{}",
|
||||
window_url.scheme(),
|
||||
window_url.host().unwrap(),
|
||||
if let Some(port) = window_url.port() {
|
||||
format!(":{}", port)
|
||||
let window_origin =
|
||||
if cfg!(windows) && window_url.scheme() != "http" && window_url.scheme() != "https" {
|
||||
format!("https://{}.localhost", window_url.scheme())
|
||||
} else {
|
||||
"".into()
|
||||
}
|
||||
);
|
||||
format!(
|
||||
"{}://{}{}",
|
||||
window_url.scheme(),
|
||||
window_url.host().unwrap(),
|
||||
if let Some(port) = window_url.port() {
|
||||
format!(":{}", port)
|
||||
} else {
|
||||
"".into()
|
||||
}
|
||||
)
|
||||
};
|
||||
pending.register_uri_scheme_protocol("asset", move |request| {
|
||||
#[cfg(target_os = "windows")]
|
||||
let path = request.uri().replace("asset://localhost/", "");
|
||||
|
Loading…
Reference in New Issue
Block a user