mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2026-10-27 09:40:40 +00:00
Import/export a flyer design as a portable JSON file
Replaces the raw "Export event JSON" button with Import design / Export
design in the editor. A design file is content + relays only —
deliberately identity-free (no npub, naddr, event id, or signature, all
of which are derived at publish), so it can be handed to anyone and
published under their own key.
Format: { type: "voxvera_flyer_design", version: 1, flyer: <payload>,
relays: [] }. Export serializes the current form as-is (draft-friendly).
Import reads the picked file (capped at 256 KB), accepts the wrapper
format or a bare voxvera_flyer payload, then shows a confirm modal before
overwriting the editor; on confirm it fills the form and restores relays.
Imported content stays untrusted: the renderer escapes every field and
strict validation still runs at publish.
Adds 8 localized strings across all 14 languages (i18n parity passes).
Tests: export round-trip (identity-free assertions), import-then-confirm,
cancel-leaves-unchanged, and invalid-file rejection, across all 6
engines. Full suite 336 passing.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
a4cb8dffcb
commit
b344f92be7
5 files changed
+345
-13
No files matched your search
@@ -206,6 +206,31 @@ arriving later); the viewer shows a localized "This flyer was removed." state
|
||||
replaceable overwrites and NIP-09 may still serve the original — so it is framed
|
||||
as a request, not a guarantee.
|
||||
|
||||
## Importing and exporting a flyer design
|
||||
|
||||
The editor can save and load a flyer **design** as a portable `.json` file
|
||||
(`Export design` / `Import design`), independent of publishing. The file format
|
||||
is `{ type: "voxvera_flyer_design", version: 1, flyer: <payload>, relays: [] }`,
|
||||
where `flyer` is exactly `rawPayloadFromForm()` — the content fields plus the
|
||||
relay list, and **nothing identity-bound**: no npub, `naddr`, event id, or
|
||||
signature (all of those are derived at publish time by `withPosterUrl` /
|
||||
`signAndPublish`). That makes a design portable: it can be handed to anyone and
|
||||
published under *their* key with a fresh address.
|
||||
|
||||
- **Export** (`exportDesign`) serializes the current form as-is (draft-friendly,
|
||||
no strict validation) and downloads `<folder_name>-voxvera-design.json`.
|
||||
- **Import** (`importDesignFromFile`) reads the picked file (capped at 256 KB),
|
||||
`JSON.parse`s it, and accepts either the wrapper format or a bare
|
||||
`voxvera_flyer` payload (`readDesignFile`, lenient). It then shows a **confirm
|
||||
modal** (`#import-modal`) before overwriting the editor, and on confirm
|
||||
(`applyPendingImport`) fills the form via `fillEditorFromConfig` and restores
|
||||
the relay list. Imported content is untrusted, but it flows through the lenient
|
||||
view path (the renderer escapes every field) and still faces strict
|
||||
`validatePayload` at publish (raw-HTML rejection, length caps, URL schemes).
|
||||
|
||||
This replaced the earlier raw "Export event JSON" button; the published
|
||||
(signed) event JSON is still shown in `#event-json-output` after a publish.
|
||||
|
||||
## Print paper size
|
||||
|
||||
The flyer supports two print sizes: **US Letter** (8.5×11in) and **A4**
|
||||
|
||||
Reference in new issue
Block a user