mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-21 01:32:03 +03:00
feat(core): expose scope::fs::Scope::new (#8432)
This commit is contained in:
parent
11a1529d6a
commit
b59f2f54e7
5
.changes/expose-fs-scope-new.md
Normal file
5
.changes/expose-fs-scope-new.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri": patch:feat
|
||||||
|
---
|
||||||
|
|
||||||
|
Expose `scope::fs::Scope::new`.
|
@ -1568,7 +1568,7 @@ impl<R: Runtime> Builder<R> {
|
|||||||
app.manage(Scopes {
|
app.manage(Scopes {
|
||||||
ipc: scope::ipc::Scope::new(app.config()),
|
ipc: scope::ipc::Scope::new(app.config()),
|
||||||
#[cfg(feature = "protocol-asset")]
|
#[cfg(feature = "protocol-asset")]
|
||||||
asset_protocol: scope::fs::Scope::for_fs_api(
|
asset_protocol: scope::fs::Scope::new(
|
||||||
&app,
|
&app,
|
||||||
&app.config().tauri.security.asset_protocol.scope,
|
&app.config().tauri.security.asset_protocol.scope,
|
||||||
)?,
|
)?,
|
||||||
|
@ -91,11 +91,10 @@ fn push_pattern<P: AsRef<Path>, F: Fn(&str) -> Result<Pattern, glob::PatternErro
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Scope {
|
impl Scope {
|
||||||
/// Creates a new scope from a `FsAllowlistScope` configuration.
|
/// Creates a new scope from a [`FsScope`] configuration.
|
||||||
#[allow(unused)]
|
pub fn new<R: crate::Runtime, M: crate::Manager<R>>(
|
||||||
pub(crate) fn for_fs_api<R: crate::Runtime, M: crate::Manager<R>>(
|
|
||||||
manager: &M,
|
manager: &M,
|
||||||
scope: &tauri_utils::config::FsScope,
|
scope: &FsScope,
|
||||||
) -> crate::Result<Self> {
|
) -> crate::Result<Self> {
|
||||||
let mut allowed_patterns = HashSet::new();
|
let mut allowed_patterns = HashSet::new();
|
||||||
for path in scope.allowed_paths() {
|
for path in scope.allowed_paths() {
|
||||||
|
Loading…
Reference in New Issue
Block a user