Skip to content

refactor(core): allow referencing capabilities on the Tauri config file#8797

Merged
lucasfernog merged 3 commits into
devfrom
refactor/capabilities-conf
Feb 18, 2024
Merged

refactor(core): allow referencing capabilities on the Tauri config file#8797
lucasfernog merged 3 commits into
devfrom
refactor/capabilities-conf

Conversation

@lucasfernog
Copy link
Copy Markdown
Member

The current capability file design automatically adds all files in the capabilities folder to the application. While this is convenient for the developer, it restricts dynamic use cases (for instance plugins that are only enabled on debug or with an associated Cargo feature). After talking with @tweidinger we agreed we should add a reference on tauri.conf.json where the dev must specify which capabilities to include.

This PR adds a capabilities array inside app > security > capabilities where you can reference capabilities by identifier or inline capability objects (though this one isn't ideal since it lacks JSON schema support).

I'll open an issue later today detailing the dynamic capability implementation we can support.

@lucasfernog lucasfernog requested a review from a team as a code owner February 6, 2024 14:54
@lucasfernog
Copy link
Copy Markdown
Member Author

Maybe we should default to include all capabilities if the config array is empty? I know @FabianLars would like that so we won't deal with another "hidden" breaking change.

@lucasfernog lucasfernog changed the title refactor(core): capabilities must be referenced on the Tauri config file refactor(core): allow referencing capabilities on the Tauri config file Feb 6, 2024
@FabianLars
Copy link
Copy Markdown
Member

Yup, probably. But it's still beta so if it's objectively better than just break it 🤷

(i also don't really get the issue itself tbh so idk)

@lucasfernog
Copy link
Copy Markdown
Member Author

I like how the latest change is a balance between DX and configurability.

Comment thread tooling/cli/templates/tauri.conf.json Outdated
Comment thread core/tauri-codegen/src/context.rs
@lucasfernog lucasfernog merged commit 83a68de into dev Feb 18, 2024
@lucasfernog lucasfernog deleted the refactor/capabilities-conf branch February 18, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants