fix: improvements and ipc fixes for loading window content using custom protocol (#8670)

* fix: improvements and ipc fixes for loading window content using custom protocol

closes #5478

* Discard changes to tooling/cli/Cargo.lock

* clippy

* fix tests

* typo

* fix webviewurl deserialize

* resolve todo, fixes

* fmt

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
Amr Bashir 2024-01-31 14:38:25 +02:00 committed by GitHub
parent 00e1567584
commit 58fe2e812a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 8707 additions and 580 deletions

View File

@ -0,0 +1,5 @@
---
'tauri': 'patch:enhance'
---
Allow IPC calls when window origin is a defined custom protocol.

View File

@ -0,0 +1,5 @@
---
'tauri-utils': 'patch:breaking'
---
Changed `dist_dir` and `dev_path` config options to be optional.

View File

@ -0,0 +1,5 @@
---
'tauri-utils': 'patch:feat'
---
Add `WebviewUrl::CustomProtocol` enum variant.

View File

@ -88,10 +88,10 @@ impl CodegenContext {
&config.build.dist_dir
};
match app_url {
AppUrl::Url(WebviewUrl::App(p)) => {
Some(AppUrl::Url(WebviewUrl::App(p))) => {
println!("cargo:rerun-if-changed={}", config_parent.join(p).display());
}
AppUrl::Files(files) => {
Some(AppUrl::Files(files)) => {
for path in files {
println!(
"cargo:rerun-if-changed={}",

View File

@ -164,36 +164,33 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
};
let assets = match app_url {
AppUrl::Url(url) => match url {
WebviewUrl::External(_) => Default::default(),
WebviewUrl::App(path) => {
if path.components().count() == 0 {
panic!(
"The `{}` configuration cannot be empty",
if dev { "devPath" } else { "distDir" }
)
Some(url) => match url {
AppUrl::Url(url) => match url {
WebviewUrl::External(_) | WebviewUrl::CustomProtocol(_) => Default::default(),
WebviewUrl::App(path) => {
let assets_path = config_parent.join(path);
if !assets_path.exists() {
panic!(
"The `{}` configuration is set to `{:?}` but this path doesn't exist",
if dev { "devPath" } else { "distDir" },
path
)
}
EmbeddedAssets::new(assets_path, &options, map_core_assets(&options, target))?
}
let assets_path = config_parent.join(path);
if !assets_path.exists() {
panic!(
"The `{}` configuration is set to `{:?}` but this path doesn't exist",
if dev { "devPath" } else { "distDir" },
path
)
}
EmbeddedAssets::new(assets_path, &options, map_core_assets(&options, target))?
}
_ => unimplemented!(),
},
AppUrl::Files(files) => EmbeddedAssets::new(
files
.iter()
.map(|p| config_parent.join(p))
.collect::<Vec<_>>(),
&options,
map_core_assets(&options, target),
)?,
_ => unimplemented!(),
},
AppUrl::Files(files) => EmbeddedAssets::new(
files
.iter()
.map(|p| config_parent.join(p))
.collect::<Vec<_>>(),
&options,
map_core_assets(&options, target),
)?,
_ => unimplemented!(),
None => Default::default(),
};
let out_dir = {
@ -398,7 +395,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
Default::default()
};
let resolved_act = Resolved::resolve(acl, capabilities, target).expect("failed to resolve ACL");
let resolved_acl = Resolved::resolve(acl, capabilities, target).expect("failed to resolve ACL");
Ok(quote!({
#[allow(unused_mut, clippy::let_and_return)]
@ -410,7 +407,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
#package_info,
#info_plist,
#pattern,
#resolved_act
#resolved_acl
);
#with_tray_icon_code
context

View File

@ -109,8 +109,6 @@
"build": {
"description": "The build configuration.",
"default": {
"devPath": "http://localhost:8080/",
"distDir": "../dist",
"withGlobalTauri": false
},
"allOf": [
@ -575,13 +573,18 @@
"description": "An URL to open on a Tauri webview window.",
"anyOf": [
{
"description": "An external URL.",
"description": "An external URL. Must use either the `http` or `https` schemes.",
"type": "string",
"format": "uri"
},
{
"description": "The path portion of an app URL. For instance, to load `tauri://localhost/users/john`, you can simply provide `users/john` in this configuration.",
"type": "string"
},
{
"description": "A custom protocol url, for example, `doom://index.html`",
"type": "string",
"format": "uri"
}
]
},
@ -2408,19 +2411,23 @@
},
"devPath": {
"description": "The path to the application assets or URL to load in development.\n\nThis is usually an URL to a dev server, which serves your application assets with live reloading. Most modern JavaScript bundlers provides a way to start a dev server by default.\n\nSee [vite](https://vitejs.dev/guide/), [Webpack DevServer](https://webpack.js.org/configuration/dev-server/) and [sirv](https://github.com/lukeed/sirv) for examples on how to set up a dev server.",
"default": "http://localhost:8080/",
"allOf": [
"anyOf": [
{
"$ref": "#/definitions/AppUrl"
},
{
"type": "null"
}
]
},
"distDir": {
"description": "The path to the application assets or URL to load in production.\n\nWhen a path relative to the configuration file is provided, it is read recursively and all files are embedded in the application binary. Tauri then looks for an `index.html` file unless you provide a custom window URL.\n\nYou can also provide a list of paths to be embedded, which allows granular control over what files are added to the binary. In this case, all files are added to the root and you must reference it that way in your HTML files.\n\nWhen an URL is provided, the application won't have bundled assets and the application will load that URL by default.",
"default": "../dist",
"allOf": [
"anyOf": [
{
"$ref": "#/definitions/AppUrl"
},
{
"type": "null"
}
]
},

View File

@ -146,7 +146,7 @@
### New Features
- [`acc36fe1`](https://www.github.com/tauri-apps/tauri/commit/acc36fe1176cc8aa9063bde932abeb94796c5c72)([#6158](https://www.github.com/tauri-apps/tauri/pull/6158)) Add option to configure `require_literal_leading_dot` on `fs` and `asset` protcol scopes.
- [`acc36fe1`](https://www.github.com/tauri-apps/tauri/commit/acc36fe1176cc8aa9063bde932abeb94796c5c72)([#6158](https://www.github.com/tauri-apps/tauri/pull/6158)) Add option to configure `require_literal_leading_dot` on `fs` and `asset` protocol scopes.
- [`35cd751a`](https://www.github.com/tauri-apps/tauri/commit/35cd751adc6fef1f792696fa0cfb471b0bf99374)([#5176](https://www.github.com/tauri-apps/tauri/pull/5176)) Added the `desktop_template` option on `tauri.conf.json > tauri > bundle > deb`.
- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `maximizable`, `minimizable` and `closable` options to the window configuration.
- [`3cb7a3e6`](https://www.github.com/tauri-apps/tauri/commit/3cb7a3e642bb10ee90dc1d24daa48b8c8c15c9ce)([#6997](https://www.github.com/tauri-apps/tauri/pull/6997)) Add `MimeType::parse_with_fallback` and `MimeType::parse_from_uri_with_fallback`

View File

@ -21,7 +21,7 @@ use super::{
};
/// A key for a scope, used to link a [`ResolvedCommand#structfield.scope`] to the store [`Resolved#structfield.scopes`].
pub type ScopeKey = usize;
pub type ScopeKey = u64;
/// Metadata for what referenced a [`ResolvedCommand`].
#[cfg(debug_assertions)]
@ -206,7 +206,7 @@ impl Resolved {
let mut hasher = DefaultHasher::new();
allowed.scope.hash(&mut hasher);
let hash = hasher.finish() as usize;
let hash = hasher.finish();
allowed.resolved_scope_key.replace(hash);
@ -297,15 +297,15 @@ struct ResolvedCommandTemp {
#[cfg(debug_assertions)]
pub referenced_by: Vec<ResolvedCommandReference>,
pub windows: HashSet<String>,
pub scope: Vec<usize>,
pub resolved_scope_key: Option<usize>,
pub scope: Vec<ScopeKey>,
pub resolved_scope_key: Option<ScopeKey>,
}
fn resolve_command(
commands: &mut BTreeMap<CommandKey, ResolvedCommandTemp>,
command: String,
capability: &Capability,
scope_id: Option<usize>,
scope_id: Option<ScopeKey>,
#[cfg(debug_assertions)] permission: &Permission,
) {
let contexts = match &capability.context {

View File

@ -43,23 +43,50 @@ fn default_true() -> bool {
}
/// An URL to open on a Tauri webview window.
#[derive(PartialEq, Eq, Debug, Clone, Deserialize, Serialize)]
#[derive(PartialEq, Eq, Debug, Clone, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(untagged)]
#[non_exhaustive]
pub enum WebviewUrl {
/// An external URL.
/// An external URL. Must use either the `http` or `https` schemes.
External(Url),
/// The path portion of an app URL.
/// For instance, to load `tauri://localhost/users/john`,
/// you can simply provide `users/john` in this configuration.
App(PathBuf),
/// A custom protocol url, for example, `doom://index.html`
CustomProtocol(Url),
}
impl<'de> Deserialize<'de> for WebviewUrl {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: Deserializer<'de>,
{
#[derive(Deserialize)]
#[serde(untagged)]
enum WebviewUrlDeserializer {
Url(Url),
Path(PathBuf),
}
match WebviewUrlDeserializer::deserialize(deserializer)? {
WebviewUrlDeserializer::Url(u) => {
if u.scheme() == "https" || u.scheme() == "http" {
Ok(Self::External(u))
} else {
Ok(Self::CustomProtocol(u))
}
}
WebviewUrlDeserializer::Path(p) => Ok(Self::App(p)),
}
}
}
impl fmt::Display for WebviewUrl {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::External(url) => write!(f, "{url}"),
Self::External(url) | Self::CustomProtocol(url) => write!(f, "{url}"),
Self::App(path) => write!(f, "{}", path.display()),
}
}
@ -1858,7 +1885,7 @@ pub enum HookCommand {
///
/// See more: <https://tauri.app/v1/api/config#buildconfig>
#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize, Default)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct BuildConfig {
@ -1871,8 +1898,8 @@ pub struct BuildConfig {
///
/// See [vite](https://vitejs.dev/guide/), [Webpack DevServer](https://webpack.js.org/configuration/dev-server/) and [sirv](https://github.com/lukeed/sirv)
/// for examples on how to set up a dev server.
#[serde(default = "default_dev_path", alias = "dev-path")]
pub dev_path: AppUrl,
#[serde(alias = "dev-path")]
pub dev_path: Option<AppUrl>,
/// The path to the application assets or URL to load in production.
///
/// When a path relative to the configuration file is provided,
@ -1884,8 +1911,8 @@ pub struct BuildConfig {
///
/// When an URL is provided, the application won't have bundled assets
/// and the application will load that URL by default.
#[serde(default = "default_dist_dir", alias = "dist-dir")]
pub dist_dir: AppUrl,
#[serde(alias = "dist-dir")]
pub dist_dir: Option<AppUrl>,
/// A shell command to run before `tauri dev` kicks in.
///
/// The TAURI_ENV_PLATFORM, TAURI_ENV_ARCH, TAURI_ENV_FAMILY, TAURI_ENV_PLATFORM_VERSION, TAURI_ENV_PLATFORM_TYPE and TAURI_ENV_DEBUG environment variables are set if you perform conditional compilation.
@ -1908,31 +1935,6 @@ pub struct BuildConfig {
pub with_global_tauri: bool,
}
impl Default for BuildConfig {
fn default() -> Self {
Self {
runner: None,
dev_path: default_dev_path(),
dist_dir: default_dist_dir(),
before_dev_command: None,
before_build_command: None,
before_bundle_command: None,
features: None,
with_global_tauri: false,
}
}
}
fn default_dev_path() -> AppUrl {
AppUrl::Url(WebviewUrl::External(
Url::parse("http://localhost:8080").unwrap(),
))
}
fn default_dist_dir() -> AppUrl {
AppUrl::Url(WebviewUrl::App("../dist".into()))
}
#[derive(Debug, PartialEq, Eq)]
struct PackageVersion(String);
@ -2123,8 +2125,8 @@ pub struct PluginConfig(pub HashMap<String, JsonValue>);
fn default_build() -> BuildConfig {
BuildConfig {
runner: None,
dev_path: default_dev_path(),
dist_dir: default_dist_dir(),
dev_path: None,
dist_dir: None,
before_dev_command: None,
before_build_command: None,
before_bundle_command: None,
@ -2159,6 +2161,10 @@ mod build {
let url = url_lit(url);
quote! { #prefix::External(#url) }
}
Self::CustomProtocol(url) => {
let url = url_lit(url);
quote! { #prefix::CustomProtocol(#url) }
}
})
}
}
@ -2489,8 +2495,8 @@ mod build {
impl ToTokens for BuildConfig {
fn to_tokens(&self, tokens: &mut TokenStream) {
let dev_path = &self.dev_path;
let dist_dir = &self.dist_dir;
let dev_path = opt_lit(self.dev_path.as_ref());
let dist_dir = opt_lit(self.dist_dir.as_ref());
let with_global_tauri = self.with_global_tauri;
let runner = quote!(None);
let before_dev_command = quote!(None);
@ -2758,8 +2764,6 @@ mod test {
let t_config = TauriConfig::default();
// get default build config
let b_config = BuildConfig::default();
// get default dev path
let d_path = default_dev_path();
// get default window
let d_windows: Vec<WindowConfig> = vec![];
// get default bundle
@ -2806,10 +2810,8 @@ mod test {
// create a build config
let build = BuildConfig {
runner: None,
dev_path: AppUrl::Url(WebviewUrl::External(
Url::parse("http://localhost:8080").unwrap(),
)),
dist_dir: AppUrl::Url(WebviewUrl::App("../dist".into())),
dev_path: None,
dist_dir: None,
before_dev_command: None,
before_build_command: None,
before_bundle_command: None,
@ -2821,12 +2823,6 @@ mod test {
assert_eq!(t_config, tauri);
assert_eq!(b_config, build);
assert_eq!(d_bundle, tauri.bundle);
assert_eq!(
d_path,
AppUrl::Url(WebviewUrl::External(
Url::parse("http://localhost:8080").unwrap()
))
);
assert_eq!(d_windows, tauri.windows);
}
}

View File

@ -0,0 +1,339 @@
{
"$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"
}
]
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"test": {
"description": "Test something!!",
"anyOf": [
{
"$ref": "#/definitions/PermissionSet"
},
{
"type": "null"
}
]
}
},
"definitions": {
"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"
}
}
}
},
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"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"
}
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"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": {
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {
"allow": null,
"deny": null
},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"PermissionKind": {
"type": "string",
"oneOf": [
{
"description": "allow-app-hide -> Enables the app_hide command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-app-hide"
]
},
{
"description": "deny-app-hide -> Denies the app_hide command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-app-hide"
]
},
{
"description": "allow-app-show -> Enables the app_show command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-app-show"
]
},
{
"description": "deny-app-show -> Denies the app_show command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-app-show"
]
},
{
"description": "allow-name -> Enables the name command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-name"
]
},
{
"description": "deny-name -> Denies the name command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-name"
]
},
{
"description": "allow-tauri-version -> Enables the tauri_version command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-tauri-version"
]
},
{
"description": "deny-tauri-version -> Denies the tauri_version command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-tauri-version"
]
},
{
"description": "allow-version -> Enables the version command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-version"
]
},
{
"description": "deny-version -> Denies the version command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-version"
]
},
{
"description": "default -> Default permissions for the plugin.",
"type": "string",
"enum": [
"default"
]
}
]
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"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 [`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"
}
}
]
}
}
}

View File

@ -0,0 +1,329 @@
{
"$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-app-hide -> Enables the app_hide command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-app-hide"
]
},
{
"description": "deny-app-hide -> Denies the app_hide command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-app-hide"
]
},
{
"description": "allow-app-show -> Enables the app_show command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-app-show"
]
},
{
"description": "deny-app-show -> Denies the app_show command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-app-show"
]
},
{
"description": "allow-name -> Enables the name command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-name"
]
},
{
"description": "deny-name -> Denies the name command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-name"
]
},
{
"description": "allow-tauri-version -> Enables the tauri_version command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-tauri-version"
]
},
{
"description": "deny-tauri-version -> Denies the tauri_version command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-tauri-version"
]
},
{
"description": "allow-version -> Enables the version command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-version"
]
},
{
"description": "deny-version -> Denies the version command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-version"
]
},
{
"description": "default -> Default permissions for the plugin.",
"type": "string",
"enum": [
"default"
]
}
]
}
}
}

