mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-24 04:03:52 +03:00
This commit is contained in:
parent
255d64e3dc
commit
10fb027b75
6
.changes/migrate-plugins.md
Normal file
6
.changes/migrate-plugins.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-cli": patch:bug
|
||||
"@tauri-apps/cli": patch:bug
|
||||
---
|
||||
|
||||
Migrate v1 plugins to their v2 releases.
|
6
.changes/migrate-prevent-duplications.md
Normal file
6
.changes/migrate-prevent-duplications.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-cli": patch:bug
|
||||
"@tauri-apps/cli": patch:bug
|
||||
---
|
||||
|
||||
Prevent duplicate permissions on v1 migration.
|
@ -39,7 +39,10 @@ pub struct Options {
|
||||
|
||||
pub fn command(options: Options) -> Result<()> {
|
||||
crate::helpers::app_paths::resolve();
|
||||
run(options)
|
||||
}
|
||||
|
||||
pub fn run(options: Options) -> Result<()> {
|
||||
let (plugin, version) = options
|
||||
.plugin
|
||||
.split_once('@')
|
||||
|
@ -386,13 +386,16 @@ fn allowlist_to_permissions(
|
||||
allowlist: tauri_utils_v1::config::AllowlistConfig,
|
||||
) -> Vec<PermissionEntry> {
|
||||
macro_rules! permissions {
|
||||
($allowlist: ident, $permissions_list: ident, $object: ident, $field: ident => $associated_permission: expr) => {
|
||||
($allowlist: ident, $permissions_list: ident, $object: ident, $field: ident => $associated_permission: expr) => {{
|
||||
if $allowlist.all || $allowlist.$object.all || $allowlist.$object.$field {
|
||||
$permissions_list.push(PermissionEntry::PermissionRef(
|
||||
$associated_permission.to_string().try_into().unwrap(),
|
||||
));
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
};
|
||||
}};
|
||||
}
|
||||
|
||||
let mut permissions = Vec::new();
|
||||
@ -474,8 +477,11 @@ fn allowlist_to_permissions(
|
||||
|
||||
// shell
|
||||
if allowlist.shell.scope.0.is_empty() {
|
||||
permissions!(allowlist, permissions, shell, execute => "shell:allow-execute");
|
||||
permissions!(allowlist, permissions, shell, sidecar => "shell:allow-execute");
|
||||
let added = permissions!(allowlist, permissions, shell, execute => "shell:allow-execute");
|
||||
// prevent duplicated permission
|
||||
if !added {
|
||||
permissions!(allowlist, permissions, shell, sidecar => "shell:allow-execute");
|
||||
}
|
||||
} else {
|
||||
let allowed = allowlist
|
||||
.shell
|
||||
|
@ -45,6 +45,22 @@ fn migrate_manifest(manifest: &mut Document) -> Result<()> {
|
||||
("tauri-codegen", "dependencies"),
|
||||
("tauri-macros", "dependencies"),
|
||||
("tauri-runtime-wry", "dependencies"),
|
||||
// normal deps - plugins
|
||||
("tauri-plugin-authenticator", "dependencies"),
|
||||
("tauri-plugin-autostart", "dependencies"),
|
||||
("tauri-plugin-fs-extra", "dependencies"),
|
||||
("tauri-plugin-fs-watch", "dependencies"),
|
||||
("tauri-plugin-localhost", "dependencies"),
|
||||
("tauri-plugin-log", "dependencies"),
|
||||
("tauri-plugin-persisted-scope", "dependencies"),
|
||||
("tauri-plugin-positioner", "dependencies"),
|
||||
("tauri-plugin-single-instance", "dependencies"),
|
||||
("tauri-plugin-sql", "dependencies"),
|
||||
("tauri-plugin-store", "dependencies"),
|
||||
("tauri-plugin-stronghold", "dependencies"),
|
||||
("tauri-plugin-upload", "dependencies"),
|
||||
("tauri-plugin-websocket", "dependencies"),
|
||||
("tauri-plugin-window-state", "dependencies"),
|
||||
// dev
|
||||
("tauri", "dev-dependencies"),
|
||||
("tauri-utils", "dev-dependencies"),
|
||||
@ -207,6 +223,10 @@ fn migrate_dependency_table<D: TableLike>(
|
||||
remove: &[&str],
|
||||
rename: &[(&str, &str)],
|
||||
) {
|
||||
dep.remove("rev");
|
||||
dep.remove("git");
|
||||
dep.remove("branch");
|
||||
dep.remove("tag");
|
||||
*dep.entry("version").or_insert(Item::None) = Item::Value(version.into());
|
||||
let manifest_features = dep.entry("features").or_insert(Item::None);
|
||||
if let Some(features_array) = manifest_features.as_array_mut() {
|
||||
|
@ -25,7 +25,7 @@ pub fn run() -> Result<()> {
|
||||
|
||||
// Add plugins
|
||||
for plugin in migrated.plugins {
|
||||
crate::add::command(crate::add::Options {
|
||||
crate::add::run(crate::add::Options {
|
||||
plugin: plugin.clone(),
|
||||
branch: None,
|
||||
tag: None,
|
||||
|
Loading…
Reference in New Issue
Block a user