Coder Social home page Coder Social logo

sh1nu11bi / droppy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from silverwind/droppy

0.0 1.0 0.0 6.72 MB

Self-hosted file storage server with a convenient web interface

License: BSD 2-Clause "Simplified" License

Makefile 0.41% JavaScript 68.06% CSS 27.30% HTML 4.23%

droppy's Introduction

droppy

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.

Features

  • 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

Install

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.

Configure

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
}

Options

  • 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 to 0 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 to 0 to disable keepalive messages.
#### Listener Options

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 or https. 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 to 0 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.

API

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.

droppy([options])

  • options {object}: Options. Extends config.json. In addition to above listed options, configdir, filesdir and log are present on the API.

Returns function onRequest(req, res). All arguments are optional.

Installation guides

Note about wget

For correct filenames of shared links, use --content-disposition or add this to ~/.wgetrc:

content-disposition = on

Note about startup performance

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.

droppy's People

Contributors

paulmillr avatar poorchop avatar silverwind avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.