Handling User Media Uploads #272
Replies: 9 comments 41 replies
-
Should this be a NIP? |
Beta Was this translation helpful? Give feedback.
-
I like the idea of S3-compatibility. |
Beta Was this translation helpful? Give feedback.
-
Please just work with us on connection requirements moving forward so we can plan and adapt. Thank you! |
Beta Was this translation helpful? Give feedback.
-
While using torrents (dht+magnet links as media URIs in clients) is cool, after much consideration, I've come to the conclusion that this goes against the nostr ethos. It's spelled out pretty clearly in https://github.com/nostr-protocol/nostr -- "it does not rely on P2P techniques, therefore it works.". I agree with this and believe something like a S3 compatibility layer makes the most sense. |
Beta Was this translation helpful? Give feedback.
-
Thanks to @monlovesmango for pulling me into this discussion. I am glad this is being hashed out now. Image hosting can be a local storage running on Umbrel or a cloud storage like AWS. It should be an option in the Nostr client settings. The deal between user and storage provider should be outside the scope of Nostr client. Nostr client calls the url from settings and pass on the image to get an image link in return. That link goes into the note and published into relay. This may be ok for a web Nostr client. But may be a problem for App that goes through App store review. At starbackr we push all the uploaded images through google vision API to scan for illegal and Ch..Po.. stuff and reject them based on filters. So a client may choose to list only approved storage providers and not all. Or a client can choose to bundle their own service such as hostr. NIP is definitely recommended to make it standard for all clients to follow. |
Beta Was this translation helpful? Give feedback.
-
I have been thinking around on the idea of a more distributed approach to file storage in nostr for a while now. In my mind Relys can act as a hosting providers, without introducing any other requirements such as an S3 endpoint, by building on the protocols that are already implemented so far: WebSockets. As it has been mentioned before, the nostr-protocol is not optimized for raw data transmissions, so I propose a second layer sub-protocol that is. I have started to note down some stuff on this approach nostr-ing. This would not only allow us to share files over multiple Relays, but also lays the groundworks for distributed live transmissions (e.g., Nostr Spaces/Audio Chatrooms). |
Beta Was this translation helpful? Give feedback.
-
@fiatjaf chiming in on nostr: Some ideas that would be interesting to explore:
I think this enables somewhat decentralized image-hosting:
|
Beta Was this translation helpful? Give feedback.
-
Alright. We had a good discussion and explored several options to come up with the best way to handle user media uploads. I want to summarize the discussion and see if we have a clear path forward for next steps. Reading through PR #268 created by @michaelhall923 he proposed a way for users to upload media within Damus app. At the same time, I proposed a similar idea to @monlovesmango to implement in the Astral app. The discussion was around how to support different storage mechanism such as torrent, S3-API, IPFS or use base64. From the discussion above, it is clear that all these options can be implemented by the clients, and they should choose which one to implement. The goal is to be as open as possible with supporting different media storage. But at the same time, provide a way for clients to be compatible with displaying event properly to end user. Also, we should discourage clients from using base64 image data and directly storing it on the event. Change proposal Nostr protocol : (May be a new NIP) - completely optional and backward compatible Event structure will have additional tags to link to the file and a hash to the file when created. Sample: content: '\n' + tags: [ [ 'file1', 'link to image', 'sha256 hash to file' ], [ 'file2', 'link to image', 'sha256 hash to file' ]] This is completely optional, and clients can still create events by directly embedding the URL in the content. but for the client displaying the content, they can scan for tags and replace the tags with the actual file they get from the location. They can also verify the hash of the file to confirm hash matches and only display the file when everything is good. Text only clients can display the content and ignore the tags. Tags should not conflict with anchor tags such as "p" and "e." Nostr Clients: Clients can provide options for the users in their settings to pick a storage provider based on their choice. This can be a torrent location, S3-compatible storage, or a common storage location such as nostr.build. Proposed file/link formats
A magnet consists of several parts: Detailed implementation will be the responsiblity of the client team and possibly share info to other clients.
Displaying event: The client makes a call to the http url found in the tag and displays the file or image appropriately.
Let me know if I missed anything. |
Beta Was this translation helpful? Give feedback.
-
Update: there is now a primitive spec that standardizes media uploads and retrieval in Nostr clients. Right now it defines an API similar to Imgur's for the sake of simplicity. It can be expanded upon to include support for things like S3 compatibility or torrents. |
Beta Was this translation helpful? Give feedback.
-
Starting a discussion based off this PR #268 .
To recap my understanding to date:
@michaelhall923 opened up the PR that allowed a user to choose from 2 image hosting providers (nostr.build & nostrum.com) in settings. Then, users could select media to upload directly from the New Note screen.
@jb55 expressed concerns about hardcoding integrations to hosting providers without guarantees of reliability in the long term from these providers. He also mentioned that he would prefer a proper spec that would allow users to configure their Damus client to use any provider they want that conforms to the spec.
@BenGWeeks mentioned the idea of using torrents (dht/magnet links) to handle media uploads. @michaelhall923 expressed concern about illegal content moderation using this method.
I mentioned the idea of conforming to the AWS S3 API as the proper spec @jb55 is looking for. Many, if not most, cloud object store providers expose a S3-compatible API.
My thoughts so far:
I had another conversation with @monlovesmango about this and we discussed using the pre-signed URL aspect of S3-compatible APIs to allow clients to POST directly to the object store without having to run an intermediary web server.
@monlovesmango is also working on building
hostr
(https://github.com/monlovesmango/hostr), which is intended to be a NIP-5 auth + lightning payment layer for media uploads to nostr.hostr
could be built to act as a wrapper over a user-defined S3-compatible object store provider that handles nip-5 auth + lighting payment + S3-compatible pre-signed URL generation.Clients would just have to conform to S3-compatible APIs w/ pre-signed URLs. Users could then choose to self-host on their own AWS/Cloudflare/Backblaze/whatever account. Or they could choose to set up their own
hostr
instance for them and their friends. Or they could choose a service provider (like someone hosting hostr for sats).Beta Was this translation helpful? Give feedback.
All reactions