ff14-auth/CLAUDE.md
2026-05-20 08:05:09 +02:00

1.9 KiB

ff14-auth — FFLogs Report Viewer

Projekt

Einfache PHP/HTML/JS-Seite zum Verbinden mit FFLogs via OAuth2 PKCE und Abrufen von Report-Daten über die GraphQL-API. Kein Framework, kein Composer, kein npm — Plain PHP für Shared Hosting.

Dateistruktur

config.php          — Konstanten (CLIENT_ID, URIs) + session_start_safe()
index.php           — Haupt-UI: Connect-Button / Report-Formular / Terminal-Output
auth/
  start.php         — PKCE generieren, Session speichern, Redirect zu FFLogs
  callback.php      — Code gegen Token tauschen, Token in Session speichern
api/
  fight.php         — POST-Endpunkt: GraphQL-Query → JSON
js/
  app.js            — Formular, Dropdown, Fetch, Ausgabe
debug/
  schema.php        — Einmaliges Schema-Explorer Tool (nicht produktiv deployen)

Konfiguration

  • config.php: CLIENT_ID, REDIRECT_URI, DEV_MODE anpassen
  • DEV_MODE = true deaktiviert SSL-Verifizierung (nur lokal, nie in Produktion)
  • session.cookie_secure ist bei DEV_MODE automatisch false

FFLogs API

  • OAuth2 PKCE (kein Client Secret, öffentliche App)
  • App registrieren: https://www.fflogs.com/api/clients/
  • GraphQL Endpoint (user-scoped): https://www.fflogs.com/api/v2/user
  • Token Endpoint: https://www.fflogs.com/oauth/token
  • Kein Refresh Token für öffentliche Clients — abgelaufene Sessions starten PKCE neu

Lokale Entwicklung

php -S localhost:8080

Dann http://localhost:8080 im Browser öffnen. Redirect URI in FFLogs App und config.php: http://localhost:8080/auth/callback.php

Bekannte Schema-Infos (ReportFight)

Verfügbare aber noch nicht genutzte Felder: friendlyPlayers, enemyNPCs, lastPhase, standardComposition, hasEcho, combatTime, phaseTransitions Vollständiges Schema: siehe debug/schema.php oder fflogs-schema.json

Deployment

  • DEV_MODE auf false setzen
  • REDIRECT_URI auf produktive HTTPS-URL anpassen
  • debug/ Ordner nicht deployen