refactor: move plugin functionality from tauri-build to tauri-plugin (#8737)

* refactor: move plugin functionality from tauri-build to tauri-plugin

* fixes

* fix build

* move docs function

* autogenerated

* fix path
This commit is contained in:
Lucas Fernandes Nogueira 2024-02-03 08:48:57 -03:00 committed by GitHub
parent 63d6d474fd
commit 0cdfda2876
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
35 changed files with 1460 additions and 3838 deletions

View File

@ -217,7 +217,7 @@
"path": "./core/tauri-plugin",
"manager": "rust",
"dependencies": [
"tauri"
"tauri-utils"
],
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
},

View File

@ -0,0 +1,5 @@
---
"tauri-build": patch:breaking
---
Moved `mobile::PluginBuilder`, `mobile::update_entitlements`, `config::plugin_config` and `mobile::update_android_manifest` to the new `tauri-plugin` crate.

View File

@ -43,10 +43,6 @@ glob = "0.3"
toml = "0.8"
schemars = { version = "0.8", features = [ "preserve_order" ] }
[target."cfg(target_os = \"macos\")".dependencies]
swift-rs = { version = "1.0.6", features = [ "build" ] }
plist = "1"
[features]
default = [ "config-json" ]
codegen = [ "tauri-codegen", "quote" ]

View File

@ -1,22 +0,0 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use serde::de::DeserializeOwned;
use std::{env::var, io::Cursor};
pub fn plugin_config<T: DeserializeOwned>(name: &str) -> Option<T> {
let config_env_var_name = format!(
"TAURI_{}_PLUGIN_CONFIG",
name.to_uppercase().replace('-', "_")
);
if let Ok(config_str) = var(&config_env_var_name) {
println!("cargo:rerun-if-env-changed={config_env_var_name}");
serde_json::from_reader(Cursor::new(config_str))
.map(Some)
.expect("failed to parse configuration")
} else {
None
}
}

View File

