Skip to content

Commit 52c093a

Browse files
authored
docs(fs): Fix scope example in js inline docs (#2034)
1 parent 6d6508f commit 52c093a

File tree

10 files changed

+29
-18
lines changed

10 files changed

+29
-18
lines changed

plugins/fs/api-iife.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/fs/guest-js/index.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,29 @@
1414
*
1515
* The API has a scope configuration that forces you to restrict the paths that can be accessed using glob patterns.
1616
*
17-
* The scope configuration is an array of glob patterns describing folder paths that are allowed.
18-
* For instance, this scope configuration only allows accessing files on the
19-
* *databases* folder of the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | `$APPDATA` directory}:
17+
* The scope configuration is an array of glob patterns describing file/directory paths that are allowed.
18+
* For instance, this scope configuration allows **all** enabled `fs` APIs to (only) access files in the
19+
* *databases* directory of the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | `$APPDATA` directory}:
2020
* ```json
2121
* {
22-
* "plugins": {
23-
* "fs": {
24-
* "scope": ["$APPDATA/databases/*"]
22+
* "permissions": [
23+
* {
24+
* "identifier": "fs:scope",
25+
* "allow": [{ "path": "$APPDATA/databases/*" }]
2526
* }
26-
* }
27+
* ]
28+
* }
29+
* ```
30+
*
31+
* Scopes can also be applied to specific `fs` APIs by using the API's identifier instead of `fs:scope`:
32+
* ```json
33+
* {
34+
* "permissions": [
35+
* {
36+
* "identifier": "fs:allow-exists",
37+
* "allow": [{ "path": "$APPDATA/databases/*" }]
38+
* }
39+
* ]
2740
* }
2841
* ```
2942
*
@@ -56,8 +69,6 @@
5669
*
5770
* Trying to execute any API with a URL not configured on the scope results in a promise rejection due to denied access.
5871
*
59-
* Note that this scope applies to **all** APIs on this module.
60-
*
6172
* @module
6273
*/
6374

0 commit comments

Comments
 (0)