mirror of
https://github.com/github/awesome-copilot.git
synced 2026-07-14 18:11:01 +00:00
0916fe444d
* Add APNG Studio canvas extension APNG Studio is an interactive GitHub Copilot canvas extension for building Animated PNG (APNG) files from frames: draw or upload frames, tune per-frame timing and compositing, preview live, send the result to a phone by QR, and export an animated .png. Adds extensions/apng-studio/ with the required .github/plugin/plugin.json and assets/preview.png, and regenerates .github/plugin/marketplace.json. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address review feedback for APNG Studio Security and robustness (extension.mjs): - Reject "." and ".." project ids so canvas/action input cannot resolve outside artifacts/. - Bound request bodies (1 MiB JSON, 40 MiB frame upload); return 413 when exceeded. - Reject malformed JSON with 400 instead of coercing to {}, so a truncated body cannot trigger destructive routes such as /frames/clear. - Scope shares per project so one canvas cannot rotate or stop another's share; the LAN server is shared and torn down once no shares remain. - get_state treats hiddenFirst as active only with >=2 frames, matching the encoder, so a single-frame project reports the correct duration. Accessibility (web/): - Expose Pen/Eraser state with aria-pressed and keep it in sync in setTool. - Mark the toast as an aria-live status region. Packaging: - Add extensions/apng-studio/.gitignore with artifacts/ so the documented runtime-data exclusion holds for this extension. - Update the README install section to reference the committed awesome-copilot extension path. Regenerated .github/plugin/marketplace.json. * Use "GitHub Copilot app" wording Update the plugin description (and regenerated marketplace entry) to refer to the host as the GitHub Copilot app. * Address deeper review for APNG Studio Security: - Require a per-server access token on every loopback data/mutation request (minted per canvas server, carried in the iframe URL, attached to every renderer request). Static assets stay public. Blocks a local process or cross-origin page from reading state or driving mutations. Concurrency and durability: - Serialize the load-mutate-save cycle per project; dedupe concurrent first loads; write project.json via temp file + rename. Lifecycle: - Track SSE clients per instance and end them before server.close(). - Stop a project's LAN share only when no other panel references it. Correctness: - Report exact numerator/denominator total duration; handle pointercancel. QR and accessibility: - Place QR version bits least-significant-bit first (versions 7-10). - Associate delay/fps/dispose/blend labels with their inputs via for=. * Address deeper concurrency and validation review for APNG Studio - Run assemble() under the project lock; add_color_frame renders and appends within one lock. - Validate uploaded frames (PNG chunk scan, size + dimension checks) before writing; first frame stores real dimensions; CanvasError maps to 400. - Validate move delta; clear frames in memory before deleting files. - Route the open-handler rename through applySettings. - Deduplicate LAN share startup; clean up if the canvas closes mid-start. - End SSE streams before server.close(); skip dead streams in broadcast. - Exact fractional duration; drawing surface stays >= 1px; refresh state before re-seeding "start from last frame". * Address review: PNG format validation, share bind, limits, a11y - Validate uploaded frames are 8-bit RGBA non-interlaced PNGs (standard compression/filter); reject formats the codec can't encode. - Cap projects at 600 frames (add + duplicate). - Bind the LAN share server to the private address, not 0.0.0.0; require a private address and rebind when it changes while idle; build the URL from the bound address. - Align width/height inputs and clampSize to the 2048 maximum. - Size the drawing surface by width + aspect ratio for narrow panels. - set_frame with an unknown frameId returns a validation error. * Address review: encoded-byte budget, timing modes, id keys, load errors - 256 MiB aggregate encoded-byte budget (add + duplicate); per-frame size tracked and backfilled on load, so a frame count alone no longer bounds assembly memory. - Frame timing is one exclusive mode (delayMs | fps | delayNum/delayDen); combinations are rejected instead of producing hybrid delays. - Collision-resistant project storage keys: safe ids are used verbatim (existing projects still load) and only unsafe ids get a hash suffix, so "foo/bar" and "foo?bar" can't share a directory. - Load only treats a missing file as a new project; other read/parse errors surface instead of silently overwriting real data. - Share server binds to a real LAN interface (skips virtual/VPN/container, prefers physical NICs and common ranges). - Generated export names get millisecond + random suffix to avoid same-second overwrite. - PNG validator accepts the encoder's Uint8Array so agent solid-color frames aren't rejected. * Address review: crash-safe frame writes, server startup, APNG first frame - Write the PNG before mutating project metadata on add/duplicate, and delete after persisting, so an interrupted disk op can't dangle a reference or advance unsaved state. - Evict a project from the in-memory cache if its save fails, so a transient write error can't desync the live session from disk. - Reject on the loopback server's listen error and drop a half-initialized instance so startup failures clean up and can retry. - Normalize APNG dispose_op PREVIOUS to BACKGROUND on the first animated frame (spec requirement). - Release decoded ImageBitmaps after use so a large upload batch doesn't retain native image memory. - Surface otherwise-silent async UI failures via a toast; check the state response is ok before parsing it. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
621 lines
13 KiB
CSS
621 lines
13 KiB
CSS
:root {
|
|
--radius: 10px;
|
|
--radius-sm: 7px;
|
|
--gap: 12px;
|
|
--card-bg: var(--background-color-default, #ffffff);
|
|
--muted: var(--text-color-muted, #59636e);
|
|
--border: var(--border-color-default, #d1d9e0);
|
|
--fg: var(--text-color-default, #1f2328);
|
|
--accent: var(--true-color-blue, #0969da);
|
|
--danger: var(--true-color-red, #cf222e);
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
/* Ensure the `hidden` attribute always wins over element display rules. */
|
|
[hidden] {
|
|
display: none !important;
|
|
}
|
|
|
|
body {
|
|
margin: 0;
|
|
padding: 14px 14px 40px;
|
|
background: var(--background-color-default, #ffffff);
|
|
color: var(--fg);
|
|
font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
|
|
font-size: var(--text-body-medium, 14px);
|
|
line-height: var(--leading-body-medium, 20px);
|
|
-webkit-font-smoothing: antialiased;
|
|
}
|
|
|
|
h1 {
|
|
font-family: var(--font-sans-display, var(--font-sans, sans-serif));
|
|
font-size: var(--text-title-medium, 18px);
|
|
font-weight: var(--font-weight-semibold, 600);
|
|
line-height: 1.2;
|
|
margin: 0;
|
|
}
|
|
|
|
.app-header {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
justify-content: space-between;
|
|
gap: var(--gap);
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
.header-actions {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.reload-glyph {
|
|
display: inline-block;
|
|
}
|
|
.reload-glyph.spinning {
|
|
animation: apng-spin 0.6s linear infinite;
|
|
}
|
|
@keyframes apng-spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
.muted {
|
|
color: var(--muted);
|
|
}
|
|
.tiny {
|
|
font-size: var(--text-caption, 11px);
|
|
}
|
|
.muted.tiny {
|
|
margin: 8px 0 0;
|
|
}
|
|
|
|
.badge {
|
|
font-family: var(--font-mono, monospace);
|
|
font-size: var(--text-code-inline, 12px);
|
|
color: var(--muted);
|
|
border: 1px solid var(--border);
|
|
border-radius: 999px;
|
|
padding: 2px 9px;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
#subtitle {
|
|
margin: 3px 0 0;
|
|
font-size: var(--text-body-small, 12px);
|
|
}
|
|
|
|
.card {
|
|
background: var(--card-bg);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
padding: 14px;
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
.section-title {
|
|
font-weight: var(--font-weight-semibold, 600);
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.row {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.row.gap {
|
|
gap: 8px;
|
|
}
|
|
.row.wrap {
|
|
flex-wrap: wrap;
|
|
}
|
|
.row.between,
|
|
.between {
|
|
justify-content: space-between;
|
|
}
|
|
|
|
/* Buttons */
|
|
.btn {
|
|
appearance: none;
|
|
border: 1px solid var(--border);
|
|
background: var(--background-color-default, #fff);
|
|
color: var(--fg);
|
|
border-radius: var(--radius-sm);
|
|
padding: 7px 12px;
|
|
font-size: var(--text-body-small, 13px);
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
|
|
}
|
|
.btn:hover {
|
|
background: var(--n-2-10, rgba(0, 0, 0, 0.04));
|
|
}
|
|
.btn:active {
|
|
transform: translateY(0.5px);
|
|
}
|
|
.btn:disabled {
|
|
opacity: 0.45;
|
|
cursor: not-allowed;
|
|
}
|
|
.btn-sm {
|
|
padding: 4px 9px;
|
|
font-size: var(--text-caption, 12px);
|
|
}
|
|
.btn-primary {
|
|
background: var(--accent);
|
|
border-color: var(--accent);
|
|
color: var(--color-white, #fff);
|
|
}
|
|
.btn-primary:hover {
|
|
filter: brightness(1.06);
|
|
background: var(--accent);
|
|
}
|
|
.btn-ghost {
|
|
background: transparent;
|
|
border-color: transparent;
|
|
}
|
|
.btn-ghost:hover {
|
|
background: var(--n-2-10, rgba(0, 0, 0, 0.05));
|
|
}
|
|
.danger {
|
|
color: var(--danger);
|
|
}
|
|
|
|
/* Preview */
|
|
.preview-wrap {
|
|
position: relative;
|
|
border-radius: var(--radius-sm);
|
|
border: 1px solid var(--border);
|
|
min-height: 160px;
|
|
max-height: 320px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
overflow: hidden;
|
|
padding: 10px;
|
|
}
|
|
#preview {
|
|
max-width: 100%;
|
|
max-height: 300px;
|
|
image-rendering: auto;
|
|
display: block;
|
|
}
|
|
#preview.pixelated {
|
|
image-rendering: pixelated;
|
|
}
|
|
.empty-preview {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: var(--background-color-default, #fff);
|
|
text-align: center;
|
|
}
|
|
.preview-meta {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 7px;
|
|
justify-content: center;
|
|
color: var(--muted);
|
|
font-size: var(--text-body-small, 12px);
|
|
margin: 10px 0 12px;
|
|
}
|
|
.preview-meta .dot {
|
|
opacity: 0.5;
|
|
}
|
|
.saved-path {
|
|
margin: 10px 0 0;
|
|
font-family: var(--font-mono, monospace);
|
|
font-size: var(--text-caption, 11px);
|
|
word-break: break-all;
|
|
}
|
|
|
|
/* Checkerboard for transparency */
|
|
.checker {
|
|
--checker-base: var(--background-color-default, #fff);
|
|
--checker-square: var(--border-color-default, #d9dbe0);
|
|
background-color: var(--checker-base);
|
|
background-image:
|
|
linear-gradient(45deg, var(--checker-square) 25%, transparent 25%),
|
|
linear-gradient(-45deg, var(--checker-square) 25%, transparent 25%),
|
|
linear-gradient(45deg, transparent 75%, var(--checker-square) 75%),
|
|
linear-gradient(-45deg, transparent 75%, var(--checker-square) 75%);
|
|
background-size: 16px 16px;
|
|
background-position: 0 0, 0 8px, 8px -8px, -8px 0;
|
|
}
|
|
|
|
/* Send to phone */
|
|
.share-panel {
|
|
display: flex;
|
|
gap: var(--gap);
|
|
align-items: center;
|
|
margin-top: 12px;
|
|
padding: 12px;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
background: var(--card-bg);
|
|
}
|
|
.share-qr {
|
|
flex-shrink: 0;
|
|
padding: 8px;
|
|
border-radius: var(--radius-sm);
|
|
line-height: 0;
|
|
}
|
|
.share-qr img {
|
|
width: 132px;
|
|
height: 132px;
|
|
image-rendering: pixelated;
|
|
display: block;
|
|
}
|
|
.share-body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
min-width: 0;
|
|
}
|
|
.share-title {
|
|
font-weight: var(--font-weight-semibold, 600);
|
|
}
|
|
.share-url {
|
|
font-family: var(--font-mono, monospace);
|
|
font-size: var(--text-code-inline, 12px);
|
|
color: var(--accent);
|
|
word-break: break-all;
|
|
text-decoration: none;
|
|
margin-top: 2px;
|
|
}
|
|
.share-url:hover {
|
|
text-decoration: underline;
|
|
}
|
|
.share-foot {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 8px;
|
|
margin-top: 6px;
|
|
}
|
|
|
|
/* Settings */
|
|
.settings-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
gap: 10px;
|
|
}
|
|
.field {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
font-size: var(--text-body-small, 12px);
|
|
color: var(--muted);
|
|
}
|
|
.field .inline {
|
|
display: flex;
|
|
gap: 6px;
|
|
}
|
|
input[type="number"],
|
|
input[type="text"] {
|
|
width: 100%;
|
|
padding: 6px 8px;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius-sm);
|
|
background: var(--background-color-default, #fff);
|
|
color: var(--fg);
|
|
font-size: var(--text-body-medium, 13px);
|
|
font-family: inherit;
|
|
}
|
|
input:focus-visible,
|
|
.btn:focus-visible,
|
|
select:focus-visible {
|
|
outline: 2px solid var(--color-focus-outline, var(--accent));
|
|
outline-offset: 1px;
|
|
}
|
|
|
|
/* hidden-first checkbox living inside the settings grid */
|
|
.field .chk {
|
|
color: var(--fg);
|
|
font-size: var(--text-body-small, 12px);
|
|
padding: 4px 0;
|
|
}
|
|
.field .chk.disabled {
|
|
opacity: 0.45;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Settings subsection: apply-to-all controls */
|
|
.subsection {
|
|
margin-top: 14px;
|
|
padding-top: 12px;
|
|
border-top: 1px dashed var(--border);
|
|
}
|
|
.subsection-title {
|
|
font-size: var(--text-caption, 11px);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.04em;
|
|
color: var(--muted);
|
|
font-weight: 600;
|
|
margin-bottom: 8px;
|
|
}
|
|
.apply-rows {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
.apply-rows .inline {
|
|
display: flex;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
gap: 6px;
|
|
}
|
|
.apply-rows .inline input[type="number"] {
|
|
width: 68px;
|
|
}
|
|
.apply-rows select {
|
|
padding: 5px 7px;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius-sm);
|
|
background: var(--background-color-default, #fff);
|
|
color: var(--fg);
|
|
font-size: var(--text-body-small, 12px);
|
|
font-family: inherit;
|
|
}
|
|
.mini {
|
|
font-size: 11px;
|
|
color: var(--muted);
|
|
}
|
|
.help {
|
|
margin-top: 12px;
|
|
font-size: var(--text-body-small, 12px);
|
|
}
|
|
.help summary {
|
|
cursor: pointer;
|
|
color: var(--accent);
|
|
font-size: var(--text-caption, 11px);
|
|
}
|
|
.help ul {
|
|
margin: 8px 0 0;
|
|
padding-left: 18px;
|
|
color: var(--muted);
|
|
}
|
|
.help li {
|
|
margin-bottom: 5px;
|
|
}
|
|
.help b {
|
|
color: var(--fg);
|
|
}
|
|
|
|
/* Frame strip */
|
|
.frame-strip {
|
|
display: flex;
|
|
gap: 10px;
|
|
overflow-x: auto;
|
|
padding-bottom: 6px;
|
|
}
|
|
.frame-card {
|
|
flex: 0 0 auto;
|
|
width: 168px;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius-sm);
|
|
overflow: hidden;
|
|
background: var(--card-bg);
|
|
}
|
|
.frame-card.is-static {
|
|
border-color: var(--accent);
|
|
border-style: dashed;
|
|
}
|
|
.frame-thumb-wrap {
|
|
position: relative;
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
.frame-thumb {
|
|
width: 100%;
|
|
height: 88px;
|
|
object-fit: contain;
|
|
display: block;
|
|
}
|
|
.static-badge {
|
|
position: absolute;
|
|
top: 5px;
|
|
left: 5px;
|
|
background: var(--accent);
|
|
color: var(--color-white, #fff);
|
|
font-size: 9px;
|
|
font-weight: 700;
|
|
letter-spacing: 0.04em;
|
|
padding: 1px 5px;
|
|
border-radius: 4px;
|
|
}
|
|
.frame-body {
|
|
padding: 7px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 6px;
|
|
}
|
|
.frame-index {
|
|
font-size: var(--text-caption, 11px);
|
|
color: var(--muted);
|
|
font-weight: 600;
|
|
}
|
|
.frame-field {
|
|
display: flex;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
gap: 4px;
|
|
}
|
|
.frame-label {
|
|
font-size: 10px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.03em;
|
|
min-width: 46px;
|
|
}
|
|
.num-in {
|
|
width: 52px !important;
|
|
padding: 3px 4px !important;
|
|
font-size: var(--text-caption, 11px) !important;
|
|
text-align: center;
|
|
}
|
|
.slash {
|
|
font-size: 11px;
|
|
}
|
|
.ms-hint {
|
|
flex-basis: 100%;
|
|
font-size: 10px;
|
|
}
|
|
.frame-select {
|
|
flex: 1;
|
|
min-width: 0;
|
|
padding: 3px 4px;
|
|
border: 1px solid var(--border);
|
|
border-radius: 5px;
|
|
background: var(--background-color-default, #fff);
|
|
color: var(--fg);
|
|
font-size: var(--text-caption, 11px);
|
|
font-family: inherit;
|
|
}
|
|
.frame-actions {
|
|
display: flex;
|
|
gap: 3px;
|
|
margin-top: 1px;
|
|
}
|
|
.icon-btn {
|
|
flex: 1;
|
|
appearance: none;
|
|
border: 1px solid var(--border);
|
|
background: transparent;
|
|
color: var(--fg);
|
|
border-radius: 5px;
|
|
padding: 3px 0;
|
|
cursor: pointer;
|
|
font-size: 12px;
|
|
line-height: 1;
|
|
}
|
|
.icon-btn:hover {
|
|
background: var(--n-2-10, rgba(0, 0, 0, 0.05));
|
|
}
|
|
.icon-btn.danger:hover {
|
|
background: var(--true-color-red-muted, rgba(207, 34, 46, 0.1));
|
|
}
|
|
.icon-btn:disabled {
|
|
opacity: 0.35;
|
|
cursor: not-allowed;
|
|
}
|
|
.empty-frames {
|
|
font-size: var(--text-body-small, 12px);
|
|
padding: 4px 0 0;
|
|
}
|
|
|
|
/* Draw panel */
|
|
.draw-panel {
|
|
margin-top: 14px;
|
|
padding-top: 14px;
|
|
border-top: 1px dashed var(--border);
|
|
}
|
|
.draw-tools {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
align-items: center;
|
|
gap: 10px;
|
|
margin-bottom: 10px;
|
|
}
|
|
.tool {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 5px;
|
|
font-size: var(--text-caption, 12px);
|
|
color: var(--muted);
|
|
}
|
|
.tool input[type="color"] {
|
|
width: 30px;
|
|
height: 26px;
|
|
padding: 0;
|
|
border: 1px solid var(--border);
|
|
border-radius: 6px;
|
|
background: none;
|
|
cursor: pointer;
|
|
}
|
|
.tool-group {
|
|
display: inline-flex;
|
|
gap: 0;
|
|
}
|
|
.tool-group .tool-btn {
|
|
border-radius: 0;
|
|
margin-left: -1px;
|
|
}
|
|
.tool-group .tool-btn:first-child {
|
|
border-radius: var(--radius-sm) 0 0 var(--radius-sm);
|
|
margin-left: 0;
|
|
}
|
|
.tool-group .tool-btn:last-child {
|
|
border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
|
|
}
|
|
.tool-btn.active {
|
|
background: var(--accent);
|
|
border-color: var(--accent);
|
|
color: var(--color-white, #fff);
|
|
}
|
|
.draw-options {
|
|
display: flex;
|
|
gap: 16px;
|
|
margin-bottom: 10px;
|
|
}
|
|
.chk {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
font-size: var(--text-body-small, 12px);
|
|
cursor: pointer;
|
|
}
|
|
.canvas-stage {
|
|
position: relative;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius-sm);
|
|
overflow: hidden;
|
|
margin-bottom: 10px;
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
.canvas-stage .onion,
|
|
.canvas-stage canvas {
|
|
position: relative;
|
|
max-width: 100%;
|
|
display: block;
|
|
touch-action: none;
|
|
}
|
|
.canvas-stage .onion {
|
|
position: absolute;
|
|
inset: 0;
|
|
margin: auto;
|
|
opacity: 0.28;
|
|
pointer-events: none;
|
|
object-fit: contain;
|
|
}
|
|
#draw-canvas {
|
|
cursor: crosshair;
|
|
}
|
|
|
|
/* Toast */
|
|
.toast {
|
|
position: fixed;
|
|
left: 50%;
|
|
bottom: 18px;
|
|
transform: translateX(-50%);
|
|
background: var(--fg);
|
|
color: var(--background-color-default, #fff);
|
|
padding: 8px 14px;
|
|
border-radius: 999px;
|
|
font-size: var(--text-body-small, 12px);
|
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
|
|
z-index: 50;
|
|
max-width: 90%;
|
|
text-align: center;
|
|
}
|
|
.toast[hidden] {
|
|
display: none;
|
|
}
|