@ -32,11 +32,8 @@ use std::{
mod acl;
#[cfg(feature = "codegen")]
mod codegen;
/// Tauri configuration functions.
pub mod config;
mod manifest;
/// Mobile build functions.
pub mod mobile;
mod mobile;
mod static_vcruntime;
#[cfg(feature = "codegen")]

View File

@ -2,242 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use std::{
env::{var, var_os},
fs::{copy, create_dir, create_dir_all, read_to_string, remove_dir_all, write},
path::{Path, PathBuf},
};
use std::{fs::write, path::PathBuf};
use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
#[derive(Debug, Default, Deserialize, Serialize, Eq, PartialEq)]
pub(crate) struct PluginMetadata {
pub path: PathBuf,
}
#[derive(Default)]
pub struct PluginBuilder {
android_path: Option<PathBuf>,
ios_path: Option<PathBuf>,
}
impl PluginBuilder {
/// Creates a new builder for mobile plugin functionality.
pub fn new() -> Self {
Self::default()
}
/// Sets the Android project path.
pub fn android_path<P: Into<PathBuf>>(mut self, android_path: P) -> Self {
self.android_path.replace(android_path.into());
self
}
/// Sets the iOS project path.
pub fn ios_path<P: Into<PathBuf>>(mut self, ios_path: P) -> Self {
self.ios_path.replace(ios_path.into());
self
}
/// Injects the mobile templates in the given path relative to the manifest root.
pub fn run(self) -> Result<()> {
let target_os = var("CARGO_CFG_TARGET_OS").unwrap();
let mobile = target_os == "android" || target_os == "ios";
crate::cfg_alias("mobile", mobile);
crate::cfg_alias("desktop", !mobile);
match target_os.as_str() {
"android" => {
if let Some(path) = self.android_path {
let manifest_dir = var_os("CARGO_MANIFEST_DIR").map(PathBuf::from).unwrap();
let source = manifest_dir.join(path);
let tauri_library_path = std::env::var("DEP_TAURI_ANDROID_LIBRARY_PATH")
.expect("missing `DEP_TAURI_ANDROID_LIBRARY_PATH` environment variable. Make sure `tauri` is a dependency of the plugin.");
println!("cargo:rerun-if-env-changed=DEP_TAURI_ANDROID_LIBRARY_PATH");
create_dir_all(source.join(".tauri")).context("failed to create .tauri directory")?;
copy_folder(
Path::new(&tauri_library_path),
&source.join(".tauri").join("tauri-api"),
&[],
)
.context("failed to copy tauri-api to the plugin project")?;
println!("cargo:android_library_path={}", source.display());
}
}
#[cfg(target_os = "macos")]
"ios" => {
if let Some(path) = self.ios_path {
let manifest_dir = var_os("CARGO_MANIFEST_DIR").map(PathBuf::from).unwrap();
let tauri_library_path = std::env::var("DEP_TAURI_IOS_LIBRARY_PATH")
.expect("missing `DEP_TAURI_IOS_LIBRARY_PATH` environment variable. Make sure `tauri` is a dependency of the plugin.");
let tauri_dep_path = path.parent().unwrap().join(".tauri");
create_dir_all(&tauri_dep_path).context("failed to create .tauri directory")?;
copy_folder(
Path::new(&tauri_library_path),
&tauri_dep_path.join("tauri-api"),
&[".build", "Package.resolved", "Tests"],
)
.context("failed to copy tauri-api to the plugin project")?;
link_swift_library(&var("CARGO_PKG_NAME").unwrap(), manifest_dir.join(path));
}
}
_ => (),
}
Ok(())
}
}
#[cfg(target_os = "macos")]
#[doc(hidden)]
pub fn link_swift_library(name: &str, source: impl AsRef<Path>) {
let source = source.as_ref();
let sdk_root = std::env::var_os("SDKROOT");
std::env::remove_var("SDKROOT");
swift_rs::SwiftLinker::new(
&std::env::var("MACOSX_DEPLOYMENT_TARGET").unwrap_or_else(|_| "10.13".into()),
)
.with_ios(&std::env::var("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or_else(|_| "13.0".into()))
.with_package(name, source)
.link();
if let Some(root) = sdk_root {
std::env::set_var("SDKROOT", root);
}
}
fn copy_folder(source: &Path, target: &Path, ignore_paths: &[&str]) -> Result<()> {
let _ = remove_dir_all(target);
for entry in walkdir::WalkDir::new(source) {
let entry = entry?;
let rel_path = entry.path().strip_prefix(source)?;
let rel_path_str = rel_path.to_string_lossy();
if ignore_paths
.iter()
.any(|path| rel_path_str.starts_with(path))
{
continue;
}
let dest_path = target.join(rel_path);
if entry.file_type().is_dir() {
create_dir(&dest_path)
.with_context(|| format!("failed to create directory {}", dest_path.display()))?;
} else {
copy(entry.path(), &dest_path).with_context(|| {
format!(
"failed to copy {} to {}",
entry.path().display(),
dest_path.display()
)
})?;
println!("cargo:rerun-if-changed={}", entry.path().display());
}
}
Ok(())
}
#[cfg(target_os = "macos")]
fn update_plist_file<P: AsRef<Path>, F: FnOnce(&mut plist::Dictionary)>(
path: P,
f: F,
) -> Result<()> {
use std::io::Cursor;
let path = path.as_ref();
if path.exists() {
let plist_str = read_to_string(path)?;
let mut plist = plist::Value::from_reader(Cursor::new(&plist_str))?;
if let Some(dict) = plist.as_dictionary_mut() {
f(dict);
let mut plist_buf = Vec::new();
let writer = Cursor::new(&mut plist_buf);
plist::to_writer_xml(writer, &plist)?;
let new_plist_str = String::from_utf8(plist_buf)?;
if new_plist_str != plist_str {
write(path, new_plist_str)?;
}
}
}
Ok(())
}
#[cfg(target_os = "macos")]
pub fn update_entitlements<F: FnOnce(&mut plist::Dictionary)>(f: F) -> Result<()> {
if let (Some(project_path), Ok(app_name)) = (
var_os("TAURI_IOS_PROJECT_PATH").map(PathBuf::from),
var("TAURI_IOS_APP_NAME"),
) {
update_plist_file(
project_path
.join(format!("{app_name}_iOS"))
.join(format!("{app_name}_iOS.entitlements")),
f,
)?;
}
Ok(())
}
fn xml_block_comment(id: &str) -> String {
format!("<!-- {id}. AUTO-GENERATED. DO NOT REMOVE. -->")
}
fn insert_into_xml(xml: &str, block_identifier: &str, parent_tag: &str, contents: &str) -> String {
let block_comment = xml_block_comment(block_identifier);
let mut rewritten = Vec::new();
let mut found_block = false;
let parent_closing_tag = format!("</{parent_tag}>");
for line in xml.split('\n') {
if line.contains(&block_comment) {
found_block = !found_block;
continue;
}
// found previous block which should be removed
if found_block {
continue;
}
if let Some(index) = line.find(&parent_closing_tag) {
let identation = " ".repeat(index + 4);
rewritten.push(format!("{}{}", identation, block_comment));
for l in contents.split('\n') {
rewritten.push(format!("{}{}", identation, l));
}
rewritten.push(format!("{}{}", identation, block_comment));
}
rewritten.push(line.to_string());
}
rewritten.join("\n")
}
pub fn update_android_manifest(block_identifier: &str, parent: &str, insert: String) -> Result<()> {
if let Some(project_path) = var_os("TAURI_ANDROID_PROJECT_PATH").map(PathBuf::from) {
let manifest_path = project_path.join("app/src/main/AndroidManifest.xml");
let manifest = read_to_string(&manifest_path)?;
let rewritten = insert_into_xml(&manifest, block_identifier, parent, &insert);
if rewritten != manifest {
write(manifest_path, rewritten)?;
}
}
Ok(())
}
pub(crate) fn generate_gradle_files(project_dir: PathBuf) -> Result<()> {
pub fn generate_gradle_files(project_dir: PathBuf) -> Result<()> {
let gradle_settings_path = project_dir.join("tauri.settings.gradle");
let app_build_gradle_path = project_dir.join("app").join("tauri.build.gradle.kts");
@ -289,37 +58,3 @@ dependencies {"
Ok(())
}
#[cfg(test)]
mod tests {
#[test]
fn insert_into_xml() {
let manifest = r#"<manifest>
<application>
<intent-filter>
</intent-filter>
</application>
</manifest>"#;
let id = "tauritest";
let new = super::insert_into_xml(manifest, id, "application", "<something></something>");
let block_id_comment = super::xml_block_comment(id);
let expected = format!(
r#"<manifest>
<application>
<intent-filter>
</intent-filter>
{block_id_comment}
<something></something>
{block_id_comment}
</application>
</manifest>"#
);
assert_eq!(new, expected);
// assert it's still the same after an empty update
let new = super::insert_into_xml(&expected, id, "application", "<something></something>");
assert_eq!(new, expected);
}
}

View File

@ -11,22 +11,28 @@ rust-version = { workspace = true }
[features]
build = [
"dep:anyhow",
"dep:serde",
"dep:cargo_metadata",
"dep:serde_json",
"dep:glob",
"dep:toml",
"dep:plist",
"dep:walkdir",
]
runtime = []
[dependencies]
anyhow = { version = "1", optional = true }
serde = { version = "1", optional = true }
cargo_metadata = { version = "0.18", optional = true }
tauri = { version = "2.0.0-alpha.20", default-features = false, path = "../tauri" }
tauri-utils = { version = "2.0.0-alpha.13", default-features = false, path = "../tauri-utils" }
serde_json = { version = "1", optional = true }
glob = { version = "0.3", optional = true }
toml = { version = "0.8", optional = true }
schemars = { version = "0.8", features = [ "preserve_order" ] }
walkdir = { version = "1", optional = true }
[target."cfg(target_os = \"macos\")".dependencies]
plist = { version = "1", optional = true }
[package.metadata.docs.rs]
features = ["build", "runtime"]

View File

@ -0,0 +1,232 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
//! Mobile-specific build utilities.
use std::{
env::var_os,
fs::{copy, create_dir, create_dir_all, read_to_string, remove_dir_all, write},
path::{Path, PathBuf},
};
use anyhow::{Context, Result};
use super::{build_var, cfg_alias};
#[cfg(target_os = "macos")]
pub fn update_entitlements<F: FnOnce(&mut plist::Dictionary)>(f: F) -> Result<()> {
if let (Some(project_path), Ok(app_name)) = (
var_os("TAURI_IOS_PROJECT_PATH").map(PathBuf::from),
std::env::var("TAURI_IOS_APP_NAME"),
) {
update_plist_file(
project_path
.join(format!("{app_name}_iOS"))
.join(format!("{app_name}_iOS.entitlements")),
f,
)?;
}
Ok(())
}
pub fn update_android_manifest(block_identifier: &str, parent: &str, insert: String) -> Result<()> {
if let Some(project_path) = var_os("TAURI_ANDROID_PROJECT_PATH").map(PathBuf::from) {
let manifest_path = project_path.join("app/src/main/AndroidManifest.xml");
let manifest = read_to_string(&manifest_path)?;
let rewritten = insert_into_xml(&manifest, block_identifier, parent, &insert);
if rewritten != manifest {
write(manifest_path, rewritten)?;
}
}
Ok(())
}
pub(crate) fn setup(
android_path: Option<PathBuf>,
#[allow(unused_variables)] ios_path: Option<PathBuf>,
) -> Result<()> {
let target_os = build_var("CARGO_CFG_TARGET_OS")?;
let mobile = target_os == "android" || target_os == "ios";
cfg_alias("mobile", mobile);
cfg_alias("desktop", !mobile);
match target_os.as_str() {
"android" => {
if let Some(path) = android_path {
let manifest_dir = build_var("CARGO_MANIFEST_DIR").map(PathBuf::from)?;
let source = manifest_dir.join(path);
let tauri_library_path = std::env::var("DEP_TAURI_ANDROID_LIBRARY_PATH")
.expect("missing `DEP_TAURI_ANDROID_LIBRARY_PATH` environment variable. Make sure `tauri` is a dependency of the plugin.");
println!("cargo:rerun-if-env-changed=DEP_TAURI_ANDROID_LIBRARY_PATH");
create_dir_all(source.join(".tauri")).context("failed to create .tauri directory")?;
copy_folder(
Path::new(&tauri_library_path),
&source.join(".tauri").join("tauri-api"),
&[],
)
.context("failed to copy tauri-api to the plugin project")?;
println!("cargo:android_library_path={}", source.display());
}
}
#[cfg(target_os = "macos")]
"ios" => {
if let Some(path) = ios_path {
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR")
.map(PathBuf::from)
.unwrap();
let tauri_library_path = std::env::var("DEP_TAURI_IOS_LIBRARY_PATH")
.expect("missing `DEP_TAURI_IOS_LIBRARY_PATH` environment variable. Make sure `tauri` is a dependency of the plugin.");
let tauri_dep_path = path.parent().unwrap().join(".tauri");
create_dir_all(&tauri_dep_path).context("failed to create .tauri directory")?;
copy_folder(
Path::new(&tauri_library_path),
&tauri_dep_path.join("tauri-api"),
&[".build", "Package.resolved", "Tests"],
)
.context("failed to copy tauri-api to the plugin project")?;
tauri_utils::build::link_swift_library(
&std::env::var("CARGO_PKG_NAME").unwrap(),
manifest_dir.join(path),
);
}
}
_ => (),
}
Ok(())
}
fn copy_folder(source: &Path, target: &Path, ignore_paths: &[&str]) -> Result<()> {
let _ = remove_dir_all(target);
for entry in walkdir::WalkDir::new(source) {
let entry = entry?;
let rel_path = entry.path().strip_prefix(source)?;
let rel_path_str = rel_path.to_string_lossy();
if ignore_paths
.iter()
.any(|path| rel_path_str.starts_with(path))
{
continue;
}
let dest_path = target.join(rel_path);
if entry.file_type().is_dir() {
create_dir(&dest_path)
.with_context(|| format!("failed to create directory {}", dest_path.display()))?;
} else {
copy(entry.path(), &dest_path).with_context(|| {
format!(
"failed to copy {} to {}",
entry.path().display(),
dest_path.display()
)
})?;
println!("cargo:rerun-if-changed={}", entry.path().display());
}
}
Ok(())
}
#[cfg(target_os = "macos")]
fn update_plist_file<P: AsRef<Path>, F: FnOnce(&mut plist::Dictionary)>(
path: P,
f: F,
) -> Result<()> {
use std::io::Cursor;
let path = path.as_ref();
if path.exists() {
let plist_str = read_to_string(path)?;
let mut plist = plist::Value::from_reader(Cursor::new(&plist_str))?;
if let Some(dict) = plist.as_dictionary_mut() {
f(dict);
let mut plist_buf = Vec::new();
let writer = Cursor::new(&mut plist_buf);
plist::to_writer_xml(writer, &plist)?;
let new_plist_str = String::from_utf8(plist_buf)?;
if new_plist_str != plist_str {
write(path, new_plist_str)?;
}
}
}
Ok(())
}
fn xml_block_comment(id: &str) -> String {
format!("<!-- {id}. AUTO-GENERATED. DO NOT REMOVE. -->")
}
fn insert_into_xml(xml: &str, block_identifier: &str, parent_tag: &str, contents: &str) -> String {
let block_comment = xml_block_comment(block_identifier);
let mut rewritten = Vec::new();
let mut found_block = false;
let parent_closing_tag = format!("</{parent_tag}>");
for line in xml.split('\n') {
if line.contains(&block_comment) {
found_block = !found_block;
continue;
}
// found previous block which should be removed
if found_block {
continue;
}
if let Some(index) = line.find(&parent_closing_tag) {
let identation = " ".repeat(index + 4);
rewritten.push(format!("{}{}", identation, block_comment));
for l in contents.split('\n') {
rewritten.push(format!("{}{}", identation, l));
}
rewritten.push(format!("{}{}", identation, block_comment));
}
rewritten.push(line.to_string());
}
rewritten.join("\n")
}
#[cfg(test)]
mod tests {
#[test]
fn insert_into_xml() {
let manifest = r#"<manifest>
<application>
<intent-filter>
</intent-filter>
</application>
</manifest>"#;
let id = "tauritest";
let new = super::insert_into_xml(manifest, id, "application", "<something></something>");
let block_id_comment = super::xml_block_comment(id);
let expected = format!(
r#"<manifest>
<application>
<intent-filter>
</intent-filter>
{block_id_comment}
<something></something>
{block_id_comment}
</application>
</manifest>"#
);
assert_eq!(new, expected);
// assert it's still the same after an empty update
let new = super::insert_into_xml(&expected, id, "application", "<something></something>");
assert_eq!(new, expected);
}
}

View File

@ -4,12 +4,35 @@
use std::path::{Path, PathBuf};
use cargo_metadata::{Metadata, MetadataCommand};
use tauri::utils::acl::{self, Error};
use anyhow::Result;
use tauri_utils::acl::{self, Error};
pub mod mobile;
use serde::de::DeserializeOwned;
use std::{env::var, io::Cursor};
pub fn plugin_config<T: DeserializeOwned>(name: &str) -> Option<T> {
let config_env_var_name = format!(
"TAURI_{}_PLUGIN_CONFIG",
name.to_uppercase().replace('-', "_")
);
if let Ok(config_str) = var(&config_env_var_name) {
println!("cargo:rerun-if-env-changed={config_env_var_name}");
serde_json::from_reader(Cursor::new(config_str))
.map(Some)
.expect("failed to parse configuration")
} else {
None
}
}
pub struct Builder<'a> {
commands: &'a [&'static str],
global_scope_schema: Option<schemars::schema::RootSchema>,
android_path: Option<PathBuf>,
ios_path: Option<PathBuf>,
}
impl<'a> Builder<'a> {
@ -17,6 +40,8 @@ impl<'a> Builder<'a> {
Self {
commands,
global_scope_schema: None,
android_path: None,
ios_path: None,
}
}
@ -26,10 +51,22 @@ impl<'a> Builder<'a> {
self
}
/// Sets the Android project path.
pub fn android_path<P: Into<PathBuf>>(mut self, android_path: P) -> Self {
self.android_path.replace(android_path.into());
self
}
/// Sets the iOS project path.
pub fn ios_path<P: Into<PathBuf>>(mut self, ios_path: P) -> Self {
self.ios_path.replace(ios_path.into());
self
}
/// [`Self::try_build`] but will exit automatically if an error is found.
pub fn build(self) {
if let Err(error) = self.try_build() {
println!("{}: {}", env!("CARGO_PKG_NAME"), error);
println!("{}: {error:#}", env!("CARGO_PKG_NAME"));
std::process::exit(1);
}
}
@ -40,11 +77,11 @@ impl<'a> Builder<'a> {
///
/// Errors will occur if environmental variables expected to be set inside of [build scripts]
/// are not found, or if the crate violates Tauri plugin conventions.
pub fn try_build(self) -> Result<(), Error> {
pub fn try_build(self) -> Result<()> {
// convention: plugin names should not use underscores
let name = build_var("CARGO_PKG_NAME")?;
if name.contains('_') {
return Err(Error::CrateName);
anyhow::bail!("plugin names cannot contain underscores");
}
let out_dir = PathBuf::from(build_var("OUT_DIR")?);
@ -53,77 +90,36 @@ impl<'a> Builder<'a> {
let _links = build_var("CARGO_MANIFEST_LINKS")?;
let autogenerated = Path::new("permissions").join(acl::build::AUTOGENERATED_FOLDER_NAME);
let commands_dir = &autogenerated.join("commands");
let commands_dir = autogenerated.join("commands");
std::fs::create_dir_all(&autogenerated).expect("unable to create permissions dir");
if !self.commands.is_empty() {
acl::build::autogenerate_command_permissions(commands_dir, self.commands, "");
acl::build::autogenerate_command_permissions(&commands_dir, self.commands, "");
}
let permissions = acl::build::define_permissions("./permissions/**/*.*", &name, &out_dir)?;
acl::build::generate_schema(&permissions, "./permissions")?;
generate_docs(&permissions, &autogenerated)?;
acl::build::generate_docs(&permissions, &autogenerated)?;
if let Some(global_scope_schema) = self.global_scope_schema {
acl::build::define_global_scope_schema(global_scope_schema, &name, &out_dir)?;
}
let metadata = find_metadata()?;
println!("{metadata:#?}");
mobile::setup(self.android_path, self.ios_path)?;
Ok(())
}
}
fn generate_docs(permissions: &[acl::plugin::PermissionFile], out_dir: &Path) -> Result<(), Error> {
let mut docs = format!("# Permissions\n\n");
fn docs_from(id: &str, description: Option<&str>) -> String {
let mut docs = format!("## {id}");
if let Some(d) = description {
docs.push_str(&format!("\n\n{d}"));
}
docs
fn cfg_alias(alias: &str, has_feature: bool) {
if has_feature {
println!("cargo:rustc-cfg={alias}");
}
for permission in permissions {
for set in &permission.set {
docs.push_str(&docs_from(&set.identifier, Some(&set.description)));
docs.push_str("\n\n");
}
if let Some(default) = &permission.default {
docs.push_str(&docs_from("default", default.description.as_deref()));
docs.push_str("\n\n");
}
for permission in &permission.permission {
docs.push_str(&docs_from(
&permission.identifier,
permission.description.as_deref(),
));
docs.push_str("\n\n");
}
}
std::fs::write(out_dir.join("reference.md"), docs).map_err(Error::WriteFile)?;
Ok(())
}
/// Grab an env var that is expected to be set inside of build scripts.
fn build_var(key: &'static str) -> Result<String, Error> {
std::env::var(key).map_err(|_| Error::BuildVar(key))
}
fn find_metadata() -> Result<Metadata, Error> {
build_var("CARGO_MANIFEST_DIR").and_then(|dir| {
MetadataCommand::new()
.current_dir(dir)
.no_deps()
.exec()
.map_err(Error::Metadata)
})
}

View File

@ -44,8 +44,11 @@ cargo_metadata = { version = "0.18", optional = true }
[target."cfg(target_os = \"linux\")".dependencies]
heck = "0.4"
[target."cfg(target_os = \"macos\")".dependencies]
swift-rs = { version = "1.0.6", optional = true, features = [ "build" ] }
[features]
build = [ "proc-macro2", "quote", "cargo_metadata", "schema" ]
build = [ "proc-macro2", "quote", "cargo_metadata", "schema", "swift-rs" ]
compression = [ "brotli" ]
schema = [ "schemars" ]
isolation = [ "aes-gcm", "getrandom", "serialize-to-javascript" ]

View File

@ -259,6 +259,46 @@ pub fn generate_schema<P: AsRef<Path>>(
Ok(())
}
/// Generate a markdown documentation page containing the list of permissions of the plugin.
pub fn generate_docs(permissions: &[PermissionFile], out_dir: &Path) -> Result<(), Error> {
let mut docs = "# Permissions\n\n".to_string();
fn docs_from(id: &str, description: Option<&str>) -> String {
let mut docs = format!("## {id}");
if let Some(d) = description {
docs.push_str(&format!("\n\n{d}"));
}
docs
}
for permission in permissions {
for set in &permission.set {
docs.push_str(&docs_from(&set.identifier, Some(&set.description)));
docs.push_str("\n\n");
}
if let Some(default) = &permission.default {
docs.push_str(&docs_from("default", default.description.as_deref()));
docs.push_str("\n\n");
}
for permission in &permission.permission {
docs.push_str(&docs_from(
&permission.identifier,
permission.description.as_deref(),
));
docs.push_str("\n\n");
}
}
let reference_path = out_dir.join("reference.md");
if docs != read_to_string(&reference_path).unwrap_or_default() {
std::fs::write(reference_path, docs).map_err(Error::WriteFile)?;
}
Ok(())
}
/// Read all permissions listed from the defined cargo cfg key value.
pub fn read_permissions() -> Result<HashMap<String, Vec<PermissionFile>>, Error> {
let mut permissions_map = HashMap::new();

View File

@ -28,10 +28,6 @@ pub enum Error {
#[error("expected build script env var {0}, but it was not found - ensure this is called in a build script")]
BuildVar(&'static str),
/// Plugin name doesn't follow Tauri standards
#[error("plugin names cannot contain underscores")]
CrateName,
/// The links field in the manifest **MUST** be set and match the name of the crate.
#[error("package.links field in the Cargo manifest is not set, it should be set to the same as package.name")]
LinksMissing,

View File

@ -0,0 +1,25 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
//! Build script utilities.
/// Link a Swift library.
#[cfg(target_os = "macos")]
pub fn link_swift_library(name: &str, source: impl AsRef<std::path::Path>) {
let source = source.as_ref();
let sdk_root = std::env::var_os("SDKROOT");
std::env::remove_var("SDKROOT");
swift_rs::SwiftLinker::new(
&std::env::var("MACOSX_DEPLOYMENT_TARGET").unwrap_or_else(|_| "10.13".into()),
)
.with_ios(&std::env::var("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or_else(|_| "13.0".into()))
.with_package(name, source)
.link();
if let Some(root) = sdk_root {
std::env::set_var("SDKROOT", root);
}
}

View File

@ -37,6 +37,9 @@ pub mod resources;
#[cfg(feature = "build")]
pub mod tokens;
#[cfg(feature = "build")]
pub mod build;
/// Application pattern.
pub mod pattern;

View File

@ -5,6 +5,7 @@
use heck::AsShoutySnakeCase;
use std::env::var_os;
use std::fs::create_dir_all;
use std::fs::read_dir;
use std::fs::read_to_string;
use std::fs::write;
@ -297,7 +298,7 @@ fn main() {
if target_os == "ios" {
let lib_path =
PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("mobile/ios-api");
tauri_build::mobile::link_swift_library("Tauri", &lib_path);
tauri_utils::build::link_swift_library("Tauri", &lib_path);
println!("cargo:ios_library_path={}", lib_path.display());
}
}
@ -347,7 +348,7 @@ permissions = [{default_permissions}]
.unwrap_or_else(|_| panic!("unable to autogenerate default permissions"));
}
tauri_utils::acl::build::define_permissions(
let permissions = tauri_utils::acl::build::define_permissions(
&permissions_out_dir
.join("**")
.join("*.toml")
@ -356,6 +357,11 @@ permissions = [{default_permissions}]
out_dir,
)
.unwrap_or_else(|e| panic!("failed to define permissions for {plugin}: {e}"));
let docs_out_dir = Path::new("permissions").join(plugin).join("autogenerated");
create_dir_all(&docs_out_dir).expect("failed to create plugin documentation directory");
tauri_utils::acl::build::generate_docs(&permissions, &docs_out_dir)
.expect("failed to generate plugin documentation page");
}
}

View File

@ -0,0 +1,46 @@
# Permissions
## allow-app-hide
Enables the app_hide command without any pre-configured scope.
## deny-app-hide
Denies the app_hide command without any pre-configured scope.
## allow-app-show
Enables the app_show command without any pre-configured scope.
## deny-app-show
Denies the app_show command without any pre-configured scope.
## allow-name
Enables the name command without any pre-configured scope.
## deny-name
Denies the name command without any pre-configured scope.
## allow-tauri-version
Enables the tauri_version command without any pre-configured scope.
## deny-tauri-version
Denies the tauri_version command without any pre-configured scope.
## allow-version
Enables the version command without any pre-configured scope.
## deny-version
Denies the version command without any pre-configured scope.
## default
Default permissions for the plugin.

View File

@ -0,0 +1,38 @@
# Permissions
## allow-emit
Enables the emit command without any pre-configured scope.
## deny-emit
Denies the emit command without any pre-configured scope.
## allow-emit-to
Enables the emit_to command without any pre-configured scope.
## deny-emit-to
Denies the emit_to command without any pre-configured scope.
## allow-listen
Enables the listen command without any pre-configured scope.
## deny-listen
Denies the listen command without any pre-configured scope.
## allow-unlisten
Enables the unlisten command without any pre-configured scope.
## deny-unlisten
Denies the unlisten command without any pre-configured scope.
## default
Default permissions for the plugin.

View File

@ -1,315 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PermissionFile",
"description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.",
"type": "object",
"properties": {
"default": {
"description": "The default permission set for the plugin",
"anyOf": [
{
"$ref": "#/definitions/DefaultPermission"
},
{
"type": "null"
}
]
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
}
},
"definitions": {
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"Permission": {
"description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.",
"type": "object",
"required": [
"identifier"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
}
}
},
"Commands": {
"description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.",
"type": "object",
"properties": {
"allow": {
"description": "Allowed command.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"description": "Denied command, which takes priority.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Scopes": {
"description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.",
"type": "object",
"properties": {
"allow": {
"description": "Data that defines what is allowed by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
},
"deny": {
"description": "Data that defines what is denied by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
}
}
},
"Value": {
"description": "All supported ACL values.",
"anyOf": [
{
"description": "Represents a null JSON value.",
"type": "null"
},
{
"description": "Represents a [`bool`].",
"type": "boolean"
},
{
"description": "Represents a valid ACL [`Number`].",
"allOf": [
{
"$ref": "#/definitions/Number"
}
]
},
{
"description": "Represents a [`String`].",
"type": "string"
},
{
"description": "Represents a list of other [`Value`]s.",
"type": "array",
"items": {
"$ref": "#/definitions/Value"
}
},
{
"description": "Represents a map of [`String`] keys to [`Value`]s.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Value"
}
}
]
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"PermissionKind": {
"type": "string",
"oneOf": [
{
"description": "allow-emit -> Enables the emit command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-emit"
]
},
{
"description": "deny-emit -> Denies the emit command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-emit"
]
},
{
"description": "allow-emit-to -> Enables the emit_to command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-emit-to"
]
},
{
"description": "deny-emit-to -> Denies the emit_to command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-emit-to"
]
},
{
"description": "allow-listen -> Enables the listen command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-listen"
]
},
{
"description": "deny-listen -> Denies the listen command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-listen"
]
},
{
"description": "allow-unlisten -> Enables the unlisten command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-unlisten"
]
},
{
"description": "deny-unlisten -> Denies the unlisten command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-unlisten"
]
},
{
"description": "default -> Default permissions for the plugin.",
"type": "string",
"enum": [
"default"
]
}
]
}
}
}

View File

@ -0,0 +1,182 @@
# Permissions
## allow-append
Enables the append command without any pre-configured scope.
## deny-append
Denies the append command without any pre-configured scope.
## allow-create-default
Enables the create_default command without any pre-configured scope.
## deny-create-default
Denies the create_default command without any pre-configured scope.
## allow-get
Enables the get command without any pre-configured scope.
## deny-get
Denies the get command without any pre-configured scope.
## allow-insert
Enables the insert command without any pre-configured scope.
## deny-insert
Denies the insert command without any pre-configured scope.
## allow-is-checked
Enables the is_checked command without any pre-configured scope.
## deny-is-checked
Denies the is_checked command without any pre-configured scope.
## allow-is-enabled
Enables the is_enabled command without any pre-configured scope.
## deny-is-enabled
Denies the is_enabled command without any pre-configured scope.
## allow-items
Enables the items command without any pre-configured scope.
## deny-items
Denies the items command without any pre-configured scope.
## allow-new
Enables the new command without any pre-configured scope.
## deny-new
Denies the new command without any pre-configured scope.
## allow-popup
Enables the popup command without any pre-configured scope.
## deny-popup
Denies the popup command without any pre-configured scope.
## allow-prepend
Enables the prepend command without any pre-configured scope.
## deny-prepend
Denies the prepend command without any pre-configured scope.
## allow-remove
Enables the remove command without any pre-configured scope.
## deny-remove
Denies the remove command without any pre-configured scope.
## allow-remove-at
Enables the remove_at command without any pre-configured scope.
## deny-remove-at
Denies the remove_at command without any pre-configured scope.
## allow-set-accelerator
Enables the set_accelerator command without any pre-configured scope.
## deny-set-accelerator
Denies the set_accelerator command without any pre-configured scope.
## allow-set-as-app-menu
Enables the set_as_app_menu command without any pre-configured scope.
## deny-set-as-app-menu
Denies the set_as_app_menu command without any pre-configured scope.
## allow-set-as-help-menu-for-nsapp
Enables the set_as_help_menu_for_nsapp command without any pre-configured scope.
## deny-set-as-help-menu-for-nsapp
Denies the set_as_help_menu_for_nsapp command without any pre-configured scope.
## allow-set-as-window-menu
Enables the set_as_window_menu command without any pre-configured scope.
## deny-set-as-window-menu
Denies the set_as_window_menu command without any pre-configured scope.
## allow-set-as-windows-menu-for-nsapp
Enables the set_as_windows_menu_for_nsapp command without any pre-configured scope.
## deny-set-as-windows-menu-for-nsapp
Denies the set_as_windows_menu_for_nsapp command without any pre-configured scope.
## allow-set-checked
Enables the set_checked command without any pre-configured scope.
## deny-set-checked
Denies the set_checked command without any pre-configured scope.
## allow-set-enabled
Enables the set_enabled command without any pre-configured scope.
## deny-set-enabled
Denies the set_enabled command without any pre-configured scope.
## allow-set-icon
Enables the set_icon command without any pre-configured scope.
## deny-set-icon
Denies the set_icon command without any pre-configured scope.
## allow-set-text
Enables the set_text command without any pre-configured scope.
## deny-set-text
Denies the set_text command without any pre-configured scope.
## allow-text
Enables the text command without any pre-configured scope.
## deny-text
Denies the text command without any pre-configured scope.
## default
Default permissions for the plugin.

View File

@ -1,567 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PermissionFile",
"description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.",
"type": "object",
"properties": {
"default": {
"description": "The default permission set for the plugin",
"anyOf": [
{
"$ref": "#/definitions/DefaultPermission"
},
{
"type": "null"
}
]
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
}
},
"definitions": {
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"Permission": {
"description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.",
"type": "object",
"required": [
"identifier"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
}
}
},
"Commands": {
"description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.",
"type": "object",
"properties": {
"allow": {
"description": "Allowed command.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"description": "Denied command, which takes priority.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Scopes": {
"description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.",
"type": "object",
"properties": {
"allow": {
"description": "Data that defines what is allowed by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
},
"deny": {
"description": "Data that defines what is denied by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
}
}
},
"Value": {
"description": "All supported ACL values.",
"anyOf": [
{
"description": "Represents a null JSON value.",
"type": "null"
},
{
"description": "Represents a [`bool`].",
"type": "boolean"
},
{
"description": "Represents a valid ACL [`Number`].",
"allOf": [
{
"$ref": "#/definitions/Number"
}
]
},
{
"description": "Represents a [`String`].",
"type": "string"
},
{
"description": "Represents a list of other [`Value`]s.",
"type": "array",
"items": {
"$ref": "#/definitions/Value"
}
},
{
"description": "Represents a map of [`String`] keys to [`Value`]s.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Value"
}
}
]
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"PermissionKind": {
"type": "string",
"oneOf": [
{
"description": "allow-append -> Enables the append command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-append"
]
},
{
"description": "deny-append -> Denies the append command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-append"
]
},
{
"description": "allow-create-default -> Enables the create_default command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-create-default"
]
},
{
"description": "deny-create-default -> Denies the create_default command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-create-default"
]
},
{
"description": "allow-get -> Enables the get command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-get"
]
},
{
"description": "deny-get -> Denies the get command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-get"
]
},
{
"description": "allow-insert -> Enables the insert command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-insert"
]
},
{
"description": "deny-insert -> Denies the insert command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-insert"
]
},
{
"description": "allow-is-checked -> Enables the is_checked command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-is-checked"
]
},
{
"description": "deny-is-checked -> Denies the is_checked command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-is-checked"
]
},
{
"description": "allow-is-enabled -> Enables the is_enabled command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-is-enabled"
]
},
{
"description": "deny-is-enabled -> Denies the is_enabled command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-is-enabled"
]
},
{
"description": "allow-items -> Enables the items command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-items"
]
},
{
"description": "deny-items -> Denies the items command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-items"
]
},
{
"description": "allow-new -> Enables the new command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-new"
]
},
{
"description": "deny-new -> Denies the new command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-new"
]
},
{
"description": "allow-popup -> Enables the popup command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-popup"
]
},
{
"description": "deny-popup -> Denies the popup command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-popup"
]
},
{
"description": "allow-prepend -> Enables the prepend command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-prepend"
]
},
{
"description": "deny-prepend -> Denies the prepend command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-prepend"
]
},
{
"description": "allow-remove -> Enables the remove command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-remove"
]
},
{
"description": "deny-remove -> Denies the remove command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-remove"
]
},
{
"description": "allow-remove-at -> Enables the remove_at command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-remove-at"
]
},
{
"description": "deny-remove-at -> Denies the remove_at command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-remove-at"
]
},
{
"description": "allow-set-accelerator -> Enables the set_accelerator command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-accelerator"
]
},
{
"description": "deny-set-accelerator -> Denies the set_accelerator command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-accelerator"
]
},
{
"description": "allow-set-as-app-menu -> Enables the set_as_app_menu command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-as-app-menu"
]
},
{
"description": "deny-set-as-app-menu -> Denies the set_as_app_menu command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-as-app-menu"
]
},
{
"description": "allow-set-as-help-menu-for-nsapp -> Enables the set_as_help_menu_for_nsapp command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-as-help-menu-for-nsapp"
]
},
{
"description": "deny-set-as-help-menu-for-nsapp -> Denies the set_as_help_menu_for_nsapp command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-as-help-menu-for-nsapp"
]
},
{
"description": "allow-set-as-window-menu -> Enables the set_as_window_menu command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-as-window-menu"
]
},
{
"description": "deny-set-as-window-menu -> Denies the set_as_window_menu command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-as-window-menu"
]
},
{
"description": "allow-set-as-windows-menu-for-nsapp -> Enables the set_as_windows_menu_for_nsapp command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-as-windows-menu-for-nsapp"
]
},
{
"description": "deny-set-as-windows-menu-for-nsapp -> Denies the set_as_windows_menu_for_nsapp command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-as-windows-menu-for-nsapp"
]
},
{
"description": "allow-set-checked -> Enables the set_checked command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-checked"
]
},
{
"description": "deny-set-checked -> Denies the set_checked command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-checked"
]
},
{
"description": "allow-set-enabled -> Enables the set_enabled command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-enabled"
]
},
{
"description": "deny-set-enabled -> Denies the set_enabled command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-enabled"
]
},
{
"description": "allow-set-icon -> Enables the set_icon command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-icon"
]
},
{
"description": "deny-set-icon -> Denies the set_icon command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-icon"
]
},
{
"description": "allow-set-text -> Enables the set_text command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-text"
]
},
{
"description": "deny-set-text -> Denies the set_text command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-text"
]
},
{
"description": "allow-text -> Enables the text command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-text"
]
},
{
"description": "deny-text -> Denies the text command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-text"
]
},
{
"description": "default -> Default permissions for the plugin.",
"type": "string",
"enum": [
"default"
]
}
]
}
}
}

