Serve standalone game without login
This commit is contained in:
1 parent
2320c309a7
commit
4834adca7b
3 files changed
+3
-4
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ RUN touch src/main.rs && cargo build --release --target wasm32-unknown-unknown \
|
|||||||
&& cp target/wasm32-unknown-unknown/release/dungeoncraft.wasm /out/ \
|
&& cp target/wasm32-unknown-unknown/release/dungeoncraft.wasm /out/ \
|
||||||
&& cp "$CARGO_HOME"/registry/src/*/macroquad-*/js/mq_js_bundle.js /out/
|
&& cp "$CARGO_HOME"/registry/src/*/macroquad-*/js/mq_js_bundle.js /out/
|
||||||
|
|
||||||
# --- standalone: the whole game in one HTML file (downloadable for logged-in users)
|
# --- standalone: the whole game in one HTML file (downloadable without login)
|
||||||
FROM python:3-alpine AS standalone
|
FROM python:3-alpine AS standalone
|
||||||
WORKDIR /w
|
WORKDIR /w
|
||||||
COPY www/ www/
|
COPY www/ www/
|
||||||
|
|||||||
+1
-1
@@ -99,7 +99,7 @@ The game also autosaves into the browser every two minutes and when the tab is c
|
|||||||
|
|
||||||
### Savegame service
|
### Savegame service
|
||||||
|
|
||||||
A small Rust service (axum) in `server/` keeps the user accounts (Argon2 password hashes) and the savegames as files in the Docker volume `savegames` (one folder per user). nginx forwards `/api/` to it; the service itself is not published. The standalone file is served under `/standalone/` only for logged-in users (nginx `auth_request`).
|
A small Rust service (axum) in `server/` keeps the user accounts (Argon2 password hashes) and the savegames as files in the Docker volume `savegames` (one folder per user). nginx forwards `/api/` to it; the service itself is not published. The standalone file is served under `/standalone/` as a public file, so it can be downloaded before login.
|
||||||
|
|
||||||
| Request | Meaning |
|
| Request | Meaning |
|
||||||
|---|---|
|
|---|---|
|
||||||
|
|||||||
+1
-2
@@ -12,9 +12,8 @@ server {
|
|||||||
default_type application/manifest+json;
|
default_type application/manifest+json;
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
}
|
}
|
||||||
# the standalone file only for logged-in users (checked by the service)
|
# the standalone file is public: it can be downloaded before login
|
||||||
location /standalone/ {
|
location /standalone/ {
|
||||||
auth_request /api/auth;
|
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
}
|
}
|
||||||
# savegame service (server/). Resolved at request time, so the game still starts without it;
|
# savegame service (server/). Resolved at request time, so the game still starts without it;
|
||||||
|
|||||||
Reference in new issue
Block a user