diff --git a/config.js b/config.js index 2f1d899..d344274 100644 --- a/config.js +++ b/config.js @@ -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", diff --git a/lib/chat-filter.txt b/lib/chat-filter.txt index 65988f6..b544f4c 100644 --- a/lib/chat-filter.txt +++ b/lib/chat-filter.txt @@ -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. # diff --git a/lib/chatfilter.js b/lib/chatfilter.js index 5fbbb73..aa58435 100644 --- a/lib/chatfilter.js +++ b/lib/chatfilter.js @@ -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, diff --git a/lib/manage.js b/lib/manage.js index fd9c5b5..1e702e5 100644 --- a/lib/manage.js +++ b/lib/manage.js @@ -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."}; diff --git a/lib/world.js b/lib/world.js index 1a6d3dd..b9fb7fc 100644 --- a/lib/world.js +++ b/lib/world.js @@ -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. diff --git a/swf-src/XtReplyDemuxer.as b/swf-src/XtReplyDemuxer.as index 3fb1537..c3c9763 100644 --- a/swf-src/XtReplyDemuxer.as +++ b/swf-src/XtReplyDemuxer.as @@ -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])); } diff --git a/swf/ajclient.swf b/swf/ajclient.swf index 8a7cf7b..10e0f1e 100644 Binary files a/swf/ajclient.swf and b/swf/ajclient.swf differ