View File

@ -0,0 +1,70 @@
# Permissions
## allow-basename
Enables the basename command without any pre-configured scope.
## deny-basename
Denies the basename command without any pre-configured scope.
## allow-dirname
Enables the dirname command without any pre-configured scope.
## deny-dirname
Denies the dirname command without any pre-configured scope.
## allow-extname
Enables the extname command without any pre-configured scope.
## deny-extname
Denies the extname command without any pre-configured scope.
## allow-is-absolute
Enables the is_absolute command without any pre-configured scope.
## deny-is-absolute
Denies the is_absolute command without any pre-configured scope.
## allow-join
Enables the join command without any pre-configured scope.
## deny-join
Denies the join command without any pre-configured scope.
## allow-normalize
Enables the normalize command without any pre-configured scope.
## deny-normalize
Denies the normalize command without any pre-configured scope.
## allow-resolve
Enables the resolve command without any pre-configured scope.
## deny-resolve
Denies the resolve command without any pre-configured scope.
## allow-resolve-directory
Enables the resolve_directory command without any pre-configured scope.
## deny-resolve-directory
Denies the resolve_directory command without any pre-configured scope.
## default
Default permissions for the plugin.

View File

@ -1,371 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PermissionFile",
"description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.",
"type": "object",
"properties": {
"default": {
"description": "The default permission set for the plugin",
"anyOf": [
{
"$ref": "#/definitions/DefaultPermission"
},
{
"type": "null"
}
]
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
}
},
"definitions": {
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"Permission": {
"description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.",
"type": "object",
"required": [
"identifier"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
}
}
},
"Commands": {
"description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.",
"type": "object",
"properties": {
"allow": {
"description": "Allowed command.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"description": "Denied command, which takes priority.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Scopes": {
"description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.",
"type": "object",
"properties": {
"allow": {
"description": "Data that defines what is allowed by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
},
"deny": {
"description": "Data that defines what is denied by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
}
}
},
"Value": {
"description": "All supported ACL values.",
"anyOf": [
{
"description": "Represents a null JSON value.",
"type": "null"
},
{
"description": "Represents a [`bool`].",
"type": "boolean"
},
{
"description": "Represents a valid ACL [`Number`].",
"allOf": [
{
"$ref": "#/definitions/Number"
}
]
},
{
"description": "Represents a [`String`].",
"type": "string"
},
{
"description": "Represents a list of other [`Value`]s.",
"type": "array",
"items": {
"$ref": "#/definitions/Value"
}
},
{
"description": "Represents a map of [`String`] keys to [`Value`]s.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Value"
}
}
]
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"PermissionKind": {
"type": "string",
"oneOf": [
{
"description": "allow-basename -> Enables the basename command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-basename"
]
},
{
"description": "deny-basename -> Denies the basename command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-basename"
]
},
{
"description": "allow-dirname -> Enables the dirname command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-dirname"
]
},
{
"description": "deny-dirname -> Denies the dirname command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-dirname"
]
},
{
"description": "allow-extname -> Enables the extname command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-extname"
]
},
{
"description": "deny-extname -> Denies the extname command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-extname"
]
},
{
"description": "allow-is-absolute -> Enables the is_absolute command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-is-absolute"
]
},
{
"description": "deny-is-absolute -> Denies the is_absolute command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-is-absolute"
]
},
{
"description": "allow-join -> Enables the join command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-join"
]
},
{
"description": "deny-join -> Denies the join command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-join"
]
},
{
"description": "allow-normalize -> Enables the normalize command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-normalize"
]
},
{
"description": "deny-normalize -> Denies the normalize command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-normalize"
]
},
{
"description": "allow-resolve -> Enables the resolve command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-resolve"
]
},
{
"description": "deny-resolve -> Denies the resolve command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-resolve"
]
},
{
"description": "allow-resolve-directory -> Enables the resolve_directory command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-resolve-directory"
]
},
{
"description": "deny-resolve-directory -> Denies the resolve_directory command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-resolve-directory"
]
},
{
"description": "default -> Default permissions for the plugin.",
"type": "string",
"enum": [
"default"
]
}
]
}
}
}

