Blossom Uploader for Nostr

Blossom Uploader for Nostr

In my mini project to publish from Joplin to Nostr, I wanted to move to publishing images in a Joplin note to some internet file hosting. So the obvious is something like imgur or imgbb and these require account creation and use of an API key.

The nostr way of doing things is to use blossom and your nsec is the authentication, noice!

So I noticed that nostr.build now has a service at https://blossom.band/

It seems to be a very nice service with:

Backed by the time-proven and highly available infrastructure of Nostr.build,
with global reach and a fast CDN network.
Every distinct user's npub gets their own server domain that is not shared by anyone but the
owner of that npub.

They also have a free tier which is good for experimentation, their paid plans are at https://nostr.build/plans/ . I'm still yet to figure out of they are a candidate for self-hosting or just for media. That's another research project.

Anywayzzz this here article is my test to publish from Joplin for long form posts.
When I was doing wordpress posts, I preferred to write up in Joplin with all its note-taking nice-ness, search, tagging, plugins. I've tried Habla and YakiHonne but I miss my Joplin workflow and tools. So, I've written this in Joplin and using my plugin to test for the article be uploaded as long form (NIP-23) post.

Still trying to figure out how to get the markdown transferring across cleanly. Sorry, this is a test.




I made a test project to understand Blossom https://github.com/djinoz/blossom_uploader
🙉
Take #2: Explicity set kind:30023

Blossom Uploader for Nostr

A Node.js command-line tool to upload images and media files to various services compatible with Nostr notes, with full support for the Blossom protocol.

Installation

npm install

Usage

node blossom_uploader.js [options] <files...>

Options

  • -s, --service <service>: Upload service to use (default: "imgbb")
  • -k, --key <key>: API key for the service (if required)
  • -u, --url <url>: Custom URL for the service (required for blossom)
  • -n, --nsec <nsec>: Nostr private key (nsec) for blossom authentication
  • -d, --debug: Show debug information
  • -o, --output <format>: Output format: json or url (default: "url")
  • -h, --help: Display help
  • -V, --version: Output the version number

Examples

Upload a single image using ImgBB (default):

node blossom_uploader.js path/to/image.jpg

Upload using Imgur:

node blossom_uploader.js -s imgur image1.png

Use your own ImgBB API key:

node blossom_uploader.js -s imgbb -k YOUR_API_KEY image.png

Upload to a Blossom server using your nsec private key:

node blossom_uploader.js -s blossom -u https://blossom.band/upload -n nsec1... image.png

Get JSON output:

node blossom_uploader.js -o json image.jpg
This post and comments are published on Nostr.