Skip to content

Conversation

@Simon-Laux
Copy link
Contributor

@Simon-Laux Simon-Laux commented Dec 8, 2025

Adds an api to get all ui config keys. There already is an option to get all normal config keys ("sys.config_keys"), but before this pr there was no way to get all ui.* config keys.

Why is this api needed?

For webxdc cleanup on desktop, which stores window position in a ui config key (such as ui.desktop.webxdcBounds.676464) as soon as a webxdc is opened since many versions now. So listing all ui keys is a good way for us to find out which webxdc may have web data stored. unfortunately electron does not (yet?) have a way to list all origins that have web-data like android does, so this is the next best thing we can do before itterating all possible ids, see also deltachat/deltachat-desktop#5758.

Why is this only a jsonrpc api and not another special/virtual config key like "sys.config_keys"?

r10s indicated that ui.*-config keys are barely used (deltachat/deltachat-desktop#5790 (comment)), so I thought it makes more sense to add it as dedicated api which's existentence is checked by the typechecker, so it will be easier to not miss it when we should remove the api again in the future.

But we could also do a dedicated special/virtual config key for it, if you think that is better, this is easy to change.

}

/// Returns all `ui.*` config keys that were set by the UI.
pub async fn get_all_ui_config_keys(context: &Context) -> Result<Vec<String>> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub async fn get_all_ui_config_keys(context: &Context) -> Result<Vec<String>> {
pub async fn get_ui_config_keys(context: &Context) -> Result<Vec<String>> {

I think that "all" isn't necessary, it's assumed. SysConfigKeys also doesn't have "All"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wanted to put something there to differentiate it from SysConfigKeys`, because it does not return all possible keys, just the ones that were set by the ui.

(its impossible to know which ones exist, because they are not strictly defined and the UIs can save whatever they want there, for example I use it often in my bots to save state.)

Copy link
Collaborator

@link2xt link2xt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have api: prefix that goes into API changes section.

Otherwise fine to merge assuming it's going to be used in desktop.

@Simon-Laux Simon-Laux changed the title feat: jsonrpc api get_all_ui_config_keys to get all "ui.*" config keys api: jsonrpc api get_all_ui_config_keys to get all "ui.*" config keys Dec 11, 2025
@Simon-Laux
Copy link
Contributor Author

desktop pr exists now: deltachat/deltachat-desktop#5871

Co-authored-by: iequidoo <117991069+iequidoo@users.noreply.github.com>
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.

4 participants