View File

@ -0,0 +1,14 @@
# Permissions
## allow-close
Enables the close command without any pre-configured scope.
## deny-close
Denies the close command without any pre-configured scope.
## default
Default permissions for the plugin.

View File

@ -1,273 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PermissionFile",
"description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.",
"type": "object",
"properties": {
"default": {
"description": "The default permission set for the plugin",
"anyOf": [
{
"$ref": "#/definitions/DefaultPermission"
},
{
"type": "null"
}
]
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
}
},
"definitions": {
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"Permission": {
"description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.",
"type": "object",
"required": [
"identifier"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
}
}
},
"Commands": {
"description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.",
"type": "object",
"properties": {
"allow": {
"description": "Allowed command.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"description": "Denied command, which takes priority.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Scopes": {
"description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.",
"type": "object",
"properties": {
"allow": {
"description": "Data that defines what is allowed by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
},
"deny": {
"description": "Data that defines what is denied by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
}
}
},
"Value": {
"description": "All supported ACL values.",
"anyOf": [
{
"description": "Represents a null JSON value.",
"type": "null"
},
{
"description": "Represents a [`bool`].",
"type": "boolean"
},
{
"description": "Represents a valid ACL [`Number`].",
"allOf": [
{
"$ref": "#/definitions/Number"
}
]
},
{
"description": "Represents a [`String`].",
"type": "string"
},
{
"description": "Represents a list of other [`Value`]s.",
"type": "array",
"items": {
"$ref": "#/definitions/Value"
}
},
{
"description": "Represents a map of [`String`] keys to [`Value`]s.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Value"
}
}
]
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"PermissionKind": {
"type": "string",
"oneOf": [
{
"description": "allow-close -> Enables the close command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-close"
]
},
{
"description": "deny-close -> Denies the close command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-close"
]
},
{
"description": "default -> Default permissions for the plugin.",
"type": "string",
"enum": [
"default"
]
}
]
}
}
}

