mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 01:37: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.
|
// 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;
|
// 48: the item giver (the item finder renamed) with previews and hex colours;
|
||||||
// 49 and 50: its link to a colour picker.
|
// 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.
|
// what the official CDN is asked for; not ours to change.
|
||||||
upstreamBuildVersion: "3",
|
upstreamBuildVersion: "3",
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
# The server's chat filter (lib/chatfilter.js): typed chat, Jam-a-Gram
|
# 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
|
# messages, Jammer Wall posts and bios. A message that breaks a rule here
|
||||||
# nobody, and its sender is told it was not sent. Players cannot turn this
|
# 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
|
# off (unlike the client's own filter). It is read again when this file
|
||||||
# changes: no restart needed.
|
# changes: no restart needed.
|
||||||
#
|
#
|
||||||
|
|||||||
+2
-2
@@ -4,8 +4,8 @@ const fs = require("fs");
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
// the server's own filter for what players write to each other: typed chat,
|
// 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
|
// Jam-a-Gram messages, Jammer Wall posts and bios. unlike the chat filter in
|
||||||
// client (the player's to set, or turn off), this one cannot be turned off,
|
// 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
|
// 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,
|
// 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,
|
// "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 bans = require("./bans.js");
|
||||||
const captcha = require("./captcha.js");
|
const captcha = require("./captcha.js");
|
||||||
const chatlog = require("./chatlog.js");
|
const chatlog = require("./chatlog.js");
|
||||||
|
const chatFilter = require("./chatfilter.js");
|
||||||
const erase = require("./erase.js");
|
const erase = require("./erase.js");
|
||||||
const masterpieces = require("./masterpieces.js");
|
const masterpieces = require("./masterpieces.js");
|
||||||
const defpacks = require("./defpacks.js");
|
const defpacks = require("./defpacks.js");
|
||||||
@@ -360,6 +361,13 @@ const act = (account, body, req, from, res) => {
|
|||||||
if (bio === null) {
|
if (bio === null) {
|
||||||
return {error: `At most ${badges.MAX_BIO} characters on ${badges.MAX_BIO_LINES} lines.`};
|
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;
|
account.bio = bio;
|
||||||
accounts.save(account);
|
accounts.save(account);
|
||||||
return {ok: bio ? "Saved." : "Removed."};
|
return {ok: bio ? "Saved." : "Removed."};
|
||||||
|
|||||||
+5
-2
@@ -966,14 +966,17 @@ const playedText = seconds => {
|
|||||||
return `Played ${minutes} minute${minutes === 1 ? "" : "s"}`;
|
return `Played ${minutes} minute${minutes === 1 ? "" : "s"}`;
|
||||||
};
|
};
|
||||||
const cardBio = account => {
|
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) {
|
if (!account.playtimePublic) {
|
||||||
return account.bio;
|
return bio;
|
||||||
}
|
}
|
||||||
const session = online.get(account.username.toLowerCase());
|
const session = online.get(account.username.toLowerCase());
|
||||||
if (session) {
|
if (session) {
|
||||||
countPlaytime(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.
|
// the time since it was last counted, added to the account's playtime.
|
||||||
|
|||||||
@@ -155,8 +155,9 @@ package
|
|||||||
_loc4_ += 17;
|
_loc4_ += 17;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// A player's bio, the last field of what their card is told.
|
// 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())
|
// 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]));
|
param1.obj[7] = AJClient.filterOrNote(String(param1.obj[7]));
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in new issue
Block a user