Skip to content

Commit c7c3b59

Browse files
committed
windows compatibility improvements
1 parent 2914cec commit c7c3b59

File tree

10 files changed

+1967
-29
lines changed

10 files changed

+1967
-29
lines changed

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ repository = "https://github.com/marcomq/tauri-plugin-deno"
1515
tauri = { version = "2" }
1616
serde = "1.0"
1717
thiserror = "2"
18-
1918
deno_core = "0.338"
2019
deno_fs = "0.103.0"
2120
deno_error = "0.5.5"
22-
deno_runtime = { version = "0.201", features = ["transpile"] } # , features = ["include_js_files_for_snapshotting"] }
21+
deno_runtime = { version = "0.201", features = ["transpile"] }
2322
deno_resolver = "0.24.0"
2423
sys_traits = "0.1.8"
25-
2624
reqwest = "0.12"
2725
tokio = { version = "1.43.0", features = ["full"] }
2826
lazy_static = "1.5.0"
29-
# deno_runtime = { version = "0.201" } # , features = ["include_js_files_for_snapshotting"] }
3027

3128
[build-dependencies]
3229
tauri-plugin = { version = "2", features = ["build"] }
30+
31+
32+
[target.'cfg(windows)'.dependencies]
33+
winapi = { version = "0.3.9", features = ["sysinfoapi"] }

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The source files are expected to be in `src-tauri/src-deno`. Changing them will
1313

1414
## Status
1515

16-
This plugin was currently only tested it on MacOS.
16+
This plugin was tested on MacOS & Windows and is expected to work fine on linux too. There still seem to be issues on windows production binaries, as Deno code isn't called on windows.
1717

1818
Current TODO list:
1919
- make sure that windows & linux production binaries are working fine
@@ -78,4 +78,10 @@ There are following additional permissions available that can be added to by usi
7878
- allow-call-function (allows `callFunction`; calls function in backend; enabled by default)
7979
- allow-read-variable (allows `readVariable`; read js variable from backend)
8080
- allow-register-function (allows `registerFunction`; client side way of allowing additional functions)
81-
- allow-run-code (allows `runCode`; call code directly in backend)
81+
- allow-run-code (allows `runCode`; call code directly in backend)
82+
83+
## Preconditions:
84+
In addition to the usual tauri preconditions, like installing rust, you need to perform following steps:
85+
86+
Windows:
87+
- install clang/llvm: `choco install llvm`

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ fn main() {
1616
.android_path("android")
1717
.ios_path("ios")
1818
.build();
19-
}
19+
}