View File

@ -0,0 +1,78 @@
# Permissions
## allow-new
Enables the new command without any pre-configured scope.
## deny-new
Denies the new command without any pre-configured scope.
## allow-set-icon
Enables the set_icon command without any pre-configured scope.
## deny-set-icon
Denies the set_icon command without any pre-configured scope.
## allow-set-icon-as-template
Enables the set_icon_as_template command without any pre-configured scope.
## deny-set-icon-as-template
Denies the set_icon_as_template command without any pre-configured scope.
## allow-set-menu
Enables the set_menu command without any pre-configured scope.
## deny-set-menu
Denies the set_menu command without any pre-configured scope.
## allow-set-show-menu-on-left-click
Enables the set_show_menu_on_left_click command without any pre-configured scope.
## deny-set-show-menu-on-left-click
Denies the set_show_menu_on_left_click command without any pre-configured scope.
## allow-set-temp-dir-path
Enables the set_temp_dir_path command without any pre-configured scope.
## deny-set-temp-dir-path
Denies the set_temp_dir_path command without any pre-configured scope.
## allow-set-title
Enables the set_title command without any pre-configured scope.
## deny-set-title
Denies the set_title command without any pre-configured scope.
## allow-set-tooltip
Enables the set_tooltip command without any pre-configured scope.
## deny-set-tooltip
Denies the set_tooltip command without any pre-configured scope.
## allow-set-visible
Enables the set_visible command without any pre-configured scope.
## deny-set-visible
Denies the set_visible command without any pre-configured scope.
## default
Default permissions for the plugin.

