|
@@ -20,6 +20,8 @@ use tauri_utils::acl::{
|
|
ExecutionContext, Scopes,
|
|
ExecutionContext, Scopes,
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+use url::Url;
|
|
|
|
+
|
|
use crate::{ipc::InvokeError, sealed::ManagerBase, Runtime};
|
|
use crate::{ipc::InvokeError, sealed::ManagerBase, Runtime};
|
|
use crate::{AppHandle, Manager};
|
|
use crate::{AppHandle, Manager};
|
|
|
|
|
|
@@ -40,7 +42,7 @@ pub enum Origin {
|
|
/// Remote origin.
|
|
/// Remote origin.
|
|
Remote {
|
|
Remote {
|
|
/// Remote URL.
|
|
/// Remote URL.
|
|
- url: String,
|
|
|
|
|
|
+ url: Url,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
|
|
@@ -58,7 +60,7 @@ impl Origin {
|
|
match (self, context) {
|
|
match (self, context) {
|
|
(Self::Local, ExecutionContext::Local) => true,
|
|
(Self::Local, ExecutionContext::Local) => true,
|
|
(Self::Remote { url }, ExecutionContext::Remote { url: url_pattern }) => {
|
|
(Self::Remote { url }, ExecutionContext::Remote { url: url_pattern }) => {
|
|
- url_pattern.matches(url)
|
|
|
|
|
|
+ url_pattern.test(url)
|
|
}
|
|
}
|
|
_ => false,
|
|
_ => false,
|
|
}
|
|
}
|
|
@@ -816,7 +818,7 @@ mod tests {
|
|
let resolved_cmd = vec![ResolvedCommand {
|
|
let resolved_cmd = vec![ResolvedCommand {
|
|
windows: vec![Pattern::new(window).unwrap()],
|
|
windows: vec![Pattern::new(window).unwrap()],
|
|
context: ExecutionContext::Remote {
|
|
context: ExecutionContext::Remote {
|
|
- url: Pattern::new(url).unwrap(),
|
|
|
|
|
|
+ url: url.parse().unwrap(),
|
|
},
|
|
},
|
|
..Default::default()
|
|
..Default::default()
|
|
}];
|
|
}];
|
|
@@ -837,7 +839,9 @@ mod tests {
|
|
command,
|
|
command,
|
|
window,
|
|
window,
|
|
webview,
|
|
webview,
|
|
- &Origin::Remote { url: url.into() }
|
|
|
|
|
|
+ &Origin::Remote {
|
|
|
|
+ url: url.parse().unwrap()
|
|
|
|
+ }
|
|
),
|
|
),
|
|
Some(resolved_cmd)
|
|
Some(resolved_cmd)
|
|
);
|
|
);
|
|
@@ -853,7 +857,7 @@ mod tests {
|
|
let resolved_cmd = vec![ResolvedCommand {
|
|
let resolved_cmd = vec![ResolvedCommand {
|
|
windows: vec![Pattern::new(window).unwrap()],
|
|
windows: vec![Pattern::new(window).unwrap()],
|
|
context: ExecutionContext::Remote {
|
|
context: ExecutionContext::Remote {
|
|
- url: Pattern::new(url).unwrap(),
|
|
|
|
|
|
+ url: url.parse().unwrap(),
|
|
},
|
|
},
|
|
..Default::default()
|
|
..Default::default()
|
|
}];
|
|
}];
|
|
@@ -875,7 +879,7 @@ mod tests {
|
|
window,
|
|
window,
|
|
webview,
|
|
webview,
|
|
&Origin::Remote {
|
|
&Origin::Remote {
|
|
- url: url.replace('*', "studio")
|
|
|
|
|
|
+ url: url.replace('*', "studio").parse().unwrap()
|
|
}
|
|
}
|
|
),
|
|
),
|
|
Some(resolved_cmd)
|
|
Some(resolved_cmd)
|
|
@@ -908,7 +912,7 @@ mod tests {
|
|
window,
|
|
window,
|
|
webview,
|
|
webview,
|
|
&Origin::Remote {
|
|
&Origin::Remote {
|
|
- url: "https://tauri.app".into()
|
|
|
|
|
|
+ url: "https://tauri.app".parse().unwrap()
|
|
}
|
|
}
|
|
)
|
|
)
|
|
.is_none());
|
|
.is_none());
|