- JavaScript 77.3%
- CSS 11.9%
- HTML 8.9%
- Shell 1.7%
- Dockerfile 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Zone changes reach Full and Critical phones as before, and now always post to the Discord webhook whatever the channel level is set to: they're rule changes, and the staff member making them gets no phone alert of their own. A pending zone alert is now sent when the server stops instead of being dropped, the wait is logged when one is scheduled (and shortened to 20s by default), and a failed Discord post says so in the log. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
| public | ||
| scripts | ||
| src | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| compose.build.yaml | ||
| compose.yaml | ||
| Dockerfile | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| server.js | ||
HvZ Map
Here are some screenshots (more than one will be added later...):
A live, crowd-sourced intel map for Humans vs Zombies at LeTourneau University. Players report zombie sightings, backup requests, and intel from their phones, and every open map updates instantly.
New here? The wiki has a player and staff guide with screenshots.
- Red → grey dots. A report starts red and fades to grey over
FADE_MINUTES(default 15). "Still there" makes it red again. - Live window. Reports leave the live map after
LIVE_HOURS(default 12). Nothing is deleted. - Archive. Admins archive a day to clear it off the live map. Archived and older days can be replayed on a time scrubber and exported as CSV or GeoJSON.
- Access. Choose between a shared human passcode (the default), Discord with the Human role only, or open. You can switch live from the admin page.
- Campus only. The map is locked to the main campus, and everything outside the boundary is dimmed. Buildings are labeled, and each report records the nearest building ("near Speer Chapel").
The map
There are three map styles. Tap the layers button (top right) to open the picker, which has a preview of each:
| Layer | Notes |
|---|---|
| Tactical Map (default) | Draws buildings, fields, parking, roads, and walkways from public/campus.geojson and loads no map tiles. It stays sharp at any zoom and is the best choice on a weak signal or at night. |
| Satellite | Esri World Imagery at the deepest real resolution available for campus (zoom 19, about 30 cm per pixel). Retina phones load tiles one level deeper at half size, so they get four times the pixels. |
| Streets | OpenStreetMap tiles |
The campus data comes from OpenStreetMap, the same source behind the 2026 LETU Campus Map (Esri's Open Basemap). To pick up edits made on openstreetmap.org, regenerate it:
node scripts/fetch-campus.mjs
To change the building label text, edit LABELS in that script.
No-play zones
Nothing is a no-play zone out of the box. Staff decide, by drawing one with the 🚧 No-play behavior: ☰ → ✏️ Draw a zone (see Rule zones). A zone is drawn with a dotted outline and labeled "No-play zone". Reports inside it are still accepted but carry a warning:
- The report sheet warns when the crosshair is inside the zone.
- Popups and the recent list mark reports placed there.
- A phone sharing its GPS location vibrates and shows a warning when it enters a zone.
Campus-wide construction can come from OpenStreetMap instead, but only when you ask for it:
node scripts/fetch-campus.mjs --construction
That marks every building tagged building=construction as a no-play zone, and the CONSTRUCTION list in the script can force one on or off by name. Without the flag the generated public/campus.geojson carries no zones at all, and the shipped file has none.
Run it
The server runs a published image and never builds. On the host:
git clone https://code.inactiveimmortal.com/Inactiveimmortal/hvz-map.git
cd hvz-map
cp .env.example .env # set ADMIN_PASSCODE, HUMAN_PASSCODE, PUBLIC_URL
echo "HVZ_IMAGE=code.inactiveimmortal.com/inactiveimmortal/hvz-map:1.0.0" >> .env
docker login code.inactiveimmortal.com -u <your-forgejo-user> # once, private registry
docker compose up -d
Updating to a new version later is two lines (see Releases for building one):
sed -i 's|^HVZ_IMAGE=.*|HVZ_IMAGE=code.inactiveimmortal.com/inactiveimmortal/hvz-map:1.1.0|' .env
docker compose pull && docker compose up -d
Rolling back is the same with an older tag. Data lives in the hvz-data volume, so it survives image changes; docker compose logs -f shows requests and generated passcodes.
To build from source instead of pulling (development, or no registry access):
docker compose -f compose.build.yaml up -d --build
Without Docker (Node 22.13+):
npm install
npm start
Releases
Versions are git tags (v1.0.0). Images are built on a workstation with Docker and pushed to the Forgejo container registry beside the repo, so no CI runner is needed and the server only pulls. Log in once with a Forgejo access token that has the write:package scope (Settings -> Applications -> Access Tokens):
docker login code.inactiveimmortal.com -u <your-forgejo-user>
Then:
| Command | Builds | Image tags |
|---|---|---|
./scripts/release.sh |
the working tree as-is | :develop, :develop-<commit> |
./scripts/release.sh v1.0.0 |
that tag, from a clean checkout | :1.0.0, :1.0, :latest |
./scripts/release.sh --new v1.1.0 |
creates and pushes the tag first, then builds it | :1.1.0, :1.1, :latest |
Both linux/amd64 and linux/arm64 go into one image, so the same tag runs on the Proxmox host and on Apple Silicon. Useful flags: --local (this machine only, no push), --no-push, --no-latest, --platforms linux/amd64, --force.
Cutting a new version:
npm version 1.1.0 --no-git-tag-version # bump package.json (shown in the menu)
git commit -am "Release 1.1.0"
git push
./scripts/release.sh --new v1.1.0
Deploying it:
# on the server, in the repo directory
sed -i 's|^HVZ_IMAGE=.*|HVZ_IMAGE=code.inactiveimmortal.com/inactiveimmortal/hvz-map:1.1.0|' .env
docker compose pull && docker compose up -d
Override the registry or image path with HVZ_REGISTRY and HVZ_IMAGE_PATH if they ever move.
Data lives in a single SQLite file at $DATA_DIR/hvz.sqlite (the hvz-data volume in compose). To back it up, copy that file.
Behind Pangolin / Traefik / Cloudflare
- Point a resource at
http://<host>:3000. No path rewriting is needed. - Use HTTPS. Phones only allow the "Use my GPS" button on a secure origin.
- Live updates use Server-Sent Events (
/api/stream), which work through Traefik and Cloudflare. The server sends a keep-alive every 20s so idle timeouts don't cut the stream. - Keep
TRUST_PROXY=trueso rate limiting sees real client IPs (CF-Connecting-IP/X-Forwarded-For), and setPUBLIC_URL. - Cloudflare replaces the server's
no-cacheon.jsand.csswith its own browser cache time (4 hours by default). The app doesn't depend on it: pages load scripts and styles from/static/<version>/, so every release gets new URLs, and those are sent withimmutable. Pages themselves (/,/admin) and/apistay uncached.
Admin
Sign in with ADMIN_PASSCODE from the ☰ menu (or "Staff sign-in" on the Discord screen). Staff work lives on its own page at /admin, reached from ☰ → ⚙️ Admin, so the map itself stays a map. The ☰ button shows a red badge when something is waiting on you.
| Tab | What it does |
|---|---|
| Review | Gone requests and unconfirmed big hordes, each with Keep / Remove (or Reject / Approve ✓). Tapping one opens it on the map. |
| Zones | Every rule zone, with Edit (opens it on the map) and Delete. + Draw a zone hands you back to the map in drawing mode. |
| Days | Per-day counts, plus Archive/Unarchive, Replay, CSV, and GeoJSON for each day. |
| Settings | Auth mode, human passcode (changing it kicks everyone on the old one, which is useful after a tag), timers, duplicate protection, auto-verify, heatmap weights, and a Pushover test. |
Moderators see Review and Zones; the rest is admin-only. Values saved in Settings override .env until you click Reset to .env defaults.
Two staff things stay on the map, because that is where they make sense:
- ☰ → 🗺 View & replay — Live or Replay a day. Replaying puts a slim bar along the bottom of the map (play, time slider, ⚙ options, ✕ back to live) and leaves the rest of the screen to the map, like a weather radar. The ⚙ opens the panel for the day, whole-day, include-gone, color-by and type filters. The Report button hides while replaying; ◎ my location stays.
- ☰ → ✏️ Draw a zone — start drawing without a detour through /admin.
- ☰ → 🖼 Share image — the current view as a PNG without any UI, with a watermark (logo, version, export time). Copy, Share (where the phone supports sharing files) or Save. Staff only for now: change
canExportinpublic/export.jsto() => trueto open it to every player.
Verifying a report, clearing one, or deleting it permanently all happen in the report's own popup on the map.
Staff roles and verification
| Role | How they sign in | Can |
|---|---|---|
| Human | HUMAN_PASSCODE, Discord Human role, or nothing (open mode) |
See the map, report (no approval needed), confirm "Still there", ask for "Gone" |
| Moderator | MOD_PASSCODE or DISCORD_MOD_ROLE_IDS |
Everything above, plus ✓ verify reports, approve or reject Gone requests, and remove reports directly |
| Admin | ADMIN_PASSCODE, DISCORD_ADMIN_ROLE_IDS, or DISCORD_ADMIN_USER_IDS |
Everything, including settings, archives, exports, and permanent delete |
A blue ✓ marks verified reports. Staff verify a report from its popup, and reports that staff file themselves are verified automatically. The popup names who verified it, and the CSV export includes verifiedAt and verifiedBy.
Auto-verify by corroboration
Reports also earn the ✓ on their own once enough different people back the same sighting, so nobody has to wait for an admin. A separate report of the same type, a merged duplicate and a "Still there" tap all count — once per person — and reports of that type within AUTO_VERIFY_METERS (default 60 m) of each other are tallied together, so GPS scatter doesn't split a crowd. When the tally reaches AUTO_VERIFY_CONFIRMS (default 3), every report in the cluster is verified as "N independent reports" and any big horde waiting on an admin is approved at the same time.
Set AUTO_VERIFY_CONFIRMS=0 to keep verification staff-only. Staff always override it: ✓ Verify works as before, and taking a ✓ away with Remove ✓ also stops that report from being auto-verified again. Both numbers are live-editable under /admin → Settings → Verified ✓ marks.
Rule zones
Moderators and admins draw rule areas right on the map: ☰ → ✏️ Draw a zone (or /admin → Zones → + Draw a zone). On a phone this uses the same crosshair as reporting: drag the map, tap + Corner for each corner, then Finish (Undo removes the last one). On desktop you click each corner on the map. Then set it up:
-
Behavior decides how the app treats the zone:
Behavior Default look What it does 🚶 Transit orange, dashed Report sheet says "transit only, not a refuge". The default note explains the car-safe-zone rule and no camping. 🛡 Safe green Report sheet says "safe zone" 🚧 No-play red-orange, dotted Warns in the report sheet, marks popups, vibrates on GPS entry (see No-play zones) 📌 Custom blue Information only, no warnings. For mission areas, spawn points, and so on. -
Look is fully customizable per zone: an emoji icon, a type name (e.g. "Mission area"; names already in use are suggested), and a color from the swatches or any color via the rainbow button. The preview chip shows the result. Leave any of these blank to use the behavior's default.
Zones reach every open map instantly. Tapping a zone shows its icon, name, type, and note, and staff get Edit and Reshape there (drag corners, or tap a midpoint to add a corner). The drawing tool (Geoman) only downloads when staff start drawing.
Risk heatmap
The 🔥 button on the right side of the map swaps the individual markers for a heatmap of general danger, for players who just want to know where to avoid. Each player's choice is remembered. Heat per report:
| Report | Base weight |
|---|---|
| 🧟 Zombies | number of zombies |
| 🆘 Need help | 2 |
| 💫 Stunned | 0.25 per zombie while the stun countdown runs, 1 per zombie once it ends |
The base weight is then adjusted:
- Verified: reports verified by a moderator or admin count double.
- Confirmations: each "Still there" adds 25%, up to 4 confirmations.
- Age: heat fades linearly to nothing over twice the red → grey fade time.
- Scale: six weighted zombies at one spot reads as maximum risk.
Cleared reports (by staff, by players' Gone votes, or from the Review tab) leave the map, the counts and the heatmap, but stay in Recent reports for the rest of the live window, greyed out and marked Gone, so players can see what was there.
Every weight is adjustable under /admin → Settings → Risk heatmap weights, and changes reach every phone immediately: heat per zombie, per backup request, per stunned zombie (during and after the stun), the verified multiplier, the bonus per confirmation, the heat that counts as maximum risk, and how long heat lasts. Lower "heat for maximum risk" to make single reports glow hotter; raise it to save red for real hordes.
Unconfirmed big hordes (below) add no heat until staff approve them.
Duplicate protection
-
Cooldown: a player must wait
REPORT_COOLDOWN_SECONDS(default 45) between reports, and the Send button counts down. Moderators and admins are exempt. -
Merging: a report of the same type within
MERGE_METERS(default 25 m) of one seen in the lastMERGE_MINUTES(default 5) is added to the existing report instead of drawn as a second dot. Its count is added on top (reports of 2 and 3 zombies make 5), it bumps the "last seen" time and counts as a confirmation, and its note is appended. The report sheet warns before sending ("↻ Matches 3 zombies 12 m away. Sending adds yours to it."). Stun reports never merge, because each one starts its own countdown. -
Open mode: every device gets its own anonymous session, so the cooldown and "Gone" votes aren't shared by everyone behind the campus Wi-Fi's single public IP.
-
Big hordes: a zombie report above
HORDE_APPROVAL_THRESHOLD(default 5) from a player shows on the map straight away as unconfirmed — dashed outline with a "?" badge — but adds nothing to the zombie count or the heatmap until staff approve it. Admins get a high-priority Pushover with one-tap Approve ✓ (marks it verified) or Reject (removes it); staff can also do either from /admin → Review, or just ✓ Verify the report. Merging can trip the threshold too, so three reports of 2 zombies at one spot add up to an unconfirmed horde of 6 rather than a silent pile-up. Moderators and admins skip approval entirely.
All of these values can be changed live under /admin → Settings.
Overlapping reports
Reports close together merge into one cluster marker. The cluster shows the total zombies in it (sightings and stuns), filled with the freshest report's age color, with ✓ and ! badges when relevant. A cluster of only backup requests shows how many there are. Tapping a cluster fans reports that share a spot (within about 25 m) out in place, and zooms into spread-out groups, no deeper than the sharpest imagery level. Tapping a report in the recent list or review queue un-clusters it automatically.
Admin review and Pushover
One player can't clear the map on their own. When a player taps Gone:
- The report stays on the map with "🕓 1 of 3 players said gone". More players tapping Gone add votes (one per person) instead of new requests. Once
GONE_VOTES_TO_CLEAR(default 3) different players agree, the report clears by itself, with no admin needed. Change the number under /admin → Settings → Clearing reports; 0 leaves every Gone for staff. - Staff see a red badge on ☰, and /admin → Review lists each request with Keep / Remove.
- If Pushover is configured, every admin key gets a push notification. Its Review link opens a one-tap Remove / Keep page, and also signs that browser in as admin, so Open map and Open admin work without the passcode. The link is signed and expires after
REVIEW_LINK_HOURS; opening it never approves or removes anything by itself, and changingADMIN_PASSCODEsigns out every session a link created. Anyone the notification is forwarded to gets the same access until the link expires, so don't forward it.
When a moderator or admin taps Gone, the report is removed immediately and any pending request for it closes.
Setup:
- Create an application at https://pushover.net/apps/build and put its token in
PUSHOVER_APP_TOKEN. - Put each admin's 30-character user key in
PUSHOVER_USER_KEYS, comma-separated. A single Pushover delivery group key also works and is easier to manage. - Set
PUBLIC_URLso notifications include the review link. - Restart the app, then check it under /admin → Settings → Admin notifications. That section says whether Pushover is on, how many keys are loaded, and what the last failure was; Send test notification pushes a real message and reports back exactly what Pushover said.
Nothing arriving? The usual reasons, in order:
- The keys never reached the container.
.envchanges needdocker compose up -d(a restart, not a reload); the status line showsOffwhen the token or keys are missing. - You are staff. Moderators and admins clear reports and file hordes directly, so your own taps never raise a request and never notify. Test with a player account, or use Send test notification.
- A bad key. Pushover answers
user identifier is not a valid user, group, or subscribed user key, which the status line shows verbatim. - No outbound internet from the server, which shows up as a timeout. Every attempt is also logged as
[pushover] …, sodocker compose logs -f hvz-maptells the same story.
Player alerts
Players choose their own alerts under ☰ → 🔔 Alerts, per phone. Alerts arrive as notifications even when the map is closed (Web Push through the service worker):
| Level | Alerts for |
|---|---|
| Full | Every new report (zombies, stuns, 🆘), big hordes once they're confirmed, and zone changes |
| Critical | 🆘 backup requests, confirmed big hordes, and zone changes |
| None | Nothing (the default) |
- A big horde never alerts while it's unconfirmed. It's announced once, as "Confirmed horde", when staff approve it (✓ Verify, the Review tab, or a Pushover link) or corroboration verifies it. A horde staff file themselves is confirmed on arrival.
- Merged reports don't alert, so three people reporting the same group is one alert. Nobody is alerted about their own report.
- Tapping an alert opens that report on the map, or the zone with its rules.
- Zone changes (a zone added, changed or removed) reach both Full and Critical phones, since they're rule changes, and always post to the Discord channel whatever level it is set to. They wait until staff leave the zone alone for
ZONE_ALERT_DELAY_SECONDS(default 20) and describe the end result, so shaping a zone with several saves sends one alert, and a zone added and deleted again sends none. A pending one is sent when the server stops, so a deploy can't swallow it. Whoever made the change doesn't get it on their own phone, but still sees the Discord post. - iPhone: web notifications only work in the installed home-screen app (iOS 16.4+), never in a Safari tab. The Alerts panel says so. Android works in the browser or installed.
- Alerts are tied to the session that turned them on: signing out, a changed passcode or a lost Discord role stops them. A phone that uninstalled the app is cleaned up the first time a push to it fails.
- The server's VAPID keys are generated on first start and kept in the database. Set
VAPID_PUBLIC_KEY/VAPID_PRIVATE_KEYif the database may ever be recreated, since new keys stop every phone's alerts until players turn them on again.
Discord alerts channel
Set DISCORD_WEBHOOK_URL (channel settings → Integrations → Webhooks → New Webhook → Copy Webhook URL) and restart. Alerts post there using the same levels; pick one under /admin → Settings → Discord alerts channel (default DISCORD_ALERT_LEVEL=critical), where Send test to Discord checks the webhook. Posts link to the report when PUBLIC_URL is set, and never ping anyone, even if a player's note contains @everyone.
Discord sign-in (optional)
- Create an application at https://discord.com/developers/applications. You don't need a bot.
- Under OAuth2 → Redirects, add
${PUBLIC_URL}/auth/discord/callback. - Copy the Client ID and Client Secret into
.env. - In Discord, turn on Settings → Advanced → Developer Mode. Then right-click the server to copy
DISCORD_GUILD_ID, and right-click roles under Server Settings → Roles to copyDISCORD_HUMAN_ROLE_IDSandDISCORD_ADMIN_ROLE_IDS. - Set
AUTH_MODE=discord(or pick it on the admin page) and restart.
Players authorize the identify and guilds.members.read scopes. Roles are re-checked every DISCORD_ROLE_RECHECK_MINUTES (default 5). When a mod swaps someone's Human role for Zombie, that player's open map locks within about 5 minutes.
Reporting
The red ⚠ button in the bottom-right corner opens the report sheet. Zombies is preselected and the map centers on the player's GPS, so a quick sighting is two taps: ⚠ → Send. To report something else, tap a different type chip. The sheet shows the nearest building live, and after the first report the player's name is remembered.
| Type | Marker | Fields |
|---|---|---|
| 🧟 Zombies | round dot with the horde size | how many, note (e.g. "Tank (yellow vest)") |
| 💫 Stunned | dotted dot with a purple ring that drains over the stun time | how many were stunned, note (e.g. "Spawner (blue vest)") |
| 🆘 Need help | diamond ! |
humans with you, note. Everyone's phone vibrates. |
Stun reports follow Rule 4a: a stunned zombie may respawn STUN_MINUTES (default 10) after the report. Popups and the recent list count down ("can respawn in 7 min"), then switch to "stun ended, may be back". Special perks change the timer (a stunned Spawner is out for 20 minutes), so players should note the vest color.
Intel reports from earlier builds still show up in replays and exports, but new ones can't be created.
Home screen app
On phones, the map offers to install itself a few seconds after sign-in. It won't ask again for 3 days after "Not now", and it's always available under ☰ → 📲 Install app.
- Android (Chrome, Edge, Samsung Internet): an Install button opens the browser's native install prompt.
- iPhone/iPad: step-by-step Share → Add to Home Screen instructions. iOS home screen apps don't share Safari's cookies, so players sign in once more inside the app.
Icons are rendered from public/icon.svg. If you change it, regenerate them:
for s in 180 192 512; do rsvg-convert -w $s -h $s public/icon.svg -o public/icon-$s.png; done
Reports more than AREA_PADDING_METERS (default 100) outside the campus boundary are rejected.
Offline
A service worker (public/sw.js) keeps the app files (network-first, so a deploy reaches phones on their next open with signal) and the map tiles a phone has shown (cache-first, up to 1500), so the installed app opens with no signal. Pages it never saw get offline.html. /api and /auth are never cached.
A report made without signal, or that gets no answer within 12 seconds, goes to an outbox on the phone (📤 in the summary chip) and sends itself when the connection returns. It carries the time it was seen, so it lands with the right age; the server refuses ones more than 30 minutes old.
Long-press the installed app's icon for shortcuts that open the report sheet for zombies, a stun or backup (/?new=zombie|stun|help). On platforms with the Badging API, the icon shows the number of active reports.
API (for scripts)
All endpoints take and return JSON and use the hvz_sid session cookie.
POST /api/login {code, name}/POST /api/logout/GET /api/meGET /api/stream(SSE:snapshot,upsert,remove,settings,locked)POST /api/reports {type: zombie|stun|help, lat, lng, count?, note?, name?, seenAt?}(seenAt: epoch ms, up to 30 minutes ago)POST /api/reports/:id/seen/POST /api/reports/:id/gonePOST /api/alerts {subscription, level: full|critical|none}/POST /api/alerts/test {endpoint}- Admin:
GET|PATCH /api/admin/settings,POST /api/admin/settings/reset,GET /api/admin/days,GET /api/admin/days/:day,POST /api/admin/days/:day/archive|unarchive,GET /api/admin/days/:day/export.csv|geojson,DELETE /api/admin/reports/:id