mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09: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
@@ -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."};
|
||||
|
||||
Reference in new issue
Block a user