Repository navigation
Opt-in update banner, off by default - #202
Merged
Merged
Conversation
ARTEX_UPDATE_CHECK=1 lets the backend check the public GitHub releases API for the latest tag at most once per 24 h (in-memory cache; failures are not retried in the window) and report it in GET /api/health when it is newer than the build version. The web UI shows a dismissible strip linking to the Releases page. Unset (the default), no update request is made.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An opt-in update banner, off by default.
ARTEX_UPDATE_CHECK(follows the existingARTEX_*env-flag pattern, e.g.ARTEX_RSI_LESSONS,ARTEX_UNTRUSTED_BOUNDARY). Accepted on-values:1,true,on,yes. Default: unset = off.GET /api/healthhas nolatest_versionfield; the UI renders no banner.GET /api/health, the backend askshttps://api.github.com/repos/BaaRai/ARTEX/releases/latestfortag_name, at most once per 24 h (in-memory cache: timestamp + tag). A failed check (network error, non-200 such as a rate limit, bad JSON) also stamps the time, shows nothing, and is not retried in that window. The request carries onlyUser-Agent: artex-update-checkandAccept: application/vnd.github+json: no cookies, no user or host identifiers.main.versioninjected from the git tag bybuild.shvia ldflags, handed toserver.BuildVersion). Leadingmajor.minor.patchis compared (2.2.0-3-gabc-dirtyreads as2.2.0); a non-numeric version such asdevnever shows a banner.web/src/lib/local-storage.client.ts.Files
server/update_check.go: opt-in flag, 24 h cache/decision logic, GitHub fetch, version compare.server/update_check_test.go: unit tests for the decision logic (injected fetch and clock).server/server.go:healthaddslatest_versiononly when the check is on and a newer release exists.web/src/lib/api.ts,web/src/app/(main)/_components/main-content.tsx: optional field + banner..env.example,docker-compose.yml,README.md: document and pass through the flag.Verification
go test ./server/(full package) passes; new tests: off = no fetch and no banner; on = one fetch within 24 h, a second after 24 h; failure = nothing shown and no retry within 24 h; version comparison table.go vet ./server/,go build ./..., gofmt clean.web/:npx tsc --noEmitandnpm run buildpass.Not verified