droppy is a self-hosted file storage server with an interface similar to desktop file managers and has capabilites to edit files as well as view media directly in the browser. It focuses on performance and intuitive usage. It can run both standalone or through express. To provide realtime updates, most communication is done through WebSockets. A demo is available here.
- Fully responsive HTML5 interface
- Multi-file and folder upload
- Realtime updates of changes
- Share public download links
- Zip download of folders
- Image and video gallery, audio player
- Drag & drop and swipe gesture support
- Fullscreen support
- Edit text files in a heavily customized CodeMirror
- Supports all modern browsers and Node.js 0.10 or greater
With Node.js
and npm
installed, run:
$ [sudo] npm install -g droppy
$ droppy start
If you're running Docker, use the official (work in progress) image:
$ docker pull silverwind/droppy
$ docker run -p 8989:8989 -v $HOSTDIR:/droppy-data silverwind/droppy
Replace $HOSTDIR
with a directory on the docker host where configuration and files can be stored for persistence outside the container. This isn't strictly necessary, but it enables one to update by simply pulling a new image.
To install to a local directory:
$ git clone https://github.com/silverwind/droppy.git
$ cd droppy
$ npm install
$ node droppy.js start
To store configuration and files, these two directories will be used:
~/.droppy
: configuration directory. Override with--configdir <dir>
.~/.droppy/files
: files directory. Override with--filesdir <dir>
.
By default, the server listens on all interfaces, port 8989. On first login, a prompt for username and password for the first account will appear. Additional accounts can be created in the options interface or the command line.
Run droppy config
to edit config/config.json
, which is created with these defaults:
{
"listeners" : [
{
"host" : ["0.0.0.0", "::"],
"port" : 8989,
"protocol" : "http"
}
],
"public" : false,
"timestamps" : true,
"linkLength" : 5,
"logLevel" : 2,
"maxFileSize" : 0,
"updateInterval" : 1000,
"pollingInterval" : 0,
"keepAlive" : 20000
}
listeners
Array - Defines on which network interfaces, port and protocols the server will listen. See listener options below.listeners
has no effect when droppy is used as a module.public
Boolean - When enabled, no authentication is performed.timestamps
Boolean - When enabled, adds timestamps to log output.linkLength
Number - The amount of characters in a share link.logLevel
Number - Logging amount.0
is no logging,1
is errors,2
is info (HTTP requests),3
is debug (Websocket communication).maxFileSize
Number - The maximum file size in bytes a user can upload in a single file.updateInterval
Number - Interval in milliseconds which a single client can receive update messages through changes in the file system.pollingInterval
Number - Interval in milliseconds which the file system is polled for changes, which may be necessary on network drives and other non-standard situations. This is CPU-intensive! Corresponds to chokidar's usePolling option. Set to0
to disable polling.keepAlive
Number - Interval in milliseconds in which the server sends keepalive message over the websocket. These messages add some overhead but may be needed with proxies are involved. Set to0
to disable keepalive messages.
listeners
defines on which interfaces, ports and protcol(s) the server will listen. For example:
"listeners": [
{
"host" : [ "0.0.0.0", "::" ],
"port" : 80,
"protocol" : "http"
},
{
"host" : "0.0.0.0",
"port" : 443,
"protocol" : "https",
"key" : "~/certs/tls.key",
"cert" : "~/certs/tls.crt",
"ca" : "~/certs/tls.ca",
"dhparam" : "~/certs/tls.dhparam",
"hsts" : 31536000
}
]
The above configuration will result in:
- HTTP listening on all IPv4 and IPv6 interfaces, port 80.
- HTTPS listening on all IPv4 interfaces, port 443, with 1 year of HSTS duration, using the provided SSL/TLS files.
A listener object accepts these options:
host
String/Array - Network interface(s) to listen on. Required.port
Number/Array - Network port(s) to listen on. Required.protocol
String - Protocol to use,http
orhttps
. Required.
For SSL/TLS these additional options are available:
key
String - Path to PEM-encoded SSL/TLS private key file. Required.cert
String - Path to PEM-encoded SSL/TLS certificate file. Required.ca
String - Path to PEM-encoded SSL/TLS intermediate certificate file.dhparam
String - Path to PEM-encoded SSL/TLS Diffie-Hellman parameters file. If not provided, new 2048 bit parameters will generated and saved for future use.hsts
Number - Length of the HSTS header in seconds. Set to0
to disable HSTS.
Note: Unless given absolute, SSL/TLS paths are relative to the config folder. If your certificate file includes an concatenated intermediate certificate, it will be detected and used, there's no need to specify ca
in this case.
droppy can be used with express like this:
var app = require("express")();
var droppy = require("droppy")({
configdir: "~/droppy/config"
filesdir: "~/droppy/files",
log: "~/droppy/log",
logLevel: 0
});
app.use("/", droppy).listen(process.env.PORT || 8989);
See the commented express example for a working example.
- options {object}: Options. Extends config.json. In addition to above listed options,
configdir
,filesdir
andlog
are present on the API.
Returns function onRequest(req, res)
. All arguments are optional.
For correct filenames of shared links, use --content-disposition
or add this to ~/.wgetrc
:
content-disposition = on
droppy is currently optimized for a moderate amount of files. To aid in performance, all directories are read into memory once on startup. The downside of this is that the startup will take considerable time on slow storage with hunderts of thousands of files present.
© silverwind, distributed under BSD licence.