New Desktop App - #21
Open
princebaretto99 wants to merge 1 commit into
Open
Conversation
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.
Summary
Replaces the Electron-based Percy Desktop App with a lightweight, native Node.js desktop app (
desktop-app/) — no Electron, no Chromium runtime bundled into the installer. It keeps the same job (start/stop a local Percy server for the Chrome extension) but ships as a proper double-clickable app with a real menu bar icon, and fixes several extension-side bugs surfaced while getting the new app working end-to-end with current@percy/cli.What's new:
desktop-app/native/tray.swift), compiled as a universal arm64+Intel binary and driven by the Node process over stdin/stdout JSON. Windows/Linux use the smallsystray2native helper. Menu shows live "Percy server: running/stopped" status, "Stop Percy server", and "Quit".@yao-pkg/pkg, not Electron — Node is bundled into the executable, so end users don't need Node/npm installed.npm run build:macproduces a proper.appbundle (LSUIElement, no Dock icon, ad-hoc signed);build:win/build:linuxproduce standalone executables.localhost:3778:POST /percy/start— starts the local Percy server (spawns the standalone Percy CLI, downloaded once from the officialpercy/cliGitHub releases into~/.percy-desktop-app/bin)POST /percy/snapshot— proxies a snapshot upload to the Percy server (see "Why a proxy" below)POST /percy/stop— stops the Percy serverGET /healthcheck— app + Percy server statusPERCY_BROWSER_EXECUTABLE— faster startup, no ~150MB browser download, and avoids an Apple Silicon/Rosetta browser-launch timeout Percy's bundled x86_64 Chromium hit in testing.Hostheader (defends against DNS rebinding) and rejects state-changing requests (/percy/start,/percy/snapshot,/percy/stop) from non-extension web origins, since any webpage can otherwise reachlocalhost.~/.percy-desktop-app/app.log(a double-clicked app has no terminal).See
desktop-app/README.mdfor build/run instructions and full API docs.Extension-side fixes (
utils/percy-utils.ts)Getting a real end-to-end build working against current
@percy/clisurfaced a few bugs, unrelated to Electron vs. Node but blocking either desktop app:Percy.finalise()can legitimately run for 30–60s+ (Percy server startup + snapshot uploads), but a pendingfetchdoesn't reset Chrome's ~30s service worker idle timer — only extension API calls do. Added achrome.runtime.getPlatformInfo()keepalive ping for the duration offinalise().stopPercy()used GET; Percy CLI's/percy/stoponly accepts POST. Was silently 404ing and leaving builds stuck in "Receiving"./percy/snapshotand/percy/stop(loopback-origin-only check, added for CSRF hardening in newer CLI versions — the extension'schrome-extension://origin fails it). Routed both calls through the desktop app's proxy endpoints instead of hitting Percy directly; the desktop app forwards them origin-less, server-to-server.import { it } from "node:test"accidentally left in the file.Testing
403, spoofedHostgets403, extension-origin requests pass).Manual pass (capture snapshot → finalize → desktop app starts Percy → snapshots upload → build appears on Percy dashboard with received snapshots → server stops) against the packaged app, per OS:
Not done / follow-ups
@yao-pkg/pkgexecutable) opens a console window alongside the tray icon — a pkg limitation.