Web Apps and APIs
Portal
The portal (port 8082) uses ASP.NET Core Identity with cookies. Its look is a
moonlit parchment theme (wwwroot/css/night.css). Its pages:
| page | what it is |
|---|---|
/ | home: the three steps in, the features list (what is built, with screenshots where there are any) and a short "coming later" list |
/QuickStart | four steps from a key to the game world, and what to do if you can't sign in |
/Guide | First bow: from empty hands to a bow and arrows — ask Anyxa for an axe, sell firewood, buy tools, train Carpentry to 10, make the bow and arrows |
/Characters | list and delete characters (they are made in the game client) |
/Play | a play token for test tools; not linked from the site, since the client signs in with email and password |
/Account/Register | create an account; needs a registration key, typed in or carried by the link as ?key= |
/Account/Login, /Account/Logout | sign in and out |
The screenshots are taken by the client's --shots mode
(Testing with Bots).
API endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/account/me | cookie | Current user profile and characters |
GET | /api/account/characters | cookie | User's characters |
POST | /api/account/playtoken | cookie | Issue JWT for a character |
POST | /api/gameauth/token | email and password | Issue JWT from the game's login screen |
POST | /api/telemetry | sink key | Receive a telemetry capture (Deployment) |
GET | /health | none | Health check |
Play token response:
{
"token": "<jwt>",
"host": "127.0.0.1",
"port": 7777
}
Configuration
Important environment variables:
ConnectionStrings__DefaultJwt__SecretJwt__IssuerJwt__AudienceGameServer__HostGameServer__PortSeed__AdminEmailSeed__AdminPassword: in Production both apps refuse to start while this is unset or still the default, so setADMIN_PASSWORDin.envDataProtection__KeysPath: a folder that outlives the container, for the keys that sign cookies. Compose sets it to a named volume, so a redeploy does not sign everyone outRateLimits__Login,RateLimits__Register,RateLimits__GameAuth: tries one address gets (10 a minute, 20 in ten minutes, 120 a minute). RaiseRateLimits__GameAuthfor a load test that signs in more clients than that from one machinePortal__PublicUrl(admin only): the portal's address, for the register links on the Registration keys page
Sign-in protection
- Ten wrong passwords in a row lock an account for five minutes, on the portal, the admin and the game client's sign-in alike. A right password clears the count, and an admin password reset clears a lock.
- Sign-in and register tries are limited per address (above). Over the limit the answer is HTTP 429.
- A banned account is refused on the portal and by
/api/gameauth/*(HTTP 403 with the reason to show), as well as by the game server. - Both apps read
X-Forwarded-ForandX-Forwarded-Protofrom a proxy on a private address (Caddy), so the limits count the visitor's own address and the sign-in cookie is marked Secure over https.
Admin panel
The admin app shares the same database and Identity configuration. Admin pages require the Admin role.
For how to use it, see Using the Admin Panel.
Features:
- dashboard with server heartbeat and counts
- player search and ban
- server controls:
- broadcast
- kick
- state change
- graceful shutdown request
- audit log view
- content pages for items, materials, node types, placed nodes (with Respawn all nodes), recipes, skills, creatures, creature kinds, spawners, quests, calendar events and NPCs; see GM Tools for the full list and how edits reach the game server
- the NPC editor at
/Npcs: services, a conversation map, relationship rules and per-player standings (NPCs and the Economy) - a character page at
/Players/Character, which shows and sets a character's hidden karma