Skip to content

Commit

Permalink
docs(fs): Fix scope example in js inline docs (tauri-apps#2034)
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianLars authored Nov 11, 2024
1 parent 6d6508f commit 52c093a
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion plugins/fs/api-iife.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 20 additions & 9 deletions plugins/fs/guest-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,29 @@
*
* The API has a scope configuration that forces you to restrict the paths that can be accessed using glob patterns.
*
* The scope configuration is an array of glob patterns describing folder paths that are allowed.
* For instance, this scope configuration only allows accessing files on the
* *databases* folder of the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | `$APPDATA` directory}:
* The scope configuration is an array of glob patterns describing file/directory paths that are allowed.
* For instance, this scope configuration allows **all** enabled `fs` APIs to (only) access files in the
* *databases* directory of the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | `$APPDATA` directory}:
* ```json
* {
* "plugins": {
* "fs": {
* "scope": ["$APPDATA/databases/*"]
* "permissions": [
* {
* "identifier": "fs:scope",
* "allow": [{ "path": "$APPDATA/databases/*" }]
* }
* }
* ]
* }
* ```
*
* Scopes can also be applied to specific `fs` APIs by using the API's identifier instead of `fs:scope`:
* ```json
* {
* "permissions": [
* {
* "identifier": "fs:allow-exists",
* "allow": [{ "path": "$APPDATA/databases/*" }]
* }
* ]
* }
* ```
*
Expand Down Expand Up @@ -56,8 +69,6 @@
*
* Trying to execute any API with a URL not configured on the scope results in a promise rejection due to denied access.
*
* Note that this scope applies to **all** APIs on this module.
*
* @module
*/

Expand Down
Loading

0 comments on commit 52c093a

Please sign in to comment.