View File

@ -0,0 +1,311 @@
{
"$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"
}
]
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"test": {
"description": "Test something!!",
"anyOf": [
{
"$ref": "#/definitions/PermissionSet"
},
{
"type": "null"
}
]
}
},
"definitions": {
"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"
}
}
}
},
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"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"
}
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"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": {
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {
"allow": null,
"deny": null
},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"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-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"
]
}
]
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"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 [`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"
}
}
]
}
}
}

View File

@ -0,0 +1,301 @@
{
"$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-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,577 @@
{
"$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"
}
]
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"test": {
"description": "Test something!!",
"anyOf": [
{
"$ref": "#/definitions/PermissionSet"
},
{
"type": "null"
}
]
}
},
"definitions": {
"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"
}
}
}
},
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"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"
}
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"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": {
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {
"allow": null,
"deny": null
},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"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"
]
}
]
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"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 [`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"
}
}
]
}
}
}

View File

@ -0,0 +1,567 @@
{
"$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,381 @@
{
"$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"
}
]
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"test": {
"description": "Test something!!",
"anyOf": [
{
"$ref": "#/definitions/PermissionSet"
},
{
"type": "null"
}
]
}
},
"definitions": {
"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"
}
}
}
},
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"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"
}
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"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": {
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {
"allow": null,
"deny": null
},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"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"
]
}
]
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"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 [`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"
}
}
]
}
}
}

