Repository navigation
Canvases in any browser: Canvas App at /canvas/, ?instance= on the canvas room socket - #4
Merged
Merged
Conversation
…nvas room socket
People who are not on Copper can now use the linked Canvas Cloud's
canvases from a browser, through the same proxy Copper uses:
- GET /canvas/ serves Canvas App (copper-browser/canvas-app's web build,
vendored as crates/copper-cloud/assets/canvas-app.html by
packaging/sync-canvas-app.sh). Same origin, so its REST calls need no
CORS (copper-cloud grants none, and the gate refuses preflights).
- The gate accepts the instance credential as ?instance= on
/v1/canvases/{id}/ws upgrades only: a browser cannot set headers on a
WebSocket. Query strings are never logged, and the canvas link strips
instance= (like token=) before forwarding, so Canvas Cloud never sees it.
- /join/{token} links browsers to /canvas/#/join/{token} under the Copper
button.
Tests: gate unit tests, the proxy's query stripping, a browser-style room
socket end to end through the mock Canvas Cloud (accepted with the query,
401 without or with a wrong one, nothing of ours forwarded), /canvas/
headers and redirect, the landing link. Found by Felipe's canvas-cloud e2e.
Co-Authored-By: Claude Opus 5.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 the gap Felipe's canvas-cloud end-to-end run found: Canvas App could not sync with a copper-cloud such as dev1 from a browser. The gate only reads
x-copper-instance, which a browser cannot set on a WebSocket, and copper-cloud has no CORS, so preflights are refused too.Changes
GET /canvas/serves Canvas App. It's the web build, vendored ascrates/copper-cloud/assets/canvas-app.html;packaging/sync-canvas-app.sh [REF] | --checkkeeps it current./v1/canvases…proxy Copper uses./join, and holds no data.no-cache,nosniff,Referrer-Policy: no-referrer, CSPframe-ancestors 'none'; the rest of the policy is the page's own<meta>CSP./canvasredirects with 308.?instance=on/v1/canvases/{id}/wsupgrades only (INSTANCE_QUERY). Request logs never record query strings. The canvas link now stripsinstance=along withtoken=, so Canvas Cloud never sees Copper's gate credential./join/{token}gets a "Not on Copper? Open it in your browser" link to/canvas/#/join/{token}.docs/canvas.md(new Canvas App section),docs/canvas-link.md(query and header rules), README.Tests
cargo clippy --workspace --all-targets -D warningsis clean.cargo test -p copper-cloud-core -p copper-cloud-canvas-link -p copper-cloudpasses against Postgres 16. New tests:app::tests::canvas_sockets,instance_from_query;proxy::tests::query_drops_token(now alsoinstance=);canvas_link::browser_websocket_carries_the_gate_credential_in_the_query: a browser-style socket through the mock Canvas Cloud is accepted, frames pipe through, and upstream sees neithertokennorinstance. Without the key, or with a wrong one, it gets 401instance_key.canvas_app::serves_canvas_app;After merge
deploy/aws/up.sh <name> --release vX. Felipe holds that state.https://copper.dev.exowatt.com/canvas/and paste a link code; in directory mode that is a personal access key from the portal.A public canvas-cloud (its own hostname,
web_root, no link code) is the longer-term option; it's on feads as a decision.🤖 Generated with Claude Code