mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
feat: store the repository picker list and update it by webhook
The anonymize page's "Your repositories" picker now pages and searches a per-user list stored in MongoDB instead of calling GitHub on every page and search. GitHub is read only when the list is empty, when the user presses the new refresh button, or after an installation change marks it stale. - One sync per list (Mongo lock with a renewed lease); full pagination in the background after the first page is returned; rate limits pause syncs. - GitHub App installation, installation_repositories and repository webhooks update the stored lists idempotently. The App must subscribe to the Repository event (documented in docs/github-app-setup.md). - Legacy OAuth lists change only on refresh. - Picker header shows "Updated 3 min ago" and a refresh button. - dev-mock: stored list, simulated refresh and webhook endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0640d741f1
commit
c73e992b7c
22 files changed
+1026
-153
No files matched your search
@@ -29,8 +29,22 @@ Configure:
|
||||
- Allow installation on any account if this is a public service.
|
||||
- Generate a private key and record the App ID, slug, client ID and client secret.
|
||||
|
||||
GitHub delivers installation, installation repository selection, and App user
|
||||
revocation lifecycle events. The webhook verifies raw request bytes before parsing
|
||||
Under **Permissions & events › Subscribe to events**, check **Repository**.
|
||||
GitHub delivers installation, installation repository selection (`installation_repositories`),
|
||||
and App user revocation (`github_app_authorization`) events to every App; the
|
||||
**Repository** event (created, deleted, renamed, transferred, privatized,
|
||||
publicized) is delivered only when subscribed.
|
||||
|
||||
The anonymize page's "Your repositories" picker reads a list stored in MongoDB
|
||||
(`userrepositories`, with one `userrepositorysyncs` row per user and connection).
|
||||
It calls GitHub only when the list is empty, when the user presses refresh, or
|
||||
after an installation change marks it stale. These webhooks update the stored
|
||||
lists in place: an uninstall or deselection removes the affected rows, a
|
||||
suspension hides them, and renames, transfers and visibility changes rewrite
|
||||
them. New repositories are added for the user named by the event; other users
|
||||
of the same installation get a background sync, because only GitHub knows
|
||||
whether they can see a newly added private repository. Legacy OAuth lists get
|
||||
no webhooks and change only on refresh. The webhook verifies raw request bytes before parsing
|
||||
JSON. Failed processing returns an error for operational visibility; use GitHub's
|
||||
delivery redelivery controls after an outage. Pending installation checks also
|
||||
retry on repository access. Access checks verify the user's current repository
|
||||
|
||||
Reference in new issue
Block a user