You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add GitHub Discussions-backed voting, truth predictions, and difficulty ratings
Replace the Cloudflare Worker + KV voting backend with GitHub Discussions.
Likes are HEART reactions, truth predictions are THUMBS_UP/DOWN reactions,
difficulty ratings are discussion comments. A shared App Engine proxy at
formal-conjectures-web-worker.uc.r.appspot.com handles OAuth and anonymous
reads using GitHub App installation tokens.
Key changes:
- voting.js: complete rewrite for GitHub Discussions backend
- theorem.js/browse.js: enable voting integration and new sort options
- appengine/: new App Engine proxy (replaces site/worker/)
- build.js: accept pre-processed JSON from the live site
- Workflow: -webtest branches skip Lean build, download JSON, inject config
- Consent modal on first interaction explaining public nature of activity
- OAuth callback routed through proxy so one URL works for all forks
Interactive voting widgets are temporarily disabled; read-only discussion
data (vote counts, predictions, difficulty) is displayed via the proxy.
Handles GitHub App OAuth token exchange and anonymous discussion reads for the voting system. One deployment serves all forks.
4
+
5
+
For an overview of the voting system, see [`docs/voting.md`](../docs/voting.md).
6
+
7
+
## Shared Proxy
8
+
9
+
The default deployment at `formal-conjectures-web-worker.uc.r.appspot.com` is used automatically by the CI workflow. Forkers don't need their own proxy — just install the [formal-conjectures-voting](https://github.com/apps/formal-conjectures-voting) GitHub App on their fork.
10
+
11
+
The shared proxy:
12
+
- Uses GitHub App installation tokens (works for any repo where the app is installed)
13
+
- Only serves `google-deepmind/formal-conjectures` and its forks
14
+
- Allows any `*.github.io` origin via CORS
15
+
- Routes OAuth callbacks so a single registered callback URL works for all forks
Proxy runs on `http://localhost:8080`. Secrets from env vars skip Secret Manager.
79
+
80
+
## API Endpoints
81
+
82
+
### `POST /token`
83
+
84
+
Exchanges a GitHub OAuth `code` for an access token. Body: `{ "code": "..." }`.
85
+
86
+
### `GET /oauth/callback?return_to=URL`
87
+
88
+
OAuth redirect bounce. Validates `return_to` is `*.github.io` or localhost, appends the `code` parameter, and redirects.
89
+
90
+
### `GET /discussions?owner=OWNER&repo=REPO`
91
+
92
+
Aggregated discussion data (votes, predictions, difficulty). Uses GitHub App installation tokens. Cached 60 seconds. Returns 403 if the repo is not `google-deepmind/formal-conjectures` or a fork of it.
93
+
94
+
## Configuration
95
+
96
+
| Variable | Source | Description |
97
+
|---|---|---|
98
+
|`ALLOWED_ORIGIN`|`app.yaml` / env | Extra CORS origins (`.github.io` allowed automatically) |
0 commit comments