mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Feature/guest trainer (#89)
* add anonymous guest training with a daily puzzle limit - /guest-train serves random endgames with no difficulty picker; signed-in visitors are redirected to /train - guests get 5 puzzles per UTC day, keyed by an in-memory HMAC of the client address; the raw address is never stored or logged - a sign-up wall replaces the next puzzle once the budget is spent - move the endgame library behind auth so guests cannot browse it - privacy disclosure tracked in #87 * remove chess-test endpoint and liveview
This commit is contained in:
@@ -81,6 +81,13 @@ config :chesstrainer, Chesstrainer.Cache,
|
||||
max_size: cache_max_size,
|
||||
backup_time: cache_backup_time
|
||||
|
||||
# Guest puzzle limit: free puzzles per UTC day for anonymous visitors. The
|
||||
# visitor is identified by a keyed hash of their address held in memory only.
|
||||
# Enable TRUST_FORWARDED_FOR only behind a proxy that sets the header.
|
||||
config :chesstrainer, Chesstrainer.GuestLimits,
|
||||
limit: String.to_integer(System.get_env("GUEST_PUZZLE_LIMIT", "5")),
|
||||
trust_forwarded_for: System.get_env("TRUST_FORWARDED_FOR") in ~w(true 1)
|
||||
|
||||
config :chesstrainer, ChesstrainerWeb.Endpoint,
|
||||
http: [port: String.to_integer(System.get_env("PORT", "4000"))]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user