fix(p533): don't kill the engine on plain-HTTP hosts#1133
Merged
Conversation
crypto.subtle only exists in secure contexts (HTTPS or localhost). On a self-hosted instance reached over plain HTTP (http://192.168.x.x:3001), sha256Hex() threw "crypto.subtle is undefined" during the data-file integrity check, which took down the whole P.533 engine and surfaced as "WASM engine unavailable" — sending self-hosters chasing a wasm install problem that didn't exist (the wasm bundle was fine). Skip the integrity check when crypto.subtle is absent, with a one-time console warning. gzip's own CRC still catches corruption, and the bytes come from our own same-origin proxy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #1129.
Diagnosis
The reporter's screenshot shows the real error:
WASM engine unavailable … (can't access property "digest", crypto.subtle is undefined).crypto.subtleonly exists in secure contexts (HTTPS or localhost). A self-hosted instance reached over plain HTTP on a LAN address doesn't have it, sosha256Hex()threw during the P.533 data-file integrity check — killing the whole engine and surfacing as a WASM problem. The wasm bundle itself was installed and serving correctly (as the reporter verified), and the official instance works because it's HTTPS.Fix
Skip the integrity check when
crypto.subtleis absent, with a one-time console warning. This is safe: gzip's own CRC still catches corruption, and the bytes come from our own same-origin/api/p533-data/proxy.Verification
crypto.subtleabsent,fetchAndDecompressstill delivers data, the manifest hash (deliberately wrong in the fixture) is never consulted, and the warning fires exactly once across assets.Same change is on Staging as 087aea6.
🤖 Generated with Claude Code