Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 2 additions & 60 deletions crates/tauri-cli/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1543,19 +1543,15 @@
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
"items": true
},
"deny": {
"description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
"items": true
}
}
}
Expand All @@ -1564,60 +1560,6 @@
"Identifier": {
"type": "string"
},
"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"
}
]
},
"Target": {
"description": "Platform target.",
"oneOf": [
Expand Down
20 changes: 8 additions & 12 deletions crates/tauri-cli/src/migrate/migrations/v1/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ use crate::{error::Context, ErrorExt, Result};
use serde_json::{Map, Value};
use tauri_utils::acl::{
capability::{Capability, PermissionEntry},
Scopes, Value as AclValue,
Scopes,
};

use std::{
collections::{BTreeMap, HashSet},
fs,
path::Path,
};
use std::{collections::HashSet, fs, path::Path};

pub fn migrate(tauri_dir: &Path) -> Result<MigratedConfig> {
if let Ok((mut config, config_path)) =
Expand Down Expand Up @@ -500,11 +496,11 @@ fn allowlist_to_permissions(
if !(fs_allowed.is_empty() && fs_denied.is_empty()) {
let fs_allowed = fs_allowed
.into_iter()
.map(|p| AclValue::String(p.to_string_lossy().into()))
.map(|p| serde_json::Value::String(p.to_string_lossy().into()))
.collect::<Vec<_>>();
let fs_denied = fs_denied
.into_iter()
.map(|p| AclValue::String(p.to_string_lossy().into()))
.map(|p| serde_json::Value::String(p.to_string_lossy().into()))
.collect::<Vec<_>>();
permissions.push(PermissionEntry::ExtendedPermission {
identifier: "fs:scope".to_string().try_into().unwrap(),
Expand Down Expand Up @@ -571,7 +567,7 @@ fn allowlist_to_permissions(
.scope
.0
.into_iter()
.map(|p| serde_json::to_value(p).unwrap().into())
.map(|p| serde_json::to_value(p).unwrap())
.collect::<Vec<_>>();

permissions.push(PermissionEntry::ExtendedPermission {
Expand Down Expand Up @@ -611,9 +607,9 @@ fn allowlist_to_permissions(
.0
.into_iter()
.map(|p| {
let mut map = BTreeMap::new();
map.insert("url".to_string(), AclValue::String(p.to_string()));
AclValue::Map(map)
let mut map = serde_json::Map::new();
map.insert("url".to_string(), serde_json::Value::String(p.to_string()));
serde_json::Value::Object(map)
})
.collect::<Vec<_>>();

Expand Down
62 changes: 2 additions & 60 deletions crates/tauri-schema-generator/schemas/capability.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,15 @@
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
"items": true
},
"deny": {
"description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
"items": true
}
}
}
Expand All @@ -136,60 +132,6 @@
"Identifier": {
"type": "string"
},
"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"
}
]
},
"Target": {
"description": "Platform target.",
"oneOf": [
Expand Down
62 changes: 2 additions & 60 deletions crates/tauri-schema-generator/schemas/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1543,19 +1543,15 @@
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
"items": true
},
"deny": {
"description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
"items": true
}
}
}
Expand All @@ -1564,60 +1560,6 @@
"Identifier": {
"type": "string"
},
"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"
}
]
},
"Target": {
"description": "Platform target.",
"oneOf": [
Expand Down
62 changes: 2 additions & 60 deletions crates/tauri-schema-generator/schemas/permission.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,76 +91,18 @@
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
"items": true
},
"deny": {
"description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
"items": true
}
}
},
"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"
}
]
},
"Target": {
"description": "Platform target.",
"oneOf": [
Expand Down
Loading
Loading