View File

@ -1,385 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PermissionFile",
"description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.",
"type": "object",
"properties": {
"default": {
"description": "The default permission set for the plugin",
"anyOf": [
{
"$ref": "#/definitions/DefaultPermission"
},
{
"type": "null"
}
]
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
}
},
"definitions": {
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"Permission": {
"description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.",
"type": "object",
"required": [
"identifier"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
}
}
},
"Commands": {
"description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.",
"type": "object",
"properties": {
"allow": {
"description": "Allowed command.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"description": "Denied command, which takes priority.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Scopes": {
"description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.",
"type": "object",
"properties": {
"allow": {
"description": "Data that defines what is allowed by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
},
"deny": {
"description": "Data that defines what is denied by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
}
}
},
"Value": {
"description": "All supported ACL values.",
"anyOf": [
{
"description": "Represents a null JSON value.",
"type": "null"
},
{
"description": "Represents a [`bool`].",
"type": "boolean"
},
{
"description": "Represents a valid ACL [`Number`].",
"allOf": [
{
"$ref": "#/definitions/Number"
}
]
},
{
"description": "Represents a [`String`].",
"type": "string"
},
{
"description": "Represents a list of other [`Value`]s.",
"type": "array",
"items": {
"$ref": "#/definitions/Value"
}
},
{
"description": "Represents a map of [`String`] keys to [`Value`]s.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Value"
}
}
]
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"PermissionKind": {
"type": "string",
"oneOf": [
{
"description": "allow-new -> Enables the new command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-new"
]
},
{
"description": "deny-new -> Denies the new command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-new"
]
},
{
"description": "allow-set-icon -> Enables the set_icon command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-icon"
]
},
{
"description": "deny-set-icon -> Denies the set_icon command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-icon"
]
},
{
"description": "allow-set-icon-as-template -> Enables the set_icon_as_template command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-icon-as-template"
]
},
{
"description": "deny-set-icon-as-template -> Denies the set_icon_as_template command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-icon-as-template"
]
},
{
"description": "allow-set-menu -> Enables the set_menu command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-menu"
]
},
{
"description": "deny-set-menu -> Denies the set_menu command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-menu"
]
},
{
"description": "allow-set-show-menu-on-left-click -> Enables the set_show_menu_on_left_click command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-show-menu-on-left-click"
]
},
{
"description": "deny-set-show-menu-on-left-click -> Denies the set_show_menu_on_left_click command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-show-menu-on-left-click"
]
},
{
"description": "allow-set-temp-dir-path -> Enables the set_temp_dir_path command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-temp-dir-path"
]
},
{
"description": "deny-set-temp-dir-path -> Denies the set_temp_dir_path command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-temp-dir-path"
]
},
{
"description": "allow-set-title -> Enables the set_title command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-title"
]
},
{
"description": "deny-set-title -> Denies the set_title command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-title"
]
},
{
"description": "allow-set-tooltip -> Enables the set_tooltip command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-tooltip"
]
},
{
"description": "deny-set-tooltip -> Denies the set_tooltip command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-tooltip"
]
},
{
"description": "allow-set-visible -> Enables the set_visible command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-visible"
]
},
{
"description": "deny-set-visible -> Denies the set_visible command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-visible"
]
},
{
"description": "default -> Default permissions for the plugin.",
"type": "string",
"enum": [
"default"
]
}
]
}
}
}

View File

@ -0,0 +1,86 @@
# Permissions
## allow-create-webview
Enables the create_webview command without any pre-configured scope.
## deny-create-webview
Denies the create_webview command without any pre-configured scope.
## allow-create-webview-window
Enables the create_webview_window command without any pre-configured scope.
## deny-create-webview-window
Denies the create_webview_window command without any pre-configured scope.
## allow-internal-toggle-devtools
Enables the internal_toggle_devtools command without any pre-configured scope.
## deny-internal-toggle-devtools
Denies the internal_toggle_devtools command without any pre-configured scope.
## allow-print
Enables the print command without any pre-configured scope.
## deny-print
Denies the print command without any pre-configured scope.
## allow-set-webview-focus
Enables the set_webview_focus command without any pre-configured scope.
## deny-set-webview-focus
Denies the set_webview_focus command without any pre-configured scope.
## allow-set-webview-position
Enables the set_webview_position command without any pre-configured scope.
## deny-set-webview-position
Denies the set_webview_position command without any pre-configured scope.
## allow-set-webview-size
Enables the set_webview_size command without any pre-configured scope.
## deny-set-webview-size
Denies the set_webview_size command without any pre-configured scope.
## allow-webview-close
Enables the webview_close command without any pre-configured scope.
## deny-webview-close
Denies the webview_close command without any pre-configured scope.
## allow-webview-position
Enables the webview_position command without any pre-configured scope.
## deny-webview-position
Denies the webview_position command without any pre-configured scope.
## allow-webview-size
Enables the webview_size command without any pre-configured scope.
## deny-webview-size
Denies the webview_size command without any pre-configured scope.
## default
Default permissions for the plugin.

