damus-io / damus

iOS nostr client
GNU General Public License v3.0
2k stars 289 forks source link

Media uploads: enforce file length limit for non nostr.build accounts before upload #2216

Open jb55 opened 6 months ago

jb55 commented 6 months ago

To do this, we need a way to know if the current user has a nostr build account. Maybe some kind of quick http nostr auth to test.

Once we know if we have a nostr.build account, then we can know what the size limit on uploads are.

Perhaps this should be generalized with NIP-96 metadata, not sure if it has this

@fishcake advised:

https://developer.apple.com/documentation/avfoundation/avassetexportsession/1622333-filelengthlimit

jb55 commented 6 months ago

@fishcakeday let me know what is the best way to get the file size limit.

curl https://nostr.build/api/v2/upload/limit is implemented, it will check based on your NIP98 authentication or return a free upload limit by default with no headers: