| Summary: | Account settings can get clobbered if username is shared between instances | ||
|---|---|---|---|
| Product: | [Applications] Tokodon | Reporter: | Raphael Gaschignard <raphael> |
| Component: | general | Assignee: | Unassigned bugs <unassigned-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | carl, josh |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
I can confirm this is an issue, along with other inconsistencies due to some assumptions based on username uniqueness. I can fix this in a few days, but since you already know what's wrong, I highly suggest opening an MR (https://invent.kde.org/network/tokodon/-/merge_requests)! We'll have to support migrating from the old settings groups as well. (In reply to Joshua Goins from comment #1) > I can confirm this is an issue, along with other inconsistencies due to some > assumptions based on username uniqueness. I can fix this in a few days, but > since you already know what's wrong, I highly suggest opening an MR > (https://invent.kde.org/network/tokodon/-/merge_requests)! We'll have to > support migrating from the old settings groups as well. Alright, will try to send something in! I wrote a patch, but don't have push rights to the KDE repository. I tried to email in the merge request via a patch file and that failed as well. Do you have any guidance here? Actually, I got this working (needed to fork the project, got a bit confused because the button wouldn't show up until I had added an SSH key... also reading the KDE contribution guide resolved my issue). Patch is up as a MR! This was merged and got into 23.02 :D |
SUMMARY If you connect to multiple instances with the same username, the settings file clobbers over one of the instance settings on save. The relevant bit in `account.cpp`, where we're using the username (`m_name`) to save the account settings: ``` void Account::writeToSettings(QSettings &settings) const { settings.beginGroup(m_name); settings.setValue("token", m_token); /* snip */ settings.endGroup(); } ``` I think the group needs to be set as something non-unique. At least `mastodon.sdf.org` sets the username as just the left part of the identifier, so `m_name` is only unique per instance, instead of globally unique. A simple fix would be to simply use the instance + the name as the group