Pass start FEN and game data to the board analyser, load board.css, drop the status dot

This commit is contained in:
claude committed 2026-10-10 16:02:29 +02:00
1 parent 309754bb08
commit 611a117a38
3 files changed
+15 -1

No files matched your search

+14
View File
@@ -26,6 +26,8 @@ STC_MAX_BASE_SECONDS = 30
BUCKETS = ('STC', 'LTC', 'OTHER')
START_FEN = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1'
@lru_cache(maxsize=512)
def classify_time_control(time_control):
@@ -276,6 +278,9 @@ def parse_pgn(text):
'date' : header_map.get('Date', ''),
'duration' : header_map.get('GameDuration', ''),
'fen' : fen,
'start_fen' : fen or START_FEN,
'variant' : header_map.get('Variant', ''),
'chess960' : 'fischer' in header_map.get('Variant', '').lower() or '960' in header_map.get('Variant', ''),
'headers' : headers,
'rows' : rows,
'moves' : moves,
@@ -344,6 +349,7 @@ def event_context(event, content):
'back_label' : 'Errors' if event.machine_id else 'Events',
'game' : None,
'moves_json' : [],
'game_json' : None,
'log' : None,
'download_name' : 'event%d.%s' % (event.id, 'pgn' if kind == 'pgn' else 'log'),
}
@@ -352,6 +358,13 @@ def event_context(event, content):
if kind == 'pgn':
context['game'] = parse_pgn(content)
context['moves_json'] = context['game']['moves']
context['game_json'] = {
'startFen' : context['game']['start_fen'],
'chess960' : context['game']['chess960'],
'white' : context['game']['white'],
'black' : context['game']['black'],
'note' : context['game']['final_note'] or context['game']['termination'],
}
elif kind == 'log':
context['log'] = parse_log(content)
@@ -362,6 +375,7 @@ def event_context(event, content):
context['kind'] = 'log'
context['game'] = None
context['moves_json'] = []
context['game_json'] = None
context['log'] = parse_log(content)
return context