fix: support windows

This commit is contained in:
reya
2024-04-12 18:35:19 +07:00
parent 8a7b246315
commit 35cf0abda4
4 changed files with 327 additions and 102 deletions

View File

@@ -11,6 +11,13 @@
} }
] ]
}, },
{
"description": "A list of capabilities.",
"type": "array",
"items": {
"$ref": "#/definitions/Capability"
}
},
{ {
"description": "A list of capabilities.", "description": "A list of capabilities.",
"type": "object", "type": "object",
@@ -34,8 +41,7 @@
"type": "object", "type": "object",
"required": [ "required": [
"identifier", "identifier",
"permissions", "permissions"
"windows"
], ],
"properties": { "properties": {
"identifier": { "identifier": {
@@ -85,15 +91,11 @@
} }
}, },
"platforms": { "platforms": {
"description": "Target platforms this capability applies. By default all platforms applies.", "description": "Target platforms this capability applies. By default all platforms are affected by this capability.",
"default": [ "type": [
"linux", "array",
"macOS", "null"
"windows",
"android",
"iOS"
], ],
"type": "array",
"items": { "items": {
"$ref": "#/definitions/Target" "$ref": "#/definitions/Target"
} }
@@ -108,7 +110,7 @@
], ],
"properties": { "properties": {
"urls": { "urls": {
"description": "Remote domains this capability refers to. Can use glob patterns.", "description": "Remote domains this capability refers to using the [URLPattern standard](https://urlpattern.spec.whatwg.org/).\n\n# Examples\n\n- \"https://*.mydomain.dev\": allows subdomains of mydomain.dev - \"https://mydomain.dev/api/*\": allows any subpath of mydomain.dev/api",
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
@@ -182,7 +184,7 @@
] ]
}, },
{ {
"description": "fs:allow-app-write-recursive -> This allows full recusrive write access to the complete `$APP` folder, files and subdirectories.", "description": "fs:allow-app-write-recursive -> This allows full recursive write access to the complete `$APP` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-app-write-recursive" "fs:allow-app-write-recursive"
@@ -224,7 +226,7 @@
] ]
}, },
{ {
"description": "fs:allow-appcache-write-recursive -> This allows full recusrive write access to the complete `$APPCACHE` folder, files and subdirectories.", "description": "fs:allow-appcache-write-recursive -> This allows full recursive write access to the complete `$APPCACHE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-appcache-write-recursive" "fs:allow-appcache-write-recursive"
@@ -266,7 +268,7 @@
] ]
}, },
{ {
"description": "fs:allow-appconfig-write-recursive -> This allows full recusrive write access to the complete `$APPCONFIG` folder, files and subdirectories.", "description": "fs:allow-appconfig-write-recursive -> This allows full recursive write access to the complete `$APPCONFIG` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-appconfig-write-recursive" "fs:allow-appconfig-write-recursive"
@@ -308,7 +310,7 @@
] ]
}, },
{ {
"description": "fs:allow-appdata-write-recursive -> This allows full recusrive write access to the complete `$APPDATA` folder, files and subdirectories.", "description": "fs:allow-appdata-write-recursive -> This allows full recursive write access to the complete `$APPDATA` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-appdata-write-recursive" "fs:allow-appdata-write-recursive"
@@ -350,7 +352,7 @@
] ]
}, },
{ {
"description": "fs:allow-applocaldata-write-recursive -> This allows full recusrive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.", "description": "fs:allow-applocaldata-write-recursive -> This allows full recursive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-applocaldata-write-recursive" "fs:allow-applocaldata-write-recursive"
@@ -392,7 +394,7 @@
] ]
}, },
{ {
"description": "fs:allow-applog-write-recursive -> This allows full recusrive write access to the complete `$APPLOG` folder, files and subdirectories.", "description": "fs:allow-applog-write-recursive -> This allows full recursive write access to the complete `$APPLOG` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-applog-write-recursive" "fs:allow-applog-write-recursive"
@@ -434,7 +436,7 @@
] ]
}, },
{ {
"description": "fs:allow-audio-write-recursive -> This allows full recusrive write access to the complete `$AUDIO` folder, files and subdirectories.", "description": "fs:allow-audio-write-recursive -> This allows full recursive write access to the complete `$AUDIO` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-audio-write-recursive" "fs:allow-audio-write-recursive"
@@ -476,7 +478,7 @@
] ]
}, },
{ {
"description": "fs:allow-cache-write-recursive -> This allows full recusrive write access to the complete `$CACHE` folder, files and subdirectories.", "description": "fs:allow-cache-write-recursive -> This allows full recursive write access to the complete `$CACHE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-cache-write-recursive" "fs:allow-cache-write-recursive"
@@ -518,7 +520,7 @@
] ]
}, },
{ {
"description": "fs:allow-config-write-recursive -> This allows full recusrive write access to the complete `$CONFIG` folder, files and subdirectories.", "description": "fs:allow-config-write-recursive -> This allows full recursive write access to the complete `$CONFIG` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-config-write-recursive" "fs:allow-config-write-recursive"
@@ -560,7 +562,7 @@
] ]
}, },
{ {
"description": "fs:allow-data-write-recursive -> This allows full recusrive write access to the complete `$DATA` folder, files and subdirectories.", "description": "fs:allow-data-write-recursive -> This allows full recursive write access to the complete `$DATA` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-data-write-recursive" "fs:allow-data-write-recursive"
@@ -602,7 +604,7 @@
] ]
}, },
{ {
"description": "fs:allow-desktop-write-recursive -> This allows full recusrive write access to the complete `$DESKTOP` folder, files and subdirectories.", "description": "fs:allow-desktop-write-recursive -> This allows full recursive write access to the complete `$DESKTOP` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-desktop-write-recursive" "fs:allow-desktop-write-recursive"
@@ -644,7 +646,7 @@
] ]
}, },
{ {
"description": "fs:allow-document-write-recursive -> This allows full recusrive write access to the complete `$DOCUMENT` folder, files and subdirectories.", "description": "fs:allow-document-write-recursive -> This allows full recursive write access to the complete `$DOCUMENT` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-document-write-recursive" "fs:allow-document-write-recursive"
@@ -686,7 +688,7 @@
] ]
}, },
{ {
"description": "fs:allow-download-write-recursive -> This allows full recusrive write access to the complete `$DOWNLOAD` folder, files and subdirectories.", "description": "fs:allow-download-write-recursive -> This allows full recursive write access to the complete `$DOWNLOAD` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-download-write-recursive" "fs:allow-download-write-recursive"
@@ -728,7 +730,7 @@
] ]
}, },
{ {
"description": "fs:allow-exe-write-recursive -> This allows full recusrive write access to the complete `$EXE` folder, files and subdirectories.", "description": "fs:allow-exe-write-recursive -> This allows full recursive write access to the complete `$EXE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-exe-write-recursive" "fs:allow-exe-write-recursive"
@@ -770,7 +772,7 @@
] ]
}, },
{ {
"description": "fs:allow-font-write-recursive -> This allows full recusrive write access to the complete `$FONT` folder, files and subdirectories.", "description": "fs:allow-font-write-recursive -> This allows full recursive write access to the complete `$FONT` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-font-write-recursive" "fs:allow-font-write-recursive"
@@ -812,7 +814,7 @@
] ]
}, },
{ {
"description": "fs:allow-home-write-recursive -> This allows full recusrive write access to the complete `$HOME` folder, files and subdirectories.", "description": "fs:allow-home-write-recursive -> This allows full recursive write access to the complete `$HOME` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-home-write-recursive" "fs:allow-home-write-recursive"
@@ -854,7 +856,7 @@
] ]
}, },
{ {
"description": "fs:allow-localdata-write-recursive -> This allows full recusrive write access to the complete `$LOCALDATA` folder, files and subdirectories.", "description": "fs:allow-localdata-write-recursive -> This allows full recursive write access to the complete `$LOCALDATA` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-localdata-write-recursive" "fs:allow-localdata-write-recursive"
@@ -896,7 +898,7 @@
] ]
}, },
{ {
"description": "fs:allow-log-write-recursive -> This allows full recusrive write access to the complete `$LOG` folder, files and subdirectories.", "description": "fs:allow-log-write-recursive -> This allows full recursive write access to the complete `$LOG` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-log-write-recursive" "fs:allow-log-write-recursive"
@@ -938,7 +940,7 @@
] ]
}, },
{ {
"description": "fs:allow-picture-write-recursive -> This allows full recusrive write access to the complete `$PICTURE` folder, files and subdirectories.", "description": "fs:allow-picture-write-recursive -> This allows full recursive write access to the complete `$PICTURE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-picture-write-recursive" "fs:allow-picture-write-recursive"
@@ -980,7 +982,7 @@
] ]
}, },
{ {
"description": "fs:allow-public-write-recursive -> This allows full recusrive write access to the complete `$PUBLIC` folder, files and subdirectories.", "description": "fs:allow-public-write-recursive -> This allows full recursive write access to the complete `$PUBLIC` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-public-write-recursive" "fs:allow-public-write-recursive"
@@ -1022,7 +1024,7 @@
] ]
}, },
{ {
"description": "fs:allow-resource-write-recursive -> This allows full recusrive write access to the complete `$RESOURCE` folder, files and subdirectories.", "description": "fs:allow-resource-write-recursive -> This allows full recursive write access to the complete `$RESOURCE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-resource-write-recursive" "fs:allow-resource-write-recursive"
@@ -1064,7 +1066,7 @@
] ]
}, },
{ {
"description": "fs:allow-runtime-write-recursive -> This allows full recusrive write access to the complete `$RUNTIME` folder, files and subdirectories.", "description": "fs:allow-runtime-write-recursive -> This allows full recursive write access to the complete `$RUNTIME` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-runtime-write-recursive" "fs:allow-runtime-write-recursive"
@@ -1106,7 +1108,7 @@
] ]
}, },
{ {
"description": "fs:allow-temp-write-recursive -> This allows full recusrive write access to the complete `$TEMP` folder, files and subdirectories.", "description": "fs:allow-temp-write-recursive -> This allows full recursive write access to the complete `$TEMP` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-temp-write-recursive" "fs:allow-temp-write-recursive"
@@ -1148,7 +1150,7 @@
] ]
}, },
{ {
"description": "fs:allow-template-write-recursive -> This allows full recusrive write access to the complete `$TEMPLATE` folder, files and subdirectories.", "description": "fs:allow-template-write-recursive -> This allows full recursive write access to the complete `$TEMPLATE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-template-write-recursive" "fs:allow-template-write-recursive"
@@ -1190,7 +1192,7 @@
] ]
}, },
{ {
"description": "fs:allow-video-write-recursive -> This allows full recusrive write access to the complete `$VIDEO` folder, files and subdirectories.", "description": "fs:allow-video-write-recursive -> This allows full recursive write access to the complete `$VIDEO` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-video-write-recursive" "fs:allow-video-write-recursive"
@@ -2131,31 +2133,51 @@
}, },
"allow": { "allow": {
"items": { "items": {
"title": "Entry", "title": "FsScopeEntry",
"description": "FS scope entry.",
"anyOf": [
{
"description": "FS scope path.",
"type": "string"
},
{
"type": "object", "type": "object",
"required": [ "required": [
"path" "path"
], ],
"properties": { "properties": {
"path": { "path": {
"description": "FS scope path.",
"type": "string" "type": "string"
} }
} }
} }
]
}
}, },
"deny": { "deny": {
"items": { "items": {
"title": "Entry", "title": "FsScopeEntry",
"description": "FS scope entry.",
"anyOf": [
{
"description": "FS scope path.",
"type": "string"
},
{
"type": "object", "type": "object",
"required": [ "required": [
"path" "path"
], ],
"properties": { "properties": {
"path": { "path": {
"description": "FS scope path.",
"type": "string" "type": "string"
} }
} }
} }
]
}
} }
} }
}, },
@@ -2234,35 +2256,51 @@
}, },
"allow": { "allow": {
"items": { "items": {
"title": "ScopeEntry", "title": "HttpScopeEntry",
"description": "HTTP scope entry object definition.", "description": "HTTP scope entry.",
"anyOf": [
{
"description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"type": "string"
},
{
"type": "object", "type": "object",
"required": [ "required": [
"url" "url"
], ],
"properties": { "properties": {
"url": { "url": {
"description": "A URL that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\nExamples:\n\n- \"https://*\" or \"https://**\" : allows all HTTPS urls\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"", "description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"type": "string" "type": "string"
} }
} }
} }
]
}
}, },
"deny": { "deny": {
"items": { "items": {
"title": "ScopeEntry", "title": "HttpScopeEntry",
"description": "HTTP scope entry object definition.", "description": "HTTP scope entry.",
"anyOf": [
{
"description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"type": "string"
},
{
"type": "object", "type": "object",
"required": [ "required": [
"url" "url"
], ],
"properties": { "properties": {
"url": { "url": {
"description": "A URL that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\nExamples:\n\n- \"https://*\" or \"https://**\" : allows all HTTPS urls\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"", "description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"type": "string" "type": "string"
} }
} }
} }
]
}
} }
} }
}, },
@@ -2274,6 +2312,12 @@
"properties": { "properties": {
"identifier": { "identifier": {
"oneOf": [ "oneOf": [
{
"type": "string",
"enum": [
"shell:default"
]
},
{ {
"description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.", "description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -2339,7 +2383,7 @@
"type": "object", "type": "object",
"required": [ "required": [
"args", "args",
"command", "cmd",
"name", "name",
"sidecar" "sidecar"
], ],
@@ -2352,7 +2396,7 @@
} }
] ]
}, },
"command": { "cmd": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", "description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string" "type": "string"
}, },
@@ -2374,7 +2418,7 @@
"type": "object", "type": "object",
"required": [ "required": [
"args", "args",
"command", "cmd",
"name", "name",
"sidecar" "sidecar"
], ],
@@ -2387,7 +2431,7 @@
} }
] ]
}, },
"command": { "cmd": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", "description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string" "type": "string"
}, },
@@ -2487,6 +2531,12 @@
"app:deny-version" "app:deny-version"
] ]
}, },
{
"type": "string",
"enum": [
"autostart:default"
]
},
{ {
"description": "autostart:allow-disable -> Enables the disable command without any pre-configured scope.", "description": "autostart:allow-disable -> Enables the disable command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -2550,6 +2600,12 @@
"cli:deny-cli-matches" "cli:deny-cli-matches"
] ]
}, },
{
"type": "string",
"enum": [
"clipboard-manager:default"
]
},
{ {
"description": "clipboard-manager:allow-read -> Enables the read command without any pre-configured scope.", "description": "clipboard-manager:allow-read -> Enables the read command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -2578,6 +2634,12 @@
"clipboard-manager:deny-write" "clipboard-manager:deny-write"
] ]
}, },
{
"type": "string",
"enum": [
"dialog:default"
]
},
{ {
"description": "dialog:allow-ask -> Enables the ask command without any pre-configured scope.", "description": "dialog:allow-ask -> Enables the ask command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -2747,7 +2809,7 @@
] ]
}, },
{ {
"description": "fs:allow-app-write-recursive -> This allows full recusrive write access to the complete `$APP` folder, files and subdirectories.", "description": "fs:allow-app-write-recursive -> This allows full recursive write access to the complete `$APP` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-app-write-recursive" "fs:allow-app-write-recursive"
@@ -2789,7 +2851,7 @@
] ]
}, },
{ {
"description": "fs:allow-appcache-write-recursive -> This allows full recusrive write access to the complete `$APPCACHE` folder, files and subdirectories.", "description": "fs:allow-appcache-write-recursive -> This allows full recursive write access to the complete `$APPCACHE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-appcache-write-recursive" "fs:allow-appcache-write-recursive"
@@ -2831,7 +2893,7 @@
] ]
}, },
{ {
"description": "fs:allow-appconfig-write-recursive -> This allows full recusrive write access to the complete `$APPCONFIG` folder, files and subdirectories.", "description": "fs:allow-appconfig-write-recursive -> This allows full recursive write access to the complete `$APPCONFIG` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-appconfig-write-recursive" "fs:allow-appconfig-write-recursive"
@@ -2873,7 +2935,7 @@
] ]
}, },
{ {
"description": "fs:allow-appdata-write-recursive -> This allows full recusrive write access to the complete `$APPDATA` folder, files and subdirectories.", "description": "fs:allow-appdata-write-recursive -> This allows full recursive write access to the complete `$APPDATA` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-appdata-write-recursive" "fs:allow-appdata-write-recursive"
@@ -2915,7 +2977,7 @@
] ]
}, },
{ {
"description": "fs:allow-applocaldata-write-recursive -> This allows full recusrive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.", "description": "fs:allow-applocaldata-write-recursive -> This allows full recursive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-applocaldata-write-recursive" "fs:allow-applocaldata-write-recursive"
@@ -2957,7 +3019,7 @@
] ]
}, },
{ {
"description": "fs:allow-applog-write-recursive -> This allows full recusrive write access to the complete `$APPLOG` folder, files and subdirectories.", "description": "fs:allow-applog-write-recursive -> This allows full recursive write access to the complete `$APPLOG` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-applog-write-recursive" "fs:allow-applog-write-recursive"
@@ -2999,7 +3061,7 @@
] ]
}, },
{ {
"description": "fs:allow-audio-write-recursive -> This allows full recusrive write access to the complete `$AUDIO` folder, files and subdirectories.", "description": "fs:allow-audio-write-recursive -> This allows full recursive write access to the complete `$AUDIO` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-audio-write-recursive" "fs:allow-audio-write-recursive"
@@ -3041,7 +3103,7 @@
] ]
}, },
{ {
"description": "fs:allow-cache-write-recursive -> This allows full recusrive write access to the complete `$CACHE` folder, files and subdirectories.", "description": "fs:allow-cache-write-recursive -> This allows full recursive write access to the complete `$CACHE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-cache-write-recursive" "fs:allow-cache-write-recursive"
@@ -3083,7 +3145,7 @@
] ]
}, },
{ {
"description": "fs:allow-config-write-recursive -> This allows full recusrive write access to the complete `$CONFIG` folder, files and subdirectories.", "description": "fs:allow-config-write-recursive -> This allows full recursive write access to the complete `$CONFIG` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-config-write-recursive" "fs:allow-config-write-recursive"
@@ -3125,7 +3187,7 @@
] ]
}, },
{ {
"description": "fs:allow-data-write-recursive -> This allows full recusrive write access to the complete `$DATA` folder, files and subdirectories.", "description": "fs:allow-data-write-recursive -> This allows full recursive write access to the complete `$DATA` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-data-write-recursive" "fs:allow-data-write-recursive"
@@ -3167,7 +3229,7 @@
] ]
}, },
{ {
"description": "fs:allow-desktop-write-recursive -> This allows full recusrive write access to the complete `$DESKTOP` folder, files and subdirectories.", "description": "fs:allow-desktop-write-recursive -> This allows full recursive write access to the complete `$DESKTOP` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-desktop-write-recursive" "fs:allow-desktop-write-recursive"
@@ -3209,7 +3271,7 @@
] ]
}, },
{ {
"description": "fs:allow-document-write-recursive -> This allows full recusrive write access to the complete `$DOCUMENT` folder, files and subdirectories.", "description": "fs:allow-document-write-recursive -> This allows full recursive write access to the complete `$DOCUMENT` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-document-write-recursive" "fs:allow-document-write-recursive"
@@ -3251,7 +3313,7 @@
] ]
}, },
{ {
"description": "fs:allow-download-write-recursive -> This allows full recusrive write access to the complete `$DOWNLOAD` folder, files and subdirectories.", "description": "fs:allow-download-write-recursive -> This allows full recursive write access to the complete `$DOWNLOAD` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-download-write-recursive" "fs:allow-download-write-recursive"
@@ -3293,7 +3355,7 @@
] ]
}, },
{ {
"description": "fs:allow-exe-write-recursive -> This allows full recusrive write access to the complete `$EXE` folder, files and subdirectories.", "description": "fs:allow-exe-write-recursive -> This allows full recursive write access to the complete `$EXE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-exe-write-recursive" "fs:allow-exe-write-recursive"
@@ -3335,7 +3397,7 @@
] ]
}, },
{ {
"description": "fs:allow-font-write-recursive -> This allows full recusrive write access to the complete `$FONT` folder, files and subdirectories.", "description": "fs:allow-font-write-recursive -> This allows full recursive write access to the complete `$FONT` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-font-write-recursive" "fs:allow-font-write-recursive"
@@ -3377,7 +3439,7 @@
] ]
}, },
{ {
"description": "fs:allow-home-write-recursive -> This allows full recusrive write access to the complete `$HOME` folder, files and subdirectories.", "description": "fs:allow-home-write-recursive -> This allows full recursive write access to the complete `$HOME` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-home-write-recursive" "fs:allow-home-write-recursive"
@@ -3419,7 +3481,7 @@
] ]
}, },
{ {
"description": "fs:allow-localdata-write-recursive -> This allows full recusrive write access to the complete `$LOCALDATA` folder, files and subdirectories.", "description": "fs:allow-localdata-write-recursive -> This allows full recursive write access to the complete `$LOCALDATA` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-localdata-write-recursive" "fs:allow-localdata-write-recursive"
@@ -3461,7 +3523,7 @@
] ]
}, },
{ {
"description": "fs:allow-log-write-recursive -> This allows full recusrive write access to the complete `$LOG` folder, files and subdirectories.", "description": "fs:allow-log-write-recursive -> This allows full recursive write access to the complete `$LOG` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-log-write-recursive" "fs:allow-log-write-recursive"
@@ -3503,7 +3565,7 @@
] ]
}, },
{ {
"description": "fs:allow-picture-write-recursive -> This allows full recusrive write access to the complete `$PICTURE` folder, files and subdirectories.", "description": "fs:allow-picture-write-recursive -> This allows full recursive write access to the complete `$PICTURE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-picture-write-recursive" "fs:allow-picture-write-recursive"
@@ -3545,7 +3607,7 @@
] ]
}, },
{ {
"description": "fs:allow-public-write-recursive -> This allows full recusrive write access to the complete `$PUBLIC` folder, files and subdirectories.", "description": "fs:allow-public-write-recursive -> This allows full recursive write access to the complete `$PUBLIC` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-public-write-recursive" "fs:allow-public-write-recursive"
@@ -3587,7 +3649,7 @@
] ]
}, },
{ {
"description": "fs:allow-resource-write-recursive -> This allows full recusrive write access to the complete `$RESOURCE` folder, files and subdirectories.", "description": "fs:allow-resource-write-recursive -> This allows full recursive write access to the complete `$RESOURCE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-resource-write-recursive" "fs:allow-resource-write-recursive"
@@ -3629,7 +3691,7 @@
] ]
}, },
{ {
"description": "fs:allow-runtime-write-recursive -> This allows full recusrive write access to the complete `$RUNTIME` folder, files and subdirectories.", "description": "fs:allow-runtime-write-recursive -> This allows full recursive write access to the complete `$RUNTIME` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-runtime-write-recursive" "fs:allow-runtime-write-recursive"
@@ -3671,7 +3733,7 @@
] ]
}, },
{ {
"description": "fs:allow-temp-write-recursive -> This allows full recusrive write access to the complete `$TEMP` folder, files and subdirectories.", "description": "fs:allow-temp-write-recursive -> This allows full recursive write access to the complete `$TEMP` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-temp-write-recursive" "fs:allow-temp-write-recursive"
@@ -3713,7 +3775,7 @@
] ]
}, },
{ {
"description": "fs:allow-template-write-recursive -> This allows full recusrive write access to the complete `$TEMPLATE` folder, files and subdirectories.", "description": "fs:allow-template-write-recursive -> This allows full recursive write access to the complete `$TEMPLATE` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-template-write-recursive" "fs:allow-template-write-recursive"
@@ -3755,7 +3817,7 @@
] ]
}, },
{ {
"description": "fs:allow-video-write-recursive -> This allows full recusrive write access to the complete `$VIDEO` folder, files and subdirectories.", "description": "fs:allow-video-write-recursive -> This allows full recursive write access to the complete `$VIDEO` folder, files and subdirectories.",
"type": "string", "type": "string",
"enum": [ "enum": [
"fs:allow-video-write-recursive" "fs:allow-video-write-recursive"
@@ -4762,6 +4824,83 @@
"http:deny-fetch-send" "http:deny-fetch-send"
] ]
}, },
{
"description": "image:default -> Default permissions for the plugin.",
"type": "string",
"enum": [
"image:default"
]
},
{
"description": "image:allow-from-bytes -> Enables the from_bytes command without any pre-configured scope.",
"type": "string",
"enum": [
"image:allow-from-bytes"
]
},
{
"description": "image:allow-from-path -> Enables the from_path command without any pre-configured scope.",
"type": "string",
"enum": [
"image:allow-from-path"
]
},
{
"description": "image:allow-new -> Enables the new command without any pre-configured scope.",
"type": "string",
"enum": [
"image:allow-new"
]
},
{
"description": "image:allow-rgba -> Enables the rgba command without any pre-configured scope.",
"type": "string",
"enum": [
"image:allow-rgba"
]
},
{
"description": "image:allow-size -> Enables the size command without any pre-configured scope.",
"type": "string",
"enum": [
"image:allow-size"
]
},
{
"description": "image:deny-from-bytes -> Denies the from_bytes command without any pre-configured scope.",
"type": "string",
"enum": [
"image:deny-from-bytes"
]
},
{
"description": "image:deny-from-path -> Denies the from_path command without any pre-configured scope.",
"type": "string",
"enum": [
"image:deny-from-path"
]
},
{
"description": "image:deny-new -> Denies the new command without any pre-configured scope.",
"type": "string",
"enum": [
"image:deny-new"
]
},
{
"description": "image:deny-rgba -> Denies the rgba command without any pre-configured scope.",
"type": "string",
"enum": [
"image:deny-rgba"
]
},
{
"description": "image:deny-size -> Denies the size command without any pre-configured scope.",
"type": "string",
"enum": [
"image:deny-size"
]
},
{ {
"description": "menu:default -> Default permissions for the plugin.", "description": "menu:default -> Default permissions for the plugin.",
"type": "string", "type": "string",
@@ -5126,6 +5265,12 @@
"notification:deny-request-permission" "notification:deny-request-permission"
] ]
}, },
{
"type": "string",
"enum": [
"os:default"
]
},
{ {
"description": "os:allow-arch -> Enables the arch command without any pre-configured scope.", "description": "os:allow-arch -> Enables the arch command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -5357,6 +5502,12 @@
"path:deny-resolve-directory" "path:deny-resolve-directory"
] ]
}, },
{
"type": "string",
"enum": [
"process:default"
]
},
{ {
"description": "process:allow-exit -> Enables the exit command without any pre-configured scope.", "description": "process:allow-exit -> Enables the exit command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -5406,6 +5557,12 @@
"resources:deny-close" "resources:deny-close"
] ]
}, },
{
"type": "string",
"enum": [
"shell:default"
]
},
{ {
"description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.", "description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -5462,6 +5619,12 @@
"shell:deny-stdin-write" "shell:deny-stdin-write"
] ]
}, },
{
"type": "string",
"enum": [
"store:default"
]
},
{ {
"description": "store:allow-clear -> Enables the clear command without any pre-configured scope.", "description": "store:allow-clear -> Enables the clear command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -5637,6 +5800,13 @@
"tray:default" "tray:default"
] ]
}, },
{
"description": "tray:allow-get-by-id -> Enables the get_by_id command without any pre-configured scope.",
"type": "string",
"enum": [
"tray:allow-get-by-id"
]
},
{ {
"description": "tray:allow-new -> Enables the new command without any pre-configured scope.", "description": "tray:allow-new -> Enables the new command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -5644,6 +5814,13 @@
"tray:allow-new" "tray:allow-new"
] ]
}, },
{
"description": "tray:allow-remove-by-id -> Enables the remove_by_id command without any pre-configured scope.",
"type": "string",
"enum": [
"tray:allow-remove-by-id"
]
},
{ {
"description": "tray:allow-set-icon -> Enables the set_icon command without any pre-configured scope.", "description": "tray:allow-set-icon -> Enables the set_icon command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -5700,6 +5877,13 @@
"tray:allow-set-visible" "tray:allow-set-visible"
] ]
}, },
{
"description": "tray:deny-get-by-id -> Denies the get_by_id command without any pre-configured scope.",
"type": "string",
"enum": [
"tray:deny-get-by-id"
]
},
{ {
"description": "tray:deny-new -> Denies the new command without any pre-configured scope.", "description": "tray:deny-new -> Denies the new command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -5707,6 +5891,13 @@
"tray:deny-new" "tray:deny-new"
] ]
}, },
{
"description": "tray:deny-remove-by-id -> Denies the remove_by_id command without any pre-configured scope.",
"type": "string",
"enum": [
"tray:deny-remove-by-id"
]
},
{ {
"description": "tray:deny-set-icon -> Denies the set_icon command without any pre-configured scope.", "description": "tray:deny-set-icon -> Denies the set_icon command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -5798,6 +5989,12 @@
"updater:deny-download-and-install" "updater:deny-download-and-install"
] ]
}, },
{
"type": "string",
"enum": [
"upload:default"
]
},
{ {
"description": "upload:allow-download -> Enables the download command without any pre-configured scope.", "description": "upload:allow-download -> Enables the download command without any pre-configured scope.",
"type": "string", "type": "string",
@@ -6834,6 +7031,12 @@
"window:deny-unminimize" "window:deny-unminimize"
] ]
}, },
{
"type": "string",
"enum": [
"window-state:default"
]
},
{ {
"description": "window-state:allow-restore-window-state -> Enables the restore_window_state command without any pre-configured scope.", "description": "window-state:allow-restore-window-state -> Enables the restore_window_state command without any pre-configured scope.",
"type": "string", "type": "string",

View File

@@ -19,6 +19,7 @@ use nostr_sdk::prelude::*;
use std::fs; use std::fs;
use tauri::Manager; use tauri::Manager;
use tauri_plugin_autostart::MacosLauncher; use tauri_plugin_autostart::MacosLauncher;
#[cfg(target_os = "macos")]
use traffic_light::setup_traffic_light_positioner; use traffic_light::setup_traffic_light_positioner;
pub struct Nostr { pub struct Nostr {

View File

@@ -1,4 +1,6 @@
#[cfg(target_os = "macos")]
use objc::{msg_send, sel, sel_impl}; use objc::{msg_send, sel, sel_impl};
#[cfg(target_os = "macos")]
use rand::{distributions::Alphanumeric, Rng}; use rand::{distributions::Alphanumeric, Rng};
use tauri::{ use tauri::{
plugin::{Builder, TauriPlugin}, plugin::{Builder, TauriPlugin},

View File

@@ -1,5 +1,7 @@
use std::path::PathBuf; use std::path::PathBuf;
use tauri::{Manager, Runtime, TitleBarStyle, WebviewUrl, WebviewWindowBuilder}; #[cfg(target_os = "macos")]
use tauri::TitleBarStyle;
use tauri::{Manager, Runtime, WebviewUrl, WebviewWindowBuilder};
use tauri_plugin_shell::ShellExt; use tauri_plugin_shell::ShellExt;
pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> { pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
@@ -52,6 +54,7 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
let _ = window.set_focus(); let _ = window.set_focus();
}; };
} else { } else {
#[cfg(target_os = "macos")]
let _ = let _ =
WebviewWindowBuilder::new(app, "editor-0", WebviewUrl::App(PathBuf::from("editor"))) WebviewWindowBuilder::new(app, "editor-0", WebviewUrl::App(PathBuf::from("editor")))
.title("Editor") .title("Editor")
@@ -61,6 +64,14 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
.title_bar_style(TitleBarStyle::Overlay) .title_bar_style(TitleBarStyle::Overlay)
.build() .build()
.unwrap(); .unwrap();
#[cfg(not(target_os = "macos"))]
let _ =
WebviewWindowBuilder::new(app, "editor-0", WebviewUrl::App(PathBuf::from("editor")))
.title("Editor")
.min_inner_size(500., 400.)
.inner_size(600., 400.)
.build()
.unwrap();
} }
} }
"about" => { "about" => {
@@ -70,6 +81,7 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
println!("todo!") println!("todo!")
} }
"settings" => { "settings" => {
#[cfg(target_os = "macos")]
let _ = WebviewWindowBuilder::new( let _ = WebviewWindowBuilder::new(
app, app,
"settings", "settings",
@@ -82,6 +94,13 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
.title_bar_style(TitleBarStyle::Overlay) .title_bar_style(TitleBarStyle::Overlay)
.build() .build()
.unwrap(); .unwrap();
#[cfg(not(target_os = "macos"))]
let _ = WebviewWindowBuilder::new(app, "editor-0", WebviewUrl::App(PathBuf::from("editor")))
.title("Editor")
.min_inner_size(500., 400.)
.inner_size(600., 400.)
.build()
.unwrap();
} }
"quit" => { "quit" => {
app.exit(0); app.exit(0);