mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-08-04 15:12:12 +00:00
crypto.randomUUID() and navigator.clipboard are both [SecureContext]- gated, so neither exists on a plain-HTTP origin that isn't localhost. That covers the dev host (http://invoiceshelf.test) and any self-hosted install reached over a hostname or LAN IP — a large share of them. generateClientId() called crypto.randomUUID() unguarded. It runs during Pinia store construction via the invoice, estimate and recurring-invoice stub factories, so on those origins it threw a TypeError before the store existed and took the document screens down with it. The value is only a placeholder identity for a row that has no server id yet — the server assigns the real one on save, which is why DocumentItem and DocumentTax type it `number | string`. It never needed randomness, so it is now a session counter: no crypto, no fallback branch, works everywhere. PaymentDropdown.copyPdfUrl() had a textarea fallback attached with .catch(), which cannot fire — on a non-secure origin navigator.clipboard is undefined, so `.writeText` throws on property access before any promise exists. Test up front instead, matching the guard the invoice and estimate dropdowns already use.
820 B
820 B