mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-27 21:05:34 +00:00
The docs-site leaderboard (docs/javascripts/leaderboard.js) reads the public Supabase anon key from window.OPENJARVIS_SUPABASE_ANON_KEY, but nothing set it, so the published leaderboard always rendered "Leaderboard not configured yet". Add a generated config file (leaderboard-config.js) loaded before leaderboard.js that supplies the global, and inject its value at docs-build time from the existing VITE_SUPABASE_ANON_KEY repo secret. The committed default is empty, so local `mkdocs build` and fork PRs (no secret) degrade gracefully. The anon key is public by design (Supabase RLS protects the data). - docs/javascripts/leaderboard-config.js: empty-default global declaration. - mkdocs.yml: load leaderboard-config.js before leaderboard.js. - docs.yml: write the config from the secret (read via env, JSON-encoded into a JS string literal to avoid injection) before `mkdocs build`. - tests/deployment/test_docs_leaderboard.py: guard the wiring + load order. Verified with a local `mkdocs build`: the generated config ships in site/ and loads before leaderboard.js. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
13 lines
695 B
JavaScript
13 lines
695 B
JavaScript
// Public Supabase config for the savings leaderboard.
|
|
//
|
|
// This file is loaded *before* leaderboard.js and supplies the anon key it
|
|
// reads from `window.OPENJARVIS_SUPABASE_ANON_KEY`. The key is injected at
|
|
// docs-build time from the VITE_SUPABASE_ANON_KEY repo secret (see
|
|
// .github/workflows/docs.yml). It is intentionally empty here so that local
|
|
// `mkdocs build` and fork pull requests — which have no secret — render the
|
|
// graceful "Leaderboard not configured yet" message instead of failing.
|
|
//
|
|
// The anon key is public by design: Supabase Row-Level Security protects the
|
|
// data, so shipping it in the public docs bundle is expected.
|
|
window.OPENJARVIS_SUPABASE_ANON_KEY = "";
|