Skip to content

feat(web): Pandar Cloud sign-in and Devices tab - #22

Merged
5aaee9 merged 1 commit into
mainfrom
feat/web-pandar-cloud
Nov 26, 2026
Merged

5aaee9 merged 1 commit into
mainfrom
feat/web-pandar-cloud

Conversation

@5aaee9

@5aaee9 5aaee9 commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a Cloud menu next to File that signs in to a Pandar Hub. While signed in, a Devices tab shows the tenant's printers with live status. Print plate now sends through the Cloud session, and the manual Physical Printer settings are removed.

This ports the following upstream OrcaSlicer behaviour (v2.5.0, 40ecc66f):

  • Sign-in and sign-out: GUI_App::request_login / ShowUserLogin (GUI_App.cpp:5135, :5363) and GUI_App::request_user_logout (:5448).
  • The Device tab: MainFrame's m_monitor_page / MonitorPanel (MainFrame.cpp:1606-1608), which MainFrame::show_device (:1661-1745) inserts after Preview.

The architecture doc docs/architecture/web-pandar-print-host.md is updated.

Sign-in

  • The dialog asks only for the Hub URL and remembers the last one.
  • A popup opens {hub}/web-sign-in with redirect_url, a PKCE S256 code_challenge and a random state.
  • The Hub sends the popup back to public/cloud-callback.html with a one-use ticket. That page posts { ticket, state } on the ares.cloud BroadcastChannel. The app's Cross-Origin-Opener-Policy: same-origin header severs window.opener, so the popup cannot report back directly.
  • The app exchanges the ticket and the PKCE verifier at POST /api/v1/web/login-tickets/exchange for a 30-day web:session tenant token.

Session storage

  • The session (token, expiry, tenant, user) and the Hub URL are stored in the cloud field of ares.config and mirrored in the store.
  • An expired session is not restored on load.
  • Sign-out, or any 401 from the tenant API, drops the token and keeps the Hub URL.
  • The old printHost field is dropped on load, not migrated.

Devices tab (#/devices)

  • One card per printer: status, nozzle, bed and chamber temperatures, and the running print's name, layer, time left and progress.
  • The tab loads GET /printers, then opens the printer-event WebSocket. Each printer_snapshot replaces its printer. A closed socket reconnects after 5 s.
  • The socket is open only while the tab is shown.
  • While signed out, the route redirects to Prepare.

Print plate

  • When signed out, Print plate opens the sign-in dialog and then the send dialog.
  • The upload itself is unchanged and now uses the session token.

Depends on

The Pandar Hub web sign-in endpoints (/web-sign-in, web/login-tickets, web:session scope) come from ProjectPandar/pandar#18.

Testing

  • New web/e2e/pandarCloud.spec.ts. The fake Hub in web/e2e/pandarHub.ts redirects the popup and accepts the exchange only when SHA-256(verifier) equals the challenge it issued. The spec checks:

    • the stored session after sign-in;
    • the printer cards, then a live printer_snapshot update;
    • that the session survives a reload;
    • that sign-out removes the Devices tab and keeps the Hub URL.

    Screenshots and session.json are written to target/web-e2e/pandar-cloud/.

  • web/e2e/pandarSend.spec.ts now signs in through Cloud before sending.

  • Local results: bun run fmt:check, lint, typecheck and test:unit pass. The pandar, persistence, fileMenu and about E2E specs pass on desktop. The iPhone/iPad mobile specs were not run locally because WebKit is not installed.

🤖 Generated with Claude Code

Port GUI_App::request_login / request_user_logout and MainFrame's Device
tab (MainFrame.cpp:1606-1608, show_device) over the Pandar Hub web login
ticket: a Cloud menu next to File signs in through a PKCE popup, the
web:session token is kept in ares.config, and a Devices tab shows the
tenant's printers live from the printer-event socket. Print plate now
sends through the Cloud session; the manual print host is removed.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T17:34:15.830042Z e20649b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@5aaee9
5aaee9 enabled auto-merge November 26, 2026 17:14
@5aaee9
5aaee9 added this pull request to the merge queue Nov 26, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e20649bf37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +93 to +97
const response = await fetch(`${hub}/api/v1/web/login-tickets/exchange`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ticket: await ticket, code_verifier: verifier }),
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Abort the exchange request when sign-in is cancelled

If the popup has already delivered its ticket and the exchange request is still in flight, clicking Cancel only aborts the ticket wait; this fetch has no abort signal and will still save the session and update app state after the dialog was cancelled. Pass the controller signal to the exchange request (and ignore its result after cancellation) so cancelling cannot unexpectedly sign the user in.

Useful? React with 👍 / 👎.

Merged via the queue into main with commit debc6ea Nov 26, 2026
16 checks passed
@5aaee9
5aaee9 deleted the feat/web-pandar-cloud branch November 28, 2026 12:28
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