Add player_name column to games (migration included), with regex-based validation and anti-abuse sanitization. New /scoreboard page shows recent games from localStorage, popular categories with play counts, and top-10 per-category leaderboards sorted by completion time. Also includes two-click reverse word matching, base URL prefix support for reverse-proxy hosting, BasePageHandler refactoring, themed table CSS for all 5 themes, and comprehensive test coverage for player names and scoreboard API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
20 lines
602 B
Python
20 lines
602 B
Python
"""Shared handler base classes."""
|
|
|
|
import tornado.web
|
|
|
|
|
|
class BasePageHandler(tornado.web.RequestHandler):
|
|
"""Base handler that injects ``base_url`` into all templates."""
|
|
|
|
def static_url(self, path, **kwargs):
|
|
url = super().static_url(path, **kwargs)
|
|
base_url = self.application.settings.get("base_url", "/")
|
|
if base_url != "/":
|
|
url = base_url + url.lstrip("/")
|
|
return url
|
|
|
|
def get_template_namespace(self):
|
|
ns = super().get_template_namespace()
|
|
ns["base_url"] = self.application.settings.get("base_url", "/")
|
|
return ns
|