Commit Graph

100 Commits

Author SHA1 Message Date
3145dde107 Invite to watch my webcam
* Add a feature where a webcam broadcaster may manually invite others on
  chat to watch, even if normally the other person would not be allowed.
  For example, it will bypass the mutual webcam requirement setting and
  allow the invited user to watch even if their own camera is not on.
* The button appears in Profile Modals and in the overflow menu on the
  MessageBox component.
2025-03-30 15:33:58 -07:00
09da9fa23d Don't send WhoList within 15 seconds of server start
To help alleviate rocky chat server reboots, WhoList messages will be
withheld in the first 15 seconds from server start.

When a lot of chatters were online during a reboot (e.g. 50 or more),
they would all try and reconnect after 5 seconds and each login was
broadcasting Who List updates to everybody else logged in. With the
surge of logins in a short time, these WhoList messages would fill up
the buffers of each recipient, kicking them offline for being too slow
to keep up with messages; only for that recipient to reconnect again.
The average user may have experienced 2 or 3 disconnects when the chat
server reboots.

To help alleviate the spam of messages being sent out:

* Presence messages are withheld for the first 30 seconds ("has joined
  the room" notifications)
* Now, WhoList messages are withheld for the first 15 seconds.

After 16 seconds of uptime, the server will send a WhoList to everybody
currently online to catch them up.

To accommodate this, the front-end will show a spinner and say "Waiting
for Who List..." when the page is connected but no WhoList has been
received yet. Under normal operation, this spinner won't be visible
beyond a brief moment as a WhoList is normally sent upon joining the
chat.
2025-03-21 20:49:26 -07:00
23a73620b9 Switch to mattn/go-sqlite3
Instead of the pure Go implementation of SQLite, swap in the cgo library
from mattn/go-sqlite3. On local testing this cuts the SQL query times in
half for the History modal (from 400ms per page to 150ms) and may
improve performance in production.
2025-03-17 17:58:03 -07:00
89dd40f77f Refactor SQL query for DMs History modal
The ORDER BY timestamp on the DMs Username History endpoint was causing
SQLite to do a full table scan by timestamp instead of indexing on
channel ID. So, instead, we fetch the distinct channel IDs for the
current user and add them to an IN clause on the main query (instead of
a LIKE clause), which causes the index to use the channel_id instead of
timestamp. This may improve CPU performance and speed on this endpoint.
2025-03-17 17:38:37 -07:00
df4dd6a2b3 Rate limit pre-emptive boots of users not even watching your cam 2025-03-12 19:21:32 -07:00
3ddb321bf4 Safety for the operator-only hidden status 2025-03-11 21:31:40 -07:00
2e718e15a6 Echo: Skip messages sent by blocked usernames 2025-03-09 15:52:34 -07:00
885adda156 Echo Public Channel Messages
Add a feature where recent public channel messages can be echoed back to
newly joining users when they enter the chat room.

* Configure in settings.toml with EchoMessagesOnJoin. 0 = disable storage.
* Messages are stored in RAM and lost on a server reboot.
* A buffer of recent public messages per channel can be kept, e.g. for the
  10 most recent messages.
* The settings can be reloaded with /reconfigure and the message buffers
  will rebalance on the next message sent.
* When a new user logs in, a new "echo" message is sent that contains all
  of the echoed messages on a "messages" list, in one WebSocket packet.
* Echoed messages are put above the ChatServer welcome messages.
* If a message is taken back, it's removed from the echo message buffer.

Other Changes

* Don't broadcast Presence messages within 30 seconds of the server boot, to
  lessen a flood of messages when a lot of users were connected at reboot.
* Change the default "Join messages" setting on front-end to hide them in
  public channels.
* For the admin buttons in ProfileModal, use the AlertModal instead of native
  browser prompts.
2025-02-17 22:08:25 -08:00
859e9dee5b Send admin reports on /nsfw command + Fixes
* On the /nsfw command, BareRTC will issue an admin report to your main website
  so you have visibility into when this command is used.
* On the server side, fix the "Open" command so it will prevent webcams from
  connecting if the offerer had been Booted by the answerer, in addition to the
  previous blocks about Mute and Block. Admin users can still connect always.
* Add a debug command `/watch username` to manually open somebody's camera on
  chat. Note: the chat server enforces the permission to actually do so.
* Remove the /debug-dangerous-force-deadlock admin command.
2025-02-17 12:50:06 -08:00
74a756d1ef History Modal + Dark Detector Fixes
* Add a History button under the DMs where an authenticated JWT user can page
  through the usernames they have stored history with, to bring up those DMs
  even if their chat partner is not currently online.
* Try some fixes to the dark video detector to see if it reduces false
  positives: wait for the canplaythrough video event to fire before beginning
  the dark detection. Also, increase the threshold so dark frames need to be
  seen 5 times in a row instead of twice before cutting the camera.
2025-02-14 18:12:39 -08:00
7021c56045 Moderator rule: nodvd (exempt from dark video detector)
Some users had reported the dark video detector errors out on their
camera, reading a solid black image and average color of 0 despite their
camera actually being bright and colorful.

This case seems rare, but the nodvd moderation rule can lift the feature
for specific affected users while keeping it in place for everyone else.
2025-01-03 23:15:05 -08:00
134f9218a8 Add webcam troubleshooting tips to the About page 2024-10-17 20:13:08 -07:00
971a6d800d Customizable error strings for moderation rules 2024-09-20 20:33:42 -07:00
16b148fc92 JWT Token Chat Moderation Rules
Add support for your website to apply chat moderation rules to users
as they log onto the chat room.
2024-09-19 17:29:08 -07:00
d4b69311ae Blockable admin user support 2024-09-10 14:50:47 -07:00
147315fee2 Video z-index workaround for Safari
When the Safari browser puts a webcam video full-screen and then
returns, the z-index of the video was higher than the buttons and
controls normally overlaid on top of it.

Add a z-index:1 to the video controls to keep them on top after
returning from full screen. Similar: for popped-out draggable videos,
adding a z-index:1 allows the video to correctly sit on top of docked
videos without the docked video controls (zi:1) rendering above the
popped-out video when you overlap them.

Note: the z-index:1 is applied to popped-out and video controls, any
other combination (e.g. 1 for popped-out and 2 for controls) caused
controls of docked videos to render on top of popped-out ones when they
overlapped.
2024-06-13 14:28:29 -07:00
9c77bdb62e New Op commands and fixes with blocking admin users
Add moderation rules:

* You can apply rules in the settings.toml to enforce moderator restrictions on
  certain users, e.g. to force their camera to always be NSFW or bar them from
  sharing their webcam at all anymore.

Chat UI improvements around users blocking admin accounts:

* When a main website block is in place, the DMs button in the Who List shows
  as greyed out with a cross through, as if that user had closed their DMs.
* Admin users are always able to watch the camera of people who have blocked
  them. The broadcaster is not notified about the watch.

New operator commands:

* /cut username: to tell a user to turn off their webcam.
* /unmute-all: to lift all mutes on your side, e.g. so your moderator chatbot
  can still see public messages from users who have blocked it.
* /help-advanced: moved the more dangerous admin command documentation here.

Miscellaneous fixes:

* The admin commands now tolerate an @ prefix in front of usernames.
* The /nsfw command won't fire unless the user's camera is actually active and
  not marked as explicit.
2024-05-17 17:15:48 -07:00
747f4fd5d4 Let channels configure whether to permit photos 2024-05-13 18:51:54 -07:00
3424be2f4d Clear DMs history button 2024-04-11 23:28:35 -07:00
f0dd1d952c Direct Message History
* Add support for storing DM history between users in a SQLite3 database.
* Opt-in by editing your settings.toml to set DirectMessageHistory/Enabled=true
* Retention days (default 90) will flush old DMs on app startup.
* On the front-end, DM history is checked when a DM thread is opened.
2024-03-29 17:48:01 -07:00
96d61614f4 Add DisconnectNow API endpoint 2024-03-15 15:59:42 -07:00
e74f7297e6 Include DM context in reported messages 2024-01-20 15:17:02 -08:00
f75ad32728 Ban command update, join/leave messages
* The /ban command doesn't require the target user to be online at the
  time of the ban.
* Update the presence messages so they will generally only go to the
  primary (first) public channel, and also to another public channel if
  the user is currently looking at one of the others.
2023-12-16 15:10:48 -08:00
0e0aac991d Polling API for the chat room 2023-12-10 18:43:18 -08:00
00c6015148 Server-side IsVideoNotAllowed validation checks 2023-12-10 15:31:47 -08:00
c3808bbe89 Fix a null pointer exception if a DM partner goes offline 2023-12-03 21:46:14 -08:00
2cf4e5cc27 Logging bugfix 2023-11-25 18:36:38 -08:00
deb3bb616b Fix webcam freezing issues with mutualOpen video connections 2023-11-18 15:38:02 -08:00
356d2ddfa8 Null pointer exception fixes 2023-11-11 15:16:17 -08:00
f0a6585af1 Bump config version 2023-11-11 15:06:17 -08:00
1e702b0e1e Add channel logging feature 2023-11-11 14:59:49 -08:00
2ac3e8e128 Fix graceful disconnect commands from the server 2023-10-23 19:05:02 -07:00
fea1d1c7b9 Prefers non-explicit and option to expressly remember closed videos 2023-10-14 12:24:30 -07:00
bdb5e6359b Various fixes and improvements
* Re-set user's status if they disconnect and reconnect
* Remove "(offline)" text next to ChatServer/ChatClient messages
* Make names and pictures in presence messages clickable to open profile
  cards
2023-10-14 11:01:58 -07:00
7373882abf Profile Modals + Misc Features
* Add profile modal popups and Webhook support to get more detailed user
  info from your website.
* Add "unboot" command, available in the profile modal.
2023-10-07 13:22:41 -07:00
2810169ce9 Volume sliders, fullscreen video, misc tweaks 2023-10-05 18:59:49 -07:00
15b291826e Make WebSocketSendTimeout configurable 2023-09-30 12:46:45 -07:00
a1b0d2e965 Blocklist improvements + WebSocket timeout tweak 2023-09-30 12:32:09 -07:00
4b971fcf41 Server side filtering 2023-09-29 19:10:34 -07:00
d01bae9966 Bugfix on booted cams 2023-09-12 20:03:10 -07:00
cbfbcd768f Chat Setting Menu + Various Tweaks
* In place of the Help and Settings buttons, add a hamburger menu
  dropdown and place the links under there.
* Also in the dropdown is Close All Cameras and Mute All Cameras (if you
  have any cams open; the links are hidden if not)
* Also in the dropdown add a Logout button that just links to a new
  /logout route in order to unload the page and align with some users'
  expectations (not knowing closing out of the chat page was enough to
  log out of the room before)
* Bring back "(offline)" indicators when a user is no longer in the
  room.
2023-09-08 18:46:36 -07:00
d8c92800f3 Fixes for admins, VIP and blocking + Frontend tweaks
Changes to the chat server:
* Blocking will not apply to admin user accounts (operators)
* Users who block an admin will instead mute them, but the admin can
  still DM them if required
* Messages to VIP channels are broadcast to admins even if they are not
  VIPs, e.g. so moderator chatbots can see
* On the Who List: VIP-only cameras to highlight with the VIP background
  color on those buttons
2023-09-07 19:43:03 -07:00
e728644a77 Port front-end over to Vue CLI (create-vue)
This commit makes an initial port of the front-end over to a proper Vue
CLI application. It seems to work from surface level testing.

Changes made:

* Rename web/static to public/static to place it into the Vue build path
  * Notes: web/static/js/BareRTC.js and web/templates/chat.html are now
    deprecated
* Rename web/static/js/sounds.js into src/lib/sounds.js making it a
  proper JavaScript module with exports.
* Fill out initial src/App.vue by copying and updating
  web/templates/chat.html and web/static/js/BareRTC.js into this module.
2023-09-06 17:15:02 -07:00
a7342988ba Null exception fix 2023-09-05 14:09:07 -07:00
7ffa6b4dbd More thorough blocking behavior 2023-09-05 13:57:11 -07:00
940f14e2d6 VIP-only chat channels 2023-09-03 12:48:21 -07:00
6e2aa517f5 Support for VIP users via JWT Auth 2023-09-03 12:08:23 -07:00
0acb729175 Update admin icon from gavel to peace 2023-08-30 13:31:21 -07:00
fd82a463f3 Deadlock detection, DND, and Frontend Fixes
* Deadlock detection: the chatbot handlers will spin off a background goroutine
  to ping DMs at itself and test for responsiveness. If the echoes don't return
  for a minute, issue a /api/shutdown command to the HTTP server to force a
  reboot.
* New admin API endpoint: /api/shutdown, equivalent to the operator '/shutdown'
  command sent in chat. Requires your AdminAPIKey to call it. Used by the chatbot
  as part of deadlock detection.
* Adjust some uses of mutexes to hopefully mitigate deadlocks a bit.
* Do Not Disturb: if users opt to "Ignore unsolicited DMs" they will set a DND
  status on the server which will grey-out their DM icon for other chatters.
* Bring back an option for ChatServer to notify you when somebody begins watching
  your camera (on by default).
* Automatically focus the message entry box when changing channels.
* Lower webcam resolution hints to 480p to test performance implications.
2023-08-29 15:54:40 -07:00
b5429226d6 A muted admin user can still DM you 2023-08-13 22:59:35 -07:00