Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Feb 18, 2024

Conversation

lucasfernog
Copy link
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
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
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
Member Author

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

tooling/cli/templates/tauri.conf.json Outdated Show resolved Hide resolved
core/tauri-codegen/src/context.rs Show resolved Hide resolved
@lucasfernog lucasfernog merged commit 83a68de into dev Feb 18, 2024
29 of 32 checks passed
@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.

None yet

3 participants