examples/tauri-app/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
"version": "0.3.0",
55
"type": "module",
66
"scripts": {
7-
"pretauri": "deno run --allow-read --allow-write --allow-env --allow-net --allow-run npm:tauri-plugin-deno-api src-tauri/src-deno/main.js &",
8-
"tauri": "tauri"
7+
"deno:bundle_and_tauri": "deno run --allow-read --allow-write --allow-env --allow-net --allow-run npm:tauri-plugin-deno-api src-tauri/src-deno/main.js & tauri",
8+
"npm:tauri": "tauri",
9+
"tauri": "deno task deno:bundle_and_tauri"
910
},
1011
"dependencies": {
1112
"@tauri-apps/api": "^2.3",

examples/tauri-app/src-tauri/gen/schemas/desktop-schema.json

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
],
3838
"definitions": {
3939
"Capability": {
40-
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows fine grained access to the Tauri core, application, or plugin commands. If a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, ], \"platforms\": [\"macOS\",\"windows\"] } ```",
40+
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows' and webviews' fine grained access to the Tauri core, application, or plugin commands. If a webview or its window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, ], \"platforms\": [\"macOS\",\"windows\"] } ```",
4141
"type": "object",
4242
"required": [
4343
"identifier",
@@ -70,14 +70,14 @@
7070
"type": "boolean"
7171
},
7272
"windows": {
73-
"description": "List of windows that are affected by this capability. Can be a glob pattern.\n\nOn multiwebview windows, prefer [`Self::webviews`] for a fine grained access control.\n\n## Example\n\n`[\"main\"]`",
73+
"description": "List of windows that are affected by this capability. Can be a glob pattern.\n\nIf a window label matches any of the patterns in this list, the capability will be enabled on all the webviews of that window, regardless of the value of [`Self::webviews`].\n\nOn multiwebview windows, prefer specifying [`Self::webviews`] and omitting [`Self::windows`] for a fine grained access control.\n\n## Example\n\n`[\"main\"]`",
7474
"type": "array",
7575
"items": {
7676
"type": "string"
7777
}
7878
},
7979
"webviews": {
80-
"description": "List of webviews that are affected by this capability. Can be a glob pattern.\n\nThis is only required when using on multiwebview contexts, by default all child webviews of a window that matches [`Self::windows`] are linked.\n\n## Example\n\n`[\"sub-webview-one\", \"sub-webview-two\"]`",
80+
"description": "List of webviews that are affected by this capability. Can be a glob pattern.\n\nThe capability will be enabled on all the webviews whose label matches any of the patterns in this list, regardless of whether the webview's window label matches a pattern in [`Self::windows`].\n\n## Example\n\n`[\"sub-webview-one\", \"sub-webview-two\"]`",
8181
"type": "array",
8282
"items": {
8383
"type": "string"
@@ -201,11 +201,26 @@
201201
"type": "string",
202202
"const": "core:app:allow-default-window-icon"
203203
},
204+
{
205+
"description": "Enables the fetch_data_store_identifiers command without any pre-configured scope.",
206+
"type": "string",
207+
"const": "core:app:allow-fetch-data-store-identifiers"
208+
},
209+
{
210+
"description": "Enables the identifier command without any pre-configured scope.",
211+
"type": "string",
212+
"const": "core:app:allow-identifier"
213+
},
204214
{
205215
"description": "Enables the name command without any pre-configured scope.",
206216
"type": "string",
207217
"const": "core:app:allow-name"
208218
},
219+
{
220+
"description": "Enables the remove_data_store command without any pre-configured scope.",
221+
"type": "string",
222+
"const": "core:app:allow-remove-data-store"
223+
},
209224
{
210225
"description": "Enables the set_app_theme command without any pre-configured scope.",
211226
"type": "string",
@@ -236,11 +251,26 @@
236251
"type": "string",
237252
"const": "core:app:deny-default-window-icon"
238253
},
254+
{
255+
"description": "Denies the fetch_data_store_identifiers command without any pre-configured scope.",
256+
"type": "string",
257+
"const": "core:app:deny-fetch-data-store-identifiers"
258+
},
259+
{
260+
"description": "Denies the identifier command without any pre-configured scope.",
261+
"type": "string",
262+
"const": "core:app:deny-identifier"
263+
},
239264
{
240265
"description": "Denies the name command without any pre-configured scope.",
241266
"type": "string",
242267
"const": "core:app:deny-name"
243268
},
269+
{
270+
"description": "Denies the remove_data_store command without any pre-configured scope.",
271+
"type": "string",
272+
"const": "core:app:deny-remove-data-store"
273+
},
244274
{
245275
"description": "Denies the set_app_theme command without any pre-configured scope.",
246276
"type": "string",
@@ -1036,6 +1066,11 @@
10361066
"type": "string",
10371067
"const": "core:window:allow-internal-toggle-maximize"
10381068
},
1069+
{
1070+
"description": "Enables the is_always_on_top command without any pre-configured scope.",
1071+
"type": "string",
1072+
"const": "core:window:allow-is-always-on-top"
1073+
},
10391074
{
10401075
"description": "Enables the is_closable command without any pre-configured scope.",
10411076
"type": "string",
@@ -1401,6 +1436,11 @@
14011436
"type": "string",
14021437
"const": "core:window:deny-internal-toggle-maximize"
14031438
},
1439+
{
1440+
"description": "Denies the is_always_on_top command without any pre-configured scope.",
1441+
"type": "string",
1442+
"const": "core:window:deny-is-always-on-top"
1443+
},
14041444
{
14051445
"description": "Denies the is_closable command without any pre-configured scope.",
14061446
"type": "string",

0 commit comments

Comments
 (0)