Commit Graph

68 Commits

Author SHA1 Message Date
infrost cb901e20e6 update ui 2026-07-08 18:11:15 +01:00
infrost c4d591efc3 新增 [sw.js (line 1)](D:/Code/QRloop/apps/web/public/sw.js:1),缓存 app shell、构建 assets、worker、wasm,支持离线回退。
新增 [manifest.webmanifest (line 1)](D:/Code/QRloop/apps/web/public/manifest.webmanifest:1) 和 app icon,并在 [index.html (line 9)](D:/Code/QRloop/apps/web/index.html:9) 接入。
新增启动屏 [boot_screen.tsx (line 1)](D:/Code/QRloop/apps/web/src/pwa/boot_screen.tsx:1),首次进入会显示进度条,等必要 runtime/wasm/worker assets 预缓存完成后才 reveal app。
新增 [preload.ts (line 1)](D:/Code/QRloop/apps/web/src/pwa/preload.ts:1),预缓存 fast_qr、RaptorQ、ZXing reader/writer wasm,以及 encode/decode/render/GIF workers。
Sender 默认从 file 开始,并把 File 放到 Text 前面:[sender.tsx (line 251)](D:/Code/QRloop/apps/web/src/app/routes/sender.tsx:251)。
为避免 web app 直接偷用 core 的 transitive dependency,我把 ZXing wasm URL 包成了 core 侧公开入口:
2026-07-08 18:11:14 +01:00
infrost 4634f49dcb update readme.md and deployment guide 2026-07-08 18:11:14 +01:00
infrost 82880694bc migrate to RaptorQR monorepo 2026-07-08 18:11:14 +01:00
infrost bea0f5cf03 delete js-qrcode dependencies (no needed anymore) 2026-07-08 18:11:14 +01:00
infrost 001f152eec Parallel QR 默认改成 4,选项扩到 1/2/4/6/8,live 和 GIF 布局都支持 6 = 3x2、8 = 4x2。
Sender 里 QR encoder、FEC codec、RaptorQ repair 都收进了 Advanced settings。
RaptorQ repair 默认从 20% 改成 10%。
Receiver 的 Max symbols 现在显示为 Auto (4),并且手动支持 6/8。
Sender 选 6/8 时会提示:Receiver 的 Auto (4) 只扫 4 个,需要手动把 Max symbols 设成对应的 6/8。
修了 fast_qr 容量:只有 ZXing WASM 继续扣那 2 bytes,fast_qr WASM 和 JS QR 都使用完整 QR byte capacity。
顺手修了 normalizeFecCodec('js-rlnc') 会被归回 wasm 默认的问题,不然高级设置里的 JS compatible 会选不住。
2026-07-08 18:11:14 +01:00
infrost f30757a276 add test files 2026-07-08 18:11:13 +01:00
infrost 5552571932 ultra fast qr generate 2026-07-08 18:11:13 +01:00
infrost 699188678e bug fixes on qr rendering 2026-07-08 18:11:13 +01:00
infrost af28cd45df add zxing-wasm qr encode method 2026-07-08 18:11:13 +01:00
Frost 2ad5b606c3 Update README with new demo link and test info
Updated the live demo link and clarified file transfer test details.
2026-07-08 18:11:13 +01:00
Frost ed22655f5b Revise file transfer scenarios in README
Updated file transfer scenarios and added details on performance improvements.
2026-07-08 18:11:13 +01:00
infrost db447ec0a0 update readme.md 2026-07-08 18:08:48 +01:00
infrost fd8b828ac4 change default message coding to raptorqwasm 2026-07-08 18:08:01 +01:00
infrost 0f28daf9cf using raptorq wasm 2026-07-08 18:08:01 +01:00
infrost ec6381b742 enable advance decode settings 2026-07-08 18:08:00 +01:00
infrost 682349e145 bug fixes and several improvements 2026-07-08 18:08:00 +01:00
infrost f06e26c256 enable Parallel QR 2026-07-08 18:08:00 +01:00
infrost 452a0c5df2 change qr scanner to zxing/wasm and ui improvement 2026-07-08 18:08:00 +01:00
infrost 5e7e3393fe add ajustable qr size 2026-07-08 18:08:00 +01:00
infrost 3f36779b73 add ajustable qr speed 2026-07-08 18:08:00 +01:00
infrost 1fb901bb56 init 2026-07-08 18:08:00 +01:00
Hermit 527d0e7b4e Update README.md 2026-07-08 18:08:00 +01:00
Hermes Agent 25437e2223 Make package scoped 2026-07-08 18:08:00 +01:00
Hermes Agent 57a52db54c Make prepublish hook do a full build 2026-07-08 18:08:00 +01:00
Hermes Agent 383b2f81d3 Replace em dashes with regular dashes in package.json, README, ARCHITECTURE 2026-05-04 16:34:13 +00:00
Hermes Agent aaef21883b Sync package.json version to v0.8.4 2026-05-04 16:31:31 +00:00
Hermes Agent f8fd9e864e Use relative Vite base path, remove strip-prefix hack 2026-05-04 16:09:32 +00:00
Hermes Agent 80c0a23bbd Fix --serve: strip Vite base path, add --port/--host flags 2026-05-04 16:05:26 +00:00
Hermes Agent 6d4a01dcd7 package.json: set author to Hermit, GitHub username to hermitm0nk 2026-05-04 15:57:13 +00:00
Hermes Agent 80a37fffdc Update package.json to v0.8.2, document CLI input modes and outer RS design in ARCHITECTURE.md 2026-05-04 15:56:04 +00:00
Hermes Agent 4b49acb8f7 CLI: pass filename and MIME type from file argument into packet metadata
- Added MIME type lookup table for common extensions
- Extracts basename from file path for filename metadata
- Channels filename/mimeType through readInput → buildFrames → packetize
- Stdin text mode leaves filename/mimeType undefined (as before)
2026-05-04 15:52:07 +00:00
Hermes Agent 5739d1b973 CLI: treat stdin as text input, file arg as binary input
- readInput() now returns {data, isText} tuple
- stdin (no file arg) → isText=true (text mode)
- file argument → isText=false (binary/file mode)
- Passes isText through to packetize for proper metadata tagging
2026-05-04 15:49:11 +00:00
Hermes Agent c93eda9156 Fix parityCount to use Math.floor, neededPackets to use totalGenerations
parityCount: Math.ceil → Math.floor
- Small files (G ≤ 33) now truly get 0 parity generations
- Large files (G ≥ 34) still get proportional parity (≈3%)
- Previously Math.ceil always gave ≥1 parity for any G ≥ 1

