This commit is contained in:
Clippii
2026-06-29 00:03:21 +01:00
parent 88d6bbe68b
commit 2885dbed19
2 changed files with 48 additions and 13 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

+48 -13
View File
@@ -69,7 +69,13 @@ const missingStaticDataPaths = new Set()
const turnstileRequiredEvent = 'tssbot:turnstile-required' const turnstileRequiredEvent = 'tssbot:turnstile-required'
const BLOCKED_PLAYER_UIDS = new Set(['165569402', '86157459', '33536334', '41808996', '3651161']) const BLOCKED_PLAYER_UIDS = new Set(['165569402', '86157459', '33536334', '41808996', '3651161'])
const BLOCKED_TEAM_NAMES = new Set(['TPC']) const BLOCKED_TEAM_NAMES = new Set()
const TEAM_DISPLAY_NAMES = new Map([
['TPC', 'They Prefer Children'],
])
const TEAM_LOOKUP_NAMES = new Map([
['they prefer children', 'TPC'],
])
const blogPostFiles = import.meta.glob('./blog/posts/*.md', { const blogPostFiles = import.meta.glob('./blog/posts/*.md', {
eager: true, eager: true,
import: 'default', import: 'default',
@@ -150,8 +156,14 @@ const publicDataSources = {
players: dataSource(apiEndpoints.players, staticDataPath('leaderboard-players.json')), players: dataSource(apiEndpoints.players, staticDataPath('leaderboard-players.json')),
homeTeams: dataSource(apiEndpoints.homeTeams, staticDataPath('home-teams.json')), homeTeams: dataSource(apiEndpoints.homeTeams, staticDataPath('home-teams.json')),
recentGames: dataSource(apiEndpoints.recentGames, staticDataPath('recent-games.json')), recentGames: dataSource(apiEndpoints.recentGames, staticDataPath('recent-games.json')),
detail: (name) => dataSource(apiEndpoints.detail(name), staticDataPath('teams', `${staticDataKey(name)}.json`)), detail: (name) => {
games: (name) => dataSource(apiEndpoints.games(name), staticDataPath('teams', `${staticDataKey(name)}.games.json`)), const lookupName = normalizeTeamLookupName(name)
return dataSource(apiEndpoints.detail(lookupName), staticDataPath('teams', `${staticDataKey(lookupName)}.json`))
},
games: (name) => {
const lookupName = normalizeTeamLookupName(name)
return dataSource(apiEndpoints.games(lookupName), staticDataPath('teams', `${staticDataKey(lookupName)}.games.json`))
},
player: (uid) => dataSource(apiEndpoints.player(uid), staticDataPath('players', `${staticDataKey(uid)}.json`)), player: (uid) => dataSource(apiEndpoints.player(uid), staticDataPath('players', `${staticDataKey(uid)}.json`)),
game: (gameId) => dataSource(apiEndpoints.game(gameId), staticDataPath('games', `${staticDataKey(gameId)}.json`)), game: (gameId) => dataSource(apiEndpoints.game(gameId), staticDataPath('games', `${staticDataKey(gameId)}.json`)),
gameLogs: (gameId) => dataSource(apiEndpoints.gameLogs(gameId), staticDataPath('games', `${staticDataKey(gameId)}.logs.json`)), gameLogs: (gameId) => dataSource(apiEndpoints.gameLogs(gameId), staticDataPath('games', `${staticDataKey(gameId)}.logs.json`)),
@@ -382,7 +394,8 @@ function gameParticipants(game) {
} }
function displayTeamName(value) { function displayTeamName(value) {
return String(value || '').trim() const name = String(value || '').trim()
return TEAM_DISPLAY_NAMES.get(name) || name
} }
function ParticipantNames({ participants, spread = false }) { function ParticipantNames({ participants, spread = false }) {
@@ -428,13 +441,22 @@ function ParticipantNames({ participants, spread = false }) {
} }
function bestTeamName(team) { function bestTeamName(team) {
return team?.name || '' return displayTeamName(team?.name)
}
function sourceTeamName(team) {
return String(team?.name || '').trim()
} }
function searchKey(value) { function searchKey(value) {
return String(value || '').trim().toLocaleLowerCase() return String(value || '').trim().toLocaleLowerCase()
} }
function normalizeTeamLookupName(value) {
const name = String(value || '').trim()
return TEAM_LOOKUP_NAMES.get(searchKey(name)) || name
}
function teamSearchResult(team) { function teamSearchResult(team) {
const name = bestTeamName(team) const name = bestTeamName(team)
return { return {
@@ -489,7 +511,7 @@ function teamDetailLooksReal(detail) {
} }
function canonicalTeamName(detail, fallback = '') { function canonicalTeamName(detail, fallback = '') {
return detail?.name || fallback return displayTeamName(detail?.name || fallback)
} }
function normalizeAnalyticsPreferences(value) { function normalizeAnalyticsPreferences(value) {
@@ -2058,7 +2080,7 @@ function AppContent() {
return return
} }
const resolved = await fetchJson(apiEndpoints.resolve(name)) const resolved = await fetchJson(apiEndpoints.resolve(normalizeTeamLookupName(name)))
const resolvedName = resolved.name const resolvedName = resolved.name
if (!resolvedName) throw new Error('Team not found') if (!resolvedName) throw new Error('Team not found')
@@ -2696,11 +2718,19 @@ function PlayerStatCard({ label, value }) {
) )
} }
function BlockedPage({ onBack }) { function BlockedPage({ imageAlt = '', imageSrc = '', onBack }) {
return ( return (
<section className="mx-auto max-w-4xl pb-12 pt-24 sm:pt-28"> <section className="mx-auto max-w-4xl pb-12 pt-24 sm:pt-28">
<div className="mt-8 rounded-xl border border-border bg-fury-white p-10 text-center"> <div className="mt-8 rounded-xl border border-border bg-fury-white p-10 text-center">
<p className="text-7xl">🤡🤡🤡🤡</p> {imageSrc ? (
<img
alt={imageAlt}
className="mx-auto max-h-[520px] w-full max-w-2xl rounded-lg object-contain"
src={imageSrc}
/>
) : (
<p className="text-7xl">🤡🤡🤡🤡</p>
)}
<p className="mt-4 text-text-soft">user affiliated with pedophiles, blocked~</p> <p className="mt-4 text-text-soft">user affiliated with pedophiles, blocked~</p>
{onBack ? ( {onBack ? (
<button <button
@@ -2746,7 +2776,11 @@ function PlayerPage({ uid, navigate }) {
if (status === 'blocked') { if (status === 'blocked') {
return ( return (
<BlockedPage onBack={() => navigate('/players')} /> <BlockedPage
imageAlt="Blocked player"
imageSrc="/war-thunder-deviss.gif"
onBack={() => navigate('/players')}
/>
) )
} }
@@ -4301,10 +4335,11 @@ function TeamProfilePage({ navigate, profile, requestedTeam, teams }) {
const summary = detail?.team_summary || detail?.squadron_summary const summary = detail?.team_summary || detail?.squadron_summary
const players = detail?.players || [] const players = detail?.players || []
const games = profile.games.data?.games || [] const games = profile.games.data?.games || []
const leaderboardTeam = teams.find((team) => bestTeamName(team) === requestedTeam) const lookupTeam = normalizeTeamLookupName(requestedTeam)
const displayName = detail?.name || bestTeamName(leaderboardTeam) || requestedTeam const leaderboardTeam = teams.find((team) => sourceTeamName(team) === lookupTeam || bestTeamName(team) === requestedTeam)
const displayName = canonicalTeamName(detail, bestTeamName(leaderboardTeam) || requestedTeam)
if (BLOCKED_TEAM_NAMES.has(requestedTeam)) { if (BLOCKED_TEAM_NAMES.has(lookupTeam)) {
return ( return (
<BlockedPage onBack={() => navigate('/teams')} /> <BlockedPage onBack={() => navigate('/teams')} />
) )