diff --git a/eslint.config.js b/eslint.config.js index a5e35ecf2..fba90809f 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -134,9 +134,9 @@ export default [ }, { ignores: [ + "isolation/*", "node_modules/**/*", "src-tauri/**/*", - ".svelte-kit/**/*", "eslint.config.js", ], }, diff --git a/isolation/index.html b/isolation/index.html new file mode 100644 index 000000000..3a1d4b303 --- /dev/null +++ b/isolation/index.html @@ -0,0 +1,13 @@ + + + + + + Isolation Secure Script + + + + + + + \ No newline at end of file diff --git a/isolation/index.js b/isolation/index.js new file mode 100644 index 000000000..c46556b1c --- /dev/null +++ b/isolation/index.js @@ -0,0 +1,5 @@ +window.__TAURI_ISOLATION_HOOK__ = payload => { + // let's not verify or modify anything, just print the content from the hook + console.log("hook", payload); + return payload; +}; diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index c9b8a2c3a..2f2673368 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -647,6 +647,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] @@ -4071,6 +4072,7 @@ dependencies = [ "tray-icon", "url", "urlpattern", + "uuid", "webkit2gtk", "webview2-com", "window-vibrancy", @@ -4093,6 +4095,7 @@ dependencies = [ "semver", "serde", "serde_json", + "tauri-codegen", "tauri-utils", "tauri-winres", "toml 0.8.2", @@ -4227,10 +4230,12 @@ version = "2.0.0-beta.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e20e51856f343c503892749b27d34042e6ca83a0369a12de3c5552d9874d04e8" dependencies = [ + "aes-gcm", "brotli", "cargo_metadata", "ctor", "dunce", + "getrandom 0.2.15", "glob", "html5ever", "infer", @@ -4248,6 +4253,7 @@ dependencies = [ "serde-untagged", "serde_json", "serde_with", + "serialize-to-javascript", "swift-rs", "thiserror", "toml 0.8.2", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index e4da67faa..f041940f2 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -16,11 +16,19 @@ name = "app_lib" crate-type = ["staticlib", "cdylib", "lib"] [build-dependencies] -tauri-build = { version = "2.0.0-beta.19", features = [] } +tauri-build = { version = "2.0.0-beta.19", features = ["isolation"] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "2.0.0-beta.24", features = [] } +tauri = { version = "2.0.0-beta.24", features = ["isolation"] } tauri-plugin-shell = "2.0.0-beta.9" radicle = "0.12.0" + +[features] +# by default Tauri runs in production mode +# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL +default = [ "custom-protocol" ] +# this feature is used for production builds where `devPath` points to the filesystem +# DO NOT remove this +custom-protocol = [ "tauri/custom-protocol" ] diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 97f698f09..58f149737 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -18,6 +18,12 @@ ], "security": { "csp": null + "pattern": { + "use": "isolation", + "options": { + "dir": "../isolation" + } + } } }, "bundle": { diff --git a/tsconfig.json b/tsconfig.json index 54dbf84ac..fb8ea3082 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "@tsconfig/svelte/tsconfig.json", "include": ["src", "./*.js", "./*.ts"], - "exclude": ["node_modules/*"], + "exclude": ["node_modules/*", "isolation/*"], "compilerOptions": { "noEmit": true, "target": "es2021", diff --git a/vite.config.ts b/vite.config.ts index b45b013e1..20b6c16f0 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,9 @@ import { svelte } from "@sveltejs/vite-plugin-svelte"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [svelte()], + build: { + outDir: "build", + }, // prevent vite from obscuring rust errors clearScreen: false, server: {