neededPackets: K * sourceGenerations → K * totalGenerations
- Aligns with the round-robin scheduler: symbols are interleaved
  across ALL generations, so practical minimum is K × totalGens
- Fixes the mismatch where 'needed' showed 32 but actual
  decode required ~48 frames (for 2 source + 1 parity case)

Tests: Updated assembly test comments and totalGenerations params
to match new parityCount behavior.

Closes the long-standing 'needed frames count is off because of
outer error correction' issue.
2026-05-04 15:32:25 +00:00
Hermes Agent d7fc7606ec fix(receiver): revert indicator to framesWithQR/accepted/needed with correct math
- framesWithQR now counts ALL frames with a valid QR (including duplicates),
  not just deduplicated ones. Moved increment before dedup check.
- acceptedPackets already correctly counts linearly-independent packets
  (rank increase), capped at K per generation by the decoder.
- neededPackets = K * sourceGenerations, computed from constants.
- Keep generation count (solvedGens/sourceGens) as secondary indicator.

This gives an honest rough progress bar: useful can approach or briefly
touch required while some generations are still partially filled, but the
generation count is the definitive completion signal.
2026-05-04 14:36:39 +00:00
Hermes Agent f4ef1bb473 fix(receiver): replace misleading packet ratio with generation progress
The compact indicator previously showed framesWithQR/acceptedPackets/neededPackets.
Because acceptedPackets counts parity-generation packets and uneven distribution
across generations, it could exceed neededPackets while the file was still not
decoded. This is confusing.

Change the primary compact indicator to generation counts:
  framesWithQR / solvedGens / sourceGens gens

This is always meaningful: solved never exceeds required, and when they match,
the transfer is complete. Packet count is kept as a raw secondary number.
2026-05-04 14:09:21 +00:00
Hermes Agent 6e14700fc4 chore: bump version to 0.7.0 2026-05-04 13:32:50 +00:00
Hermes Agent f56ed6455a feat: disable outer RS for small files (≤33 source generations)
Small files are already well-protected by QR code ECC + fountain code.
Outer Reed-Solomon only kicks in when sourceGenerations ≥ 34,
where ceil(G * 0.03) ≥ 1. This eliminates 100% overhead for tiny files.

- parityCount(): remove Math.max(1, ...) floor
- Update tests to not assume parity always exists
- Increase outer_ec_benefit.test.ts payloads to >34 gens so
  outer RS is actually active during benchmark
2026-05-04 13:32:39 +00:00
Hermes Agent ba788cc601 fix(receiver): start timer on first frame detection, add required QR count indicator
- Timer now starts when the first QR frame is detected (first progress
  message from worker with totalFrames > 0) instead of when camera is
  turned on. This eliminates the jump where elapsed time showed a few
  seconds before any QR was actually seen.

- Replace separate 'scanned' and 'useful' stats with a compact
  'QRs scanned/useful/required: X/Y/Z' indicator that clearly shows
  progress toward the total packets needed for decode. The 'required'
  count correctly accounts for outer RS overhead via K * sourceGens.

- Same display format applies to both camera and GIF-file input modes.
2026-05-04 12:31:35 +00:00
Hermes Agent b2ee0c55b5 fix: remove hardcoded absolute path from vite.config.ts alias
Replace /home/aiagent/projects/qr/src with resolve(__dirname, 'src')
so the project can be cloned and built on any machine.
2026-05-04 11:40:59 +00:00
Hermes Agent 2500796edd docs: split README into README.md and ARCHITECTURE.md
README.md now focuses on user-facing content:
- General description and live demo link
- Installation instructions (npm, Bun, npx, bunx)
- CLI usage examples (file, stdin, --serve)
- CLI flags table
- Dev setup with all relevant commands and scripts
- Link to ARCHITECTURE.md

