Browse Source

docs: added example of tauri.allowlist.protocol (#9726)

Angel S. Moreno 1 year ago
parent
commit
f1b0b00159
1 changed files with 13 additions and 0 deletions
  1. 13 0
      tooling/api/src/tauri.ts

+ 13 - 0
tooling/api/src/tauri.ts

@@ -106,6 +106,19 @@ async function invoke<T>(cmd: string, args: InvokeArgs = {}): Promise<T> {
  *
  * Additionally, `asset` must be added to [`tauri.allowlist.protocol`](https://tauri.app/v1/api/config/#allowlistconfig.protocol)
  * in `tauri.conf.json` and its access scope must be defined on the `assetScope` array on the same `protocol` object.
+ * For example: 
+ * ```json
+ * {
+ *   "tauri": {
+ *     "allowlist": {
+ *       "protocol": {
+ *         "asset": true,
+ *         "assetScope": ["$APPDATA/assets/*"]
+ *       }
+ *     }
+ *   }
+ * }
+ * ```
  *
  * @param  filePath The file path.
  * @param  protocol The protocol to use. Defaults to `asset`. You only need to set this when using a custom protocol.