diff --git a/README.md b/README.md index f90c355..64077eb 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ A tool to manage your content on blossom severs (Upload, Distribution, Posting) ## TODO / Ideas +Add cancel button for upload stream + Add Blurhash https://github.com/verbiricha/filestr/blob/master/src/blur.tsx diff --git a/src/components/FileEventEditor/FileEventEditor.tsx b/src/components/FileEventEditor/FileEventEditor.tsx index 3dbf472..caa6e91 100644 --- a/src/components/FileEventEditor/FileEventEditor.tsx +++ b/src/components/FileEventEditor/FileEventEditor.tsx @@ -98,9 +98,44 @@ const FileEventEditor = ({ data }: { data: FileEventData }) => { // await ev.publish(); }; + /* + async function createDvmBlossemAuthToken() { + const pubkey = ndk.activeUser?.pubkey; + if (!ndk.signer || !pubkey) return; + const tenMinutes = () => dayjs().unix() + 10 * 60; + const authEvent = ({ + pubkey, + created_at: dayjs().unix(), + kind: 24242, + content: 'Upload thumbail', + tags: [ + ['t', 'upload'], + ['name', `thumb_${Math.random().toString(36).substring(2)}`], // make sure the auth events are unique + ['expiration', String(tenMinutes())], + ], + }); + const ev = new NDKEvent(ndk, authEvent); + await ev.sign(); + console.log(JSON.stringify(ev.rawEvent())); + return btoa(JSON.stringify(ev.rawEvent())); + } + */ + const getThumbnails = async (data: FileEventData) => { if (!ndk.signer) return; + const thumbCount = 3; + + /*s + const authTokens = []; + for (let i = 0; i < thumbCount; i++) { + const uploadAuth = await createDvmBlossemAuthToken(); + if (uploadAuth) { + authTokens.push(['param', 'authToken', uploadAuth]); + } + } + */ + const e: NostrEvent = { created_at: dayjs().unix(), content: await ndk.signer?.encrypt( @@ -108,19 +143,15 @@ const FileEventEditor = ({ data }: { data: FileEventData }) => { JSON.stringify([ ['i', data.url[0], 'url'], ['output', 'image/jpeg'], - ['param', 'thumbnailCount', '3'], - ['param', 'imageFormat', 'jpg'], + ['param', 'thumbnailCount', `${thumbCount}`], ['relays', user?.relayUrls.join(',') || ndk.explicitRelayUrls?.join(',') || ''], ]) ), - tags: [['p', dvm.pubkey], ['encrypted']], - /*tags: [ - ['i', data.url[0], 'url'], - ['output', 'image/jpeg'], - ['param', 'thumbnailCount', '5'], - ['param', 'imageFormat', 'jpg'], - ['relays', user?.relayUrls.join(',') || ndk.explicitRelayUrls?.join(',') || ''], - ],*/ + tags: [ + ['p', dvm.pubkey], + ['encrypted'], + // TODO set expiration + ], kind: 5204, pubkey: user?.pubkey || '', }; @@ -133,7 +164,7 @@ const FileEventEditor = ({ data }: { data: FileEventData }) => { useEffect(() => { if (fileEventData.m?.startsWith('video/') && fileEventData.thumbnails == undefined) { - // getThumbnails(fileEventData); skip for now, until the DVM is properly hosted + getThumbnails(fileEventData); } }, [fileEventData]); @@ -143,7 +174,7 @@ const FileEventEditor = ({ data }: { data: FileEventData }) => { <> {thumbnailRequestEventId && (fileEventData.thumbnails && fileEventData.thumbnails.length > 0 ? ( -
+
{fileEventData.thumbnails.map((t, i) => (
@@ -157,7 +188,7 @@ const FileEventEditor = ({ data }: { data: FileEventData }) => { key={`link${i + 1}`} href={`#item${i + 1}`} onClick={() => setFileEventData(ed => ({ ...ed, thumbnail: t }))} - className={'btn btn-xs ' + (t==fileEventData.thumbnail ? 'btn-primary':'')} + className={'btn btn-xs ' + (t == fileEventData.thumbnail ? 'btn-primary' : '')} >{`${i + 1}`} ))}
@@ -200,7 +231,13 @@ const FileEventEditor = ({ data }: { data: FileEventData }) => { placeholder="Caption" > URL -
{fileEventData.url.map((text,i) =>
{text}
)}
+
+ {fileEventData.url.map((text, i) => ( +
+ {text} +
+ ))} +
diff --git a/userstories.md b/userstories.md new file mode 100644 index 0000000..e7cacb2 --- /dev/null +++ b/userstories.md @@ -0,0 +1,58 @@ + +I am currently thinking about the use cases I want to support with bouquet for UPLOADING to blossom servers. + +As a primal web user I want to upload an image to multiple blossom servers to post it on the primal web app. + +As a user I want to upload and share an arbitrary file (kind 1063) publicly so the file can be found by querying for the SHA-256 hash (x tag). + +As a photographer I want to upload multiple images to multiple blossom servers and publish them as an image album (list of images, maybe slide sets 30388). [3] + +As a tiktok user I want to upload a vertical video and post it to nostr (kind: 34236) [1] + +As a video creator I want to upload a video (16:9) and post it to nostr (flare.pub kind 34235) [1] + +As a music creator I want to upload a single audio track and publish it to nostr. (kind: 31137) [2] + +As a music collector I want to upload a complete album to nostr incl. album art and metadata (audio: 31137, playlist: 30029). [2] + +As a builder I want to upload 3D printing models to ... + + + +[1] https://github.com/nostr-protocol/nips/pull/923/files + +[2] https://github.com/nostr-protocol/nips/pull/1043 + +[3] https://cornychat.com/datatypes#kind30388slideset + + + +Bouquet + +Overview + +bouquet.slidestr.net is a tools for blossom servers that allows a user to upload content and manage his/her blobs. + +The following are example use cases for Bouquet. + +Usecases + +As a primal web user I want to upload an image to multiple blossom servers to post it on the primal web app. + +As a user I want to upload and share an arbitrary file (kind 1063) publicly so the file can be found by querying for the SHA-256 hash (x tag). + + As a photographer I want to upload multiple images to multiple blossom servers and publish them as an image album (list of images, maybe slide sets 30388). [3] + +As a tiktok user I want to upload a vertical video and post it to nostr (kind: 34236) [1] + +As a video creator I want to upload a video (16:9) and post it to nostr (flare.pub kind 34235) [1] + +As a music creator I want to upload a single audio track and publish it to nostr. (kind: 31137) [2] As a music collector I want to upload a complete album to nostr incl. album art and metadata (audio: 31137, playlist: 30029). [2] + +References + +https://github.com/nostr-protocol/nips/pull/923/files + +https://github.com/nostr-protocol/nips/pull/1043 + +https://cornychat.com/datatypes#kind30388slideset \ No newline at end of file