aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


docs/admin.md (10870B)


Administration

Open /admin or /admin/. On an empty admin_users table, the login page creates the first administrator. Complete this setup before exposing the server to other people. Later visits require that username and password. Passwords use the same salted Argon2id implementation as player accounts. Admin accounts are separate from players; there is no recovery flow. New passwords require at least five characters. Initial setup also requires password confirmation. The Admins table links to Create admin and each account's Change password page. Saving a password revokes the account's other sessions while keeping your current session signed in.

Sessions expire after 12 hours, survive server restarts, and are revoked on logout. Cookies are HttpOnly, SameSite=Strict, scoped to the mounted admin path, and Secure on HTTPS. All admin pages, actions, map feeds and assets pass through the same authentication boundary on both listeners. Cross-origin writes are rejected. /control and its descendants no longer exist. Use HTTPS for remote administration. Browser profile uploads use /admin/browser-profile/{session} and require the same administrator session and cross-origin write protection. Sign in to /admin in the same browser before opening the game with ?profile=1. Anonymous players cannot upload profiles; failed uploads leave gameplay running.

The November 5 deployment check used the normal launch configuration and the existing provisioned administrator after a graceful server restart. HTTP 8080 and HTTPS 8443 both returned 401 for unauthenticated administrative/profile writes, 403 for cross-origin profile writes, and 404 for the removed public upload route and tested debug paths. The real browser worker rejected a player-only session and uploaded successfully after administrator login under /share/test/. Evidence is retained in local/admin-profile/. The full admin browser scenario also passes after preparing its player through account claiming, including password changes and the final authenticated profile upload.

General shows player, connection, instance, NPC and database-size counts, game time and weather. Query rate samples driver executions over two seconds, including prepared queries and console queries. SQLite's internal trigger work and transaction-control statements are not counted separately. Counts include the admin interface's own authentication queries.

Players at /admin/players provides character editors and separate Teleport and Change password pages; players create accounts through the game. The player editor uses labeled form fields grouped into character, appearance, skills, location, vitals and inventory sections. Item slots refer to existing instance IDs; blank slots unassign their items. Saves validate the complete ownership change and commit atomically. Player IDs and browser credentials are not editable in this form. Player export/import is not implemented. Items retains catalog creation, ownership, assignment and instance editing. Players, item instances, the item catalog, administrators and shop stock use 1,000-row pages. Click a column heading to sort ascending or descending; filters apply before pagination, and page links retain the filter and sort. Item icons have their own column, and unnamed entries display (empty) as their link text. Item details show named catalog attributes at the instance's quality, decoded flags/capabilities and equipment slots. The Price field is a base value before shop modifiers; NoDrop items are identified as unsellable. Expand Source catalog record to inspect the original endpoint, serialized sections and provenance. Top-level attribute names match the maintained catalog YAML. Catalog detail pages show up to 1,000 acquisition locations at a time. Previous and Next change both the location links and the markers on the overview map. Same-zone map teleports and ordinary carried-item edits update connected players without reconnecting. Profile, equipment, backpack and bank changes, or inventory edits during an open shop/trade or equipment transition, reload the player. Carried-item edits also preserve a pending nano cast and its reservation until ordinary completion or cancellation. An equipped-item edit refunds a pending cast in the same transaction as the item change, before reloading the actor. Failed writes leave both the item and reservation unchanged. Password changes preserve the current game session and take effect on the next login.

Player moderation

Open the player in Players to kick, ban or delete them. A kick closes their current game and chat sessions and permits a fresh login. A character ban also blocks future sessions for that character until an administrator selects Unban character. Ban IP blocks the displayed address, including other players and new visitors connecting from it. Remove an address on IP bans. IP bans survive character deletion and server restarts. Native TCP uses the socket peer. Browser requests from a loopback proxy use the rightmost X-Forwarded-For address. Configure same-host nginx to append the client address with proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for. For other peers the server uses the socket address.

Delete player asks for confirmation and removes the character, possessions (including bank, reclaim and backpack contents), pets, missions, copied mission keys, buddies and chat records involving the character. Other mission occupants return to the exterior. Team members use the normal departure rules. A connected player loses their session after the deletion commits. Use this action for live deletion so game state and SQLite agree.

Map

The map fits the viewport and supports dragging, wheel/buttons, and two-finger pinch/pan. Offline players default off; the selected character remains visible on its teleport page. NPCs default off and appear from 1.2 pixels per world unit with a viewport no larger than 2000 units in either direction. Warp zones default on, starting at 0.3 pixels per world unit with a maximum viewport span of 6000. The server filters current live positions and returns at most 5000 NPCs and 5000 warps per request. Bounded selections have stable ordering across refreshes. A limit message asks the operator to zoom in. Hidden browser pages do not poll.

The main map links player markers to their profiles. Only the separate /admin/players/<id>/teleport page selects destinations; its action and map controls sit above the canvas, with nothing beneath it.

Warp markers use the target client's door and zone-border links. Tapping a marker shows its destination; closer zoom adds destination labels and lines where both endpoints have map coordinates. Return doors have a player-dependent entry destination. This layer does not enumerate generated mission instances.

SQL

The SQL console runs reads and writes against data/world.sqlite, with starter queries for tables, players, items, NPCs and administrators. It displays the most recent result set as a table or CSV, switching without executing again. Multiple statements use SQLite's own statement-completeness parser, including quoted semicolons and trigger bodies. Statements run once, in order. Use an explicit BEGIN/COMMIT batch for atomic multi-statement changes. An error stops the batch; earlier autocommitted statements remain committed.

Each submission gets a separate connection, so console PRAGMAs or unfinished transactions cannot affect the game's connection. Closing that connection rolls back unfinished transactions. Queries have a five-second deadline and displayed output is limited to 1000 rows or approximately 2 MiB. The console is trusted administrator access, including writes to administration tables.

The game holds live characters, NPCs, items and settings in memory. SQL does not reload that state. Checkpoints can overwrite direct changes; use the normal editors for live changes, or restart to load SQL edits. Back up the database before destructive queries.

Weather

Weather always returns to the client's ordinary environment behavior. Selecting Clear, Rain, Clouds, or Fog and clouds starts a five-minute event using the original WeatherControlIIR_t message. The event is kept in memory and is not restored after a server restart. The movement loop refreshes it every five seconds until its deadline. Each spatial effect fades in for one second, holds for four, and fades out for one. Switching settles within six seconds; ordinary weather resumes within six seconds of the deadline. Joining or zoning clients receive the event at the next refresh, without extending its deadline.

These are explicit preview presets, not recovered historical weather schedules: 70% intensity, neutral white ambient light, temperature 20, no wind/earthquake, and fog RGB 160/170/180 with 25% density only in the fog preset. The radius is 1,000,000 units around each recipient's global position. Short effects avoid accumulating permanent weather events. The normal client weather cycle continues underneath; this control does not move its internal schedule to another phase.

Protocol evidence is original kkr.dll SHA-256 a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0: WeatherControlIIR_t::Read at 0x100dbe30, activation at 0x100dc120, field conversion/queue at 0x100da960, lifetime at 0x100dad00, spatial attenuation at 0x100dae90, and rendering at 0x100db3f0. Lifted equivalents are in client/game/kkr.dll/lifted-0063.c. The N3 key is 0x0c5a5d6d; its 43-byte payload contains fade/hold durations, radius, weather/effect bytes, ambient and fog RGB, global XYZ center, and initial age. Local debug-weather AFCM identifiers are not network packet identifiers.

Focused checks

The November 5 pending-cast edit check passes 13 test roots and 31 results, covering reservations, live inventory edits, actor reloads and open-shop edits. It verifies exact cost/refund settlement and unchanged state after rejected writes. Logs are local/alpha-admin-cast/regressions.log and vet.log; go vet ./server/... and diff checks pass. This was a regression-fixture update, with no server or client behavior change.

go test ./server -run '^(TestAdmin|TestControl|TestHTTPHandler|TestSetGameTime|TestMapPlayers|TestMapTeleport)' -count=1 -timeout=5m
node --test server/map_test.js
AO_GAME_TEST=1 go test ./server -run '^TestAdminBrowser$' -count=1 -timeout=7m -v

The browser check owns and closes its temporary server and Chromium instance. It covers setup, login/logout and styled errors, admin and player password forms, navigation, SQL writes and CSV, mobile map gestures and teleport layout, same-zone teleporting, live carried-item additions/removals, weather delivery and profiling opt-in in the actual WASM client through GameTest.