|
|
|
@ -208,11 +208,18 @@ permissions = [
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tauri_plugin::Builder::new(&COMMANDS.iter().map(|c| c.0).collect::<Vec<_>>())
|
|
|
|
|
.global_api_script_path("./api-iife.js")
|
|
|
|
|
.global_scope_schema(schemars::schema_for!(FsScopeEntry))
|
|
|
|
|
.android_path("android")
|
|
|
|
|
.build();
|
|
|
|
|
tauri_plugin::Builder::new(
|
|
|
|
|
&COMMANDS
|
|
|
|
|
.iter()
|
|
|
|
|
// FIXME: https://docs.rs/crate/tauri-plugin-fs/2.1.0/builds/1571296
|
|
|
|
|
.filter(|c| c.1.is_empty())
|
|
|
|
|
.map(|c| c.0)
|
|
|
|
|
.collect::<Vec<_>>(),
|
|
|
|
|
)
|
|
|
|
|
.global_api_script_path("./api-iife.js")
|
|
|
|
|
.global_scope_schema(schemars::schema_for!(FsScopeEntry))
|
|
|
|
|
.android_path("android")
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
// workaround to include nested permissions as `tauri_plugin` doesn't support it
|
|
|
|
|
let permissions_dir = autogenerated.join("commands");
|
|
|
|
@ -234,9 +241,11 @@ permissions = [
|
|
|
|
|
.iter_mut()
|
|
|
|
|
.filter(|p| p.identifier.starts_with("allow"))
|
|
|
|
|
{
|
|
|
|
|
p.commands
|
|
|
|
|
.allow
|
|
|
|
|
.extend(nested_commands.iter().map(|s| s.to_string()));
|
|
|
|
|
for c in nested_commands.iter().map(|s| s.to_string()) {
|
|
|
|
|
if !p.commands.allow.contains(&c) {
|
|
|
|
|
p.commands.allow.push(c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let out = toml::to_string_pretty(&permission_file)
|
|
|
|
@ -248,7 +257,10 @@ permissions = [
|
|
|
|
|
|
|
|
|
|
{out}"#
|
|
|
|
|
);
|
|
|
|
|
std::fs::write(permission_path, out)
|
|
|
|
|
.unwrap_or_else(|_| panic!("failed to write {command}.toml"));
|
|
|
|
|
|
|
|
|
|
if content != out {
|
|
|
|
|
std::fs::write(permission_path, out)
|
|
|
|
|
.unwrap_or_else(|_| panic!("failed to write {command}.toml"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|