@cardinali-studio/adminkit 2.2.51 → 2.2.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/app.css +79 -54
- package/dist/app/lib/delivery-upload.js +20 -6
- package/dist/app/routes/Deliveries.js +21 -24
- package/dist/app/routes/DeliveryRecipientPreview.d.ts +2 -6
- package/dist/app/routes/DeliveryRecipientPreview.js +17 -10
- package/dist/functions/_shared/delivery-hero-format.js +15 -0
- package/dist/functions/api/delivery/hero.js +2 -1
- package/dist/functions/api/delivery/multipart.js +2 -1
- package/dist/functions/delivery-public/index.js +2 -1
- package/package.json +1 -1
package/dist/app/app.css
CHANGED
|
@@ -2494,7 +2494,6 @@ body:has(.uk) .pane-body { padding-bottom: 190px; }
|
|
|
2494
2494
|
|
|
2495
2495
|
/* Transfer composer. The options occupy their own column only when opened. */
|
|
2496
2496
|
.dl-compose-grid { grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr); }
|
|
2497
|
-
.dl-compose-companion { display: grid; gap: 14px; min-width: 0; }
|
|
2498
2497
|
.dl-compose-grid [hidden] { display: none; }
|
|
2499
2498
|
.dl-options-head, .dl-compose-actions, .dl-selection { display: flex; align-items: center; gap: .75rem; }
|
|
2500
2499
|
.dl-options-head { justify-content: space-between; }
|
|
@@ -2510,12 +2509,6 @@ body:has(.uk) .pane-body { padding-bottom: 190px; }
|
|
|
2510
2509
|
.dl-selection .ak-btn { margin-left: auto; }
|
|
2511
2510
|
.dl-compose-grid .dl-cover-head { flex-direction: column; align-items: start; }
|
|
2512
2511
|
.dl-compose-grid .dl-cover-actions { justify-content: start; }
|
|
2513
|
-
.dl-work:has(.dl-compose-grid) { container-type: inline-size; }
|
|
2514
|
-
@container (max-width: 43rem) {
|
|
2515
|
-
.dl-compose-grid { grid-template-columns: minmax(0,1fr); }
|
|
2516
|
-
.dl-compose-companion { display: contents; }
|
|
2517
|
-
.dl-recipient { order: -1; }
|
|
2518
|
-
}
|
|
2519
2512
|
@media (max-width: 700px) {
|
|
2520
2513
|
.dl-compose-grid .dl-pick { grid-template-columns: repeat(2,minmax(0,1fr)); }
|
|
2521
2514
|
}
|
|
@@ -2542,50 +2535,82 @@ body:has(.uk) .pane-body { padding-bottom: 190px; }
|
|
|
2542
2535
|
.dl-settings-shortcut { display: grid; place-items: center; width: 42px; height: 42px; background: transparent; color: var(--ak-ink-quiet); border: 1px solid transparent; border-radius: var(--ak-radius); cursor: pointer; }
|
|
2543
2536
|
.dl-settings-shortcut:hover, .dl-settings-shortcut[aria-current] { color: var(--ak-accent); border-color: var(--ak-line); }
|
|
2544
2537
|
.dl-settings-shortcut svg { width: 18px; height: 18px; }
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
.
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
.dl-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
.dl-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
.dl-
|
|
2580
|
-
.dl-
|
|
2581
|
-
.dl-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
.dl-
|
|
2586
|
-
.dl-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
.dl-
|
|
2590
|
-
|
|
2591
|
-
|
|
2538
|
+
|
|
2539
|
+
/* The canvas is the editor sheet. Keep scrolling on the host pane. */
|
|
2540
|
+
.pane:has(> .pane-body > .dl-transfer-canvas) > .pane-head:has(> .pane-spacer:only-child) {
|
|
2541
|
+
display: none;
|
|
2542
|
+
}
|
|
2543
|
+
:root[data-admin-interface="next"] .pane-body:has(> .dl-transfer-canvas) {
|
|
2544
|
+
flex: 1 0 auto;
|
|
2545
|
+
}
|
|
2546
|
+
:root .app .pane > .pane-body:has(> .dl-work.dl-transfer-canvas) {
|
|
2547
|
+
display: flex;
|
|
2548
|
+
flex-direction: column;
|
|
2549
|
+
padding: 0;
|
|
2550
|
+
}
|
|
2551
|
+
.dl-work.dl-transfer-canvas {
|
|
2552
|
+
--dl-paper: #edf2f7;
|
|
2553
|
+
--dl-caption: #1a2835;
|
|
2554
|
+
box-sizing: border-box;
|
|
2555
|
+
container-type: inline-size;
|
|
2556
|
+
background: var(--dl-paper);
|
|
2557
|
+
width: 100%;
|
|
2558
|
+
margin: 0;
|
|
2559
|
+
flex: 1 0 auto;
|
|
2560
|
+
border-radius: inherit;
|
|
2561
|
+
padding: clamp(14px, 1.8vw, 28px);
|
|
2562
|
+
align-content: start;
|
|
2563
|
+
}
|
|
2564
|
+
:root .dl-work.dl-transfer-canvas > .dl-work-head {
|
|
2565
|
+
position: static;
|
|
2566
|
+
margin: 0;
|
|
2567
|
+
padding: 0;
|
|
2568
|
+
background: transparent;
|
|
2569
|
+
flex-wrap: wrap;
|
|
2570
|
+
color: var(--dl-caption);
|
|
2571
|
+
}
|
|
2572
|
+
.dl-transfer-canvas .dl-work-actions { flex-wrap: wrap; }
|
|
2573
|
+
.dl-transfer-canvas .dl-work-actions .ak-btn:not(.ak-btn-primary) { background: var(--ak-panel); }
|
|
2574
|
+
.dl-transfer-canvas .dl-compose-grid {
|
|
2575
|
+
grid-template-columns: clamp(17rem, 35%, 24rem) minmax(0, 1fr);
|
|
2576
|
+
column-gap: clamp(16px, 3cqi, 42px);
|
|
2577
|
+
}
|
|
2578
|
+
.dl-transfer-canvas .dl-main { grid-area: 1 / 1; }
|
|
2579
|
+
.dl-transfer-canvas .dl-compose-card, .dl-transfer-canvas .dl-link {
|
|
2580
|
+
box-shadow: 0 7px 25px rgb(26 40 53 / .12);
|
|
2581
|
+
}
|
|
2582
|
+
.dl-artwork {
|
|
2583
|
+
grid-area: 1 / 2;
|
|
2584
|
+
min-width: 0;
|
|
2585
|
+
margin: 0;
|
|
2586
|
+
display: grid;
|
|
2587
|
+
gap: 12px;
|
|
2588
|
+
color: var(--dl-caption);
|
|
2589
|
+
}
|
|
2590
|
+
.dl-artwork-images { display: flex; justify-content: center; align-items: center; gap: 8px; }
|
|
2591
|
+
.dl-artwork-images img { flex: 1 1 0; min-width: 0; width: 100%; max-height: clamp(16rem, calc(100svh - 13rem), 52rem); object-fit: contain; }
|
|
2592
|
+
.dl-artwork-images img:first-child:not(:only-child) { object-position: right center; }
|
|
2593
|
+
.dl-artwork-images img + img { object-position: left center; }
|
|
2594
|
+
.dl-artwork figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; overflow-wrap: anywhere; }
|
|
2595
|
+
.dl-artwork figcaption:empty { display: none; }
|
|
2596
|
+
.dl-artwork-title { display: grid; gap: .3rem; min-width: 0; }
|
|
2597
|
+
.dl-artwork-title strong { font: 500 clamp(20px, 3cqi, 36px)/1.1 Georgia, serif; }
|
|
2598
|
+
.dl-artwork-title span, .dl-artwork figcaption p { font: 400 .875rem/1.45 var(--ak-font); }
|
|
2599
|
+
.dl-artwork figcaption p { margin: 0; max-width: 34ch; white-space: pre-line; }
|
|
2600
|
+
.dl-artwork-tools, .dl-artwork-tools [role=group] { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
|
|
2601
|
+
.dl-artwork-tools { justify-content: space-between; }
|
|
2602
|
+
.dl-artwork-tools button { background: transparent; color: inherit; border: 1px solid #acbac6; border-radius: 99px; padding: 0 .85rem; min-height: 36px; font: 500 .8rem/1 var(--ak-font); cursor: pointer; }
|
|
2603
|
+
.dl-artwork-tools button:hover { background: #fff; }
|
|
2604
|
+
.dl-artwork-tools button:disabled { opacity: .5; cursor: default; }
|
|
2605
|
+
.dl-artwork-tools [role=group] { font: 500 .75rem var(--ak-font); }
|
|
2606
|
+
.dl-artwork-tools [role=group] button { font-size: 1.2rem; }
|
|
2607
|
+
.dl-transfer-canvas .dl-side { grid-area: 1 / 2; z-index: 1; padding: 16px; border-radius: var(--ak-radius); background: var(--ak-panel); box-shadow: 0 6px 24px rgb(26 40 53 / .15); }
|
|
2608
|
+
.dl-compose-grid.is-expanded .dl-artwork { display: none; }
|
|
2609
|
+
@container (max-width: 688px) {
|
|
2610
|
+
.dl-transfer-canvas .dl-compose-grid { grid-template-columns: minmax(0,1fr); gap: 16px; }
|
|
2611
|
+
.dl-transfer-canvas .dl-main, .dl-transfer-canvas .dl-side { grid-area: auto; }
|
|
2612
|
+
.dl-artwork { grid-area: 1 / 1; margin: 0; }
|
|
2613
|
+
.dl-artwork-images img { max-height: 32svh; }
|
|
2614
|
+
.dl-artwork figcaption { flex-wrap: wrap; gap: .45rem; }
|
|
2615
|
+
.dl-artwork-tools button { min-height: 44px; }
|
|
2616
|
+
}
|
|
@@ -997,10 +997,10 @@ export function deliverySelectionName(files) {
|
|
|
997
997
|
export async function uploadDeliveryHeroObject(deliveryId, packageId, file) {
|
|
998
998
|
const variant = await makeHeroVariant(file);
|
|
999
999
|
const signed = await postJson({
|
|
1000
|
-
action: "heroPresign", id: deliveryId, packageId,
|
|
1000
|
+
action: "heroPresign", id: deliveryId, packageId, contentType: variant.blob.type,
|
|
1001
1001
|
});
|
|
1002
1002
|
const response = await fetch(signed.url, {
|
|
1003
|
-
method: "PUT", body: variant.blob, headers: { "Content-Type":
|
|
1003
|
+
method: "PUT", body: variant.blob, headers: { "Content-Type": variant.blob.type },
|
|
1004
1004
|
});
|
|
1005
1005
|
if (!response.ok)
|
|
1006
1006
|
throw new Error(`Copertina non caricata (${response.status}). Riprova.`);
|
|
@@ -1015,10 +1015,24 @@ async function makeHeroVariant(file) {
|
|
|
1015
1015
|
const bitmap = await createImageBitmap(file, { imageOrientation: "from-image" });
|
|
1016
1016
|
try {
|
|
1017
1017
|
const size = fit(bitmap.width, bitmap.height, 2560);
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1018
|
+
const canvas = document.createElement("canvas");
|
|
1019
|
+
canvas.width = size.width;
|
|
1020
|
+
canvas.height = size.height;
|
|
1021
|
+
const context = canvas.getContext("2d");
|
|
1022
|
+
if (!context)
|
|
1023
|
+
throw new Error("Impossibile preparare la copertina.");
|
|
1024
|
+
context.drawImage(bitmap, 0, 0, size.width, size.height);
|
|
1025
|
+
const encode = (type) => new Promise(resolve => canvas.toBlob(resolve, type, .82));
|
|
1026
|
+
// Safari can return a PNG when asked for WebP. Preserve alpha for transparent sources.
|
|
1027
|
+
let blob = await encode("image/webp");
|
|
1028
|
+
if (blob?.type !== "image/webp") {
|
|
1029
|
+
const fallback = /\.jpe?g$/i.test(file.name) ? "image/jpeg" : "image/png";
|
|
1030
|
+
if (blob?.type !== fallback)
|
|
1031
|
+
blob = await encode(fallback);
|
|
1032
|
+
if (blob?.type !== fallback)
|
|
1033
|
+
throw new Error("Impossibile preparare la copertina.");
|
|
1034
|
+
}
|
|
1035
|
+
return { blob, ...size };
|
|
1022
1036
|
}
|
|
1023
1037
|
finally {
|
|
1024
1038
|
bitmap.close();
|
|
@@ -412,6 +412,7 @@ export function DeliveryWorkspace({ delivery: fromServer, defaultHeroes = emptyC
|
|
|
412
412
|
const selectCovers = (event) => {
|
|
413
413
|
const input = event.currentTarget;
|
|
414
414
|
const files = Array.from(input.files || []);
|
|
415
|
+
input.value = "";
|
|
415
416
|
if (!files.length)
|
|
416
417
|
return;
|
|
417
418
|
if (files.length > 8 || files.some(file => !/\.(jpe?g|png|webp)$/i.test(file.name))) {
|
|
@@ -420,7 +421,7 @@ export function DeliveryWorkspace({ delivery: fromServer, defaultHeroes = emptyC
|
|
|
420
421
|
}
|
|
421
422
|
setCoverFiles(files);
|
|
422
423
|
setFailure(null);
|
|
423
|
-
|
|
424
|
+
setAdvanced(false);
|
|
424
425
|
};
|
|
425
426
|
/* ---- azioni di servizio ------------------------------------------------------------ */
|
|
426
427
|
const run = async (payload, done) => {
|
|
@@ -475,9 +476,6 @@ export function DeliveryWorkspace({ delivery: fromServer, defaultHeroes = emptyC
|
|
|
475
476
|
const state = delivery ? transferState(delivery) : null;
|
|
476
477
|
const expiry = draft.duration === "keep"
|
|
477
478
|
? delivery?.filesExpiresAt || null : expiryFrom(draft.duration);
|
|
478
|
-
const filesExpired = !!expiry && Date.parse(expiry) < Date.now();
|
|
479
|
-
const archived = delivery?.status === "archived";
|
|
480
|
-
const previewFileCount = filesExpired ? 0 : selection.length + packages.reduce((sum, pkg) => sum + (pkg.state === "ready" && (!archived || pkg.webEnabled) ? pkg.fileCount : 0), 0);
|
|
481
479
|
const accessEdited = !!link && (draft.pin !== (link.pin || "") || draft.duration !== clean.duration);
|
|
482
480
|
const sharingPaused = accessEdited || saving;
|
|
483
481
|
const shareMessage = delivery && link ? messageFor(delivery, link) : "";
|
|
@@ -492,31 +490,30 @@ export function DeliveryWorkspace({ delivery: fromServer, defaultHeroes = emptyC
|
|
|
492
490
|
setSaving(false);
|
|
493
491
|
}
|
|
494
492
|
}, children: "Accorcia link" }))] }), accessEdited && _jsx("p", { className: "dl-link-stats", role: "status", children: "Salva le modifiche di accesso o scadenza prima di condividere." }), _jsx("p", { className: "dl-link-stats", children: linkStory(link) }), _jsx("div", { ref: setActivityTarget, className: "dl-link-email" }), link.pin && (_jsxs("p", { className: "dl-link-stats", children: ["Codice di accesso ", _jsx("strong", { children: link.pin }), " \u00B7 Incluso nel messaggio."] }))] })) : null;
|
|
495
|
-
return (_jsxs("div", { className: "dl-work", children: [_jsxs("header", { className: "dl-work-head", children: [_jsxs("div", { className: "dl-work-title", children: [state && _jsx("span", { className: "dl-pill is-" + state.kind, children: state.label }), _jsx("h2", { children: draft.title.trim() ||
|
|
493
|
+
return (_jsxs("div", { className: "dl-work dl-transfer-canvas", children: [_jsx("input", { ref: coverRef, "data-transfer-cover-input": true, type: "file", accept: "image/jpeg,image/png,image/webp", multiple: true, hidden: true, onChange: selectCovers }), _jsxs("header", { className: "dl-work-head", children: [_jsxs("div", { className: "dl-work-title", children: [state && _jsx("span", { className: "dl-pill is-" + state.kind, children: state.label }), _jsx("h2", { children: delivery ? draft.title.trim() || delivery.title : "Nuovo transfer" })] }), _jsxs("div", { className: "dl-work-actions", children: [link && (_jsx("a", { className: "ak-btn", href: link.url, target: "_blank", rel: "noreferrer", children: "Apri pagina pubblica" })), link && (_jsx("button", { className: "ak-btn ak-btn-primary", disabled: !dirty || saving || busy || uploading, onClick: () => void save(), children: saving ? "Salvo…" : "Salva" }))] })] }), (failure || notice) && (_jsxs("p", { role: failure ? "alert" : "status", className: failure ? "ak-error dl-feedback" : "dl-feedback is-ok", children: [failure || notice, _jsx("button", { type: "button", "aria-label": "Chiudi", onClick: () => { setFailure(null); setNotice(null); }, children: "\u00D7" })] })), _jsxs("div", { className: "dl-grid dl-compose-grid" + (advanced ? " is-expanded" : ""), children: [_jsxs("div", { className: "dl-main", children: [ready && sharingCard, _jsxs("div", { className: "dl-compose-card", children: [_jsxs("section", { className: "dl-card dl-upload-card", "aria-labelledby": "dl-files-heading", children: [_jsxs("div", { className: "dl-section-head", children: [_jsx("h3", { id: "dl-files-heading", children: "File da consegnare" }), _jsx("p", { children: "Fino a 150 GB per caricamento." })] }), _jsxs("div", { className: "dl-pick", children: [_jsxs("button", { className: "dl-pick-tile", disabled: uploading, onClick: () => choose(false), children: [_jsx(FileIcon, {}), "Aggiungi file"] }), _jsxs("button", { className: "dl-pick-tile", disabled: uploading, onClick: () => choose(true), children: [_jsx(FolderIcon, {}), "Aggiungi una cartella"] }), _jsx("div", { ref: fileInputs, hidden: true })] }), _jsx(DropArea, { disabled: uploading, resuming: !!resumeRef.current, onFiles: addFiles, onError: (error) => setFailure(errorText(error)) }), !!selection.length && _jsxs("div", { className: "dl-selection", "aria-live": "polite", children: [_jsx("strong", { children: selection.length === 1 ? deliveryRelativeName(selection[0]) : selection.length + " file selezionati" }), _jsx("span", { children: formatBytes(selection.reduce((sum, file) => sum + file.size, 0)) }), _jsx("button", { type: "button", className: "ak-btn ak-btn-quiet", disabled: uploading, onClick: () => {
|
|
496
494
|
setSelection([]);
|
|
497
495
|
fileInputs.current?.replaceChildren();
|
|
498
496
|
}, children: "Svuota selezione" }), selection.length > 1 && _jsxs("details", { className: "dl-selected-list", children: [_jsx("summary", { children: "Mostra file" }), _jsx("ul", { children: selection.slice(0, filesShown).map((file, index) => _jsxs("li", { children: [_jsx("span", { children: deliveryRelativeName(file) }), _jsx("button", { className: "ak-btn", type: "button", disabled: uploading, "aria-label": `Rimuovi ${deliveryRelativeName(file)}`, onClick: () => setSelection(files => files.filter((_, i) => i !== index)), children: "\u00D7" })] }, index)) }), filesShown < selection.length && _jsx("button", { className: "ak-btn", type: "button", onClick: () => setFilesShown(count => count + 50), children: "Mostra altri file" })] })] }), job && isBusy(job) && _jsx(Progress, { job: job }), !!packages.length && (_jsx("ul", { className: "dl-files", children: packages.map((pkg) => (_jsxs("li", { className: "dl-file is-" + pkg.state + (confirmPackage === pkg.id ? " is-confirming" : ""), children: [_jsx("span", { className: "dl-file-icon", "aria-hidden": "true", children: pkg.state === "ready" ? "✓" : "…" }), _jsx(PackageContents, { pkg: pkg, confirming: confirmPackage === pkg.id, job: job?.id === pkg.id ? job : undefined, onAction: onAction }), confirmPackage === pkg.id ? (_jsx(_Fragment, { children: _jsxs("span", { className: "dl-file-actions", children: [_jsx("button", { className: "ak-btn", onClick: () => setConfirmPackage(null), children: "Annulla" }), _jsx("button", { className: "ak-btn dl-danger-btn", disabled: uploading, onClick: () => {
|
|
499
497
|
setConfirmPackage(null);
|
|
500
498
|
void run({ action: "deletePackage", id: delivery?.id, packageId: pkg.id }, "File rimossi");
|
|
501
|
-
}, children: "S\u00EC, rimuovi" })] }) })) : (_jsx(_Fragment, { children: _jsxs("span", { className: "dl-file-actions", children: [pkg.state !== "ready" && !(job?.id === pkg.id && isBusy(job)) && (_jsx("button", { className: "ak-btn", disabled: uploading, onClick: () => { resumeRef.current = pkg; setSelection([]); setNotice(resumeHint); }, children: "Riprendi" })), !(job?.id === pkg.id && isBusy(job)) && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: uploading, onClick: () => setConfirmPackage(pkg.id), children: "Rimuovi" }))] }) }))] }, pkg.id))) }))] }), _jsxs("form", { ref: quickFields, className: "dl-card dl-about dl-quick-fields", onSubmit: event => { event.preventDefault(); void beginUpload(selection, resumeRef.current); }, children: [_jsx(DeliveryEmail, { id: delivery?.id, value: emailPreferences, onChange: setEmailPreferences, busy: saving || uploading, unsaved: dirty, activityTarget: activityTarget, canResend: ready, hydratePreferences: !!fromServer, onState: p => { setEmailPreferences(p); setEmailClean(p); } }), _jsx(Field, { label: "Titolo", children: _jsx("input", { disabled: uploading || saving, value: draft.title, placeholder: selection.length ? deliverySelectionName(selection) : "Titolo del transfer", onChange: (e) => change({ title: e.target.value }) }) }), _jsx(Field, { label: "Messaggio", wide: true, children: _jsx("textarea", { disabled: uploading || saving, rows: 3, value: draft.description, onChange: (e) => change({ description: e.target.value }) }) }), _jsxs("div", { className: "dl-compose-actions", children: [_jsx("button", { ref: toggleRef, type: "button", className: "ak-btn dl-options-toggle", "aria-label": "Opzioni del transfer", title: "Opzioni del transfer", "aria-expanded": advanced, "aria-controls": "dl-options", onClick: () => setAdvanced(open => !open), children: "\u2022\u2022\u2022" }), _jsx("button", { className: "ak-btn ak-btn-primary", type: "submit", disabled: !selection.length || uploading || saving || busy, children: preparing ? "Caricamento in corso…" : resumeRef.current ? "Riprendi caricamento" : "Trasferisci" })] })] })] }), !ready && sharingCard, !link && delivery && !uploading && (_jsx("button", { className: "ak-btn", disabled: saving || busy, onClick: () => void save(), children: "Ottieni il link" }))] }),
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
: "Questo transfer non ha anteprime da cui scegliere: carica un'immagine, oppure resta quella predefinita." })) : null] }), !!delivery && (_jsxs("section", { className: "dl-danger", children: [_jsxs("div", { children: [_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: busy, onClick: () => void duplicate(), children: "Usa come modello" }), delivery.status === "active" && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: busy, onClick: () => void run({ action: "archive", id: delivery.id }, "Originali tolti: recuperabili per sette giorni"), children: "Libera spazio: togli gli originali" }))] }), confirmDelete ? (_jsxs("div", { className: "dl-confirm", children: [_jsxs("p", { children: ["Elimino ", _jsx("strong", { children: delivery.title }), photos.length ? ` (${countPhotos(packages)} file, ${formatBytes(delivery.storedBytes)})` : "", "? Il link smette subito di funzionare. La rimozione dei file e degli upload residui viene completata in background. Non si torna indietro."] }), _jsx("button", { className: "ak-btn", onClick: () => setConfirmDelete(false), children: "Annulla" }), _jsx("button", { className: "ak-btn dl-danger-btn", onClick: () => void remove(), children: "S\u00EC, elimina" })] })) : (_jsx("button", { className: "ak-btn ak-btn-quiet", onClick: () => setConfirmDelete(true), children: "Elimina il transfer" }))] }))] })] })] })] })] }));
|
|
499
|
+
}, children: "S\u00EC, rimuovi" })] }) })) : (_jsx(_Fragment, { children: _jsxs("span", { className: "dl-file-actions", children: [pkg.state !== "ready" && !(job?.id === pkg.id && isBusy(job)) && (_jsx("button", { className: "ak-btn", disabled: uploading, onClick: () => { resumeRef.current = pkg; setSelection([]); setNotice(resumeHint); }, children: "Riprendi" })), !(job?.id === pkg.id && isBusy(job)) && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: uploading, onClick: () => setConfirmPackage(pkg.id), children: "Rimuovi" }))] }) }))] }, pkg.id))) }))] }), _jsxs("form", { ref: quickFields, className: "dl-card dl-about dl-quick-fields", onSubmit: event => { event.preventDefault(); void beginUpload(selection, resumeRef.current); }, children: [_jsx(DeliveryEmail, { id: delivery?.id, value: emailPreferences, onChange: setEmailPreferences, busy: saving || uploading, unsaved: dirty, activityTarget: activityTarget, canResend: ready, hydratePreferences: !!fromServer, onState: p => { setEmailPreferences(p); setEmailClean(p); } }), _jsx(Field, { label: "Titolo", children: _jsx("input", { disabled: uploading || saving, value: draft.title, placeholder: selection.length ? deliverySelectionName(selection) : "Titolo del transfer", onChange: (e) => change({ title: e.target.value }) }) }), _jsx(Field, { label: "Messaggio", wide: true, children: _jsx("textarea", { disabled: uploading || saving, rows: 3, value: draft.description, onChange: (e) => change({ description: e.target.value }) }) }), _jsxs("div", { className: "dl-compose-actions", children: [_jsx("button", { ref: toggleRef, type: "button", className: "ak-btn dl-options-toggle", "aria-label": "Opzioni del transfer", title: "Opzioni del transfer", "aria-expanded": advanced, "aria-controls": "dl-options", onClick: () => setAdvanced(open => !open), children: "\u2022\u2022\u2022" }), _jsx("button", { className: "ak-btn ak-btn-primary", type: "submit", disabled: !selection.length || uploading || saving || busy, children: preparing ? "Caricamento in corso…" : resumeRef.current ? "Riprendi caricamento" : "Trasferisci" })] })] })] }), !ready && sharingCard, !link && delivery && !uploading && (_jsx("button", { className: "ak-btn", disabled: saving || busy, onClick: () => void save(), children: "Ottieni il link" }))] }), _jsx(DeliveryRecipientPreview, { title: draft.title.trim() || (selection.length ? deliverySelectionName(selection) : delivery?.title) || "", clientName: draft.clientName.trim(), message: draft.description, covers: previewCovers, disabled: saving || uploading || preparing, onChoose: () => coverRef.current?.click() }), _jsxs("aside", { className: "dl-side", id: "dl-options", "aria-label": "Opzioni del transfer", hidden: !advanced, children: [_jsxs("div", { className: "dl-options-head", children: [_jsx("h3", { tabIndex: -1, ref: optionsTitle, children: "Opzioni del transfer" }), _jsx("button", { type: "button", className: "ak-btn", "aria-label": "Chiudi opzioni", onClick: () => { setAdvanced(false); toggleRef.current?.focus(); }, children: "\u00D7" })] }), _jsxs("fieldset", { className: "dl-option-fields", disabled: uploading || saving, children: [_jsxs(Group, { title: "Opzioni di consegna", note: packages.length
|
|
500
|
+
? "Le opzioni dei file caricati sono bloccate. Per cambiarle, rimuovi e ricarica i file."
|
|
501
|
+
: "Puoi cambiare queste opzioni prima di premere Trasferisci.", children: [_jsxs("label", { className: "dl-check", children: [_jsx("input", { type: "checkbox", checked: draft.gallery, disabled: !!packages.length, onChange: (e) => change({ gallery: e.target.checked }) }), _jsxs("span", { children: [_jsx("strong", { children: "Galleria" }), _jsx("small", { children: "Mostra le foto in anteprima sulla pagina del transfer." })] })] }), _jsxs("label", { className: "dl-check", children: [_jsx("input", { type: "checkbox", checked: draft.light, disabled: !!packages.length, onChange: (e) => change({ light: e.target.checked, webFormat: jpegEnabled ? draft.webFormat : "webp" }) }), _jsxs("span", { children: [_jsx("strong", { children: "Aggiungi conversione in bassa risoluzione" }), _jsx("small", { children: "Chi scarica pu\u00F2 scegliere foto pi\u00F9 leggere per web e social, fino a 2048 px sul lato lungo." })] })] }), draft.light && (_jsxs("label", { className: "dl-field", children: [_jsx("span", { children: "Formato della conversione" }), _jsxs("select", { className: "dl-select", "aria-label": "Formato della conversione", value: draft.webFormat, disabled: !!packages.length || uploading, onChange: (e) => change({ webFormat: e.target.value === "jpg" ? "jpg" : "webp" }), children: [_jsx("option", { value: "webp", children: "WebP \u2014 file pi\u00F9 piccoli" }), _jsx("option", { value: "jpg", disabled: !jpegEnabled && draft.webFormat !== "jpg", children: "JPG \u2014 massima compatibilit\u00E0" })] }), _jsxs("small", { children: ["2048 px sul lato lungo, senza ingrandire le foto pi\u00F9 piccole. Qualit\u00E0 ", draft.webFormat === "jpg" ? "82%" : "80%", "."] })] }))] }), _jsx(Group, { title: "Cliente", children: _jsx(Field, { label: "Destinatario", hint: "Nome del cliente o dell\u2019azienda. Facoltativo.", children: _jsx("input", { value: draft.clientName, placeholder: "Es. Azienda Rossi", onChange: (e) => change({ clientName: e.target.value }) }) }) }), _jsxs(Group, { title: "Chi pu\u00F2 aprirlo", children: [_jsxs("label", { className: "dl-radio", children: [_jsx("input", { type: "radio", name: "dl-access", checked: !draft.pin, onChange: () => change({ pin: "" }) }), _jsxs("span", { children: [_jsx("strong", { children: "Chiunque abbia il link" }), _jsx("small", { children: "Chi riceve il link pu\u00F2 aprire il transfer e condividerlo." })] })] }), _jsxs("label", { className: "dl-radio", children: [_jsx("input", { type: "radio", name: "dl-access", checked: !!draft.pin, onChange: () => change({ pin: draft.pin || makeCode() }) }), _jsxs("span", { children: [_jsx("strong", { children: "Link e codice di accesso" }), _jsx("small", { children: "Condividi il codice con il destinatario. Dopo 10 tentativi errati, l\u2019accesso \u00E8 sospeso per un\u2019ora." })] })] }), !!draft.pin && (_jsxs("div", { className: "dl-code", children: [_jsx("input", { "aria-label": "Codice di accesso", value: draft.pin, spellCheck: false, onChange: (e) => change({ pin: e.target.value.toUpperCase() }) }), _jsx("button", { className: "ak-btn", onClick: () => change({ pin: makeCode() }), children: "Rigenera" })] }))] }), downloadLabelsEnabled && (_jsxs(Group, { title: "Testi dei pulsanti di download", note: "Lascia vuoto per usare il testo predefinito. Puoi cambiarli anche dopo l\u2019invio, senza ricaricare i file.", children: [delivery?.status !== "archived" && (_jsx(Field, { label: "Pulsante degli originali", children: _jsx("input", { value: draft.downloadOriginalsLabel, maxLength: 80, placeholder: "Scarica i file", onChange: (e) => change({ downloadOriginalsLabel: e.target.value }) }) })), (packages.length ? packages.some(pkg => pkg.webEnabled) : draft.light) && (_jsx(Field, { label: "Pulsante della versione leggera", children: _jsx("input", { value: draft.downloadWebLabel, maxLength: 80, placeholder: "Versione leggera", onChange: (e) => change({ downloadWebLabel: e.target.value }) }) }))] })), _jsxs(Group, { title: "Scadenza", children: [_jsxs("select", { "aria-label": "Scadenza", className: "dl-select", value: draft.duration, onChange: (e) => change({ duration: e.target.value }), children: [delivery && _jsx("option", { value: "keep", children: delivery.filesExpiresAt
|
|
502
|
+
? `Fino al ${formatDate(delivery.filesExpiresAt)}`
|
|
503
|
+
: "Per sempre" }), _jsx("option", { value: "7", children: "7 giorni" }), _jsx("option", { value: "30", children: "30 giorni" }), _jsx("option", { value: "60", children: "60 giorni" }), _jsx("option", { value: "180", children: "6 mesi" }), _jsx("option", { value: "365", children: "1 anno" }), _jsx("option", { value: "forever", children: "Per sempre" })] }), _jsx("p", { className: "dl-note", children: expiry
|
|
504
|
+
? `Dopo il ${formatDate(expiry)} il link continua ad aprirsi, ma i file non si scaricano più.`
|
|
505
|
+
: "I file restano finché non li togli tu." })] }), _jsxs(Group, { title: "Alla fine della pagina", children: [_jsxs("label", { className: "dl-check", children: [_jsx("input", { type: "checkbox", checked: draft.ctaEnabled, onChange: (e) => change({ ctaEnabled: e.target.checked }) }), _jsxs("span", { children: [_jsx("strong", { children: "Chiedi una recensione" }), _jsx("small", { children: "Un pulsante in fondo, dopo le fotografie." })] })] }), draft.ctaEnabled && (_jsxs(_Fragment, { children: [_jsx(Field, { label: "Testo del pulsante", children: _jsx("input", { value: draft.ctaLabel, onChange: (e) => change({ ctaLabel: e.target.value }) }) }), _jsx(Field, { label: "Indirizzo", hint: "Il link alla tua pagina delle recensioni.", children: _jsx("input", { type: "url", value: draft.ctaUrl, placeholder: "https://\u2026", onChange: (e) => change({ ctaUrl: e.target.value }) }) })] })), _jsx(Field, { label: "Note d'uso", hint: "Cosa pu\u00F2 farci il cliente. Appaiono in fondo alla pagina.", children: _jsx("textarea", { rows: 3, value: draft.licenseNotes, onChange: (e) => change({ licenseNotes: e.target.value }) }) })] }), _jsxs("details", { className: "dl-unavailable", children: [_jsx("summary", { children: "Funzioni aggiuntive non attive" }), _jsxs("div", { children: [" ", _jsxs(Group, { title: "Richiedi pagamento", children: [_jsx("span", { className: "dl-payment-status", children: "Chiedi di attivare la funzione" }), _jsxs("label", { className: "dl-check dl-payment-disabled", children: [_jsx("input", { type: "checkbox", checked: false, disabled: true, "aria-describedby": "dl-payment-description" }), _jsxs("span", { children: [_jsx("strong", { children: "Sblocca gallery e download al saldo" }), _jsx("small", { id: "dl-payment-description", children: "Potrai impostare l\u2019importo da incassare per questa consegna. Il cliente pagher\u00E0 una sola volta per sbloccare la galleria e scaricare i file." })] })] }), _jsx("p", { className: "dl-note", children: "Questa opzione non \u00E8 ancora disponibile: il transfer non richiede pagamenti e segue le impostazioni di accesso qui sopra." })] }), _jsxs(Group, { title: "Selezione del cliente", children: [_jsx("span", { className: "dl-payment-status", children: "Chiedi di attivare la funzione" }), _jsxs("label", { className: "dl-check dl-payment-disabled", children: [_jsx("input", { type: "checkbox", checked: false, disabled: true, "aria-describedby": "dl-selection-description" }), _jsxs("span", { children: [_jsx("strong", { children: "Consenti al cliente di scegliere le foto" }), _jsx("small", { id: "dl-selection-description", children: "Il cliente potr\u00E0 indicare nella galleria quali foto entrano nella sua selezione." })] })] }), _jsx("p", { className: "dl-note", children: "Questa opzione non \u00E8 ancora disponibile: al momento il cliente pu\u00F2 consultare la galleria, se abilitata, ma non salvare una selezione." })] })] })] }), _jsxs("section", { className: "dl-card dl-cover", children: [_jsxs("div", { className: "dl-cover-head", children: [_jsxs("div", { children: [_jsx("span", { className: "dl-step", children: "Copertina" }), _jsxs("p", { children: ["Fino a otto sfondi per la pagina del destinatario.", " ", coverFiles.length ? coverFiles.map(file => file.name).join(", ") : heroes.length
|
|
506
|
+
? `Ne hai scelte ${heroes.length}.`
|
|
507
|
+
: "Nessuna scelta: si userà quella predefinita."] }), _jsx("p", { role: "status", children: !delivery ? "Puoi scegliere uno sfondo per questo transfer prima di inviarlo." : heroesDirty || coverFiles.length > 0
|
|
508
|
+
? "Scelta non ancora salvata: premi Salva modifiche per mostrarla al cliente."
|
|
509
|
+
: heroes.length
|
|
510
|
+
? "Copertine salvate. Una sola immagine resta fissa; più immagini compongono la sequenza."
|
|
511
|
+
: "Scegli le copertine qui: la galleria sotto nella pagina del cliente è separata." })] }), _jsxs("div", { className: "dl-cover-actions", children: [!!photos.length && (_jsx("button", { className: "ak-btn", onClick: () => setPreviewAttempt(value => value + 1), title: "Riprova a caricare le miniature senza cambiare le copertine selezionate", children: "Ricarica anteprime" })), delivery && _jsx("button", { className: "ak-btn ak-btn-primary", disabled: !dirty || saving || busy || uploading, onClick: () => void save(), children: saving ? "Salvo…" : "Salva modifiche" }), _jsx("button", { className: "ak-btn", disabled: saving || uploading, onClick: () => coverRef.current?.click(), children: "Carica un'immagine" }), (!!heroes.length || !!coverFiles.length) && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: saving, onClick: () => { setHeroes([]); setCoverFiles([]); }, children: "Usa quella predefinita" }))] })] }), packages.some(pkg => (moreImages[pkg.id] ? moreImages[pkg.id].nextCursor : pkg.nextCursor) != null) && (_jsx("button", { className: "ak-btn", disabled: loadingImages, onClick: () => void loadMoreImages(), children: loadingImages ? "Caricamento…" : "Mostra altre foto" })), photos.length ? (_jsx("div", { className: "dl-cover-grid", children: photos.map(({ pkg, image }) => {
|
|
512
|
+
const chosen = heroes.some((item) => item.type === "package" && item.packageId === pkg.id && item.index === image.index);
|
|
513
|
+
return (_jsxs("button", { type: "button", className: chosen ? "is-chosen" : "", disabled: saving, "aria-pressed": chosen, onClick: () => toggleCover(pkg.id, image.index, image.previewUrl), children: [_jsx("img", { src: previewAttempt ? `${image.previewUrl}&previewRetry=${previewAttempt}` : image.previewUrl, alt: image.name, width: image.width, height: image.height, loading: "lazy" }), chosen && _jsx("em", { "aria-hidden": "true", children: "\u2713" })] }, `${pkg.id}-${image.index}`));
|
|
514
|
+
}) })) : ready ? (_jsx("p", { className: "dl-note dl-cover-empty", children: heroes.some((item) => item.type === "object")
|
|
515
|
+
? `${heroes.length} immagini caricate a mano.`
|
|
516
|
+
: "Questo transfer non ha anteprime da cui scegliere: carica un'immagine, oppure resta quella predefinita." })) : null] }), !!delivery && (_jsxs("section", { className: "dl-danger", children: [_jsxs("div", { children: [_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: busy, onClick: () => void duplicate(), children: "Usa come modello" }), delivery.status === "active" && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: busy, onClick: () => void run({ action: "archive", id: delivery.id }, "Originali tolti: recuperabili per sette giorni"), children: "Libera spazio: togli gli originali" }))] }), confirmDelete ? (_jsxs("div", { className: "dl-confirm", children: [_jsxs("p", { children: ["Elimino ", _jsx("strong", { children: delivery.title }), photos.length ? ` (${countPhotos(packages)} file, ${formatBytes(delivery.storedBytes)})` : "", "? Il link smette subito di funzionare. La rimozione dei file e degli upload residui viene completata in background. Non si torna indietro."] }), _jsx("button", { className: "ak-btn", onClick: () => setConfirmDelete(false), children: "Annulla" }), _jsx("button", { className: "ak-btn dl-danger-btn", onClick: () => void remove(), children: "S\u00EC, elimina" })] })) : (_jsx("button", { className: "ak-btn ak-btn-quiet", onClick: () => setConfirmDelete(true), children: "Elimina il transfer" }))] }))] })] })] })] }));
|
|
520
517
|
}
|
|
521
518
|
/* ============================================================================================
|
|
522
519
|
Impostazioni
|
|
@@ -3,12 +3,8 @@ interface Props {
|
|
|
3
3
|
clientName: string;
|
|
4
4
|
message: string;
|
|
5
5
|
covers: (string | File)[];
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
downloadLabel: string;
|
|
9
|
-
expiryLabel: string;
|
|
10
|
-
notice: string;
|
|
11
|
-
finalLabel: string;
|
|
6
|
+
onChoose: () => void;
|
|
7
|
+
disabled: boolean;
|
|
12
8
|
}
|
|
13
9
|
export declare function DeliveryRecipientPreview(props: Props): import("react").JSX.Element;
|
|
14
10
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
// Keep file previews local to the editor, including covers awaiting their first save.
|
|
4
4
|
function usePreviewCovers(sources) {
|
|
5
5
|
const [images, setImages] = useState([]);
|
|
@@ -29,21 +29,28 @@ function usePreviewCovers(sources) {
|
|
|
29
29
|
return images.filter((image) => image !== null);
|
|
30
30
|
}
|
|
31
31
|
export function DeliveryRecipientPreview(props) {
|
|
32
|
-
const
|
|
32
|
+
const figure = useRef(null);
|
|
33
|
+
const [pairPortraits, setPairPortraits] = useState(false);
|
|
33
34
|
const [page, setPage] = useState(0);
|
|
34
|
-
const [showUnlocked, setShowUnlocked] = useState(false);
|
|
35
|
-
const locked = props.locked && !showUnlocked;
|
|
36
|
-
useEffect(() => { setShowUnlocked(false); }, [props.locked]);
|
|
37
35
|
const covers = usePreviewCovers(props.covers);
|
|
38
|
-
useEffect(() => {
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const canvas = figure.current?.closest(".dl-transfer-canvas");
|
|
38
|
+
if (!canvas)
|
|
39
|
+
return;
|
|
40
|
+
const observer = new ResizeObserver(([entry]) => setPairPortraits(entry.contentRect.width > 688));
|
|
41
|
+
observer.observe(canvas);
|
|
42
|
+
return () => observer.disconnect();
|
|
43
|
+
}, []);
|
|
44
|
+
useEffect(() => { setPage(0); }, [pairPortraits, props.covers]);
|
|
39
45
|
const groups = [];
|
|
40
46
|
for (let i = 0; i < covers.length; i++) {
|
|
41
47
|
const group = [covers[i]];
|
|
42
|
-
if (
|
|
48
|
+
if (pairPortraits && covers[i].portrait && covers[i + 1]?.portrait)
|
|
43
49
|
group.push(covers[++i]);
|
|
44
50
|
groups.push(group);
|
|
45
51
|
}
|
|
46
52
|
const current = Math.min(page, Math.max(0, groups.length - 1));
|
|
47
|
-
const group =
|
|
48
|
-
|
|
53
|
+
const group = groups[current] ?? [];
|
|
54
|
+
const chooseLabel = group.length ? "Cambia copertina" : "Scegli una copertina";
|
|
55
|
+
return _jsxs("figure", { className: "dl-artwork", ref: figure, "aria-label": "Copertina del transfer", children: [group.length > 0 && _jsx("div", { className: "dl-artwork-images", children: group.map(cover => _jsx("img", { src: cover.src, alt: "" }, cover.src)) }), _jsxs("figcaption", { children: [(props.clientName || props.title) && _jsxs("div", { className: "dl-artwork-title", children: [_jsx("strong", { children: props.clientName || props.title }), props.clientName && props.title && _jsx("span", { children: props.title })] }), props.message && _jsx("p", { children: props.message })] }), _jsxs("div", { className: "dl-artwork-tools", children: [_jsx("button", { type: "button", disabled: props.disabled, onClick: props.onChoose, children: chooseLabel }), groups.length > 1 && _jsxs("div", { role: "group", "aria-label": "Sequenza delle copertine", children: [_jsx("button", { type: "button", "aria-label": "Vista precedente", onClick: () => setPage((current + groups.length - 1) % groups.length), children: "\u2039" }), _jsxs("span", { "aria-live": "polite", children: [current + 1, " / ", groups.length] }), _jsx("button", { type: "button", "aria-label": "Vista successiva", onClick: () => setPage((current + 1) % groups.length), children: "\u203A" })] })] })] });
|
|
49
56
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Covers created by earlier clients always have a WebP key.
|
|
2
|
+
export function heroExtension(contentType = "image/webp") {
|
|
3
|
+
switch (contentType) {
|
|
4
|
+
case "image/webp": return "webp";
|
|
5
|
+
case "image/jpeg": return "jpg";
|
|
6
|
+
case "image/png": return "png";
|
|
7
|
+
default: throw Object.assign(new Error("Scegli una copertina JPEG, PNG o WebP."), { status: 400, retryable: false });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function heroContentType(key) {
|
|
12
|
+
if (key.endsWith(".png")) return "image/png";
|
|
13
|
+
if (key.endsWith(".jpg")) return "image/jpeg";
|
|
14
|
+
return "image/webp";
|
|
15
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { heroContentType } from "../../_shared/delivery-hero-format.js";
|
|
1
2
|
/* Derivata hero dedicata: oggetto piccolo B2, mai l'originale fotografico. */
|
|
2
3
|
import { b2Get } from "../../_shared/b2.js";
|
|
3
4
|
|
|
@@ -11,7 +12,7 @@ export async function onRequestGet({ request, env }) {
|
|
|
11
12
|
const upstream = await b2Get(env, hero.object_key);
|
|
12
13
|
if (!upstream.ok) return new Response("Not found", { status: upstream.status });
|
|
13
14
|
const headers = new Headers({
|
|
14
|
-
"Content-Type":
|
|
15
|
+
"Content-Type": heroContentType(hero.object_key),
|
|
15
16
|
"Cache-Control": "private, max-age=3600",
|
|
16
17
|
"X-Content-Type-Options": "nosniff",
|
|
17
18
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { heroExtension } from "../../_shared/delivery-hero-format.js";
|
|
1
2
|
import { requestDiagnostics, technicalDiagnostic } from "../../_shared/diagnostics.js";
|
|
2
3
|
import packageInfo from "../../../../package.json" with { type: "json" };
|
|
3
4
|
/* Controllo multipart Backblaze B2.
|
|
@@ -75,7 +76,7 @@ async function heroPresign(env, body) {
|
|
|
75
76
|
if (!pkg) throw invalid("pacchetto per la hero non trovato o scaduto");
|
|
76
77
|
assertUploadSessionInvocation(env, pkg);
|
|
77
78
|
const heroId = crypto.randomUUID();
|
|
78
|
-
const key = b2ObjectKey(pkg.storage_prefix, `heroes/${heroId}.
|
|
79
|
+
const key = b2ObjectKey(pkg.storage_prefix, `heroes/${heroId}.${heroExtension(body.contentType)}`);
|
|
79
80
|
const now = new Date().toISOString();
|
|
80
81
|
await env.DB.prepare(`
|
|
81
82
|
INSERT INTO delivery_hero_objects
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { heroContentType } from "../_shared/delivery-hero-format.js";
|
|
1
2
|
import { bundleIdentity, bundleResponse, downloadSources } from "../_shared/delivery-download-bundle.js";
|
|
2
3
|
import {processDeliveryEmails} from "../_shared/delivery-email.js";
|
|
3
4
|
/* Consegna pubblica: /c/<token>.
|
|
@@ -528,7 +529,7 @@ async function hero(env, access, id) {
|
|
|
528
529
|
const upstream = await b2Get(env, selected.objectKey);
|
|
529
530
|
if (!upstream.ok) return new Response("Not found", { status: upstream.status });
|
|
530
531
|
const headers = new Headers({
|
|
531
|
-
"Content-Type":
|
|
532
|
+
"Content-Type": heroContentType(selected.objectKey),
|
|
532
533
|
"Cache-Control": "private, max-age=86400",
|
|
533
534
|
"X-Content-Type-Options": "nosniff",
|
|
534
535
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardinali-studio/adminkit",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Motore riusabile di un pannello di amministrazione per siti Hugo su Cloudflare Pages: codec del front matter guidato dallo schema, form React, libreria media su R2. NIENTE di specifico di un sito qui dentro.",
|
|
6
6
|
"license": "0BSD",
|