mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09:37:50 -05:00
feat: stats graphs, playtime, ip search against ban evasion, 150-char chat
- stats graphs for the admin and moderator panels (lib/stats.js, public/stats-view.html) - playtime, private unless shown on the card's bio tab; set on the account page - search accounts by ip address, only against ban evasion; mods see no addresses and each search is logged - privacy policy for the above (terms version 2026-10-17) - the per-second save looks only at accounts in play, with a slow sweep of the rest - items in several dens at once; chat filter hides slurs and threats by default - sexual usernames refused; moderators may enter full rooms; guide login allowed - 150-character chat box (client build 55) - fixes: gifts, trades, dens, pets in dens, den recycling, special animals' colours, jammer walls, settings switches; the buddy list sent at login - the item giver, the rules screen and the art studio rework
This commit is contained in:
1 parent
8400d2f928
commit
04f468af2c
56 files changed
+25667
-3894
No files matched your search
+13
-3
@@ -12,10 +12,13 @@ const config = require("../config.js");
|
||||
// the admin panel). the lists are files, read again when they change:
|
||||
// lib/reserved-names.txt staff-like names
|
||||
// public/filter/level1.txt the chat filter's first level: slurs, threats
|
||||
// lib/sexual-names.txt sexual words, refused anywhere in a name
|
||||
// (bar the short ones marked "=", see the file)
|
||||
// and the names of the Epic Dens, which are how a showcase den is asked for.
|
||||
|
||||
const RESERVED_FILE = path.join(__dirname, "reserved-names.txt");
|
||||
const SLURS_FILE = path.join(config.publicDir, "filter", "level1.txt");
|
||||
const SEXUAL_FILE = path.join(__dirname, "sexual-names.txt");
|
||||
const DIGITS = {0: "o", 1: "i", 3: "e", 4: "a", 5: "s", 7: "t"};
|
||||
|
||||
// A word as it is compared: small letters, digits at either end dropped
|
||||
@@ -28,7 +31,9 @@ const plain = word => word.toLowerCase().replace(/^\d+|\d+$/g, "").replace(/\d/g
|
||||
const squash = word => word.replace(/(.)\1+/g, "$1");
|
||||
const stretched = word => /(.)\1\1/.test(word);
|
||||
|
||||
// the entries of a list file: [{text, prefix}], text made plain as above.
|
||||
// the entries of a list file: [{text, prefix, word}], text made plain as
|
||||
// above. "word" is for a line marked "=": in lib/sexual-names.txt the rest
|
||||
// are matched anywhere in a name.
|
||||
const lists = new Map(); // file -> {mtime, entries}
|
||||
const read = file => {
|
||||
let mtime = 0;
|
||||
@@ -43,7 +48,8 @@ const read = file => {
|
||||
return kept.entries;
|
||||
}
|
||||
const entries = fs.readFileSync(file, "utf8").split(/\r?\n/).map(line => line.trim()).filter(line => line && !line.startsWith("#"))
|
||||
.map(line => ({text: line.replace(/\*$/, "").split(/\s+/).map(plain).join(""), prefix: line.endsWith("*")})).filter(entry => entry.text.length >= 2);
|
||||
.map(line => ({text: line.replace(/^=/, "").replace(/\*$/, "").split(/\s+/).map(plain).join(""), prefix: line.endsWith("*"), word: line.startsWith("=")}))
|
||||
.filter(entry => entry.text.length >= 2);
|
||||
lists.set(file, {mtime, entries});
|
||||
return entries;
|
||||
};
|
||||
@@ -71,7 +77,11 @@ const refused = username => {
|
||||
const same = (word, entry) => word === entry.text || (entry.prefix && word.startsWith(entry.text))
|
||||
|| (stretched(word) && (squash(word) === squash(entry.text) || (entry.prefix && squash(word).startsWith(squash(entry.text)))));
|
||||
const hit = entry => same(whole, entry) || words.some(word => same(word, entry));
|
||||
return read(RESERVED_FILE).some(hit) || read(SLURS_FILE).some(hit) || denNames().includes(whole);
|
||||
// anywhere in the name, with a letter drawn out three times or more read
|
||||
// as two and as one ("booooobs"; "Bobbby" is not "boob").
|
||||
const drawnOut = [whole, whole.replace(/(.)\1{2,}/g, "$1$1"), whole.replace(/(.)\1{2,}/g, "$1")];
|
||||
const inside = entry => (entry.word ? hit(entry) : drawnOut.some(form => form.includes(entry.text)));
|
||||
return read(RESERVED_FILE).some(hit) || read(SLURS_FILE).some(hit) || read(SEXUAL_FILE).some(inside) || denNames().includes(whole);
|
||||
};
|
||||
|
||||
module.exports = {refused, plain};
|
||||
Reference in new issue
Block a user