Skip to content

Releases: 447662/dsh-copy-image

v0.2.0 - clipboard copy that actually copies

Choose a tag to compare

@447662 447662 released this 19 Oct 18:20

What this fixes

Two bugs found in a real session, both fixed here.

The page froze after using the viewer

The closed overlay was hidden with opacity: 0 alone, so its invisible
full-viewport backdrop stayed in the hit-testing tree and swallowed every click
and drag. Esc and scrolling did nothing because the backdrop was still on top.

It is now display: none + pointer-events: none while closed, and only
display: flex + pointer-events: auto when open. Opening also tears the
overlay down instead of leaving a half-built one if construction throws. Right
and middle clicks no longer open the viewer at all.

Copy did nothing while Save worked

The pixels were fine - Save goes through the same export - but
navigator.clipboard.write rejects in an Electron renderer when the harness's
per-session permission handler denies clipboard-write. The copy is now written
by the host process, which is not behind that gate:

renderer --POST /dsh-copy-image/copy (image/png)--> host
host     writes a temp PNG, runs a short STA PowerShell that calls
         Clipboard.SetImage, verifies by reading back, deletes the temp file

Every route is loopback-only, and the temp path is passed to PowerShell as a
single-quoted literal so a filename cannot inject script.
navigator.clipboard.write stays as the fallback for plain-browser profiles.

Install

dsh plugin --profile desktop add github:447662/dsh-copy-image

Then fully quit DSH and reopen - the host half registers a route, so a page
refresh is not enough.

Test

node test/contract.cjs

25 assertions, including a regression guard that the closed overlay cannot block
the page again.