Commit Graph

318 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
16924a5ff5 Refactor WebRTC and Webcam Feature into Vue Mixin
* Move all WebRTC and webcam-related functionality from App.vue into an
  external Vue mixin.
* Centralize the stand-alone functions videoIconClass and
  videoButtonClass into the new WebRTC mixin, which is called by
  WhoListRow and MessageBox.
2025-03-30 13:50:01 -07:00
f1d55abb66 Replace window.alert with modalAlert on Ignore Unsolicited DMs 2025-03-29 17:32:28 -07:00
927d798bc7 Video Button in MessageBox + Various Improvements
MessageBox Improvements (Card Style):

* Rearrange the buttons by the username (Send DM, Mute, Takeback) by putting the
  lesser used options into a drop-down overflow menu to make room for adding a
  Video button, to easily see someone's webcam when they are broadcasting or to
  see if you are already watching it.
    * The visible buttons now are: Send DMs, Open Video, and Overflow.
    * The Overflow menu contains: Mute, Takeback, Hide Message
    * If the user is not on video, only DMs and Overflow buttons are shown.
* Spell out the word "Translate" on the Google Translate button, as a lot of
  users were not aware of what that button did.

MessageBox Improvements (Compact style):

* The Video button is added in between the current Overflow Menu and Emojis

Other Improvements:

* On the MessageBox, when a user is offline, their display name will be crossed
  out and their avatar image is turned to grayscale.
* On your DMs List: offline users will also have grayscale avatars.
2025-03-28 21:50:47 -07:00
2268209998 Chrome drag/drop bug: skip DOM update on dragenter
On Chromium, if the DOM is updated during a dragenter event (e.g. to
display the drop zone div), the browser will immediately fire dragleave
as well which leads to a rapid flickering effect.
2025-03-27 22:21:00 -07:00
e090841b03 Profile card for previously offline users 2025-03-22 22:22:24 -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
3180d2ddf9 Gentle nudge NSFW feature
In profile cards, show a prompt to regular users to remind a user to
mark their camera as Explicit, when the camera is blue and is currently
being watched by the current user.

Under the hood, this sends a 'react' message with a msgID of -451 and
the target's username as the react message. Updated chat pages will look
for this reaction and show a nice reminder in chat, if the user's camera
is blue and they have at least 2 watchers. Old page versions at
deployment time will simply ignore these react messages.
2025-03-18 10:57:04 -07:00
b2e7f383b5 Chatbot: Avoid upvoting a negative or possibly mean emoji 2025-03-17 18:09:58 -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
ce47fc18c2 Kick modal with reason + Show logged-in date in profile card 2025-03-17 16:54:39 -07:00
f88672559d Update sort options: Sort by blue cameras 2025-03-16 13:38:48 -07:00
c6d3acb735 Tweak cooldownTTL on the preempt boot rate limiter 2025-03-12 22:32:19 -07:00
066993a68e NonExplicit Cams can not watch Explicit cams 2025-03-12 21:20:49 -07:00
8a1b609d13 Revise the NonExplicit Video Setting
For the broadcaster:

* Turning on the NonExplicit option will be mutually exclusive to the
  Explicit option: the Explicit option is unset and the checkbox
  disabled, and the Explicit button will not be usable while the
  NonExplicit setting is active.

For watchers:

* Respect the NonExplicit setting of other cams you have open while your
  own camera is marked as Explicit.
* The NonExplicit video button is \ out on the Who List and will present
  an error message that they don't want your cam to be red when watching
  theirs.
* When your cam toggles to become Explicit, close any videos you have
  open with NonExplicit broadcasters.
2025-03-12 21:11:54 -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
5f1b282c65 Remove Profile Card button to pre-emptively boot from camera 2025-03-11 21:02:08 -07:00
7dc935c6de Send site report on kick action 2025-03-09 16:33:05 -07:00
2e718e15a6 Echo: Skip messages sent by blocked usernames 2025-03-09 15:52:34 -07:00
c910e5786a Bugfix on empty echo message 2025-02-17 22:15:37 -08:00
71aa77fc7a Go mod tidy 2025-02-17 22:09:22 -08: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
e954799fc4 Bugfix on iPad display + Working Out status
* Fix a bug on iPads in landscape mode where the screen width is 1024px.
  Previously, they would fall into a weird mode in between mobile and
  desktop, where the chat panels are mobile-style (one panel instead of
  three) but the navigation buttons normally shown on mobile were not
  appearing, making the app impossible to navigate.
* Add a Working Out status option.
2025-02-06 04:43:48 +00:00
9b54fec059 Mobile Layout Updates + DM Webcam Button
Make some improvements to the mobile web layout:

* The Who List button now will always be on the top right corner of conversation
  threads, including when you are in a DM. This makes navigating easier as you
  don't need to leave your DM and return to a public channel before being able
  to access the Who List.
