mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-09-11 07:55:34 +03:00
use btreemap for manifests
This commit is contained in:
parent
41961e7de0
commit
e729a9c83f
@ -6,7 +6,7 @@ use tauri_utils::plugin::Capability;
|
|||||||
pub use tauri_utils::plugin::{Manifest, ManifestMap, ScopeType};
|
pub use tauri_utils::plugin::{Manifest, ManifestMap, ScopeType};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::BTreeMap,
|
||||||
env::{var_os, vars_os},
|
env::{var_os, vars_os},
|
||||||
fs::{read_to_string, write},
|
fs::{read_to_string, write},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
@ -49,7 +49,7 @@ pub fn set_manifest(mut manifest: Manifest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn manifests() -> ManifestMap {
|
pub(crate) fn manifests() -> ManifestMap {
|
||||||
let mut manifests = HashMap::new();
|
let mut manifests = BTreeMap::new();
|
||||||
|
|
||||||
for (key, value) in vars_os() {
|
for (key, value) in vars_os() {
|
||||||
let key = key.to_string_lossy();
|
let key = key.to_string_lossy();
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::BTreeMap,
|
||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -155,10 +155,10 @@ impl Manifest {
|
|||||||
|
|
||||||
/// A collection mapping a plugin name to its manifest.
|
/// A collection mapping a plugin name to its manifest.
|
||||||
#[derive(Debug, Default, Deserialize, Serialize)]
|
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||||
pub struct ManifestMap(HashMap<String, Manifest>);
|
pub struct ManifestMap(BTreeMap<String, Manifest>);
|
||||||
|
|
||||||
impl Deref for ManifestMap {
|
impl Deref for ManifestMap {
|
||||||
type Target = HashMap<String, Manifest>;
|
type Target = BTreeMap<String, Manifest>;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
&self.0
|
&self.0
|
||||||
@ -171,8 +171,8 @@ impl DerefMut for ManifestMap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<HashMap<String, Manifest>> for ManifestMap {
|
impl From<BTreeMap<String, Manifest>> for ManifestMap {
|
||||||
fn from(value: HashMap<String, Manifest>) -> Self {
|
fn from(value: BTreeMap<String, Manifest>) -> Self {
|
||||||
Self(value)
|
Self(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,26 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"plugins": {
|
"plugins": {
|
||||||
|
"__app__": {
|
||||||
|
"default_capability": null,
|
||||||
|
"capabilities": [
|
||||||
|
{
|
||||||
|
"id": "allow-all-api-commands",
|
||||||
|
"component": null,
|
||||||
|
"description": "Allows all application defined commands",
|
||||||
|
"features": [
|
||||||
|
"log_operation",
|
||||||
|
"perform_request"
|
||||||
|
],
|
||||||
|
"scope": {
|
||||||
|
"allowed": [],
|
||||||
|
"blocked": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"features": [],
|
||||||
|
"scope_type": []
|
||||||
|
},
|
||||||
"event": {
|
"event": {
|
||||||
"plugin": "event",
|
"plugin": "event",
|
||||||
"default_capability": null,
|
"default_capability": null,
|
||||||
@ -51,26 +71,6 @@
|
|||||||
],
|
],
|
||||||
"scope_type": []
|
"scope_type": []
|
||||||
},
|
},
|
||||||
"__app__": {
|
|
||||||
"default_capability": null,
|
|
||||||
"capabilities": [
|
|
||||||
{
|
|
||||||
"id": "allow-all-api-commands",
|
|
||||||
"component": null,
|
|
||||||
"description": "Allows all application defined commands",
|
|
||||||
"features": [
|
|
||||||
"log_operation",
|
|
||||||
"perform_request"
|
|
||||||
],
|
|
||||||
"scope": {
|
|
||||||
"allowed": [],
|
|
||||||
"blocked": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"features": [],
|
|
||||||
"scope_type": []
|
|
||||||
},
|
|
||||||
"path": {
|
"path": {
|
||||||
"plugin": "path",
|
"plugin": "path",
|
||||||
"default_capability": null,
|
"default_capability": null,
|
||||||
|
Loading…
Reference in New Issue
Block a user