feat: Multi-user account switching#1217
Conversation
4db64ed to
9d93080
Compare
Dadadah
left a comment
There was a problem hiding this comment.
Not bad, I would appreciate if you could go in to detail about how the state store works now, perhaps we should update the developer documentation?
This PR is large, are you sure there aren't any more relevant screenshots or videos for ui/ux review?
Just added one more screenshot- But aside from that, this PR is more backend changes than UI so that's that's changed UI-wise. Eg. several of the changed JSX files was just to pass the onClose listener to the add account button so that it closes the settings UI when pressed.
Sure, updated documentation for the State/Store changes might make sense. Long story short, now instead of having only one database (currently named "localforage" in main, as that's what the library defaults to), we treat the old one as the 'global' DB that holds any store with the global flag set to true- namely the auth store at the moment. All other stores are instead loaded from and written to the appropriate store with the name For forward compatibility, I made the multi-instance PR behave like this too, so that none of your settings for existing main-instance logins are lost in the void. In other words, he default instance (as set by CONFIGURATION) is always replaced with a blank string (even if you explicitly type in One thing I didn't yet implement that should probably be added is garbage collection for unused DBs, i.e. after logout of a secondary account the data just sits there. The databases known to localforage should be double-checked against the list of saved sessions in the global auth store. |
db88bba to
e5a5fc2
Compare
600c5d4 to
53369ee
Compare
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
f9c38bd to
6979ea8
Compare
6979ea8 to
f8be6b8
Compare
refactor: use Instance.apiUrl instead of CONFIGURATION.DEFAULT_API_URL refactor: use Instance.wsUrl instead of CONFIGURATION.DEFAULT_WS_URL refactor: use Instance.mediaUrl instead of CONFIGURATION.DEFAULT_MEDIA_URL refactor: use Instance.proxyUrl instead of CONFIGURATION.DEFAULT_PROXY_URL refactor: use Instance.gifboxUrl instead of CONFIGURATION.DEFAULT_GIFBOX_URL refactor: use Instance.isStoat instead of CONFIGURATION.IS_STOAT refactor: use Instance.hcaptcha_sitekey instead of CONFIGURATION.HCAPTCHA_SITEKEY refactor: use Instance.maxEmoji instead of CONFIGURATION.MAX_EMOJI refactor: use Instance.enableVideo instead of CONFIGURATION.ENABLE_VIDEO chore: take note of remaining variables to be implemented in instance.ts chore: fix formatting feat: add hostname to Instance.ts feat: modify routes to allow access to other instances Signed-off-by: Gtoasted <git@gtoasted.de>
fix: Use instance global limits in Draft.ts because it is outside of the ClientController context refactor: Move client init from Lifecycle into Instance so that the configuration is only pulled once fix: Use instance prop for server emoji limit Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
- "Add an account" button in Settings -> My Account - "Switch Accounts" button in user context menu, if multiple accounts are stored - "Log out" button only logs out the current account, switches to next stored one if present - Account tokens stored via modified schema for 'auth' key in Auth manager - Last known name and pfp are cached, because alt accounts might not have privilege to fetch them from the API fix: Apply patches from multiuser fix: TS error caused by rebase fix: Move unused host var to multi-instance PR - Define class var at top - Remove debug lines refactor: Use new breakpoints on login screen fix: Lifecycle transitions slightly borked by PR 1197, causing random logouts fix: Separate logout wo/ delSes Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
f8be6b8 to
06cf37e
Compare
Split off from and baseline for multi-instance switching in:
Requires:
How was this PR tested?
At least a dozen furries daily-driving PR 999 for months :3
This has been briefly tested to ensure that extraction from the above didn't break it.
Screenshots & Screencasts (if appropriate)
Back button appears on auth page only when adding an additional account, not on first login. Matches styling of the light/dark mode button.

Checklist:
Please declare, if any, LLM usage involved in creating this PR
80% Raichu powered, 20% V8 Energy drink at 2 AM powered