mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27: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
+25
-6
@@ -53,6 +53,10 @@ const search = (params, favourites = null) => {
|
||||
};
|
||||
};
|
||||
|
||||
// one to four "#RRGGBB", spaces or commas between. the # is wanted: six
|
||||
// digits alone are a colour id
|
||||
const HEX_COLOURS = /^#[0-9a-f]{6}([\s,]+#[0-9a-f]{6}){0,3}$/i;
|
||||
|
||||
const give = body => {
|
||||
const account = accounts.byName(body.username);
|
||||
if (!account) {
|
||||
@@ -62,13 +66,28 @@ const give = body => {
|
||||
if (body.kind === "clothing") {
|
||||
const def = defpacks.itemDef(body.id);
|
||||
const colors = def ? String(def.colors).split(",") : [];
|
||||
// `color` is a raw colour id of the caller's choosing; otherwise one of
|
||||
// the item's own colours is picked by `colorIndex`.
|
||||
const custom = body.color !== undefined && body.color !== "";
|
||||
if (custom && !isUint(String(body.color))) {
|
||||
return {status: 400, body: {error: "The colour id must be a whole number from 0 to 4294967295"}};
|
||||
// `color` is a raw colour id of the caller's choosing, or one to four hex
|
||||
// colours ("#FF8800", "#FF0000 #FFFFFF") for the item's four colour bands
|
||||
// in order, the last filling the rest: a custom colour (lib/colours.js),
|
||||
// made as the animal editor's hex box makes one. otherwise one of the
|
||||
// item's own colours is picked by `colorIndex`.
|
||||
let custom = body.color !== undefined && body.color !== "" ? String(body.color).trim() : "";
|
||||
const hexes = custom.match(HEX_COLOURS) ? custom.split(/[\s,]+/).filter(Boolean) : null;
|
||||
if (hexes) {
|
||||
const rgbs = [0, 1, 2, 3].map(slot => parseInt(hexes[Math.min(slot, hexes.length - 1)].replace("#", ""), 16));
|
||||
const entry = world.makeColour(account, rgbs, session);
|
||||
if (!entry) {
|
||||
return {status: 400, body: {error: "Bad colour"}};
|
||||
}
|
||||
if (entry.full) {
|
||||
return {status: 429, body: {error: "No more new colours today. Colours made before can still be used."}};
|
||||
}
|
||||
custom = String(entry.id);
|
||||
}
|
||||
const color = custom ? String(body.color) : colors[Number(body.colorIndex) || 0];
|
||||
if (custom && !isUint(custom)) {
|
||||
return {status: 400, body: {error: "Colour: an id, or #RRGGBB"}};
|
||||
}
|
||||
const color = custom || colors[Number(body.colorIndex) || 0];
|
||||
if (!def || !defpacks.clothingIds().includes(Number(def.id)) || color === undefined) {
|
||||
return {status: 400, body: {error: "No such clothing item or colour"}};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user