chore: Improved README.md
This commit is contained in:
parent
beda39b085
commit
991a65137d
@ -20,7 +20,7 @@ RUN npm install
|
|||||||
|
|
||||||
COPY --from=builder ./app/build ./build
|
COPY --from=builder ./app/build ./build
|
||||||
|
|
||||||
EXPOSE 3010
|
EXPOSE 3000
|
||||||
|
|
||||||
ENV DEBUG="web*,koa*,ndk*"
|
ENV DEBUG="web*,koa*,ndk*"
|
||||||
|
|
||||||
|
59
README.md
59
README.md
@ -1,5 +1,60 @@
|
|||||||
# 🌸 blossom-drive-webserver
|
# 🌸 blossom-drive-webserver
|
||||||
|
|
||||||
Serves a blossom-drive as a web page.
|
## Overview
|
||||||
URL: https://sevrername.com/naddr1qvzqq....getnws2yc6ec/
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t blosson-drive-webserver .
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -it --rm -p 3000:3000 blosson-drive-webserver
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
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` |
|
||||||
|
@ -135,7 +135,10 @@ if (SINGLE_SITE) {
|
|||||||
// Load all drives into the cache
|
// Load all drives into the cache
|
||||||
|
|
||||||
// TODO add lastchange date, to fetch changes
|
// TODO add lastchange date, to fetch changes
|
||||||
// Load all drives into cache and refresh periodically
|
// Load all drives into cache and refresh periodically,
|
||||||
|
|
||||||
|
// currently changesare not reflected, when the drive is cached
|
||||||
|
// we need a way to update the cache with the latest changes
|
||||||
|
|
||||||
fetchAllDrives();
|
fetchAllDrives();
|
||||||
setInterval(() => fetchAllDrives(), DRIVE_REFRESH_INTERVAL);
|
setInterval(() => fetchAllDrives(), DRIVE_REFRESH_INTERVAL);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export const PORT = process.env.PORT || 3010;
|
export const PORT = process.env.PORT || 3000;
|
||||||
|
|
||||||
export const SINGLE_SITE = process.env.SINGLE_SITE;
|
export const SINGLE_SITE = process.env.SINGLE_SITE;
|
||||||
export const FOLDER_LISTING = (process.env.FOLDER_LISTING || 'true') === 'true';
|
export const FOLDER_LISTING = (process.env.FOLDER_LISTING || 'true') === 'true';
|
||||||
@ -9,7 +9,7 @@ export const DRIVE_REFRESH_TIMEOUT = parseInt(process.env.DRIVE_REFRESH_TIMEOUT
|
|||||||
export const DRIVE_CACHE_TTL = parseInt(process.env.DRIVE_CACHE_TTL || '3600', 10); // 1h
|
export const DRIVE_CACHE_TTL = parseInt(process.env.DRIVE_CACHE_TTL || '3600', 10); // 1h
|
||||||
|
|
||||||
export const CDN_CACHE_DIR = process.env.CDN_CACHE_DIR || './cache';
|
export const CDN_CACHE_DIR = process.env.CDN_CACHE_DIR || './cache';
|
||||||
export const CDN_MAX_LOCAL_CACHE_SIZE = parseInt(process.env.CDN_MAX_LOCAL_CACHE_SIZE || '', 100000); // 100KB
|
export const CDN_MAX_LOCAL_CACHE_SIZE = parseInt(process.env.CDN_MAX_LOCAL_CACHE_SIZE || '100000', 10); // 100KB
|
||||||
export const CDN_ADDITIONAL_SERVERS = (
|
export const CDN_ADDITIONAL_SERVERS = (
|
||||||
process.env.CDN_ADDITIONAL_SERVERS || 'https://cdn.hzrd149.com,https://cdn.satellite.earth'
|
process.env.CDN_ADDITIONAL_SERVERS || 'https://cdn.hzrd149.com,https://cdn.satellite.earth'
|
||||||
).split(',');
|
).split(',');
|
||||||
|
Loading…
Reference in New Issue
Block a user