diff --git a/src/components/AudioBlobList/AudioBlobList.tsx b/src/components/AudioBlobList/AudioBlobList.tsx index 318dbce..48e8344 100644 --- a/src/components/AudioBlobList/AudioBlobList.tsx +++ b/src/components/AudioBlobList/AudioBlobList.tsx @@ -1,5 +1,5 @@ import { formatFileSize, formatDate } from '../../utils/utils'; -import { ClipboardDocumentIcon, TrashIcon } from '@heroicons/react/24/outline'; +import { ClipboardDocumentIcon } from '@heroicons/react/24/outline'; import { BlobDescriptor } from 'blossom-client-sdk'; import { AudioBlob, ID3Tag, fetchId3Tag } from '../../utils/id3'; import { useQueries } from '@tanstack/react-query'; diff --git a/src/components/BlobList/Badge.tsx b/src/components/BlobList/Badge.tsx index 28c3b72..84bbf8b 100644 --- a/src/components/BlobList/Badge.tsx +++ b/src/components/BlobList/Badge.tsx @@ -33,7 +33,12 @@ const Badge = ({ ev }: { ev: NDKEvent }) => { relays: ev.onRelays.map(r => r.url), } as AddressPointer); return ( - + 🌸 drive ); diff --git a/src/components/BlobList/BlobList.tsx b/src/components/BlobList/BlobList.tsx index 85d91e9..021e240 100644 --- a/src/components/BlobList/BlobList.tsx +++ b/src/components/BlobList/BlobList.tsx @@ -61,6 +61,7 @@ const BlobList = ({ blobs, onDelete, title, className = '' }: BlobListProps) => className="link link-primary tooltip" data-tip="Copy link to clipboard" onClick={e => { + e.preventDefault(); e.stopPropagation(); navigator.clipboard.writeText(blob.url); }} diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index b8f1eeb..166aba4 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -54,16 +54,16 @@ function Home() { return ( <> - navigate('/transfer/' + selectedServer)} - onCheck={() => navigate('/check/' + selectedServer)} - title={<>Servers} - manageServers={true} - withVirtualServers={true} - > + navigate('/transfer/' + selectedServer)} + onCheck={() => navigate('/check/' + selectedServer)} + title={<>Servers} + manageServers={true} + withVirtualServers={true} + > {selectedServer && serverInfo[selectedServer] && selectedServerBlobs && ( ([]); const [uploadBusy, setUploadBusy] = useState(false); + const [imageResize, setImageResize] = useState(0); + // const [resizeImages, setResizeImages] = useState(false); // const [publishToNostr, setPublishToNostr] = useState(false); @@ -94,15 +122,22 @@ function Upload() { const filesToUpload: File[] = []; for (const f of files) { - if (cleanPrivateData) { - filesToUpload.push(await removeExifData(f)); - } else { - filesToUpload.push(f); + let processedFile = f; + + if (processedFile.type.startsWith('image/')) { + // Do image processing according to options + if (imageResize > 0) { + const { width, height } = ResizeOptions[imageResize]; + processedFile = await resizeImage(processedFile, width, height); + } + if (cleanPrivateData) { + processedFile = await removeExifData(processedFile); + } } + + filesToUpload.push(processedFile); } - // TODO use https://github.com/davejm/client-compress - // for image resizing const fileDimensions: { [key: string]: FileEventData } = {}; for (const file of filesToUpload) { let data = { @@ -232,30 +267,44 @@ function Upload() { return ( <>

Upload

- - + */} - }}>Test Mirror -
))}
-

Options

-
+

Image Options

+
setCleanPrivateData(c)} label="Clean private data in images (EXIF)" > - {/* - setResizeImages(c)} - label="Resize images to max. 2048 x 2048 (NOT IMPLEMENTED YET!)" - > - setPublishToNostr(c)} - label="Publish to NOSTR (as 1063 file metadata event) (NOT IMPLEMENTED YET!)" - > - */} + 0} + onChange={() => setImageResize(irs => (irs > 0 ? 0 : 1))} + /> +
+ + +