Radish alpha
r
Radicle desktop app
Radicle
Git (anonymous pull)
Log in to clone via SSH
Change to Isolation Pattern
Sebastian Martinez committed 1 year ago
commit dc4b65c04dc4b9911d8649fe58b45b9764947c59
parent 188bcd4d9cf28c7ff0eb84647d239f8cc5489b3e
8 files changed +45 -4
modified eslint.config.js
@@ -134,9 +134,9 @@ export default [
  },
  {
    ignores: [
+
      "isolation/*",
      "node_modules/**/*",
      "src-tauri/**/*",
-
      ".svelte-kit/**/*",
      "eslint.config.js",
    ],
  },
added isolation/index.html
@@ -0,0 +1,13 @@
+
<!doctype html>
+
<html lang="en">
+

+
<head>
+
    <meta charset="UTF-8" />
+
    <title>Isolation Secure Script</title>
+
</head>
+

+
<body>
+
    <script src="index.js"></script>
+
</body>
+

+
</html>

\ No newline at end of file
added 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;
+
};
modified 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",
modified 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" ]
modified src-tauri/tauri.conf.json
@@ -18,6 +18,12 @@
    ],
    "security": {
      "csp": null
+
      "pattern": {
+
        "use": "isolation",
+
        "options": {
+
          "dir": "../isolation"
+
        }
+
      }
    }
  },
  "bundle": {
modified 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",
modified 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: {