Skip to content

Canvases in any browser: Canvas App at /canvas/, ?instance= on the canvas room socket - #4

Merged
collinrijock merged 1 commit into
mainfrom
feat/canvas-browser-access
Oct 20, 2026
Merged

collinrijock merged 1 commit into
mainfrom
feat/canvas-browser-access

Conversation

@collinrijock

Copy link
Copy Markdown
Contributor

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 as crates/copper-cloud/assets/canvas-app.html; packaging/sync-canvas-app.sh [REF] | --check keeps it current.
    • It runs on the same origin, so no CORS is needed. It talks to the linked Canvas Cloud through the same /v1/canvases… proxy Copper uses.
    • The route is ungated, like /join, and holds no data.
    • Headers: no-cache, nosniff, Referrer-Policy: no-referrer, CSP frame-ancestors 'none'; the rest of the policy is the page's own <meta> CSP.
    • /canvas redirects with 308.
  • The gate takes ?instance= on /v1/canvases/{id}/ws upgrades only (INSTANCE_QUERY). Request logs never record query strings. The canvas link now strips instance= along with token=, 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 updated: docs/canvas.md (new Canvas App section), docs/canvas-link.md (query and header rules), README.

Tests

  • cargo clippy --workspace --all-targets -D warnings is clean.
  • cargo test -p copper-cloud-core -p copper-cloud-canvas-link -p copper-cloud passes against Postgres 16. New tests:
    • app::tests::canvas_sockets, instance_from_query;
    • proxy::tests::query_drops_token (now also instance=);
    • 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 neither token nor instance. Without the key, or with a wrong one, it gets 401 instance_key.
    • canvas_app::serves_canvas_app;
    • the landing-page link assertion.

After merge

  • dev1: release, then deploy/aws/up.sh <name> --release vX. Felipe holds that state.
  • Browser users: open 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

…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>
@collinrijock
collinrijock merged commit 9aa67f5 into main Oct 20, 2026
2 checks passed
@collinrijock
collinrijock deleted the feat/canvas-browser-access branch October 20, 2026 00:04
astherath added a commit that referenced this pull request Oct 20, 2026
…m socket (browser access, #4)

Release of #4 (canvases in any browser). Version bump, lockfile,
docs/v0.11.1.md release notes, README/install tarball examples. No migrations; 0.11.0 -> 0.11.1
is a binary swap.
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