View File

@ -1,399 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PermissionFile",
"description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.",
"type": "object",
"properties": {
"default": {
"description": "The default permission set for the plugin",
"anyOf": [
{
"$ref": "#/definitions/DefaultPermission"
},
{
"type": "null"
}
]
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
}
},
"definitions": {
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"Permission": {
"description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.",
"type": "object",
"required": [
"identifier"
],
"properties": {
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
}
}
},
"Commands": {
"description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.",
"type": "object",
"properties": {
"allow": {
"description": "Allowed command.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"description": "Denied command, which takes priority.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Scopes": {
"description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.",
"type": "object",
"properties": {
"allow": {
"description": "Data that defines what is allowed by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
},
"deny": {
"description": "Data that defines what is denied by the scope.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
}
}
},
"Value": {
"description": "All supported ACL values.",
"anyOf": [
{
"description": "Represents a null JSON value.",
"type": "null"
},
{
"description": "Represents a [`bool`].",
"type": "boolean"
},
{
"description": "Represents a valid ACL [`Number`].",
"allOf": [
{
"$ref": "#/definitions/Number"
}
]
},
{
"description": "Represents a [`String`].",
"type": "string"
},
{
"description": "Represents a list of other [`Value`]s.",
"type": "array",
"items": {
"$ref": "#/definitions/Value"
}
},
{
"description": "Represents a map of [`String`] keys to [`Value`]s.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Value"
}
}
]
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"PermissionKind": {
"type": "string",
"oneOf": [
{
"description": "allow-create-webview -> Enables the create_webview command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-create-webview"
]
},
{
"description": "deny-create-webview -> Denies the create_webview command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-create-webview"
]
},
{
"description": "allow-create-webview-window -> Enables the create_webview_window command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-create-webview-window"
]
},
{
"description": "deny-create-webview-window -> Denies the create_webview_window command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-create-webview-window"
]
},
{
"description": "allow-internal-toggle-devtools -> Enables the internal_toggle_devtools command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-internal-toggle-devtools"
]
},
{
"description": "deny-internal-toggle-devtools -> Denies the internal_toggle_devtools command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-internal-toggle-devtools"
]
},
{
"description": "allow-print -> Enables the print command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-print"
]
},
{
"description": "deny-print -> Denies the print command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-print"
]
},
{
"description": "allow-set-webview-focus -> Enables the set_webview_focus command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-webview-focus"
]
},
{
"description": "deny-set-webview-focus -> Denies the set_webview_focus command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-webview-focus"
]
},
{
"description": "allow-set-webview-position -> Enables the set_webview_position command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-webview-position"
]
},
{
"description": "deny-set-webview-position -> Denies the set_webview_position command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-webview-position"
]
},
{
"description": "allow-set-webview-size -> Enables the set_webview_size command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-set-webview-size"
]
},
{
"description": "deny-set-webview-size -> Denies the set_webview_size command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-set-webview-size"
]
},
{
"description": "allow-webview-close -> Enables the webview_close command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-webview-close"
]
},
{
"description": "deny-webview-close -> Denies the webview_close command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-webview-close"
]
},
{
"description": "allow-webview-position -> Enables the webview_position command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-webview-position"
]
},
{
"description": "deny-webview-position -> Denies the webview_position command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-webview-position"
]
},
{
"description": "allow-webview-size -> Enables the webview_size command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-webview-size"
]
},
{
"description": "deny-webview-size -> Denies the webview_size command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-webview-size"
]
},
{
"description": "default -> Default permissions for the plugin.",
"type": "string",
"enum": [
"default"
]
}
]
}
}
}

View File

@ -0,0 +1,502 @@
# Permissions
## allow-available-monitors
Enables the available_monitors command without any pre-configured scope.
## deny-available-monitors
Denies the available_monitors command without any pre-configured scope.
## allow-center
Enables the center command without any pre-configured scope.
## deny-center
Denies the center command without any pre-configured scope.
## allow-close
Enables the close command without any pre-configured scope.
## deny-close
Denies the close command without any pre-configured scope.
## allow-create
Enables the create command without any pre-configured scope.
## deny-create
Denies the create command without any pre-configured scope.
## allow-current-monitor
Enables the current_monitor command without any pre-configured scope.
## deny-current-monitor
Denies the current_monitor command without any pre-configured scope.
## allow-destroy
Enables the destroy command without any pre-configured scope.
## deny-destroy
Denies the destroy command without any pre-configured scope.
## allow-hide
Enables the hide command without any pre-configured scope.
## deny-hide
Denies the hide command without any pre-configured scope.
## allow-inner-position
Enables the inner_position command without any pre-configured scope.
## deny-inner-position
Denies the inner_position command without any pre-configured scope.
## allow-inner-size
Enables the inner_size command without any pre-configured scope.
## deny-inner-size
Denies the inner_size command without any pre-configured scope.
## allow-internal-on-mousedown
Enables the internal_on_mousedown command without any pre-configured scope.
## deny-internal-on-mousedown
Denies the internal_on_mousedown command without any pre-configured scope.
## allow-internal-on-mousemove
Enables the internal_on_mousemove command without any pre-configured scope.
## deny-internal-on-mousemove
Denies the internal_on_mousemove command without any pre-configured scope.
## allow-internal-toggle-maximize
Enables the internal_toggle_maximize command without any pre-configured scope.
## deny-internal-toggle-maximize
Denies the internal_toggle_maximize command without any pre-configured scope.
## allow-is-closable
Enables the is_closable command without any pre-configured scope.
## deny-is-closable
Denies the is_closable command without any pre-configured scope.
## allow-is-decorated
Enables the is_decorated command without any pre-configured scope.
## deny-is-decorated
Denies the is_decorated command without any pre-configured scope.
## allow-is-focused
Enables the is_focused command without any pre-configured scope.
## deny-is-focused
Denies the is_focused command without any pre-configured scope.
## allow-is-fullscreen
Enables the is_fullscreen command without any pre-configured scope.
## deny-is-fullscreen
Denies the is_fullscreen command without any pre-configured scope.
## allow-is-maximizable
Enables the is_maximizable command without any pre-configured scope.
## deny-is-maximizable
Denies the is_maximizable command without any pre-configured scope.
## allow-is-maximized
Enables the is_maximized command without any pre-configured scope.
## deny-is-maximized
Denies the is_maximized command without any pre-configured scope.
## allow-is-minimizable
Enables the is_minimizable command without any pre-configured scope.
## deny-is-minimizable
Denies the is_minimizable command without any pre-configured scope.
## allow-is-minimized
Enables the is_minimized command without any pre-configured scope.
## deny-is-minimized
Denies the is_minimized command without any pre-configured scope.
## allow-is-resizable
Enables the is_resizable command without any pre-configured scope.
## deny-is-resizable
Denies the is_resizable command without any pre-configured scope.
## allow-is-visible
Enables the is_visible command without any pre-configured scope.
## deny-is-visible
Denies the is_visible command without any pre-configured scope.
## allow-maximize
Enables the maximize command without any pre-configured scope.
## deny-maximize
Denies the maximize command without any pre-configured scope.
## allow-minimize
Enables the minimize command without any pre-configured scope.
## deny-minimize
Denies the minimize command without any pre-configured scope.
## allow-outer-position
Enables the outer_position command without any pre-configured scope.
## deny-outer-position
Denies the outer_position command without any pre-configured scope.
## allow-outer-size
Enables the outer_size command without any pre-configured scope.
## deny-outer-size
Denies the outer_size command without any pre-configured scope.
## allow-primary-monitor
Enables the primary_monitor command without any pre-configured scope.
## deny-primary-monitor
Denies the primary_monitor command without any pre-configured scope.
## allow-request-user-attention
Enables the request_user_attention command without any pre-configured scope.
## deny-request-user-attention
Denies the request_user_attention command without any pre-configured scope.
## allow-scale-factor
Enables the scale_factor command without any pre-configured scope.
## deny-scale-factor
Denies the scale_factor command without any pre-configured scope.
## allow-set-always-on-bottom
Enables the set_always_on_bottom command without any pre-configured scope.
## deny-set-always-on-bottom
Denies the set_always_on_bottom command without any pre-configured scope.
## allow-set-always-on-top
Enables the set_always_on_top command without any pre-configured scope.
## deny-set-always-on-top
Denies the set_always_on_top command without any pre-configured scope.
## allow-set-closable
Enables the set_closable command without any pre-configured scope.
## deny-set-closable
Denies the set_closable command without any pre-configured scope.
## allow-set-content-protected
Enables the set_content_protected command without any pre-configured scope.
## deny-set-content-protected
Denies the set_content_protected command without any pre-configured scope.
## allow-set-cursor-grab
Enables the set_cursor_grab command without any pre-configured scope.
## deny-set-cursor-grab
Denies the set_cursor_grab command without any pre-configured scope.
## allow-set-cursor-icon
Enables the set_cursor_icon command without any pre-configured scope.
## deny-set-cursor-icon
Denies the set_cursor_icon command without any pre-configured scope.
## allow-set-cursor-position
Enables the set_cursor_position command without any pre-configured scope.
## deny-set-cursor-position
Denies the set_cursor_position command without any pre-configured scope.
## allow-set-cursor-visible
Enables the set_cursor_visible command without any pre-configured scope.
## deny-set-cursor-visible
Denies the set_cursor_visible command without any pre-configured scope.
## allow-set-decorations
Enables the set_decorations command without any pre-configured scope.
## deny-set-decorations
Denies the set_decorations command without any pre-configured scope.
## allow-set-effects
Enables the set_effects command without any pre-configured scope.
## deny-set-effects
Denies the set_effects command without any pre-configured scope.
## allow-set-focus
Enables the set_focus command without any pre-configured scope.
## deny-set-focus
Denies the set_focus command without any pre-configured scope.
## allow-set-fullscreen
Enables the set_fullscreen command without any pre-configured scope.
## deny-set-fullscreen
Denies the set_fullscreen command without any pre-configured scope.
## allow-set-icon
Enables the set_icon command without any pre-configured scope.
## deny-set-icon
Denies the set_icon command without any pre-configured scope.
## allow-set-ignore-cursor-events
Enables the set_ignore_cursor_events command without any pre-configured scope.
## deny-set-ignore-cursor-events
Denies the set_ignore_cursor_events command without any pre-configured scope.
## allow-set-max-size
Enables the set_max_size command without any pre-configured scope.
## deny-set-max-size
Denies the set_max_size command without any pre-configured scope.
## allow-set-maximizable
Enables the set_maximizable command without any pre-configured scope.
## deny-set-maximizable
Denies the set_maximizable command without any pre-configured scope.
## allow-set-min-size
Enables the set_min_size command without any pre-configured scope.
## deny-set-min-size
Denies the set_min_size command without any pre-configured scope.
## allow-set-minimizable
Enables the set_minimizable command without any pre-configured scope.
## deny-set-minimizable
Denies the set_minimizable command without any pre-configured scope.
## allow-set-position
Enables the set_position command without any pre-configured scope.
## deny-set-position
Denies the set_position command without any pre-configured scope.
## allow-set-progress-bar
Enables the set_progress_bar command without any pre-configured scope.
## deny-set-progress-bar
Denies the set_progress_bar command without any pre-configured scope.
## allow-set-resizable
Enables the set_resizable command without any pre-configured scope.
## deny-set-resizable
Denies the set_resizable command without any pre-configured scope.
## allow-set-shadow
Enables the set_shadow command without any pre-configured scope.
## deny-set-shadow
Denies the set_shadow command without any pre-configured scope.
## allow-set-size
Enables the set_size command without any pre-configured scope.
## deny-set-size
Denies the set_size command without any pre-configured scope.
## allow-set-skip-taskbar
Enables the set_skip_taskbar command without any pre-configured scope.
## deny-set-skip-taskbar
Denies the set_skip_taskbar command without any pre-configured scope.
## allow-set-title
Enables the set_title command without any pre-configured scope.
## deny-set-title
Denies the set_title command without any pre-configured scope.
## allow-set-visible-on-all-workspaces
Enables the set_visible_on_all_workspaces command without any pre-configured scope.
## deny-set-visible-on-all-workspaces
Denies the set_visible_on_all_workspaces command without any pre-configured scope.
## allow-show
Enables the show command without any pre-configured scope.
## deny-show
Denies the show command without any pre-configured scope.
## allow-start-dragging
Enables the start_dragging command without any pre-configured scope.
## deny-start-dragging
Denies the start_dragging command without any pre-configured scope.
## allow-theme
Enables the theme command without any pre-configured scope.
## deny-theme
Denies the theme command without any pre-configured scope.
## allow-title
Enables the title command without any pre-configured scope.
## deny-title
Denies the title command without any pre-configured scope.
## allow-toggle-maximize
Enables the toggle_maximize command without any pre-configured scope.
## deny-toggle-maximize
Denies the toggle_maximize command without any pre-configured scope.
## allow-unmaximize
Enables the unmaximize command without any pre-configured scope.
## deny-unmaximize
Denies the unmaximize command without any pre-configured scope.
## allow-unminimize
Enables the unminimize command without any pre-configured scope.
## deny-unminimize
Denies the unminimize command without any pre-configured scope.
## default
Default permissions for the plugin.

