Skip to content

feat: Multi-account switching & self-hosted/on-premise instances#999

Open
Pecacheu wants to merge 7 commits into
stoatchat:mainfrom
Pecacheu:multiuser
Open

feat: Multi-account switching & self-hosted/on-premise instances#999
Pecacheu wants to merge 7 commits into
stoatchat:mainfrom
Pecacheu:multiuser

Conversation

@Pecacheu Pecacheu changed the title feat: Switch between multiple users & self-hosted backends feat: Switch between multiple accounts & self-hosted backends Mar 6, 2026
@Gtoasted

Gtoasted commented Mar 7, 2026

Copy link
Copy Markdown

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.

@Pecacheu

Pecacheu commented Mar 7, 2026

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot force-pushed the multiuser branch 2 times, most recently from d14c2fb to ab62f3b Compare March 7, 2026 03:28
@Pecacheu

Pecacheu commented Mar 13, 2026

Copy link
Copy Markdown
Contributor Author

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.

Old vs new:

Still experimenting with how to redirect all navigation though.

@Pecacheu

Pecacheu commented Mar 15, 2026

Copy link
Copy Markdown
Contributor Author

Eureka, it actually works now! (Mostly)

@insertish

Copy link
Copy Markdown
Member

This looks promising, I would update the wording to match:
image

This should also be accessible as a dialog/modal from a button, I'd say in the footer, rather than chucking it into the form (this also makes it look weird).

@Pecacheu

Pecacheu commented Mar 21, 2026

Copy link
Copy Markdown
Contributor Author

This should also be accessible as a dialog/modal from a button, I'd say in the footer, rather than chucking it into the form (this also makes it look weird).

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.

This looks promising, I would update the wording to match

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:

Use this option to connect to a self-hosted on-premise instance. This is useful for private communities or access-controlled corporate environments.

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.

@Pecacheu

Copy link
Copy Markdown
Contributor Author

This is pretty much ready and mostly tested now (though more testing is def appreciated!) so I'll go ahead and take it out of draft.

Also here is what the advanced options look like now as a modal:

@Pecacheu Pecacheu marked this pull request as ready for review March 31, 2026 18:26
@Pecacheu Pecacheu requested review from a team as code owners March 31, 2026 18:26
@Pecacheu

Pecacheu commented Apr 5, 2026

Copy link
Copy Markdown
Contributor Author

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.

@Taureon

Taureon commented Apr 16, 2026

Copy link
Copy Markdown

hey @Pecacheu are there any issues here that need resolving?
i wanna check if i can help here

@Pecacheu

Pecacheu commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

hey @Pecacheu are there any issues here that need resolving? i wanna check if i can help here

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!

@Pecacheu Pecacheu changed the title feat: Switch between multiple accounts & self-hosted backends feat: Multi-account switching & self-hosted/on-premise instances Apr 24, 2026
@Pecacheu Pecacheu force-pushed the multiuser branch 2 times, most recently from 95a24fd to d4087e9 Compare May 8, 2026 07:40
@Pecacheu Pecacheu force-pushed the multiuser branch 2 times, most recently from a9bf347 to 11d5672 Compare May 21, 2026 01:59
@chrishultin chrishultin added the ux review This needs UX review label Jun 6, 2026
@Pecacheu Pecacheu force-pushed the multiuser branch 4 times, most recently from efb9bd1 to 72b90d4 Compare June 20, 2026 17:23
@Pecacheu Pecacheu force-pushed the multiuser branch 3 times, most recently from def0316 to 73391dd Compare June 22, 2026 01:41
Dadadah added 2 commits June 21, 2026 21:37
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Gtoasted and others added 5 commits July 2, 2026 11:14
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>
fix: Makin the fields actually work

feat: Prep for instance param in URL
- Fix smDown in wrong place in FlowBase
- Change route from /instance/ to /i/ to keep links shorter since it will be prepended to everything
- Rename hostname to host because it could also contain a port number
- Add navigate and setNext to instance

fix: Show progress wheel instead of auth page while switching accounts
- Also add a back button to the auth page that only appears when in "add an account" mode and not on first login

revert: Undo committed temp change
fix: Undefined error in state index

fix: Working redirects
- 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

fix: "Copy link" option supports self-hosted instances
- 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

fix: Formatting. Just prettier being a bit silly
fix: Normalize import order in changed files
fix: "Message" option in context menu broken on alternate instances

fix: Fixes for alt instances
- 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

fix: We shall unite all as one!
- Support cross-instance channel/server/invite links (Builds on work in PR 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

chore: Fix anchor imports to prevent merge conflict

fix: Switching to user on another instance while in a server causes lastActivePath to get set to wrong value
- Fix non-reactivity warn on app routes
- Improve error handling and display during login/auth flows

fix: Pull more info from API
- Pull enableVideo and maxAttachments from API so they update when swapping instance
- Remove unused CONFIGURATION vars
- Move snackbar provider to root
- Switch auth error from alert diag to snackbar

fix: Use instance in ServerRoleEditor

fix: Alternate settings db per-user instead of only per-instance
- Fix global db overriding local db at per-key-level instead of store-level

fix: Update for rebase
refactor: Updates for feat/apiroute
fix: Better connection error
fix: Cross-instance re-login & remote link click issues

Signed-off-by: Pecacheu <3608878+Pecacheu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ux review This needs UX review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants