trying to work out oauth for Bungie API
  • JavaScript 61.3%
  • PHP 23.7%
  • CSS 8.5%
  • Python 5.4%
  • HTML 0.7%
  • Other 0.4%
Find a file
2026-07-25 23:00:44 -07:00
app Hide border around the signed-in player in the compact view 2026-07-25 23:00:44 -07:00
docs Configure log rotation for armor/fireteam and deploy armor logging 2026-07-20 21:46:28 -07:00
nginx Add Guardian Inspector: 3D equipped-gear viewer with per-character switching 2026-07-20 03:53:42 -07:00
sql Add Guardian Inspector: 3D equipped-gear viewer with per-character switching 2026-07-20 03:53:42 -07:00
tools Show equipped Super icon under ghost in the fireteam gear rail 2026-07-18 23:16:51 -07:00
.gitignore Add Guardian Inspector: 3D equipped-gear viewer with per-character switching 2026-07-20 03:53:42 -07:00
CHANGELOG.md Patch armor board in place instead of full rebuild on refresh 2026-07-25 00:57:37 -07:00
deploy-armor.sh Rename deploy.sh to deploy-armor.sh, fix .armor.env references 2026-07-15 10:33:20 -07:00
deploy-fireteam.sh Refactor repo to handle multiple web apps being built and deployed 2026-07-15 11:05:03 -07:00
deploy-inspector.sh Add Guardian Inspector: 3D equipped-gear viewer with per-character switching 2026-07-20 03:53:42 -07:00
env.example Add v1: Bungie OAuth login and armor item viewer 2026-07-12 01:40:32 -07:00
LICENSE Add v1: Bungie OAuth login and armor item viewer 2026-07-12 01:40:32 -07:00
README.md Add last-3-months/last-100-activities toggle to the bucket bar 2026-07-17 02:13:52 -07:00

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 (112), 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

  1. Copy env.example to app/.armor.env / app/.fireteam.env and fill in real values (Bungie app credentials — see docs/app-setup-guide.md; each app needs its own Bungie Application Portal registration and its own MySQL credentials or a shared svc_site account against the d2stats database).
  2. Run the relevant sql/NNN_*.sql files against d2stats (001 armor sessions, 002 fireteam sessions, 003 fireteam PGCR-collection opt-in table).
  3. Add the app's location /{app}/ nginx block (see nginx/d2stats.bjorna-3.net.example), then sudo nginx -t && sudo systemctl reload nginx.
  4. Run ./deploy-armor.sh and/or ./deploy-fireteam.sh.
  5. fireteam only — create tools/.venv (python3 -m venv tools/.venv && tools/.venv/bin/pip install pymysql), a writable fireteam-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

License

GPLv3 — see LICENSE.