tauri-apps / plugins-workspace

All of the official Tauri plugins in one place!
https://tauri.app
Apache License 2.0
915 stars 254 forks source link

[shell][v2] scope option disappeared, cannot allow shell command #1560

Closed mildred closed 3 months ago

mildred commented 3 months ago

It seems the scope option disappeared from the plugin options

https://github.com/tauri-apps/plugins-workspace/pull/862/files#diff-8058840d416610fa0e71fa59d25357bc4df67cdcbaf9822f432546818f140272

I have a config like:

  "plugins": {
    "shell": {
      "scope": [
        {
          "name":    "./bin/node",
          "sidecar": true,
          "args":    true
        }
      ]
    }
  }

but Tauri gives me an error: error while running tauri application: PluginInitialization("shell", "Error deserializing 'plugins.shell' within your Tauri configuration: unknown field scope, expected open")

mildred commented 3 months ago

The solution is to include it in the permissions like this:

{
  "...": "...",
  "app": {
    "...": "...",
    "security": {
      "csp": null,
      "capabilities": [
        {
          "identifier": "main-user-files-write",
          "windows": [ "main", "window*" ],
          "permissions": [
            "...",
            { "identifier": "shell:allow-execute",
              "allow": [
                {
                  "name":    "./bin/node",
                  "sidecar": true,
                  "args":    true
                }
              ]
            }
          ]
        }
      ]
    }
  },
  "bundle": {
    "...": "...",
    "externalBin": [
      "./bin/node"
    ],
  },
}