-
Notifications
You must be signed in to change notification settings - Fork 0
Import
- Left rail
$ importfield (280px rail, not route, not overlay) - Top-right
[ Sync / Import ]->Import addon (wb1!) - Settings -> Import (same decoder)
- Hotkey
ianywhere. Opens rail tab if collapsed.
- Click Import or press
i. Must be user gesture fornavigator.clipboard.readText(). - If clipboard is
wb1!length >10 -> auto-fill preview. Zero paste needed. - Otherwise text area focused "Paste wb1! here Ctrl+V" -> debounce 150ms -> preview.
- Preview sentence (rail cannot hold 8 columns): "6 characters, 1 over 3 days, Enter to import" plus rows with dots, hover per-section.
- Enter confirms ->
POST /api/addon/import{ bundle:"wb1!..." }-> D1character_addon_cacheandwarband_bank_cacheupsert peruser_id+char_key. - Receipt: one line per character dot + gold printed in waves like
$output, held 6 seconds, decayed in 4 steps, removed. Block returns to original height. - Nothing reloads. Only that line is stamped. Reload would discard receipt (what the overlay version did).
Client-side before D1 write:
- Not
wb1!-> ifwb0!then "That is Camp DNA, not inventory, use Share tab" else "Does not look like wb1!, run /warband copy again" - Over 20 characters or over 1 MB decoded -> "Too large, try single-character"
- Missing characters not deleted -> keeps old snapshot aging red. Staleness lowers confidence, never deletes.
- One character 39 KB JSON 8.6 KB wire, 6 154 KB / 26 KB, 20 cap 474 KB / 73 KB. 4-7 KB figure is slim with no per-item lists.
src/lib/warband-import.ts is pure, testable via Vitest, no DOM or D1:
-
WIRE_PREFIX='wb1!',DNA_PREFIX='wb0!',MAX_CHARACTERS=20,MAX_DECODED_BYTES=1_048_576 - Base64url -> bytes ->
DecompressionStream('deflate-raw')notdeflate(zlib header addon does not emit, use raw orpako.inflateRaw) - Throws on invalid input.
Web tests src/__tests__/warband-import.test.ts. Addon vectors docs/contract/vectors/v1-min.wb1.
Any element whose raw text begins with // inside an Astro expression is deleted from output silently. Compiler reads // as line comment. No error.
Fix: never write literal // in .cmt text. Mark is .cmt::before CSS. Literal doubles when rendered and deletes when absent. Always a defect.
- HTTPS and user gesture required. Warband.pro is HTTPS so Chrome and Edge work.
- Never polling
readText, only inside click. - Do not auto-submit. User confirms after seeing staleness.
- Firefox and Safari are stricter -> fallback to text area
Ctrl+V.
After confirm, scorer re-reads consumables rollup (tonight.ts, warband-import.ts types). Freshness changes block to grey text.
Maintained alongside Warband.pro App and Addon. Syncs on push. Companion for Warband.pro. MIT. Draft version 0 until CurseForge live.
Start
Integration
Internals