View File

@ -0,0 +1,371 @@
{
"$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,283 @@
{
"$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"
}
]
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"test": {
"description": "Test something!!",
"anyOf": [
{
"$ref": "#/definitions/PermissionSet"
},
{
"type": "null"
}
]
}
},
"definitions": {
"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"
}
}
}
},
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"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"
}
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"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": {
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {
"allow": null,
"deny": null
},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"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"
]
}
]
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"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 [`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"
}
}
]
}
}
}

View File

@ -0,0 +1,273 @@
{
"$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,395 @@
{
"$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"
}
]
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"test": {
"description": "Test something!!",
"anyOf": [
{
"$ref": "#/definitions/PermissionSet"
},
{
"type": "null"
}
]
}
},
"definitions": {
"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"
}
}
}
},
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"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"
}
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"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": {
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {
"allow": null,
"deny": null
},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"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"
]
}
]
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"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 [`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"
}
}
]
}
}
}

View File

@ -0,0 +1,385 @@
{
"$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,409 @@
{
"$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"
}
]
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"test": {
"description": "Test something!!",
"anyOf": [
{
"$ref": "#/definitions/PermissionSet"
},
{
"type": "null"
}
]
}
},
"definitions": {
"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"
}
}
}
},
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"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"
}
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"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": {
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {
"allow": null,
"deny": null
},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"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"
]
}
]
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"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 [`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"
}
}
]
}
}
}

