Skip to content

feat(share): media-aware generated folder index - #79

Merged
tieubao merged 5 commits into
mainfrom
feat/media-folder-index
Nov 17, 2026
Merged

tieubao merged 5 commits into
mainfrom
feat/media-folder-index

Conversation

@tieubao

@tieubao tieubao commented Nov 17, 2026

Copy link
Copy Markdown
Member

What

The generated folder index is now media-aware, for both the tunnel and the R2 backends (gen_index runs from stage_copy).

  • Rows grouped by folder, each with the name as a link, a short type and a human size. A rendered .md is still listed by its .html.
  • mp4 mov m4v webm: inline <video controls playsinline preload="metadata"> plus a download link.
  • png jpg jpeg gif webp avif svg: responsive grid of lazy, async <img> on the originals, with a lightbox (click, Esc, arrow keys, swipe, link to the full file; fits the viewport, covers the page on phones).
  • Everything else is a plain row. A text-only folder is a clean grouped list with no script.
  • Paper reading theme from write_md_style, light and dark, readable at 400 px. Inline CSS and script, nothing external.

Unchanged: own index.html or README.html wins, --no-index, dotfiles and symlinks never ship, line 1 keeps <title>index</title> for type_of.

Safety

Every label goes through html_esc, every href and src through urlenc. A name with a control character is served but not listed.

Verification

  • SHARE_TEST_ONLY='folder index' bash tests/share.sh: core group, 586 checks, PASS; 38 folder index rows, new ones cover mixed media, text-only, own index, --no-index, hostile names.
  • Negative control: dropping the < escape turns the three hostile-name rows red.
  • shellcheck bin/share tests/share.sh clean; parses and runs under macOS /bin/bash 3.2; GNU and BSD stat give the same page.
  • Headless Edge pass at 1440 px and a true 400 px viewport, light and dark, lightbox open; keyboard behavior checked in a real browser.

Spec: docs/specs/SPEC-011-media-folder-index.md. Proof: docs/verification/media-folder-index.md.

Not covered: Cloudflare tunnel and R2 serving paths (one shared call, exercised through the local server); video seeking over R2 depends on the Worker's range handling, untouched here.

The generated listing was a bare list of links. It now groups rows by folder with a type and a human size, plays videos inline, shows images as a lazy grid with a click-to-enlarge lightbox, and keeps everything else as plain rows. Self-contained, paper theme, light and dark, escaped labels and encoded hrefs.
preload=metadata alone drew a blank box. The video src now ends in #t=0.1; the Download link and the name link keep the plain path.
ls prints du of the whole pub/<id>, and the media-aware index.html is larger by design. The row normalizes size= in both listings and still diffs every other artifact.
@tieubao
tieubao merged commit 61606c6 into main Nov 17, 2026
15 of 16 checks passed
@tieubao
tieubao deleted the feat/media-folder-index branch November 17, 2026 05:05
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.

1 participant