From 230098f94958e53f6f9e7414b91104d62a58b86f Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Wed, 30 Aug 2023 18:14:49 -0700 Subject: [PATCH] Walk of shame for promoting spammy links in chat --- client/brain/public_keywords.rive | 6 ++++ web/static/js/BareRTC.js | 48 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/client/brain/public_keywords.rive b/client/brain/public_keywords.rive index 96846c6..33d3a97 100644 --- a/client/brain/public_keywords.rive +++ b/client/brain/public_keywords.rive @@ -22,6 +22,12 @@ - react 👀{weight=1} - {weight=3} + // Report messages of shame to the site admin. + + * am now being kicked from the room in shame * + - react 🫡 + ^ report "User has invoked the message of shame and said:" + ^ Later, loser! + // Catch-all: do not reply. + * - diff --git a/web/static/js/BareRTC.js b/web/static/js/BareRTC.js index 178dceb..3618a09 100644 --- a/web/static/js/BareRTC.js +++ b/web/static/js/BareRTC.js @@ -44,6 +44,9 @@ const app = Vue.createApp({ disconnectLimit: 3, disconnectCount: 0, + // Temp: spam counting for OF links + spamWarningCount: 0, + // Website configuration provided by chat.html template. config: { channels: PublicChannels, @@ -629,6 +632,51 @@ const app = Vue.createApp({ return; } + // Spammy links. + if (this.message.toLowerCase().indexOf("onlyfans.com") > -1 || + this.message.toLowerCase().indexOf("justfor.fans") > -1 || + this.message.toLowerCase().indexOf("justforfans") > -1 || + this.message.toLowerCase().match(/fans[^A-Za-z0-9]+dot/)) { + + // If they do it twice, kick them from the room. + if (this.spamWarningCount >= 1) { + // Walk of shame. + this.ws.conn.send(JSON.stringify({ + action: "message", + channel: "lobby", + message: "**(Message of Shame)** I have been naughty and posted spam in chat despite being warned, "+ + "and I am now being kicked from the room in shame. ☹️", + })); + + this.ChatServer( + "It is not allowed to promote your Onlyfans (or similar) "+ + "site on the chat room. You have been removed from the chat room, and this "+ + "incident has been reported to the site admin.", + ); + this.pushHistory({ + channel: this.channel, + username: this.username, + message: "has been kicked from the room!", + action: "presence", + }); + this.disconnect = true; + this.ws.connected = false; + setTimeout(() => { + this.ws.conn.close(); + }, 1000); + return; + } + this.spamWarningCount++; + + this.ChatClient( + "Please do not send links to your Onlyfans (or similar sites) in the chat room. "+ + "Those links are widely regarded to be spam and make a lot of people uncomfortable. "+ + "If you violate this again, your account will be suspended.", + ); + this.message = ""; + return; + } + // DEBUGGING: fake set the freeze indicator. let match = this.message.match(/^\/freeze (.+?)$/i); if (match) {