Sharry allows to share files with others in a simple way. It is a self-hosted web application. The basic concept is: upload files and get a url back that can then be shared.
Authenticated users can upload their files on a web site together with an optional password and a time period. The time period defines how long the file is available for download. Then a public URL is generated that can be shared, e.g. via email.
The download page is hard to guess, but open to everyone.
Anonymous can send files to registered ones. Each registered user can maintain alias pages. An alias page is behind a “hard-to-guess” URL (just like the download page) and allows everyone to upload files to the corresponding user. The form does not allow to specify a password or validation period, but a description can be given. The user belonging to the alias can be notified via email.
If authentication is enabled, it is not possible to share files between non-registered users. One party must be registered. But authentication can be completely disabled. Then any user can upload files. This may be useful within a closed network.
Sharry aims to provide a good support for large files. That means downloads and uploads are resumable. Large files can be downloaded via byte serving, which allows for example to watch video files directly in the browser. Uploads are resumable, too, by using resumable.js on the client. Uploads can be retried where only chunks not already at the server are transferred.
Each published upload has a validity period, after which the public download page doesn't work anymore. A cleanup job running periodically can delete those files to save space.
- resumable and recoverable upload of multiple files; thanks to resumable.js
- validation period for uploads
- resumable downloads using byte serving
- download single files or all in a zip
- protect downloads with a password
- automatic removal of invalid uploads
- external authentication (via system command or http requests)
- managing accounts, uploads and alias pages
- a command line client for uploading files
There is a demo installation at https://sharrydemo.eknet.org. You can
use the account sharry
and no password to log in. The mail feature is
not enabled and uploads are restricted to 1.5M.
Or, clone this project and use sbt (see below for prerequisites) to compile and run:
sbt run-sharry
This will build the project and start the server. Point your browser to
http://localhost:9090 and login with user admin
and password
admin
.
Or, download a binary from the release page.
There is a user manual in the docs folder (sources). These pages are shown in each sharry instance, for example here. The documentation to the command line client is included.
For the server, you need Java8, sbt and Elm installed first. Then clone the project and run:
sbt make
This creates a file in modules/server/target/scala-2.12
named
sharry-server-*.jar.sh
. This is an executable jar file and can be used
to run sharry:
The --console
argument allows to terminate the server from the
terminal (otherwise it's Ctrl-C
). By default a
H2 database is configured in the current
working directory.
$ ./modules/server/target/scala-2.12/sharry-server-0.0.1-SNAPSHOT.jar.sh --console
2017-05-08T14:53:07.345+0200 INFO [main] sharry.server.main$ [main.scala:36]
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Sharry 0.0.1-SNAPSHOT (build 2017-05-08 12:49:58UTC) is starting up …
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
2017-05-08T14:53:08.563+0200 INFO [main] sharry.server.main$ [main.scala:42]
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
• Running initialize tasks …
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
2017-05-08T14:53:08.622+0200 INFO [main] com.zaxxer.hikari.HikariDataSource [HikariDataSource.java:93] HikariPool-1 - Started.
2017-05-08T14:53:09.272+0200 INFO [main] sharry.server.main$ [main.scala:62]
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
• Starting http server at 0.0.0.0:9090
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Hit RETURN to stop the server
The command also builds the command line client. It can be found at
modules/cli/target/scala-2.12
named sharry-cli-*-.jar.sh
.
Building only the command line client doesn't require Elm and can be
built separately with sbt make-cli
.
The server and cli part is written in Scala and uses the following great libraries:
- fs2 all the way
- fs2-http for the http stack
- doobie for db access (which uses fs2, too)
- circe great library for json
- pureconfig is reading the configuration file using config library
- …
See all of them in the libs file.
The frontend is written in Elm. Two libraries
aside from elm-lang/*
are used:
- evancz/elm-markdown rendering markdown
- NoRedInk/elm-decode-pipeline decoding json
Non-elm components:
- semantic-ui for a well looking web interface
- resumable.js for handling uploads at the client
Sharry reads a configuration file that can be given as an argument to the executable. Please see the default configuration for all available options and their default values. It also contains hopefully helpful comments.
For more detailed information on its syntax, please refer to the specification and documentation of config library.
The important settings are
sharry.web.bindHost
andsharry.web.bindPort
the host and port for binding the http serversharry.web.baseurl
this must be set to the external base url. So if the app is at http://example.com/, then it should be set to this value. It is used to restrict the authentication cookie and to create links in the web application.sharry.db.driver|user|url|password
the JDBC settings; currently it should work with postgres and h2sharry.upload.max-file-size
maximum file size to uploadsharry.authc.enable=true|false
whether to enable authentication (default istrue
)sharry.authc.extern.admin.enable=true|false
enables an admin account for initial login (password isadmin
), default isfalse
Every setting can also be given as a Java system property by adding it
to the environment variable SHARRY_JAVA_OPTS
(-D
prefix is required
here):
SHARRY_JAVA_OPTS="-Dsharry.authc.enable=false" ./sharry-server-0.0.1-SNAPSHOT.jar.sh
This overrides same settings in the configuration file.
When running behind a reverse proxy, it is importand to use HTTP 1.1. For example, a minimal nginx config would look like this:
server {
listen 0.0.0.0:80;
proxy_request_buffering off;
proxy_buffering off;
location / {
proxy_pass http://127.0.0.1:9090;
# this is important, because fs2-http can only do 1.1
# and it effectively disables request_buffering
proxy_http_version 1.1;
}
}