feat: update to tauri beta, add permissions (#862)

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@crabnebula.dev>
This commit is contained in:
Tillmann
2024-02-04 03:14:41 +09:00
committed by GitHub
parent 506ce4835b
commit d198c01486
387 changed files with 21883 additions and 943 deletions
+7 -7
View File
@@ -9,9 +9,12 @@ rust-version = { workspace = true }
links = "tauri-plugin-dialog"
[package.metadata.docs.rs]
rustc-args = [ "--cfg", "docsrs" ]
rustdoc-args = [ "--cfg", "docsrs" ]
targets = [ "x86_64-unknown-linux-gnu", "x86_64-linux-android" ]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"]
[build-dependencies]
tauri-plugin = { workspace = true, features = ["build"] }
[dependencies]
serde = { workspace = true }
@@ -25,8 +28,5 @@ tauri-plugin-fs = { path = "../fs", version = "2.0.0-alpha.7" }
glib = "0.16"
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
rfd = { version = "=0.12.0", features = [ "gtk3", "common-controls-v6" ] }
rfd = { version = "=0.12.0", features = ["gtk3", "common-controls-v6"] }
raw-window-handle = "0.5"
[build-dependencies]
tauri-build = { workspace = true }
+4 -2
View File
@@ -2,11 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
const COMMANDS: &[&str] = &["open", "save", "message", "ask", "confirm"];
fn main() {
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
if let Err(error) = tauri_plugin::Builder::new(COMMANDS)
.android_path("android")
.ios_path("ios")
.run()
.try_build()
{
println!("{error:#}");
// when building documentation for Android the plugin build result is irrelevant to the crate itself
+1 -1
View File
@@ -23,6 +23,6 @@
"LICENSE"
],
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.13"
"@tauri-apps/api": "2.0.0-beta.0"
}
}
+1
View File
@@ -0,0 +1 @@
schemas/
+1
View File
@@ -0,0 +1 @@
schemas/
@@ -0,0 +1,13 @@
# Automatically generated - DO NOT EDIT!
"$schema" = "../../schemas/schema.json"
[[permission]]
identifier = "allow-ask"
description = "Enables the ask command without any pre-configured scope."
commands.allow = ["ask"]
[[permission]]
identifier = "deny-ask"
description = "Denies the ask command without any pre-configured scope."
commands.deny = ["ask"]
@@ -0,0 +1,13 @@
# Automatically generated - DO NOT EDIT!
"$schema" = "../../schemas/schema.json"
[[permission]]
identifier = "allow-confirm"
description = "Enables the confirm command without any pre-configured scope."
commands.allow = ["confirm"]
[[permission]]
identifier = "deny-confirm"
description = "Denies the confirm command without any pre-configured scope."
commands.deny = ["confirm"]
@@ -0,0 +1,13 @@
# Automatically generated - DO NOT EDIT!
"$schema" = "../../schemas/schema.json"
[[permission]]
identifier = "allow-message"
description = "Enables the message command without any pre-configured scope."
commands.allow = ["message"]
[[permission]]
identifier = "deny-message"
description = "Denies the message command without any pre-configured scope."
commands.deny = ["message"]
@@ -0,0 +1,13 @@
# Automatically generated - DO NOT EDIT!
"$schema" = "../../schemas/schema.json"
[[permission]]
identifier = "allow-open"
description = "Enables the open command without any pre-configured scope."
commands.allow = ["open"]
[[permission]]
identifier = "deny-open"
description = "Denies the open command without any pre-configured scope."
commands.deny = ["open"]
@@ -0,0 +1,13 @@
# Automatically generated - DO NOT EDIT!
"$schema" = "../../schemas/schema.json"
[[permission]]
identifier = "allow-save"
description = "Enables the save command without any pre-configured scope."
commands.allow = ["save"]
[[permission]]
identifier = "deny-save"
description = "Denies the save command without any pre-configured scope."
commands.deny = ["save"]
@@ -0,0 +1,42 @@
# Permissions
## allow-ask
Enables the ask command without any pre-configured scope.
## deny-ask
Denies the ask command without any pre-configured scope.
## allow-confirm
Enables the confirm command without any pre-configured scope.
## deny-confirm
Denies the confirm command without any pre-configured scope.
## allow-message
Enables the message command without any pre-configured scope.
## deny-message
Denies the message command without any pre-configured scope.
## allow-open
Enables the open command without any pre-configured scope.
## deny-open
Denies the open command without any pre-configured scope.
## allow-save
Enables the save command without any pre-configured scope.
## deny-save
Denies the save command without any pre-configured scope.
+5 -5
View File
@@ -118,7 +118,7 @@ pub(crate) async fn open<R: Runtime>(
if let Some(folders) = &folders {
for folder in folders {
if let Some(s) = window.try_fs_scope() {
s.allow_directory(folder, options.recursive)?;
s.allow_directory(folder, options.recursive);
}
}
}
@@ -127,7 +127,7 @@ pub(crate) async fn open<R: Runtime>(
let folder = dialog_builder.blocking_pick_folder();
if let Some(path) = &folder {
if let Some(s) = window.try_fs_scope() {
s.allow_directory(path, options.recursive)?;
s.allow_directory(path, options.recursive);
}
}
OpenResponse::Folder(folder)
@@ -140,7 +140,7 @@ pub(crate) async fn open<R: Runtime>(
if let Some(files) = &files {
for file in files {
if let Some(s) = window.try_fs_scope() {
s.allow_file(&file.path)?;
s.allow_file(&file.path);
}
window
.state::<tauri::scope::Scopes>()
@@ -152,7 +152,7 @@ pub(crate) async fn open<R: Runtime>(
let file = dialog_builder.blocking_pick_file();
if let Some(file) = &file {
if let Some(s) = window.try_fs_scope() {
s.allow_file(&file.path)?;
s.allow_file(&file.path);
}
window
.state::<tauri::scope::Scopes>()
@@ -193,7 +193,7 @@ pub(crate) async fn save<R: Runtime>(
let path = dialog_builder.blocking_save_file();
if let Some(p) = &path {
if let Some(s) = window.try_fs_scope() {
s.allow_file(p)?;
s.allow_file(p);
}
window.state::<tauri::scope::Scopes>().allow_file(p)?;
}
+2 -1
View File
@@ -1,5 +1,6 @@
{
"identifier": "studio.tauri.example",
"$schema": "../../../node_modules/.pnpm/@tauri-apps+cli@2.0.0-alpha.17/node_modules/@tauri-apps/cli/schema.json",
"identifier": "app.tauri.example",
"build": {
"frontendDist": ".",
"devUrl": "http://localhost:4000"