* In the top panel for DM threads, remove the Profile and Close buttons. Instead,
  the Close button will be on the DM itself on the Channels list.
* When you are in a DM thread, and your chat partner is on camera, their camera
  button will appear in the title bar for easy access and visibility.
* In a DM thread, clicking the username in the chat title bar will open their
  profile card.
2025-02-05 20:43:19 -08:00
e67d61a1a3 Add a Dockerfile 2025-02-02 23:27:46 -08:00
ba5fb2d48d Adjust the scam detector
* Ignore HTML tags in the message so we don't sometimes false-positive
  based on the base64-encoded image data shared in chat.
* Remove 'session' from the messenger list, it is a more obscure
  messenger and source of too many false positives.
2025-01-31 16:31:19 -08:00
200c025a78 Fix false positives with the Dark Video Detector
The Bug:

* The dark video detector on chat sometimes triggered false positives,
  and it would read a solid black screenshot from the user's camera.
* My personal repro steps would be: if I plug my USB webcam in after
  Firefox has already opened, the dark video detector would misfire and
  get a black image every time. But if I restart Firefox after the
  webcam is plugged in, it would work correctly and read screenshots off
  the camera fine.
* A couple other users ran into the false positive too, where rebooting
  their browser didn't work; it seemed either some webcam models or some
  security setting on their device may have been related.

Through Some Experimenting:

* I found a demo page online which screenshots your camera into a Canvas
  the exact same way I was doing, and it worked during the conditions
  where BareRTC would have gotten a solid black screenshot.
* Previously, BareRTC was creating the Canvas dynamically by calling
  document.createElement("canvas") and the Canvas wasn't added to the
  web page DOM.
* So I added a <canvas id="darkVideoDetector"> to the DOM and used that
  instead of creating a dynamic one.
* If the Canvas on the page were "visible" to the user, it would
  successfully screenshot my webcam into it and read it back out. But if
  the Canvas were "invisible", it would return a solid black image the
  same as the dynamically created Canvas would.
* By "invisible" I mean: if the Canvas or its container had any CSS on
  it such as display:none, visibility:hidden, opacity:0, or a
  width/height of 0px, then the Canvas would not screenshot the webcam
  and get a black image back.
* Note: even a low opacity setting like 0.1 would count the Canvas as
  being "visible" and it would work correctly.

The Fix:

* A <canvas> tag is added to the page and is wrapped in a <div> which is
  1x1 pixel in size and anchored to the bottom-right of the page,
  thereby making the canvas "visible" and able to screenshot the webcam.
2025-01-24 19:32:27 -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
1a4961e2f3 Fix wording of booted cam message to avoid ScamDetection
The word 'session' from 'your chat session' was triggering the
ScamDetection modal on ChatClient's message about booting someone off
your camera.
2025-01-03 11:29:47 -08:00
81a3567c6c Google Translate Links + Scam Warnings on Messages 2024-12-30 12:44:21 -08:00
7a25ee3091 Ban Modal + Reported Reason
Update the Ban button shown to admins in the Profile Modal:

* Now displays a modal for the admin to enter a reason and select the
  duration (1-96 hours).
* Along with the ban, the reason is posted to your main website as an
  admin report so you can log which chat admin banned which user and the
  reason given.
2024-12-25 16:19:39 -08:00
0e46d6e679 Manual takeback command for ops 2024-12-08 22:55:59 -08:00
9f64c6907b Ideal vs. Max constraints for webcams
* Set 640x480 as the ideal constraint for most users.
* But if their webcam physically can't output that resolution, allow
  them to choose the nearest up to 1280x720.
2024-12-08 17:46:50 -08:00
1b43948a9e Suppress confusing ChatServer message sent to booted admins 2024-12-04 21:27:37 -08:00
a4a04d57cd Fix speaking border on popped-out video 2024-11-17 20:39:57 -08:00
70d71611e9 Speaking detection with hark.js 2024-11-17 20:32:16 -08:00
98bf0d9e84 Fix bug in mute user modal 2024-10-27 12:29:01 -07:00
f2629ecb06 Diagnostic feature for the dark video detector 2024-10-19 13:49:29 -07:00
134f9218a8 Add webcam troubleshooting tips to the About page 2024-10-17 20:13:08 -07:00
358e8d5aec CSS fix 2024-10-04 23:32:28 -07:00
9cd6ee98a4 Tweak CSS for upvoted emoji reactions 2024-10-04 23:23:45 -07:00
671857952d CSS fix 2024-10-04 22:56:20 -07:00
96e1a6efa4 Button to show who reacted (for mobile) 2024-10-04 22:51:16 -07:00
89ae43b78a Disable right-click on video 2024-10-04 22:23:22 -07:00
9e7466f967 Disable dark video detector 2024-10-04 21:41:48 -07:00
095cf1d4ea Animate the video watermark 2024-10-04 21:39:19 -07:00