Skip to content

feat: try an optional mirror before GitHub for the tree and files - #9

Merged
m1ngsama merged 2 commits into
mainfrom
feat/mirror-source
Sep 26, 2026
Merged

m1ngsama merged 2 commits into
mainfrom
feat/mirror-source

Conversation

@m1ngsama

Copy link
Copy Markdown
Member

From mainland China the GitHub API often resets or times out, so the docs tree never loads; nbtca's own docs site on Cloudflare stays reachable.

  • DocsClientOptions.mirror (an http(s) base URL) makes listAll and getFile try ${mirror}/index.json and ${mirror}/raw/<path> first, with a 5 s timeout, and fall back to GitHub.
  • The mirror index is validated like the GitHub tree (parseTreeResponse + filterTree); a truncated or malformed index falls back. No GitHub token is ever sent to the mirror.
  • A network error, timeout or 5xx stops the client asking the mirror; a 404 for one file falls back for that file only, so a document not yet mirrored doesn't cut everyone off.
  • Mirrored content goes through the same sha-keyed store. Without mirror behaviour is unchanged; additive, so it ships as 0.3.3.

@m1ngsama
m1ngsama merged commit 0350e52 into main Sep 26, 2026
5 checks passed
@m1ngsama
m1ngsama deleted the feat/mirror-source branch September 26, 2026 15:03
@m1ngsama m1ngsama mentioned this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant