diff --git a/plugins/opener/permissions/autogenerated/reference.md b/plugins/opener/permissions/autogenerated/reference.md index 0a795ef7..b49b335b 100644 --- a/plugins/opener/permissions/autogenerated/reference.md +++ b/plugins/opener/permissions/autogenerated/reference.md @@ -5,7 +5,7 @@ as well as reveal file in directories using default file explorer - `allow-open` - `allow-reveal-item-in-dir` -- `default-urls` +- `allow-default-urls` ## Permission Table @@ -16,6 +16,19 @@ as well as reveal file in directories using default file explorer + + + +`opener:allow-default-urls` + + + + +This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application. + + + + @@ -91,19 +104,6 @@ Enables the reveal_item_in_dir command without any pre-configured scope. Denies the reveal_item_in_dir command without any pre-configured scope. - - - - - - -`opener:default-urls` - - - - -This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application. - diff --git a/plugins/opener/permissions/schemas/schema.json b/plugins/opener/permissions/schemas/schema.json index 94891e8f..22d9d40d 100644 --- a/plugins/opener/permissions/schemas/schema.json +++ b/plugins/opener/permissions/schemas/schema.json @@ -294,6 +294,11 @@ "PermissionKind": { "type": "string", "oneOf": [ + { + "description": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.", + "type": "string", + "const": "allow-default-urls" + }, { "description": "Enables the open command without any pre-configured scope.", "type": "string", @@ -324,11 +329,6 @@ "type": "string", "const": "deny-reveal-item-in-dir" }, - { - "description": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.", - "type": "string", - "const": "default-urls" - }, { "description": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer", "type": "string", diff --git a/plugins/opener/src/scope.rs b/plugins/opener/src/scope.rs index b26b910c..be4d0c86 100644 --- a/plugins/opener/src/scope.rs +++ b/plugins/opener/src/scope.rs @@ -9,7 +9,7 @@ use crate::{scope_entry::EntryRaw, Error}; #[derive(Debug)] pub enum Entry { - Url(urlpattern::UrlPattern), + Url(Box), Path(Option), } @@ -44,12 +44,14 @@ impl ScopeObject for Entry { serde_json::from_value(raw.into()) .and_then(|raw| { let entry = match raw { - EntryRaw::Url { url } => Entry::Url(parse_url_pattern(&url).map_err(|e| { - serde::de::Error::custom(format!( - "`{}` is not a valid URL pattern: {e}", - url - )) - })?), + EntryRaw::Url { url } => { + let url_pattern = parse_url_pattern(&url).map_err(|e| { + serde::de::Error::custom(format!( + "`{url}` is not a valid URL pattern: {e}" + )) + })?; + Entry::Url(Box::new(url_pattern)) + } EntryRaw::Path { path } => { let path = match app.path().parse(path) { Ok(path) => Some(path),