Files
github-readme-stats/generator
shayandClaude Opus 5 107273a1c8 fix(auth): send an https redirect_uri so GitHub sign-in works
The OAuth app registers https://gh-stats.com/api/auth/github/callback, but
the app was sending the http:// form. GitHub compares redirect_uri to the
registered callback character for character, so it refused every attempt
with "The redirect_uri is not associated with this application" and showed
users a warning that the app might be redirecting them somewhere they were
not expecting. Sign-in has been failing for everyone, and it gates themes,
custom tags and achievements.

_derived_redirect_uri built the URL from X-Forwarded-Proto, falling back to
request.scheme. The cloudflared tunnel does not reliably forward that
header, so the scheme resolved to http. The comment above it claimed the
headers are set, which is what hid this.

Anything that is not localhost or 127.0.0.1 is https. Local dev keeps
working over plain http, pinned by a test.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
2026-08-23 09:38:26 -07:00
..

Generator Service

Serves precomputed SVGs to the public internet. Holds user settings and the widgets cache. Runs a build worker + cron in the background. Also serves the React SPA (frontend sources live under frontend/).

Run locally (3 processes)

cd generator
pip install -r requirements.txt

# API
FETCHER_URL=http://localhost:5001 FETCHER_INTERNAL_TOKEN=dev python -m src.api
# Build worker
FETCHER_URL=http://localhost:5001 FETCHER_INTERNAL_TOKEN=dev python -m src.worker
# Poll cron
FETCHER_URL=http://localhost:5001 FETCHER_INTERNAL_TOKEN=dev python -m src.cron

Frontend (dev)

cd generator/frontend && npm install && npm run dev
# Vite dev server proxies /api to the Flask app.

Test

cd generator && pytest

Docker

Multi-stage (builds the frontend with node, serves everything from Python):

docker build -t ghstats-generator .
docker run --rm -e FETCHER_URL=http://fetcher:5001 -e FETCHER_INTERNAL_TOKEN=dev \
           -p 5002:5002 -v $(pwd)/data:/app/data ghstats-generator
# Worker: override CMD to ["python","-m","src.worker"]
# Cron:   override CMD to ["python","-m","src.cron"]

Endpoints

All API endpoints are under /api/. The root and /assets/* serve the SPA.

Method Path Auth Description
GET /api/health none health
GET /api/ none composite SVG; auto-enrolls unknown users
GET /api//.svg none individual widget SVG
POST /api/enroll none explicit enroll (body: {username})
GET /api//settings stub current settings
PATCH /api//settings stub update settings (enqueues rebuild)
POST /api//refresh stub one-shot re-fetch + rebuild

Responses carry X-Widget-Status: ready | building | rate_limited | not_found.

Env

See src/config.py.