View File

@ -0,0 +1,399 @@
{
"$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"
]
}
]
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -299,13 +299,13 @@ impl<R: Runtime> AppManager<R> {
/// * In dev mode, this will be based on the `devPath` configuration value.
/// * Otherwise, this will be based on the `distDir` configuration value.
#[cfg(not(dev))]
fn base_path(&self) -> &AppUrl {
&self.config.build.dist_dir
fn base_path(&self) -> Option<&AppUrl> {
self.config.build.dist_dir.as_ref()
}
#[cfg(dev)]
fn base_path(&self) -> &AppUrl {
&self.config.build.dev_path
fn base_path(&self) -> Option<&AppUrl> {
self.config.build.dev_path.as_ref()
}
/// Get the base URL to use for webview requests.
@ -313,7 +313,9 @@ impl<R: Runtime> AppManager<R> {
/// In dev mode, this will be based on the `devPath` configuration value.
pub(crate) fn get_url(&self) -> Cow<'_, Url> {
match self.base_path() {
AppUrl::Url(WebviewUrl::External(url)) => Cow::Borrowed(url),
Some(AppUrl::Url(WebviewUrl::External(url) | WebviewUrl::CustomProtocol(url))) => {
Cow::Borrowed(url)
}
_ => self.protocol_url(),
}
}

View File

@ -422,6 +422,8 @@ impl<R: Runtime> WebviewManager<R> {
}
url
}
WebviewUrl::CustomProtocol(url) => url.clone(),
_ => unimplemented!(),
};

View File

@ -165,7 +165,7 @@ fn get_response<R: Runtime>(
handler(request, &mut response);
}
// if it's an HTML file, we need to set the CSP meta tag on Linux
#[cfg(all(not(dev), target_os = "linux"))]
#[cfg(target_os = "linux")]
if let Some(response_csp) = response.headers().get("Content-Security-Policy") {
let response_csp = String::from_utf8_lossy(response_csp.as_bytes());
let html = String::from_utf8_lossy(response.body());

View File

@ -391,7 +391,7 @@ impl WindowBuilder for MockWindowBuilder {
}
#[cfg(windows)]
fn drag_and_drop(mut self, enabled: bool) -> Self {
fn drag_and_drop(self, enabled: bool) -> Self {
self
}

View File

@ -1044,17 +1044,44 @@ fn main() {
}
fn is_local_url(&self, current_url: &Url) -> bool {
self
.manager()
.get_url()
.make_relative(current_url)
.is_some()
|| {
let protocol_url = self.manager().protocol_url();
current_url.scheme() == protocol_url.scheme()
&& current_url.domain() == protocol_url.domain()
}
|| (cfg!(dev) && current_url.domain() == Some("tauri.localhost"))
// if from `tauri://` custom protocol
({
let protocol_url = self.manager().protocol_url();
current_url.scheme() == protocol_url.scheme()
&& current_url.domain() == protocol_url.domain()
}) ||
// or if relative to `distDir` or `devPath`
self
.manager()
.get_url()
.make_relative(current_url)
.is_some()
// or from a custom protocol registered by the user
|| ({
let scheme = current_url.scheme();
let protocols = self.manager().webview.uri_scheme_protocols.lock().unwrap();
#[cfg(all(not(windows), not(target_os = "android")))]
let local = protocols.contains_key(scheme);
// on window and android, custom protocols are `http://<protocol-name>.path/to/route`
// so we check using the first part of the domain
#[cfg(any(windows, target_os = "android"))]
let local = {
let protocol_url = self.manager().protocol_url();
let maybe_protocol = current_url
.domain()
.and_then(|d| d .split_once('.'))
.unwrap_or_default()
.0;
protocols.contains_key(maybe_protocol) && scheme == protocol_url.scheme()
};
local
})
}
/// Handles this window receiving an [`InvokeRequest`].

View File

@ -34,7 +34,7 @@ use crate::{
webview::PageLoadPayload,
webview::WebviewBuilder,
window::WindowBuilder,
AppHandle, Event, EventId, Manager, Runtime, Webview, Window, WindowEvent,
AppHandle, Event, EventId, Manager, Runtime, Webview, WindowEvent,
};
use tauri_macros::default_runtime;
@ -173,7 +173,7 @@ async fn reopen_window(app: tauri::AppHandle) {
/// });
/// ```
#[cfg(desktop)]
pub fn on_menu_event<F: Fn(&Window<R>, crate::menu::MenuEvent) + Send + Sync + 'static>(
pub fn on_menu_event<F: Fn(&crate::Window<R>, crate::menu::MenuEvent) + Send + Sync + 'static>(
mut self,
f: F,
) -> Self {
@ -902,7 +902,7 @@ tauri::Builder::default()
```
"####
)]
pub fn on_menu_event<F: Fn(&Window<R>, crate::menu::MenuEvent) + Send + Sync + 'static>(
pub fn on_menu_event<F: Fn(&crate::Window<R>, crate::menu::MenuEvent) + Send + Sync + 'static>(
&self,
f: F,
) {

View File

@ -6,7 +6,6 @@
pub(crate) mod plugin;
use tauri_runtime::ResizeDirection;
use tauri_runtime::{
webview::PendingWebview,
window::dpi::{PhysicalPosition, PhysicalSize},
@ -1819,7 +1818,10 @@ tauri::Builder::default()
}
/// Starts resize-dragging the window.
pub fn start_resize_dragging(&self, direction: ResizeDirection) -> crate::Result<()> {
pub fn start_resize_dragging(
&self,
direction: tauri_runtime::ResizeDirection,
) -> crate::Result<()> {
self
.window
.dispatcher

View File

@ -4,7 +4,7 @@
;(function () {
const osName = __TEMPLATE_os_name__
if (osName !== 'macos') {
if (osName !== 'macos' && osName !== 'ios' && osName !== 'android') {
document.addEventListener('mousemove', (e) => {
window.__TAURI_INTERNALS__.invoke('plugin:window|internal_on_mousemove', {
x: e.clientX,

File diff suppressed because it is too large Load Diff

View File

@ -42,9 +42,6 @@ features = [
path = "../../../core/tauri"
features = ["test"]
[target."cfg(target_os = \"windows\")".dependencies]
window-shadows = "0.2"
[features]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@ -0,0 +1,290 @@
{
"$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"
}
]
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
},
"test": {
"description": "Test something!!",
"anyOf": [
{
"$ref": "#/definitions/PermissionSet"
},
{
"type": "null"
}
]
}
},
"definitions": {
"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"
}
}
}
},
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"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"
}
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"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": {
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {
"allow": null,
"deny": null
},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"PermissionKind": {
"type": "string",
"oneOf": [
{
"description": "allow-ping -> Enables the ping command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-ping"
]
},
{
"description": "deny-ping -> Denies the ping command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-ping"
]
},
{
"description": "global-scope -> Sets a global scope.",
"type": "string",
"enum": [
"global-scope"
]
},
{
"description": "allow-ping-scoped -> Enables the ping command with a test scope.",
"type": "string",
"enum": [
"allow-ping-scoped"
]
}
]
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"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 [`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"
}
}
]
}
}
}

