From 12f001d6f714fd3cfe21f7baa76ac17a2aac03db Mon Sep 17 00:00:00 2001 From: mandalore Date: Sun, 2 Aug 2026 17:53:02 -0500 Subject: [PATCH] feat: add name blacklist to hide players from leaderboard Adds a hidden player per request. --- src/main.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index 21d1fe9..9d64135 100644 --- a/src/main.js +++ b/src/main.js @@ -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;