Skip to content

feat(deeplink): open comfy:// links to cloud.comfy.org in the app#1073

Draft
deepme987 wants to merge 3 commits into
mainfrom
deepme987/desktop2/cloud-deeplink
Draft

feat(deeplink): open comfy:// links to cloud.comfy.org in the app#1073
deepme987 wants to merge 3 commits into
mainfrom
deepme987/desktop2/cloud-deeplink

Conversation

@deepme987

Copy link
Copy Markdown
Collaborator

PR A of 2 for "open cloud.comfy.org links in Desktop" (companion: a cloud-web banner in ComfyUI_frontend that fires the link).

What

Registers the comfy:// URL scheme and opens deep links into the Comfy Cloud host window:
comfy://open?path=/workflows/123 → loads https://cloud.comfy.org/workflows/123 (focus if running, launch if not). Also accepts ?url=<encoded cloud url>.

How

  • app.setAsDefaultProtocolClient('comfy') + mac.extendInfo.CFBundleURLTypes in todesktop.json.
  • Cross-platform receive: macOS open-url (buffers a link that arrives before whenReady); Windows/Linux from process.argv at cold start and from the existing second-instance handler.
  • New pure module src/main/lib/deepLink.tsresolveDeepLink(raw): string | null.

Security

The raw OS string is untrusted. resolveDeepLink accepts only the comfy: scheme and allowlists the resolved origin to https://cloud.comfy.org — rejecting other schemes/origins, smuggled absolute URLs, protocol-relative //evil.com, and backslash tricks, with a final origin re-validation. It never returns a non-cloud URL. Fully unit-tested (22 cases).

Verify

typecheck + lint clean; deepLink.test.ts 22/22; full unit suite 2151/2151. Note: OS-level scheme registration can only be confirmed on a packaged/ToDesktop build (open "comfy://open?path=/x"); the parsing/routing/allowlist is what's unit-tested here.

Register the comfy:// URL scheme and route comfy://open?path=/... (or
?url=https://cloud.comfy.org/...) to the Comfy Cloud host window. Links
are received cross-platform (macOS open-url incl. cold-start buffering;
Windows/Linux via argv on launch + second-instance). The raw URL is
untrusted: resolveDeepLink allowlists the resolved origin to
cloud.comfy.org and returns null for any other scheme/origin, including
protocol-relative and backslash tricks. OS-level scheme registration
needs a packaged/ToDesktop build to verify end to end; the parse +
allowlist is unit-tested.
@deepme987

Copy link
Copy Markdown
Collaborator Author

Companion PRs

This PR handles the scheme + routing; #12808 is the web side that produces the links. Contract: comfy://open?url=<encoded https://cloud.comfy.org/...>.

@CLAassistant

CLAassistant commented Jun 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 484fe459-3cf6-4951-885b-9c9129221b97

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deepme987/desktop2/cloud-deeplink
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch deepme987/desktop2/cloud-deeplink

Comment @coderabbitai help to get the list of available commands and usage tips.

- add root-level protocols block so electron-builder declares the scheme
  on every OS: macOS CFBundleURLTypes, Windows NSIS registry, Linux
  .desktop MimeType
- without it setAsDefaultProtocolClient is a no-op for packaged macOS, so
  the OS never routes comfy:// links to the app
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.

3 participants