mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-24 17:20:51 +02:00
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:
@@ -6,10 +6,14 @@ edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
links = "tauri-plugin-updater"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustc-args = [ "--cfg", "docsrs" ]
|
||||
rustdoc-args = [ "--cfg", "docsrs" ]
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { workspace = true }
|
||||
@@ -17,15 +21,18 @@ serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tokio = "1"
|
||||
reqwest = { version = "0.11", default-features = false, features = [ "json", "stream" ] }
|
||||
reqwest = { version = "0.11", default-features = false, features = [
|
||||
"json",
|
||||
"stream",
|
||||
] }
|
||||
url = { workspace = true }
|
||||
http = "0.2"
|
||||
dirs-next = "2"
|
||||
minisign-verify = "0.2"
|
||||
time = { version = "0.3", features = [ "parsing", "formatting" ] }
|
||||
time = { version = "0.3", features = ["parsing", "formatting"] }
|
||||
base64 = "0.21"
|
||||
percent-encoding = "2"
|
||||
semver = { version = "1", features = [ "serde" ] }
|
||||
semver = { version = "1", features = ["serde"] }
|
||||
futures-util = "0.3"
|
||||
tempfile = "3"
|
||||
zip = "0.6"
|
||||
@@ -41,6 +48,6 @@ flate2 = "1.0.27"
|
||||
mockito = "0.31"
|
||||
|
||||
[features]
|
||||
native-tls = [ "reqwest/native-tls" ]
|
||||
native-tls-vendored = [ "reqwest/native-tls-vendored" ]
|
||||
rustls-tls = [ "reqwest/rustls-tls" ]
|
||||
native-tls = ["reqwest/native-tls"]
|
||||
native-tls-vendored = ["reqwest/native-tls-vendored"]
|
||||
rustls-tls = ["reqwest/rustls-tls"]
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
const COMMANDS: &[&str] = &["check", "download_and_install"];
|
||||
|
||||
fn main() {
|
||||
tauri_plugin::Builder::new(COMMANDS).build();
|
||||
|
||||
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||
let mobile = target_os == "ios" || target_os == "android";
|
||||
alias("desktop", !mobile);
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.13"
|
||||
"@tauri-apps/api": "2.0.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
schemas/
|
||||
@@ -0,0 +1 @@
|
||||
schemas/
|
||||
@@ -0,0 +1,13 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
"$schema" = "../../schemas/schema.json"
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-check"
|
||||
description = "Enables the check command without any pre-configured scope."
|
||||
commands.allow = ["check"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-check"
|
||||
description = "Denies the check command without any pre-configured scope."
|
||||
commands.deny = ["check"]
|
||||
@@ -0,0 +1,13 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
"$schema" = "../../schemas/schema.json"
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-download-and-install"
|
||||
description = "Enables the download_and_install command without any pre-configured scope."
|
||||
commands.allow = ["download_and_install"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-download-and-install"
|
||||
description = "Denies the download_and_install command without any pre-configured scope."
|
||||
commands.deny = ["download_and_install"]
|
||||
@@ -0,0 +1,22 @@
|
||||
# Permissions
|
||||
|
||||
## allow-check
|
||||
|
||||
Enables the check command without any pre-configured scope.
|
||||
|
||||
## deny-check
|
||||
|
||||
Denies the check command without any pre-configured scope.
|
||||
|
||||
## allow-download-and-install
|
||||
|
||||
Enables the download_and_install command without any pre-configured scope.
|
||||
|
||||
## deny-download-and-install
|
||||
|
||||
Denies the download_and_install command without any pre-configured scope.
|
||||
|
||||
## default
|
||||
|
||||
Allows checking for new updates and installing them
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
"$schema" = "schemas/schema.json"
|
||||
[default]
|
||||
description = "Allows checking for new updates and installing them"
|
||||
permissions = ["allow-check", "allow-download-and-install"]
|
||||
@@ -64,10 +64,10 @@ impl Default for WindowsUpdateInstallMode {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WindowsConfig {
|
||||
/// Additional arguments given to the NSIS or WiX installer.
|
||||
#[serde(default)]
|
||||
#[serde(default, alias = "installer-args")]
|
||||
pub installer_args: Vec<OsString>,
|
||||
/// Updating mode, see [`WindowsUpdateInstallMode`] for more info.
|
||||
#[serde(default)]
|
||||
#[serde(default, alias = "install-mode")]
|
||||
pub install_mode: WindowsUpdateInstallMode,
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ pub struct Config {
|
||||
/// Updater endpoints.
|
||||
#[serde(default)]
|
||||
pub endpoints: Vec<UpdaterEndpoint>,
|
||||
/// Updater pubkey used to verify signatures.
|
||||
/// Signature public key.
|
||||
pub pubkey: String,
|
||||
/// Updater config options specific to windows.
|
||||
/// The Windows configuration for the updater.
|
||||
pub windows: Option<WindowsConfig>,
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/capabilities/schemas
|
||||
|
||||
@@ -15,14 +15,9 @@ use serde::Serialize;
|
||||
|
||||
const UPDATER_PRIVATE_KEY: &str = "dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5Qm9uUXIyeEM2YkczeGMwZDFENmw1WHEzaFk5aDlOOXNyTWRxRnY4UUpzZ0FBQkFBQUFBQUFBQUFBQUlBQUFBQTVWbWdFYUZRWnNDZmdyUW9ibWExVEFTY0pVTWpVS2xlOHdhR1I3Q3hpd2FTNjg1MXZENEQyZWxnVE5PbnJUYWFTajRmdTJ3UWVPRlNDZldqY3dJeThKNktmY3BGdXl1M1BPdHgwOFhIQzJLSnpqS0Z2cVdmaEs2WWRmK3d4SHVCMlpHVGduaVAzclU9Cg==";
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct PackageConfig {
|
||||
version: &'static str,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct Config {
|
||||
package: PackageConfig,
|
||||
version: &'static str,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -163,9 +158,7 @@ fn update_app() {
|
||||
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
let root_dir = manifest_dir.join("../../../..");
|
||||
|
||||
let mut config = Config {
|
||||
package: PackageConfig { version: "1.0.0" },
|
||||
};
|
||||
let mut config = Config { version: "1.0.0" };
|
||||
|
||||
// bundle app update
|
||||
build_app(&manifest_dir, &config, true, Default::default());
|
||||
@@ -248,7 +241,7 @@ fn update_app() {
|
||||
}
|
||||
});
|
||||
|
||||
config.package.version = "0.1.0";
|
||||
config.version = "0.1.0";
|
||||
|
||||
// bundle initial app version
|
||||
build_app(&manifest_dir, &config, false, bundle_target);
|
||||
|
||||
Reference in New Issue
Block a user