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-open`
- `allow-reveal-item-in-dir` - `allow-reveal-item-in-dir`
- `default-urls` - `allow-default-urls`
## Permission Table ## Permission Table
@ -16,6 +16,19 @@ as well as reveal file in directories using default file explorer
</tr> </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> <tr>
<td> <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. 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> </td>
</tr> </tr>
</table> </table>

@ -294,6 +294,11 @@
"PermissionKind": { "PermissionKind": {
"type": "string", "type": "string",
"oneOf": [ "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.", "description": "Enables the open command without any pre-configured scope.",
"type": "string", "type": "string",
@ -324,11 +329,6 @@
"type": "string", "type": "string",
"const": "deny-reveal-item-in-dir" "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", "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", "type": "string",

@ -9,7 +9,7 @@ use crate::{scope_entry::EntryRaw, Error};
#[derive(Debug)] #[derive(Debug)]
pub enum Entry { pub enum Entry {
Url(urlpattern::UrlPattern), Url(Box<urlpattern::UrlPattern>),
Path(Option<PathBuf>), Path(Option<PathBuf>),
} }
@ -44,12 +44,14 @@ impl ScopeObject for Entry {
serde_json::from_value(raw.into()) serde_json::from_value(raw.into())
.and_then(|raw| { .and_then(|raw| {
let entry = match raw { let entry = match raw {
EntryRaw::Url { url } => Entry::Url(parse_url_pattern(&url).map_err(|e| { EntryRaw::Url { url } => {
let url_pattern = parse_url_pattern(&url).map_err(|e| {
serde::de::Error::custom(format!( serde::de::Error::custom(format!(
"`{}` is not a valid URL pattern: {e}", "`{url}` is not a valid URL pattern: {e}"
url
)) ))
})?), })?;
Entry::Url(Box::new(url_pattern))
}
EntryRaw::Path { path } => { EntryRaw::Path { path } => {
let path = match app.path().parse(path) { let path = match app.path().parse(path) {
Ok(path) => Some(path), Ok(path) => Some(path),

Loading…
Cancel
Save