Serve practice mode from the main server, add mode switch, fix touch
Practice mode is now at /practice on server.py instead of a separate server, with a button in the bottom-right corner of each page to the other mode. Touch: no double-tap zoom, no sticky hover after a tap, no long-press selection on the board, and a pressed look on tapped squares. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c52f30dc59
commit
ce6b71eb35
7 files changed
+51
-42
No files matched your search
@@ -17,6 +17,7 @@ from pathlib import Path
|
||||
|
||||
from aiohttp import WSMsgType, web
|
||||
|
||||
import practice
|
||||
from game import Game
|
||||
|
||||
STATIC_DIR = Path(__file__).parent / "static"
|
||||
@@ -122,6 +123,10 @@ async def index(request):
|
||||
return web.FileResponse(STATIC_DIR / "index.html")
|
||||
|
||||
|
||||
async def practice_page(request):
|
||||
return web.FileResponse(STATIC_DIR / "practice.html")
|
||||
|
||||
|
||||
async def game_socket(request):
|
||||
code = normalize_code(request.query.get("game", ""))
|
||||
ws = web.WebSocketResponse(max_msg_size=MAX_MESSAGE_SIZE)
|
||||
@@ -229,6 +234,8 @@ def make_app():
|
||||
app = web.Application(middlewares=[no_cache])
|
||||
app.router.add_get("/", index)
|
||||
app.router.add_get("/ws", game_socket)
|
||||
app.router.add_get("/practice", practice_page)
|
||||
app.router.add_post("/api/play", practice.play)
|
||||
app.router.add_static("/static", STATIC_DIR)
|
||||
app.cleanup_ctx.append(start_reaper)
|
||||
return app
|
||||
|
||||
Reference in new issue
Block a user