Add Sycamore/WASM frontend and restructure into server/ + web/
Repo is now a monorepo:
- server/: the kaya backend, unchanged in behaviour, plus:
- GET /api/me for SPA session detection
- last_move recorded on every play and broadcast in the game state, so
clients can show who played which card the moment they play it
- legal_moves per hand card for the player on turn (rules stay
server-side)
- static catch-all route serving the compiled SPA with index.html
fallback; Tortoise context now bound only for /api/* requests
- configurable OIDC post-login/logout redirects for dev against trunk
- web/: Sycamore 0.9 + WASM frontend (trunk): login via the OIDC flow,
lobby (create match / join by code), live game page over websocket with
card images (CC0 woodcut napoletane deck), capture picker, move banner,
game-over overlay, match history and leaderboard pages
- server/Dockerfile gains a rust+trunk stage building web/dist; the single
app image serves the SPA; compose builds from the repo root with
overridable ports/OIDC env
Verified end-to-end against the compose stack: four OIDC logins, game
creation, three joins by code, websocket play with broadcasts to all
players and out-of-turn rejection. 51 backend tests, mypy and cargo tests
all green.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Dev OIDC provider: navikt/mock-oauth2-server with the scopa test
|
||||
# configuration (four ready-made players) baked in. The config is
|
||||
# COPYed instead of bind-mounted so this also works against containerized
|
||||
# (e.g. rootless/DinD) docker daemons that cannot see the host workspace.
|
||||
FROM ghcr.io/navikt/mock-oauth2-server:5.0.2
|
||||
|
||||
COPY config.json /config.json
|
||||
|
||||
ENV JSON_CONFIG_PATH=/config.json
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"interactiveLogin": true,
|
||||
"tokenCallbacks": [
|
||||
{
|
||||
"issuerId": "scopa",
|
||||
"tokenExpiry": 3600,
|
||||
"requestMappings": [
|
||||
{
|
||||
"requestParam": "subject",
|
||||
"match": "alice",
|
||||
"claims": {
|
||||
"sub": "alice",
|
||||
"preferred_username": "alice",
|
||||
"name": "Alice"
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestParam": "subject",
|
||||
"match": "bob",
|
||||
"claims": {
|
||||
"sub": "bob",
|
||||
"preferred_username": "bob",
|
||||
"name": "Bob"
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestParam": "subject",
|
||||
"match": "carol",
|
||||
"claims": {
|
||||
"sub": "carol",
|
||||
"preferred_username": "carol",
|
||||
"name": "Carol"
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestParam": "subject",
|
||||
"match": "dave",
|
||||
"claims": {
|
||||
"sub": "dave",
|
||||
"preferred_username": "dave",
|
||||
"name": "Dave"
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestParam": "subject",
|
||||
"match": ".*",
|
||||
"claims": {
|
||||
"sub": "${subject}",
|
||||
"preferred_username": "${subject}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user