QR decode support (zbarimg) with searchable payload + preview panel; restructure repo root as installable omarchy plugin; plain-text safety for QR payloads

This commit is contained in:
2026-09-05 16:22:10 +01:00
parent 63a003e4a5
commit 1aac582e90
15 changed files with 144 additions and 16 deletions
+16
View File
@@ -110,3 +110,19 @@ test("entryId distinct for distinct content", () => {
const b = Store.entryId({ type: "text", text: "two" })
assert.notEqual(a, b)
})
test("qr payload passes through normalize and dedup", () => {
const e = Store.normalize({ type: "image", path: "/x/qr.png", mime: "image/png", w: 100, h: 100, qr: "https://example.com" })
assert.equal(e.qr, "https://example.com")
// Re-copy of the same image keeps the decoded QR even if the new capture lacks it.
let h = Store.addEntry([], { type: "image", path: "/x/qr.png", qr: "https://example.com", ts: 1 })
h = Store.addEntry(h, { type: "image", path: "/x/qr.png", ts: 2 })
assert.equal(h.length, 1)
assert.equal(h[0].qr, "https://example.com")
assert.equal(h[0].ts, 2)
})
test("buildRow makes QR payload searchable", () => {
const row = Store.buildRow({ type: "image", path: "/x/qr.png", mime: "image/png", qr: "secret-payload-xyz", ts: 1, bytes: 10, app: "", uses: 0 }, "image", 1)
assert.ok(row.content.includes("secret-payload-xyz"))
})