mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
feat: chat filters cover bios
The server refuses a bio that breaks its filter and hides one saved before. The client filter now runs on your own card too.
This commit is contained in:
1 parent
89fe4d2a28
commit
80383e8dec
7 files changed
+22
-9
No files matched your search
@@ -116,7 +116,7 @@ module.exports = {
|
||||
// 41: the game's text says "Burrow" where it said Animal Jam.
|
||||
// 48: the item giver (the item finder renamed) with previews and hex colours;
|
||||
// 49 and 50: its link to a colour picker.
|
||||
buildVersion: env.AJ_BUILD_VERSION || "56",
|
||||
buildVersion: env.AJ_BUILD_VERSION || "57",
|
||||
// what the official CDN is asked for; not ours to change.
|
||||
upstreamBuildVersion: "3",
|
||||
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
# The server's chat filter (lib/chatfilter.js): typed chat, Jam-a-Gram
|
||||
# messages and Jammer Wall posts. A message that breaks a rule here reaches
|
||||
# nobody, and its sender is told it was not sent. Players cannot turn this
|
||||
# messages, Jammer Wall posts and bios. A message that breaks a rule here
|
||||
# reaches nobody, and its sender is told it was not sent (a bio is not
|
||||
# saved, and one saved before is not shown). Players cannot turn this
|
||||
# off (unlike the client's own filter). It is read again when this file
|
||||
# changes: no restart needed.
|
||||
#
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
// the server's own filter for what players write to each other: typed chat,
|
||||
// Jam-a-Gram messages and Jammer Wall posts. unlike the chat filter in the
|
||||
// client (the player's to set, or turn off), this one cannot be turned off,
|
||||
// Jam-a-Gram messages, Jammer Wall posts and bios. unlike the chat filter in
|
||||
// the client (the player's to set, or turn off), this one cannot be turned off,
|
||||
// and what it catches reaches nobody. it is meant to be narrow: slurs, and
|
||||
// sexual talk aimed at someone, never swearing as such ("fuck" is fine,
|
||||
// "i'll fuck you in the ass" is not). the rules are lib/chat-filter.txt,
|
||||
|
||||
@@ -11,6 +11,7 @@ const badges = require("./badges.js");
|
||||
const bans = require("./bans.js");
|
||||
const captcha = require("./captcha.js");
|
||||
const chatlog = require("./chatlog.js");
|
||||
const chatFilter = require("./chatfilter.js");
|
||||
const erase = require("./erase.js");
|
||||
const masterpieces = require("./masterpieces.js");
|
||||
const defpacks = require("./defpacks.js");
|
||||
@@ -360,6 +361,13 @@ const act = (account, body, req, from, res) => {
|
||||
if (bio === null) {
|
||||
return {error: `At most ${badges.MAX_BIO} characters on ${badges.MAX_BIO_LINES} lines.`};
|
||||
}
|
||||
// the server's chat filter, as for anything else players write to
|
||||
// each other (lib/chat-filter.txt).
|
||||
const rule = chatFilter.broken(bio);
|
||||
if (rule) {
|
||||
console.log(`[filter] "${account.username}" bio not saved (${rule}): ${JSON.stringify(bio)}`);
|
||||
return {error: "Your bio has words that are not allowed here."};
|
||||
}
|
||||
account.bio = bio;
|
||||
accounts.save(account);
|
||||
return {ok: bio ? "Saved." : "Removed."};
|
||||
|
||||
+5
-2
@@ -966,14 +966,17 @@ const playedText = seconds => {
|
||||
return `Played ${minutes} minute${minutes === 1 ? "" : "s"}`;
|
||||
};
|
||||
const cardBio = account => {
|
||||
// a bio from before the chat filter, or one a newer rule catches, is not
|
||||
// shown (lib/chat-filter.txt).
|
||||
const bio = account.bio && !chatFilter.broken(account.bio) ? account.bio : "";
|
||||
if (!account.playtimePublic) {
|
||||
return account.bio;
|
||||
return bio;
|
||||
}
|
||||
const session = online.get(account.username.toLowerCase());
|
||||
if (session) {
|
||||
countPlaytime(session);
|
||||
}
|
||||
return account.bio ? `${playedText(account.playtime)}\n\n${account.bio}` : playedText(account.playtime);
|
||||
return bio ? `${playedText(account.playtime)}\n\n${bio}` : playedText(account.playtime);
|
||||
};
|
||||
|
||||
// the time since it was last counted, added to the account's playtime.
|
||||
|
||||
@@ -155,8 +155,9 @@ package
|
||||
_loc4_ += 17;
|
||||
}
|
||||
}
|
||||
// A player's bio, the last field of what their card is told.
|
||||
else if(param1.obj[0] == "xbn" && param1.obj.length > 7 && String(param1.obj[2]).toLowerCase() != String(gMainFrame.server.userName).toLowerCase())
|
||||
// A player's bio, the last field of what their card is told:
|
||||
// their own too, so they see it as others do.
|
||||
else if(param1.obj[0] == "xbn" && param1.obj.length > 7)
|
||||
{
|
||||
param1.obj[7] = AJClient.filterOrNote(String(param1.obj[7]));
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user