pull/2019/head
amrbashir 9 months ago
parent 42ab44cd5f
commit b9ced5422b
No known key found for this signature in database
GPG Key ID: BBD7A47A2003FF33

@ -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
</tr>
<tr>
<td>
`opener:allow-default-urls`
</td>
<td>
This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.
</td>
</tr>
<tr>
<td>
@ -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.
</td>
</tr>
<tr>
<td>
`opener:default-urls`
</td>
<td>
This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.
</td>
</tr>
</table>

@ -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",

@ -9,7 +9,7 @@ use crate::{scope_entry::EntryRaw, Error};
#[derive(Debug)]
pub enum Entry {
Url(urlpattern::UrlPattern),
Url(Box<urlpattern::UrlPattern>),
Path(Option<PathBuf>),
}
@ -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),

Loading…
Cancel
Save