feat: Switch between multiple accounts & self-hosted backends#999
feat: Switch between multiple accounts & self-hosted backends#999Pecacheu wants to merge 33 commits intostoatchat:mainfrom
Conversation
|
I'm currently working on a similar feature, but instead of making an account switcher, I'm trying to make adding servers from other instances to the sidebar possible. I've done some preliminary work here, but I'm still far from finished. I've actually been struggling to come up with a good way of managing things like user settings that are instance-specific but not server-specific, so maybe we can coordinate to make both features work together. |
Interesting- I could see both of those features working together, yes. I think the way I'm handling swapping between user tokens could be extended to apply to other stored user settings too. |
d14c2fb to
ab62f3b
Compare
|
Aight so @Gtoasted is now using an API call to fetch all the other endpoint URLs, so I can make a big improvement here UI-wise. Still experimenting with how to redirect all navigation though. |
|
Eureka, it actually works now! (Mostly) |
True. I was inspired by the collapsable UI found in some other login screens, but the text would probably fit much better inside a modal in this case. I'll give that a go.
I like the proxy wording and used that, but personally I think the "on-prem" wording feels a bit too corporate. Not that we can't acknowledge corporate use, it is definitely a common use-case for on-premise hosting, I just feel it shouldn't be worded as if that's the only people who use it, confusing some poor guy just trying to sign into some self-hosted Minecraft server chat instance. How about something like:
It's also still a good idea to have some sort of content hosting warning like above. It disavows any liability to certain types of content (you know which kind I mean) being discovered on some mega-creep's instance. #notalawyer but my pleb understanding is that in many jurisdictions, a clear warning needs to be shown to the user for this type of thing, i.e. a notice buried in some license policy doesn't count, it has to be something you click "OK" or "Accept" to. (Then again, clearly the "Here's a link to this 500 page ToS you obviously won't read, do you accept?" approach counts.) But please do reword it, again not an expert. |
|
Known issue: There seems to be some overriding behavior happening with the settings stores- They write to the correct instance's store, but read still seems to pull from the base store. I suspect that the keys are being overwritten during the hydration phase. |
- "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 privalage to fetch them from the API Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
- Currently does nothing, but it looks cool don't it? - Fix auth flow adjusting to screen width on mobile Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
The purpose of this context is to hold information about a single instance of stoat (information that is currently stored in global configuration) Signed-off-by: Gtoasted <git@gtoasted.de>
Signed-off-by: Gtoasted <git@gtoasted.de>
Signed-off-by: Gtoasted <git@gtoasted.de>
…A_URL Signed-off-by: Gtoasted <git@gtoasted.de>
…Y_URL Signed-off-by: Gtoasted <git@gtoasted.de>
…BOX_URL Signed-off-by: Gtoasted <git@gtoasted.de>
Signed-off-by: Gtoasted <git@gtoasted.de>
…TCHA_SITEKEY Signed-off-by: Gtoasted <git@gtoasted.de>
Signed-off-by: Gtoasted <git@gtoasted.de>
Signed-off-by: Gtoasted <git@gtoasted.de>
Signed-off-by: Gtoasted <git@gtoasted.de>
Signed-off-by: Gtoasted <git@gtoasted.de>
Signed-off-by: Gtoasted <git@gtoasted.de>
Signed-off-by: Gtoasted <git@gtoasted.de>
- Added InstanceManager to allow switching instances in the same context - Advanced fields at login now change out the instance, but this data is not yet stored on refresh Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
- Fix smDown in wrong place in FlowBase - Change route from /instance/ to /i/ to keep links shorter sonce it will be prepended to everything - Rename hostname to host because it could also contain a port number - Add navigate and setNext to instance Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
- Also add a back button to the auth page that only appears when in "add an account" mode and not on first login Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
- Relative path is redirected to instance-specific path - Remove unused Instance.navigate, add relPath and switchTo - Async API endpoint fetch, currently showing any error in alert() prompt because modals don't work at root level - Use Dynamic element to force reload of context when instance changes Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
- All links now use `https://stoat.chat/i/host` prefix, allowing easy and uniform detection when cross-posting links- Eg. clicking a link from another instance redirects client to that instance. - instance.href method now generates full URL by default - Use instance.href instead of location.origin to ensure consistency in app hosted on different domain to the instance's API domain Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
- Add global stores and make 'auth' store global - Store host param in session data - Auto-switch instance if current session doesn't match - Replace "Advanced" dropdown with modal - Delete session on "OK" if invalid session error - Fix buttons not highlighting in Home sidebar on alt instance Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
- Support cross-instance channel/server/invite links (Builds on work in stoatchat#1037) - Auto-redirect to appropriate instance as needed, logging into most recent saved account on instance - Fix regex for paramsFromPathname to support instance prefix - Fix annoying draft console logging Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
…astActivePath to get set to wrong value - Fix non-reactivity warn on app routes - Improve error handling and display during login/auth flows Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
|
hey @Pecacheu are there any issues here that need resolving? |
There is the one known issue above, tho it might be hard to solve without being familiar with the code already. I was planning to address it next time I have some time to work on Stoat stuff. Overall though this is looking pretty solid/stable, it has come a long way. You can always help by simply testing it out and seeing if you run into any other issues, though! |




Related Discussions
https://github.com/orgs/stoatchat/discussions/1073#discussioncomment-15783714
https://github.com/orgs/stoatchat/discussions/1310
stoatchat/self-hosted#141
stoatchat/for-desktop#43
stoatchat/for-desktop#55
#851
Current UI concept
Test live at https://forestfire.net:420
Feel free to give it a test if you've got a self-hosted instance and let me know how it goes!