Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow restricting an instance to certain rooms #283

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Zocker1999NET
Copy link

@Zocker1999NET Zocker1999NET commented Jul 27, 2023

Fixes #234

This change introduces config options, which allow to restrict which rooms the view bot is allowed to join & render messages from.

For the message preview, the implementation is quite straightforward:

  • get the room id (if having an alias)
  • check against the list of allowed rooms (if allow list is enabled)
  • do stuff the normal way if found
  • if not, return 403 to user with explanation, that the bot is not allowed to join & view this room

However, if allowlists are enabled, the UX in the room directory is not perfect. My current implementation just filters out all rooms which are not allowed. However, this may leave the user with less than 9 rooms (most probably even 0) in their search result while the user still needs to press next to search further. However, this seemed a little bit better to me than showing rooms which aren’t accessible.

To avoid this bad UX for certain use cases (most probably useful if projects self-host a small instance for themselves), I introduced a setting which hides the room directory and just redirects to the first allowed room.

I tested that all changes are doing what I intended. I also tested that, with no new settings set, the site still behaves the same.

- prevents from joining & showing not allowed rooms if enabled
- prevents from listing such rooms in room directory as well (with bad UX for now)
- helpful together with allow list
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.

Add room allowlist to configuration
1 participant