- JavaScript 61.3%
- PHP 23.7%
- CSS 8.5%
- Python 5.4%
- HTML 0.7%
- Other 0.4%
| app | ||
| docs | ||
| nginx | ||
| sql | ||
| tools | ||
| .gitignore | ||
| CHANGELOG.md | ||
| deploy-armor.sh | ||
| deploy-fireteam.sh | ||
| deploy-inspector.sh | ||
| env.example | ||
| LICENSE | ||
| README.md | ||
D2 Tools
Destiny 2 web tools, sharing one nginx host, one PHP/PDO/MySQL deploy pattern, and one Bungie.net OAuth approach — each app gets its own DB tables and its own deploy script, so nothing crosses between them.
Apps
- armor — sign in with Bungie.net and see your armor (helmet, gauntlets, chest, legs, class item) across all characters and the vault, with per-piece archetype/set-bonus/tier detail and drag-to-equip.
- fireteam — leave-the-tab-open live fireteam dashboard: one card per guardian (1–12), gear rail, an activity bar (3-month or last-100-activities view, toggled by clicking your own card's bar), and a stat panel that switches based on what the fireteam is playing. Opt-in PGCR collection per guardian for deeper stats later.
How this repo works
This repo is the dev/codebase — it is not served directly. The live site is served by nginx from /var/www/d2stats.bjorna-3.net/. All app code lives under app/, mirroring the deploy target, with one .{app}.env and one deploy-{app}.sh per app:
app/
.armor.env <- secrets/config (gitignored, never commit)
armor/ <- deployed 1:1 to /var/www/d2stats.bjorna-3.net/armor/
.fireteam.env <- secrets/config (gitignored, never commit)
fireteam/ <- deployed 1:1 to /var/www/d2stats.bjorna-3.net/fireteam/
tools/ <- cron-invoked scripts (manifest refresh, PGCR collection), run from this
checkout directly — not part of either deployed tree
Run ./deploy-armor.sh or ./deploy-fireteam.sh to rsync that app's app/{app}/ to its docroot and its .{app}.env to /var/www/d2stats.bjorna-3.net/{app}.env (kept one level above the docroot so it's never web-reachable).
Each app's .env is checked server-side only; Bungie API calls happen directly from the browser using the API_KEY/OAUTH_CLIENT_ID that config.php hands it — PHP only ever handles the OAuth secret exchange/refresh and session storage. See docs/architecture.md (armor) and docs/AGENT_BRIEF-fireteam.md (fireteam) for the full design.
Setup
- Copy
env.exampletoapp/.armor.env/app/.fireteam.envand fill in real values (Bungie app credentials — seedocs/app-setup-guide.md; each app needs its own Bungie Application Portal registration and its own MySQL credentials or a sharedsvc_siteaccount against thed2statsdatabase). - Run the relevant
sql/NNN_*.sqlfiles againstd2stats(001armor sessions,002fireteam sessions,003fireteam PGCR-collection opt-in table). - Add the app's
location /{app}/nginx block (seenginx/d2stats.bjorna-3.net.example), thensudo nginx -t && sudo systemctl reload nginx. - Run
./deploy-armor.shand/or./deploy-fireteam.sh. - fireteam only — create
tools/.venv(python3 -m venv tools/.venv && tools/.venv/bin/pip install pymysql), a writablefireteam-manifest-cache//fireteam-history-cache/pair one level above the docroot, and a/var/log/d2-tools/fireteam/log directory (kurt:www-data,775). Then add the two cron entries below.
fireteam cron jobs
# manifest refresh (activity/mode/season tables, hash-families, item icons) — daily
0 6 * * * cd /home/kurt/git/d2-tools && tools/.venv/bin/python3 tools/update_manifest.py --manifest-dir /var/www/d2stats.bjorna-3.net/fireteam-manifest-cache --env-file /var/www/d2stats.bjorna-3.net/fireteam.env >> /var/log/d2-tools/fireteam/manifest.log 2>&1
# opt-in PGCR collection for checked guardians — hourly
0 * * * * cd /home/kurt/git/d2-tools && tools/.venv/bin/python3 tools/collect_pgcrs.py --history-dir /var/www/d2stats.bjorna-3.net/fireteam-history-cache --env-file /var/www/d2stats.bjorna-3.net/fireteam.env >> /var/log/d2-tools/fireteam/pgcr-collect.log 2>&1
Docs
- docs/architecture.md — armor's OAuth + session design (fireteam's is the same pattern, see the brief below)
- docs/app-setup-guide.md — Bungie app registration reference
- docs/plan-v1.md through plan-v5.md — armor's versioned build checklists
- docs/AGENT_BRIEF-fireteam.md — fireteam's hard rules, API landmines, and bucket/panel design (start here for fireteam)
- docs/fireteam-plan-v1.md — fireteam's approved v1 build plan
- docs/oauth-documentation.txt, docs/about-the-api.txt — Bungie's own API/OAuth reference docs
License
GPLv3 — see LICENSE.