-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): include default.toml and capabilities in plugin template (#…
…10030) * feat(cli): include default.toml and capabilities in plugin template * replace execute usage with ping * add to capabilities * use default permission set
- Loading branch information
Showing
10 changed files
with
75 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"tauri-cli": "patch:enhance" | ||
"@tauri-apps/cli": "patch:enhance" | ||
--- | ||
|
||
Enhance the plugin template to include `permissions/default.toml` and default capabilities file for the example application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tooling/cli/templates/plugin/__example-api/tauri-app/src-tauri/capabilities/default.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"$schema": "../gen/schemas/desktop-schema.json", | ||
"identifier": "default", | ||
"description": "enables the default permissions", | ||
"windows": ["main"], | ||
"permissions": [ | ||
"path:default", | ||
"event:default", | ||
"window:default", | ||
"webview:default", | ||
"app:default", | ||
"resources:default", | ||
"image:default", | ||
"menu:default", | ||
"tray:default", | ||
"{{ plugin_name }}:default" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/capabilities/default.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"$schema": "../gen/schemas/desktop-schema.json", | ||
"identifier": "default", | ||
"description": "enables the default permissions", | ||
"windows": ["main"], | ||
"permissions": [ | ||
"path:default", | ||
"event:default", | ||
"window:default", | ||
"webview:default", | ||
"app:default", | ||
"resources:default", | ||
"image:default", | ||
"menu:default", | ||
"tray:default", | ||
"{{ plugin_name }}:default" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
{{#if license_header}} | ||
{{ license_header }} | ||
{{/if}} | ||
use tauri::{AppHandle, command, Runtime, State, Window}; | ||
use tauri::{AppHandle, command, Runtime}; | ||
|
||
use crate::{MyState, Result}; | ||
use crate::models::*; | ||
use crate::Result; | ||
use crate::{{ plugin_name_pascal_case }}Ext; | ||
|
||
#[command] | ||
pub(crate) async fn execute<R: Runtime>( | ||
_app: AppHandle<R>, | ||
_window: Window<R>, | ||
state: State<'_, MyState>, | ||
) -> Result<String> { | ||
state.0.lock().unwrap().insert("key".into(), "value".into()); | ||
Ok("success".to_string()) | ||
pub(crate) async fn ping<R: Runtime>( | ||
app: AppHandle<R>, | ||
payload: PingRequest, | ||
) -> Result<PingResponse> { | ||
app.{{ plugin_name_snake_case }}().ping(payload) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters