publishr - Simple file uploading/hosting service

publishr is a simple server which will allow remote users to upload files, which are then hosted.

Think of it like your own version of imgur:

  • Files of any type may be uploaded, not just images.
  • Files are served with the correct MIME.type.
  • Uploads are protected via TOTP-authentication.

Installation

Installation should be simple, if you have a working go environment:


go get github.com/skx/go-experiments

cd $GOPATH/src/github.com/skx/go-experiments/publishr/
go get -d ./...
go install .

The fetching and building are split into two steps because the code is installed in a sub-directory.

Usage

Generate a secret:

~$ publishr init

Now look at the secret:

~$ publishr secret
Configure your authenticator-client with the secret 3RWVRVJM3Y======
For example:
    oathtool --totp -b 3RWVRVJM3Y======

Finally upload your first file:


~$ curl --header "X-Auth:123456" -X POST -F file=@$HOME/image.jpg https://public.example.org/upload
http://public.example.org/1P

NOTE #1: Note the X-Auth header has been set to a valid code.

NOTE #2: We assume you've placed a reverse-proxy in front of your server, as it would otherwise only listen on 127.0.0.1:8081.