v1.2.0 — Transforms, DOM-API refactor, CI workflow#8
Merged
Merged
Conversation
Closes the 3 CodeQL "DOM text reinterpreted as HTML" alerts and eliminates the entire class of XSS sinks structurally. Introduces el() and svgEl() helpers; every attribute and text node now flows through setAttribute / createTextNode, never through the HTML parser. 14 innerHTML writes removed; 0 remain in public/index.html.
Wire in a transform pipeline between buildSourcePipeline() and the encoder. Applied in fixed order (orient → crop → resize) to match user mental model. Resize modes: max (preserves aspect), exact (fit:cover), percentage. Upscale toggle gates enlargement in max + percentage modes (exact always allows enlargement since the option is contradictory there). Crop supports 1:1 / 4:3 / 16:9 / 3:2 / custom WxH aspects via center crop. Rotate accepts 90/180/270 only; other values are no-ops. WebP byte-identical guarantee preserved: a missing transforms field or any transforms-at-default makes the helper a no-op on the pipeline. 20 server tests pass including 8 dimension assertions and a composition test with metadata toggles + format options.
Collapsible section between Privacy and Output folder. Default-collapsed with an "N active" badge in the header when any control is non-default. Resize: segmented mode picker (None / Max / Percentage / Exact) with inputs that swap based on mode. Upscale toggle gates enlargement on Max + Percentage modes (Exact always allows enlargement). Live "resulting dimensions" preview computed from the first file in the list. Rotate: segmented 0/90/180/270. Flip H + Flip V independent checkboxes. Crop: aspect dropdown (None / 1:1 / 4:3 / 3:2 / 16:9 / Custom) with W:H inputs revealed for Custom. Kernel: Lanczos 3 default, disabled until a resize is active. Per-file row gets a "Transforms active: …" notice describing what's set. Reset button next to the badge restores all controls to defaults. Payload sent as `transforms` form field only when any control is non-default — preserves the WebP byte-identical guarantee for stock conversions. End-to-end tested with the server-side applyTransforms() from Phase 1.
Added: - Transforms section (resize, rotate, flip, crop, kernel) with collapsible UI, live dimensions preview, active-count badge, and per-row notice. Sharp-pipeline operations apply in fixed order (orient → crop → resize). 20 server tests + JPEG alpha-flatten regression check all green. - Smart-label Convert / Reconvert split button. - LICENSE file at repo root. - CI workflow on PRs to main (.github/workflows/ci.yml). Changed: - Full DOM-API refactor of public/index.html. 14 innerHTML writes eliminated; el() / svgEl() helpers introduced. Closes the three CodeQL "DOM text reinterpreted as HTML" alerts structurally. Deferred: - RAW input (magick-wasm only extracts embedded preview thumbnails; needs a real RAW decoder). - Manual drag crop boxes (v1.3). WebP byte-identical guarantee verified preserved.
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.
v1.2.0 — Transforms, DOM-API refactor, CI workflow
Summary
Adds a full image-processing pipeline (resize, rotate, flip, crop, resample
kernel) alongside the existing format conversion, replaces the ambiguous
"Convert all" with a context-aware split button, and structurally closes
the three lingering CodeQL XSS alerts by replacing
innerHTMLusage withexplicit DOM construction. Lands the GitHub Actions CI smoke workflow that
was deferred from v1.1 closing.
7 commits, 9 files changed, +1293 / −158 lines. WebP byte-identical output
preserved.
What's new (user-facing)
Transforms section
A new collapsible section between Privacy and Output folder:
fit: 'cover')modes; Exact always allows enlargement (the option would be contradictory).
crop only in v1.2; manual drag crop boxes deferred to v1.3.
or Nearest (sharp pixels). Disabled until a resize is active.
in the list. A small "N active" badge in the section header signals
when any control is non-default. A Reset button restores everything
to defaults. Per-file row gets a
Transforms active: …noticesummarising what will happen.
Smart-label Convert button
The single ambiguous "Convert all" button becomes a context-aware split
button. The primary label adapts to file state:
Convert N filesConvert N newReconvert all (N+M)Reconvert all N filesThe ⌄ dropdown only appears when there's a meaningful alternative.
Architecture (the substance)
Server-side transforms
applyTransforms(pipeline, transforms)is a new helper called once at theendpoint level, between
buildSourcePipeline()and the encoder. Operationsapply in fixed order: orient → flip → crop → resize. Matches the
user's mental model and makes the pipeline predictable.