ARCHITECTURE.md contains all technical implementation details:
- High-level architecture diagram
- Full project structure tree
- Runtime and dev dependencies
- Protocol spec (packet format, constants, metadata wrapping)
- Algorithm deep dives (RLNC, GF256, QR encode/decode, GIF, scheduling)
- Sender and receiver data flow diagrams
- Design decisions and rationale
- Common pitfalls
2026-05-04 01:56:16 +00:00
Hermes Agent 468af211ad feat: rename to qr-stream, add --serve web preview, include src in package
- Rename CLI entry from qr-terminal.ts to qr-stream.ts
- Rename package to qr-stream, version 0.6.0
- Add --serve / -s flag to start built-in static file server for web UI preview
- Include dist/ and src/ in npm files so consumers get both bundled CLI and source code
- Add static_server.ts helper using Node built-in http module
- Update help text and tests for new name and --serve flag
- Remove old qr-terminal.js from deployment
2026-05-04 01:47:10 +00:00
Hermes Agent e1261ca927 chore: prepare package for npm publishing
- Add MIT LICENSE
- Remove "private": true
- Set name to qr-transfer-terminal, version 0.5.0
- Add files, engines, keywords, repository, bugs, homepage fields
- Move typescript from peerDependencies to devDependencies
- Add prepublishOnly script to ensure fresh CLI bundle
2026-05-04 01:29:09 +00:00
Hermes Agent a7773b5c0a feat(cli): make installable as qr-terminal bin; fix cursor positioning
- Add 'bin' field to package.json so npm/npx/bunx can invoke it as
  'qr-terminal'. The bin points to dist/qr-terminal.js.
- Change shebang to '#!/usr/bin/env node' for universal compatibility.
- Fix displaced chars: each frame write now ends with '\n' and
  moveCursorUp() appends '\x1b[G' to move to column 0. Previously the
  cursor stayed at the end of the previous last line, causing redraws
  to start mid-line.
- Position QR at top-left (removed padTop/padLeft centre logic) since
  the alt-buffer is clean and only the QR is shown.
- Update help text to show npx/bunx invocations.
2026-05-03 22:27:30 +00:00
Hermes Agent 352fc2d459 feat(cli): alt-buffer, top-of-screen draw, -h/--help flags
- Enter alternate screen buffer (\x1b[?1049h) before drawing and exit
  it (\x1b[?1049l) on cleanup. This preserves the user's terminal
  content when the app quits.
- Clear screen once after entering alt buffer so drawing starts from
  the top-left.
- Add -h and --help flags that print usage, stdin/file modes, and
  controls (q / Ctrl-C to quit).
- Update tests for new alt-buffer helpers and help text.
- Rebuild CLI bundle (dist/qr-terminal.js 95.4kb) and redeploy webapp.
2026-05-03 22:14:50 +00:00
Hermes Agent c0baff8d42 build: include CLI bundle in default build step 2026-05-03 22:06:56 +00:00
Hermes Agent 6854fbe3a7 fix(cli): eliminate flicker by in-place overwrite; remove status text
- Stop clearing the entire screen every frame — now clears once on first
  draw, then uses cursor-up (\x1b[nA) to overwrite the QR block in place.
- Removed frame counter, generation info, and 'press q' text — only the
  QR code is shown, keeping the display minimal and static-area free.
- Simplified buildFrames return type (Uint8Array[] only).
- Added moveCursorUp() helper to terminal_raster.ts.
2026-05-03 22:02:50 +00:00
Hermes Agent 664a0d0587 fix(cli): correct inverted QR colours via explicit ANSI white-bg/black-fg
Terminal block characters render in the foreground colour; on dark-themed
terminals the QR looked inverted. Now every line is wrapped with
\x1b[47m\x1b[30m (white bg / black fg) so dark modules appear black and
light modules appear white on any terminal theme.
2026-05-03 21:51:54 +00:00
Hermes Agent cdb43f36db fix(cli): add quiet zone around terminal QR; fix q-key quit via /dev/tty
- renderToTerminal now pads with a 4-module quiet zone (white border)
  horizontally and vertically, matching the webapp rasterizer.
- Keyboard input now tries /dev/tty first so q/Ctrl-C works even when
  stdin is a pipe (e.g. echo ... | bun run src/cli/qr-terminal.ts).
- Update all CLI renderer tests for padded output; add tests for custom
  and zero quiet zone.
- Increase outer_ec_benefit test timeout to 15s to avoid flaky failures.
- Rebuild CLI bundle and webapp; redeploy to nginx.
2026-05-03 21:38:17 +00:00
Hermes Agent 5340ae8fe1 fix: keep time/throughput visible after transfer completes
The transfer stats bar was wrapped in {scanning && ...} so elapsed
time and KB/s vanished when scanning auto-stopped on completion.
Add a persistent summary section that stays visible after scanning
stops, showing final transfer time, average throughput, and data size.

Uses formatDuration, formatBytes utility helpers already in the file.
2026-05-03 19:49:53 +00:00