feat: add name blacklist to hide players from leaderboard

Adds a hidden player per request.
This commit is contained in:
2026-08-02 17:53:30 -05:00
parent 755cffc405
commit 12f001d6f7
+12 -1
View File
@@ -48,10 +48,21 @@ const CONFIG = {
// Fallback roster if the team endpoint requires auth.
memberIds: [],
// Names to hide from the leaderboard entirely (case-insensitive).
// Match on full name ("First Last") or nickname, whichever the player goes by.
blacklistNames: ["Hidden Player"],
// Flip to true to preview the layout with placeholder rows (no network).
useSample: false,
};
const BLACKLIST = new Set(CONFIG.blacklistNames.map(n => n.trim().toLowerCase()));
function isBlacklisted(u = {}) {
const full = fullName(u).toLowerCase();
const nick = String(u.nickname || "").trim().toLowerCase();
return (full && BLACKLIST.has(full)) || (nick && BLACKLIST.has(nick));
}
const API = "https://newprod-api.bestcoastpairings.com/v1";
const HEADERS = { "client-id": "web-app", "env": "bcp", "accept": "application/json" };
const CACHE_KEY = "gg_board_v3";
@@ -279,7 +290,7 @@ function build(rows, ids) {
const kept = [];
for (const rec of rows) {
const uid = rec.userId || (rec.user && rec.user.id);
if (uid && ids.has(uid)) kept.push(rec);
if (uid && ids.has(uid) && !isBlacklisted(rec.user || {})) kept.push(rec);
}
kept.sort((a, b) => Number(b.ITCPoints || 0) - Number(a.ITCPoints || 0));
return kept;