Serves web pages from public blossom drives.
src | ||
.dockerignore | ||
.gitignore | ||
.prettierrc | ||
Dockerfile | ||
package-lock.json | ||
package.json | ||
README.md | ||
tsconfig.json |
🌸 blossom-drive-webserver
Overview
This projects serves (static) web pages from a public blossom drive. Blossom drives are nostr a nostr based personal file storage. See it's documentation for more information:
- General Spec: https://github.com/hzrd149/blossom
- Drive UI: https://github.com/hzrd149/blossom-drive
- Nostr Event for a Drive: https://github.com/hzrd149/blossom-drive/blob/master/docs/drive.md
Files can be stored via the Drive web UI, which is currently hosted at https://blossom.hzrd149.com/
Each drive is identified by an address pointer, that can be seen in the URL, e.g.: naddr1qvzqqqrhvvpzpd7x76g4e...amhxgaamr23
This naddr
can be used to serve the content of the drive on the web.
Build
Local nodejs
npm install
npm run build
npm start
Docker
docker build -t blosson-drive-webserver .
docker run -it --rm -p 3000:3000 blosson-drive-webserver
docker run -p 3000:3000 blosson-drive-webserver
Configuration
ENV Variable | Description | Default |
---|---|---|
PORT | The Port on which the server listens for connections | 3000 |
DEBUG | Sets the debug level / log output for components of the server. | web*,koa*,ndk* |
SINGLE_SITE | A naddr pointing to a drive, that will be exclusively served on this server (single site mode). When left blank (default) all drive are available through a folder path e.g. https://domain.name/naddr1e2w...9aee2sk9el27/ |
|
FOLDER_LISTING | When enabled the web server return a list of folder contents, when no ìndex.html file exists. |
true |
DRIVE_PRELOAD | When enabled the server preloads a list of all public drive events from NOSTR and stores them im memory cache. This will speed up the first request for a drive. | false |
DRIVE_REFRESH_INTERVAL | The interval in seconds how often the full lists of drives is fetched from the nostr relays. | 300 |
DRIVE_REFRESH_TIMEOUT | Timeout for the Nostr Relay Connection in seconds | 10 |
DRIVE_CACHE_TTL | Time in seconds content of the drives are cached for in memory | 3600 |
CDN_CACHE_DIR | Local folder path where blobs are stored | ./cache |
CDN_MAX_LOCAL_CACHE_SIZE | Defines a maximum file size in bytes. Files below this threshold are stored in the local cache folder. | 100000 |
CDN_ADDITIONAL_SERVERS | Comma separated list of blossom blob storage servers that are used in addition to those defined in the drive event (as r tags). |
https://cdn.hzrd149.com, https://cdn.satellite.earth |
NOSTR_DEFAULT_RELAYS | Comma separated list of NOSTR relays that are use in addition to relays defined in the naddr . |
wss://nostrue.com, wss://relay.damus.io, wss://nos.lol |