is there a public branch or pr to follow?
GM folks.
Khatru devs: Heads up. I'm making some backwards-incompatible changes to Khatru's Blossom API, as previously agreed with nostr:nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gprfmhxue69uhhq7tjv9kkjepwve5kzar2v9nzucm0d5hszxmhwden5te0wfjkccte9emk2um5v4exucn5vvhxxmmd9us2xuyp.
The three things to watch for are:
1. All blob-related events that take a sha256 will also receive a new string field (`ext`) with the file extension:
https://github.com/fiatjaf/khatru/blob/v0.18.2/blossom/server.go#L17-L26
2. If khatru can't detect the blob contents, `ext` will be empty and `BlobDescriptor.Type` will be `application/octet-stream`, in accordance with the latest Blossom specs:
https://github.com/hzrd149/blossom/blob/master/buds/01.md#get-sha256---get-blob
3. `GET /{sha256}` and `HEAD /{sha256}` will both pretty much ignore the file extension and return the blob with the `Content-Type` from the `BlobDescriptor`.
E.g., if you upload a PDF and later request `{sha256}.jpg`, Khatru’s Blossom server will still serve the original PDF with `Content-Type: application/pdf`.
(This is the best compromise given the current Blossom API, as agreed with nostr:nprofile1qqszv6q4uryjzr06xfxxew34wwc5hmjfmfpqn229d72gfegsdn2q3fgpzfmhxue69uhkummnw3e82efwvdhk6tcpz4mhxue69uhhyetvv9ujuerpd46hxtnfduhszythwden5te0dehhxarj9emkjmn99urf278z.)
I'll ping you again when this is merged.
Any thoughts or concerns, please let me know.
nostr:nprofile1qqsw9n8heusyq0el9f99tveg7r0rhcu9tznatuekxt764m78ymqu36cpr3mhxue69uhhyetvv9ujucnfw33k76twwpshy6ewvdhk6tcpzdmhxue69uhhwmm59e6hg7r09ehkuef0qy2hwumn8ghj7un9d3shjtn4w3ux7tn0dejj7ne6u4e, nostr:nprofile1qqs2qzx779ted7af5rt04vzw3l2hpzfgtk0a2pw6t2plaz4d2734vngpzamhxue69uhhyetvv9ujumn0wd68ytnzv9hxgtcppemhxue69uhkummn9ekx7mp0qy2hwumn8ghj7un9d3shjtnyv9kh2uewd9hj7hycrvd, nostr:nprofile1qqst6jhruelzn9jdf9qhyfsac3fetjyld0fwwary9cmxzfchrhacragppemhxue69uhkummn9ekx7mp0qy2hwumn8ghj76n9d3k8jenfwd5zumrpdejz7yj9f6t
(Feel free to ping anyone else who may be interested.)
#devstr #khatru #blossom
Discussion
Soon, I'll ping you the PR as soon as I'm more confident about it.
One eternity later... It took me over a month to feel “confident” about it (or rather, I totally forgot about it and moved on to something else, as usual 😂). I'm making this public now because I had to build on top of it to fix the Primal mirroring issue on mobile.
I can't open a PR because I’m not sure where to send it; Fiatjaf has a v2 fork of Khatru somewhere, and I don’t know if or where he wants me to contribute this. But here you go:
https://github.com/aaccioly-open-source/khatru/tree/feat/khatru-blossom-updates
If you want to test it in a Khatru-based relay, just run this magic incantation:
go mod edit -replace=github.com/fiatjaf/khatru=github.com/aaccioly-open-source/khatru@5425e6f793a0f19dd0ff9dda4c86ac1e1d1aeb66
go get -u github.com/fiatjaf/khatru
The changes are very straightforward. Just add the new ext string parameter wherever the compiler complains about it:
https://github.com/aaccioly-open-source/haven/commit/6c1b9e06a3c187e5f7b32272c56a5fedbac046e8