View File

@ -0,0 +1,280 @@
{
"$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"
}
]
},
"permission": {
"description": "A list of inlined permissions",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Permission"
}
},
"set": {
"description": "A list of permissions sets defined",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/PermissionSet"
}
}
},
"definitions": {
"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"
}
}
}
},
"DefaultPermission": {
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
"type": "object",
"required": [
"permissions"
],
"properties": {
"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"
}
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"Number": {
"description": "A valid ACL number.",
"anyOf": [
{
"description": "Represents an [`i64`].",
"type": "integer",
"format": "int64"
},
{
"description": "Represents a [`f64`].",
"type": "number",
"format": "double"
}
]
},
"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": {
"commands": {
"description": "Allowed or denied commands when using this permission.",
"default": {
"allow": [],
"deny": []
},
"allOf": [
{
"$ref": "#/definitions/Commands"
}
]
},
"description": {
"description": "Human-readable description of what the permission does.",
"type": [
"string",
"null"
]
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"scope": {
"description": "Allowed or denied scoped when using this permission.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/Scopes"
}
]
},
"version": {
"description": "The version of the permission.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 1.0
}
}
},
"PermissionKind": {
"type": "string",
"oneOf": [
{
"description": "allow-ping -> Enables the ping command without any pre-configured scope.",
"type": "string",
"enum": [
"allow-ping"
]
},
{
"description": "deny-ping -> Denies the ping command without any pre-configured scope.",
"type": "string",
"enum": [
"deny-ping"
]
},
{
"description": "global-scope -> Sets a global scope.",
"type": "string",
"enum": [
"global-scope"
]
},
{
"description": "allow-ping-scoped -> Enables the ping command with a test scope.",
"type": "string",
"enum": [
"allow-ping-scoped"
]
}
]
},
"PermissionSet": {
"description": "A set of direct permissions grouped together under a new name.",
"type": "object",
"required": [
"description",
"identifier",
"permissions"
],
"properties": {
"description": {
"description": "Human-readable description of what the permission does.",
"type": "string"
},
"identifier": {
"description": "A unique identifier for the permission.",
"type": "string"
},
"permissions": {
"description": "All permissions this set contains.",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionKind"
}
}
}
},
"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"
}
}
]
}
}
}

View File

@ -36,17 +36,17 @@
component: App,
icon: 'i-codicon-hubot'
},
{
!isMobile && {
label: 'Window',
component: Window,
icon: 'i-codicon-window'
},
{
!isMobile && {
label: 'Menu',
component: Menu,
icon: 'i-ph-list'
},
{
!isMobile && {
label: 'Tray',
component: Tray,
icon: 'i-ph-tray'

View File

@ -109,8 +109,6 @@
"build": {
"description": "The build configuration.",
"default": {
"devPath": "http://localhost:8080/",
"distDir": "../dist",
"withGlobalTauri": false
},
"allOf": [
@ -575,13 +573,18 @@
"description": "An URL to open on a Tauri webview window.",
"anyOf": [
{
"description": "An external URL.",
"description": "An external URL. Must use either the `http` or `https` schemes.",
"type": "string",
"format": "uri"
},
{
"description": "The path portion of an app URL. For instance, to load `tauri://localhost/users/john`, you can simply provide `users/john` in this configuration.",
"type": "string"
},
{
"description": "A custom protocol url, for example, `doom://index.html`",
"type": "string",
"format": "uri"
}
]
},
@ -2408,19 +2411,23 @@
},
"devPath": {
"description": "The path to the application assets or URL to load in development.\n\nThis is usually an URL to a dev server, which serves your application assets with live reloading. Most modern JavaScript bundlers provides a way to start a dev server by default.\n\nSee [vite](https://vitejs.dev/guide/), [Webpack DevServer](https://webpack.js.org/configuration/dev-server/) and [sirv](https://github.com/lukeed/sirv) for examples on how to set up a dev server.",
"default": "http://localhost:8080/",
"allOf": [
"anyOf": [
{
"$ref": "#/definitions/AppUrl"
},
{
"type": "null"
}
]
},
"distDir": {
"description": "The path to the application assets or URL to load in production.\n\nWhen a path relative to the configuration file is provided, it is read recursively and all files are embedded in the application binary. Tauri then looks for an `index.html` file unless you provide a custom window URL.\n\nYou can also provide a list of paths to be embedded, which allows granular control over what files are added to the binary. In this case, all files are added to the root and you must reference it that way in your HTML files.\n\nWhen an URL is provided, the application won't have bundled assets and the application will load that URL by default.",
"default": "../dist",
"allOf": [
"anyOf": [
{
"$ref": "#/definitions/AppUrl"
},
{
"type": "null"
}
]
},

View File

@ -280,7 +280,7 @@ pub fn setup(target: Target, options: &mut Options, mobile: bool) -> Result<AppI
)?;
}
if let AppUrl::Url(WebviewUrl::App(web_asset_path)) = &config_.build.dist_dir {
if let Some(AppUrl::Url(WebviewUrl::App(web_asset_path))) = &config_.build.dist_dir {
if !web_asset_path.exists() {
return Err(anyhow::anyhow!(
"Unable to find your web assets, did you forget to build your web app? Your distDir is set to \"{:?}\".",

View File

@ -195,13 +195,13 @@ pub fn setup(target: Target, options: &mut Options, mobile: bool) -> Result<AppI
if mobile {
let local_ip_address = local_ip_address(options.force_ip_prompt).to_string();
before_dev = before_dev.replace("$HOST", &local_ip_address);
if let AppUrl::Url(WebviewUrl::External(url)) = &mut dev_path {
if let Some(AppUrl::Url(WebviewUrl::External(url))) = dev_path.as_mut() {
url.set_host(Some(&local_ip_address))?;
}
} else {
before_dev = before_dev.replace(
"$HOST",
if let AppUrl::Url(WebviewUrl::External(url)) = &dev_path {
if let Some(AppUrl::Url(WebviewUrl::External(url))) = &dev_path {
url.host_str().unwrap_or("0.0.0.0")
} else {
"0.0.0.0"
@ -314,7 +314,7 @@ pub fn setup(target: Target, options: &mut Options, mobile: bool) -> Result<AppI
.dev_path
.clone();
if !options.no_dev_server {
if let AppUrl::Url(WebviewUrl::App(path)) = &dev_path {
if let Some(AppUrl::Url(WebviewUrl::App(path))) = &dev_path {
use crate::helpers::web_dev_server::start_dev_server;
if path.exists() {
let path = path.canonicalize()?;
@ -325,7 +325,9 @@ pub fn setup(target: Target, options: &mut Options, mobile: bool) -> Result<AppI
};
let server_url = start_dev_server(path, ip, options.port)?;
let server_url = format!("http://{server_url}");
dev_path = AppUrl::Url(WebviewUrl::External(server_url.parse().unwrap()));
dev_path = Some(AppUrl::Url(WebviewUrl::External(
server_url.parse().unwrap(),
)));
if let Some(c) = &options.config {
let mut c: tauri_utils::config::Config = serde_json::from_str(c)?;
@ -341,7 +343,7 @@ pub fn setup(target: Target, options: &mut Options, mobile: bool) -> Result<AppI
}
if !options.no_dev_server_wait {
if let AppUrl::Url(WebviewUrl::External(dev_server_url)) = dev_path {
if let Some(AppUrl::Url(WebviewUrl::External(dev_server_url))) = dev_path {
let host = dev_server_url
.host()
.unwrap_or_else(|| panic!("No host name in the URL"));

View File

@ -33,11 +33,13 @@ pub fn items(app_dir: Option<&PathBuf>, tauri_dir: Option<&Path>) -> Vec<Section
.unwrap_or_else(|| "unset".to_string());
items.push(SectionItem::new().description(format!("CSP: {csp}")));
let dist_dir = &config.build.dist_dir;
items.push(SectionItem::new().description(format!("distDir: {dist_dir}")));
if let Some(dist_dir) = &config.build.dist_dir {
items.push(SectionItem::new().description(format!("distDir: {dist_dir}")));
}
let dev_path = &config.build.dev_path;
items.push(SectionItem::new().description(format!("devPath: {dev_path}")));
if let Some(dev_path) = &config.build.dev_path {
items.push(SectionItem::new().description(format!("devPath: {dev_path}")));
}
if let Some(app_dir) = app_dir {
if let Ok(package_json) = read_to_string(app_dir.join("package.json")) {

View File

@ -168,7 +168,7 @@ fn setup_dev_config(
.dev_path
.clone();
if let AppUrl::Url(WebviewUrl::External(url)) = &mut dev_path {
if let Some(AppUrl::Url(WebviewUrl::External(url))) = dev_path.as_mut() {
let localhost = match url.host() {
Some(url::Host::Domain(d)) => d == "localhost",
Some(url::Host::Ipv4(i)) => {