Serves web pages from public blossom drives.
Go to file
florian e49da33532 chore: more README.md updates 2024-03-19 07:47:33 +01:00
src chore: Improved README.md 2024-03-19 07:36:57 +01:00
.dockerignore chore: Added env configurations vars 2024-03-18 20:28:32 +01:00
.gitignore chore: Added env configurations vars 2024-03-18 20:28:32 +01:00
.prettierrc chore: Added env configurations vars 2024-03-18 20:28:32 +01:00
Dockerfile chore: Improved README.md 2024-03-19 07:36:57 +01:00
README.md chore: more README.md updates 2024-03-19 07:47:33 +01:00
package-lock.json feat: Initial version of blossom based web server 2024-03-17 13:24:12 +01:00
package.json feat: Initial version of blossom based web server 2024-03-17 13:24:12 +01:00
tsconfig.json feat: Initial version of blossom based web server 2024-03-17 13:24:12 +01:00

README.md

🌸 blossom-drive-webserver

Overview

This projects serves (static) web pages from a public blossom drive. Blossom drives are a nostr based personal file storage. See it's documentation for more information:

Usage

File storage

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 reference the drive and publish it's contents on the web.

Running the web server

When running this web server the contents of the drive are available at: http://localhost:3000/naddr1qvzqqqrhvvpzpd7x76g4e...amhxgaamr23/, i.e. a static web page stored in the drive will be hosted on this URL and can be accessed in a browser.

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

Build

Local nodejs

This project is built on NodeJS, i.e. the usual commands apply:

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