File diff suppressed because it is too large Load Diff

View File

@ -977,7 +977,7 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
dependencies = [
"libc",
"redox_users",
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -1575,7 +1575,7 @@ dependencies = [
"gobject-sys",
"libc",
"system-deps",
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -1995,7 +1995,7 @@ dependencies = [
"jni-sys",
"log",
"thiserror",
"walkdir",
"walkdir 2.4.0",
"windows-sys 0.45.0",
]
@ -2026,6 +2026,16 @@ dependencies = [
"treediff",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
dependencies = [
"winapi 0.2.8",
"winapi-build",
]
[[package]]
name = "keyboard-types"
version = "0.7.0"
@ -2093,7 +2103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
dependencies = [
"cfg-if",
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -2357,7 +2367,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
"overload",
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -3115,6 +3125,16 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
[[package]]
name = "same-file"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"
dependencies = [
"kernel32-sys",
"winapi 0.2.8",
]
[[package]]
name = "same-file"
version = "1.0.6"
@ -3400,7 +3420,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
dependencies = [
"libc",
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -3725,18 +3745,16 @@ dependencies = [
"glob",
"heck",
"json-patch",
"plist",
"quote",
"schemars",
"semver",
"serde",
"serde_json",
"swift-rs",
"tauri-codegen",
"tauri-utils",
"tauri-winres",
"toml 0.8.2",
"walkdir",
"walkdir 2.4.0",
]
[[package]]
@ -3760,7 +3778,7 @@ dependencies = [
"time",
"url",
"uuid",
"walkdir",
"walkdir 2.4.0",
]
[[package]]
@ -3779,13 +3797,16 @@ dependencies = [
name = "tauri-plugin"
version = "1.0.0"
dependencies = [
"cargo_metadata",
"anyhow",
"glob",
"plist",
"schemars",
"serde",
"serde_json",
"swift-rs",
"tauri",
"toml 0.8.2",
"walkdir 1.0.7",
]
[[package]]
@ -3808,7 +3829,6 @@ dependencies = [
"log",
"serde",
"tauri",
"tauri-build",
"tauri-plugin",
"thiserror",
]
@ -3879,7 +3899,7 @@ dependencies = [
"thiserror",
"toml 0.8.2",
"url",
"walkdir",
"walkdir 2.4.0",
]
[[package]]
@ -4226,7 +4246,7 @@ checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9"
dependencies = [
"memoffset 0.9.0",
"tempfile",
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -4343,13 +4363,24 @@ version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690"
[[package]]
name = "walkdir"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff"
dependencies = [
"kernel32-sys",
"same-file 0.1.3",
"winapi 0.2.8",
]
[[package]]
name = "walkdir"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
dependencies = [
"same-file",
"same-file 1.0.6",
"winapi-util",
]
@ -4592,6 +4623,12 @@ dependencies = [
"windows-core",
]
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]]
name = "winapi"
version = "0.3.9"
@ -4602,6 +4639,12 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
@ -4614,7 +4657,7 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
dependencies = [
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -5018,7 +5061,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd"
dependencies = [
"nix",
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -5055,7 +5098,7 @@ dependencies = [
"static_assertions",
"tracing",
"uds_windows",
"winapi",
"winapi 0.3.9",
"xdg-home",
"zbus_macros",
"zbus_names",

View File

@ -11,5 +11,4 @@ serde = "1"
thiserror = "1"
[build-dependencies]
tauri-build = { path = "../../../../core/tauri-build/", default-features = false }
tauri-plugin = { path = "../../../../core/tauri-plugin", features = ["build"] }

View File

@ -2,19 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use std::process::exit;
const COMMANDS: &[&str] = &["ping"];
fn main() {
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
tauri_plugin::Builder::new(COMMANDS)
.android_path("android")
.ios_path("ios")
.run()
{
println!("{error:#}");
exit(1);
}
tauri_plugin::Builder::new(COMMANDS).build();
.build();
}

View File

@ -14,5 +14,4 @@ serde = "1.0"
thiserror = "1.0"
[build-dependencies]
tauri-build = {{{ tauri_build_dep }}}
tauri-plugin = {{{ tauri_plugin_dep }}}

View File

@ -1,16 +1,8 @@
use std::process::exit;
const COMMANDS: &[&str] = &["ping", "execute"];
fn main() {
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
tauri_plugin::Builder::new(COMMANDS)
.android_path("android")
.ios_path("ios")
.run()
{
println!("{error:#}");
exit(1);
}
tauri_plugin::Builder::new(COMMANDS).build();
.build();
}