From 35cf0abda437f5b40451f12604397759de115cf3 Mon Sep 17 00:00:00 2001 From: reya <123083837+reyamir@users.noreply.github.com> Date: Fri, 12 Apr 2024 18:35:19 +0700 Subject: [PATCH] fix: support windows --- src-tauri/gen/schemas/windows-schema.json | 405 ++++++++++++++++------ src-tauri/src/main.rs | 1 + src-tauri/src/traffic_light.rs | 2 + src-tauri/src/tray.rs | 21 +- 4 files changed, 327 insertions(+), 102 deletions(-) diff --git a/src-tauri/gen/schemas/windows-schema.json b/src-tauri/gen/schemas/windows-schema.json index e05e7844..06f35a34 100644 --- a/src-tauri/gen/schemas/windows-schema.json +++ b/src-tauri/gen/schemas/windows-schema.json @@ -11,6 +11,13 @@ } ] }, + { + "description": "A list of capabilities.", + "type": "array", + "items": { + "$ref": "#/definitions/Capability" + } + }, { "description": "A list of capabilities.", "type": "object", @@ -34,8 +41,7 @@ "type": "object", "required": [ "identifier", - "permissions", - "windows" + "permissions" ], "properties": { "identifier": { @@ -85,15 +91,11 @@ } }, "platforms": { - "description": "Target platforms this capability applies. By default all platforms applies.", - "default": [ - "linux", - "macOS", - "windows", - "android", - "iOS" + "description": "Target platforms this capability applies. By default all platforms are affected by this capability.", + "type": [ + "array", + "null" ], - "type": "array", "items": { "$ref": "#/definitions/Target" } @@ -108,7 +110,7 @@ ], "properties": { "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", "items": { "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "fs:allow-video-write-recursive" @@ -2131,30 +2133,50 @@ }, "allow": { "items": { - "title": "Entry", - "type": "object", - "required": [ - "path" - ], - "properties": { - "path": { + "title": "FsScopeEntry", + "description": "FS scope entry.", + "anyOf": [ + { + "description": "FS scope path.", "type": "string" + }, + { + "type": "object", + "required": [ + "path" + ], + "properties": { + "path": { + "description": "FS scope path.", + "type": "string" + } + } } - } + ] } }, "deny": { "items": { - "title": "Entry", - "type": "object", - "required": [ - "path" - ], - "properties": { - "path": { + "title": "FsScopeEntry", + "description": "FS scope entry.", + "anyOf": [ + { + "description": "FS scope path.", "type": "string" + }, + { + "type": "object", + "required": [ + "path" + ], + "properties": { + "path": { + "description": "FS scope path.", + "type": "string" + } + } } - } + ] } } } @@ -2234,34 +2256,50 @@ }, "allow": { "items": { - "title": "ScopeEntry", - "description": "HTTP scope entry object definition.", - "type": "object", - "required": [ - "url" - ], - "properties": { - "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/\"", + "title": "HttpScopeEntry", + "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", + "required": [ + "url" + ], + "properties": { + "url": { + "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" + } + } } - } + ] } }, "deny": { "items": { - "title": "ScopeEntry", - "description": "HTTP scope entry object definition.", - "type": "object", - "required": [ - "url" - ], - "properties": { - "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/\"", + "title": "HttpScopeEntry", + "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", + "required": [ + "url" + ], + "properties": { + "url": { + "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" + } + } } - } + ] } } } @@ -2274,6 +2312,12 @@ "properties": { "identifier": { "oneOf": [ + { + "type": "string", + "enum": [ + "shell:default" + ] + }, { "description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.", "type": "string", @@ -2339,7 +2383,7 @@ "type": "object", "required": [ "args", - "command", + "cmd", "name", "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`.", "type": "string" }, @@ -2374,7 +2418,7 @@ "type": "object", "required": [ "args", - "command", + "cmd", "name", "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`.", "type": "string" }, @@ -2487,6 +2531,12 @@ "app:deny-version" ] }, + { + "type": "string", + "enum": [ + "autostart:default" + ] + }, { "description": "autostart:allow-disable -> Enables the disable command without any pre-configured scope.", "type": "string", @@ -2550,6 +2600,12 @@ "cli:deny-cli-matches" ] }, + { + "type": "string", + "enum": [ + "clipboard-manager:default" + ] + }, { "description": "clipboard-manager:allow-read -> Enables the read command without any pre-configured scope.", "type": "string", @@ -2578,6 +2634,12 @@ "clipboard-manager:deny-write" ] }, + { + "type": "string", + "enum": [ + "dialog:default" + ] + }, { "description": "dialog:allow-ask -> Enables the ask command without any pre-configured scope.", "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "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", "enum": [ "fs:allow-video-write-recursive" @@ -4762,6 +4824,83 @@ "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.", "type": "string", @@ -5126,6 +5265,12 @@ "notification:deny-request-permission" ] }, + { + "type": "string", + "enum": [ + "os:default" + ] + }, { "description": "os:allow-arch -> Enables the arch command without any pre-configured scope.", "type": "string", @@ -5357,6 +5502,12 @@ "path:deny-resolve-directory" ] }, + { + "type": "string", + "enum": [ + "process:default" + ] + }, { "description": "process:allow-exit -> Enables the exit command without any pre-configured scope.", "type": "string", @@ -5406,6 +5557,12 @@ "resources:deny-close" ] }, + { + "type": "string", + "enum": [ + "shell:default" + ] + }, { "description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.", "type": "string", @@ -5462,6 +5619,12 @@ "shell:deny-stdin-write" ] }, + { + "type": "string", + "enum": [ + "store:default" + ] + }, { "description": "store:allow-clear -> Enables the clear command without any pre-configured scope.", "type": "string", @@ -5637,6 +5800,13 @@ "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.", "type": "string", @@ -5644,6 +5814,13 @@ "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.", "type": "string", @@ -5700,6 +5877,13 @@ "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.", "type": "string", @@ -5707,6 +5891,13 @@ "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.", "type": "string", @@ -5798,6 +5989,12 @@ "updater:deny-download-and-install" ] }, + { + "type": "string", + "enum": [ + "upload:default" + ] + }, { "description": "upload:allow-download -> Enables the download command without any pre-configured scope.", "type": "string", @@ -6834,6 +7031,12 @@ "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.", "type": "string", diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 45f51aec..45253b3f 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -19,6 +19,7 @@ use nostr_sdk::prelude::*; use std::fs; use tauri::Manager; use tauri_plugin_autostart::MacosLauncher; +#[cfg(target_os = "macos")] use traffic_light::setup_traffic_light_positioner; pub struct Nostr { diff --git a/src-tauri/src/traffic_light.rs b/src-tauri/src/traffic_light.rs index d2dc4750..9bad8195 100644 --- a/src-tauri/src/traffic_light.rs +++ b/src-tauri/src/traffic_light.rs @@ -1,4 +1,6 @@ +#[cfg(target_os = "macos")] use objc::{msg_send, sel, sel_impl}; +#[cfg(target_os = "macos")] use rand::{distributions::Alphanumeric, Rng}; use tauri::{ plugin::{Builder, TauriPlugin}, diff --git a/src-tauri/src/tray.rs b/src-tauri/src/tray.rs index 0dfbfc3e..8ce68d66 100644 --- a/src-tauri/src/tray.rs +++ b/src-tauri/src/tray.rs @@ -1,5 +1,7 @@ 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; pub fn create_tray(app: &tauri::AppHandle) -> tauri::Result<()> { @@ -52,6 +54,7 @@ pub fn create_tray(app: &tauri::AppHandle) -> tauri::Result<()> { let _ = window.set_focus(); }; } else { + #[cfg(target_os = "macos")] let _ = WebviewWindowBuilder::new(app, "editor-0", WebviewUrl::App(PathBuf::from("editor"))) .title("Editor") @@ -61,6 +64,14 @@ pub fn create_tray(app: &tauri::AppHandle) -> tauri::Result<()> { .title_bar_style(TitleBarStyle::Overlay) .build() .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" => { @@ -70,6 +81,7 @@ pub fn create_tray(app: &tauri::AppHandle) -> tauri::Result<()> { println!("todo!") } "settings" => { + #[cfg(target_os = "macos")] let _ = WebviewWindowBuilder::new( app, "settings", @@ -82,6 +94,13 @@ pub fn create_tray(app: &tauri::AppHandle) -> tauri::Result<()> { .title_bar_style(TitleBarStyle::Overlay) .build() .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" => { app.exit(0);