Repository navigation
fix(site): read digests as the API ships them, add a favicon, un-box the UI - #11
Merged
Merged
Conversation
…the UI The SHA-256 column used to fetch checksums.txt from github.com/.../releases/download/... That origin 302s to a CDN whose response carries no Access-Control-Allow-Origin, so every real browser blocked the request and rendered the table hashless. (The API asset endpoint fails the same way - the final response is the one the browser checks, and it has no ACAO header either.) The browser-side fix is to stop re-downloading the file at all: every release asset already carries a digest field in the /releases/latest response, which matches checksums.txt exactly and arrives over api.github.com, the one origin that sends CORS headers. The page is now exactly one request to one CORS-safe origin, and a regression test asserts that request budget offline. Also un-box the visual design: hard #262c37 borders read as dirt on the dark palette and made cards, pills and callouts look flat. Surfaces are now separated by gradient, hairline and shadow, and hover states arrive as tints. The favicon is a hand-drawn SVG plus a four-size ICO, linked from all five pages.
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.
Why
The live download table shipped broken for every real visitor. The page fetches
checksums.txtfromgithub.com/DevCop95/pullgoscript/releases/download/...to fill its SHA-256 column, and that origin cannot be read from a browser:
the endpoint answers with a 302 to
release-assets.githubusercontent.com, andneither the redirect nor the final CDN response carries
Access-Control-Allow-Origin. Chrome (and every other browser) refuses theresponse, logs
blocked by CORS policy, and the table renders hashless.Verified with raw requests: neither hop sends ACAO. Following the redirect from
the API asset endpoint (
Accept: application/octet-stream) does not helpeither — the final response is the one the browser checks, and it also has
none. No amount of redirect-chasing fixes a CDN that does not opt in.
Meanwhile the page already had a CORS-clean source for every hash it needed:
the
digestfield each asset carries in the/releases/latestresponse(
api.github.comsendsAccess-Control-Allow-Origin: *), which matcheschecksums.txtbyte for byte — verified against the published v2.0.2 file forall four hashed assets.
What changed
1.
site.js— one request, one CORS-safe origin.parseSumsand the second fetch are gone. The SHA-256 column is now filledfrom
a.digest.hashOf()accepts only exactlysha256:+ 64 hex characters;anything else (absent, truncated, a different algorithm) renders as an em dash,
never as a plausible-looking wrong hash. The status line distinguishes the
all-digests case from a partial one and states the counts.
2.
site.test.js— the regression test for this bug. The failure wasinvisible to DOM stubs because stubs do not implement CORS: a stub happily
"returns" a cross-origin body a real browser would refuse. So the test asserts
the request budget instead — exactly one fetch, to
https://api.github.com/..., and any other origin is both flagged as aviolation and made to fail the way a browser fails (opaque rejection). Also
rewritten: fixtures carry real digest values, the old
sumsText/sumsBrokenscenarios are replaced by a digests-malformed scenario (absent / truncated /
non-sha256 → em dash), and the pinned-fallback check now compares against the
fixture's digests. 35 assertions pass, zero dependencies, zero network.
3. Favicon —
favicon.svg+favicon.ico, linked from all five pages.The 404 reported was the browser's default
/favicon.icoprobe, which onlyfires when no icon is declared; a
<link rel="icon">stops it. SVG drawn byhand (console prompt: red chevron, amber cursor), ICO generated at real
16/32/48/64 sizes. Both served locally at 200 before this PR.
4.
site.css— un-box the design. The palette drew a saturated 1px#262c37stroke around cards, pills, callouts, code and tables on a near-blackbackground, so every surface read as a dirty wireframe box. Surfaces are now
separated by gradients, 6%-white hairlines and shadows; cards lift on hover;
callouts keep their accent bar and gain a tinted fill; pills are tinted chips
instead of caged text;
h2rules are softened to a 5% break. No HTML or classnames changed — CSS only.
Verification
node docs/site.test.js: 35/35 (fixtures), plainnode, no installspython -m http.serversmoke:/,/favicon.svg,/favicon.ico,/site.cssall 200v2.0.2 pinned fallback in
index.htmlwas regenerated only in the sense thatthe release genuinely carries these digests (no numbers were edited by hand)