Create simple shares with s3 as the backend.
Go to file
Djeeberjr de5d5a2344
All checks were successful
continuous-integration/drone/push Build is passing
added example script to upload and share files
2022-06-08 21:57:17 +02:00
cmd use sql as db driver instead of sqlite 2022-05-16 00:27:52 +02:00
internal added web_test 2022-06-03 19:56:29 +02:00
public added noscript 2022-05-10 23:19:38 +02:00
web added PDF opener 2022-06-08 12:02:09 +02:00
.dockerignore added docker stuff 2022-05-17 01:56:05 +02:00
.drone.yml fixed golang version in drone 2022-06-08 11:13:17 +02:00
.gitignore added Makefile 2022-05-13 11:58:32 +02:00
docker-compose.yml added docker stuff 2022-05-17 01:56:05 +02:00
Dockerfile added workdir to dockerfile 2022-06-08 12:50:38 +02:00
go.mod added unit testing 2022-06-01 11:55:33 +02:00
go.sum added unit testing 2022-06-01 11:55:33 +02:00
LICENSE added LICENSE 2022-05-17 01:25:02 +02:00
Makefile added tests to drone 2022-06-08 11:10:29 +02:00
package-lock.json syntax hightlighting 2022-05-11 00:38:41 +02:00
package.json syntax hightlighting 2022-05-11 00:38:41 +02:00
README.md added Techstack to README 2022-05-17 01:32:47 +02:00
rollup.config.js added code splitting and basic opener 2022-05-10 16:01:07 +02:00
share.sh added example script to upload and share files 2022-06-08 21:57:17 +02:00
tsconfig.json added frontend scaffholding 2022-05-09 20:01:31 +02:00

A simple server to share objects on an s3 bucket and display them in a nice way.

Features

  • Share any object on an s3 bucket
  • Generate short urls for the share
  • Simple API to create shares

Building

Run make and the binary together with the web frontend will be in the build directory.

Usage

Run the s3browser binary with the --help flag to see the available options. The public directory needs to be in the same directory as the binary.

S3Share requires two things:

  • a s3 bucket with read access
  • a sql database

Synopsis

s3share 0.1
Usage: s3share --s3-endpoint ENDPOINT --s3-bucket BUCKET --s3-access-key ACCESS_KEY --s3-secret-key SECRET_KEY [--s3-disable-ssl] [--address ADDRESS] --api-username USERNAME --api-password PASSWORD --db DB

Options:
  --s3-endpoint ENDPOINT
                         host[:port] [env: S3_ENDPOINT]
  --s3-bucket BUCKET     bucket to use [env: S3_BUCKET]
  --s3-access-key ACCESS_KEY [env: S3_ACCESS_KEY]
  --s3-secret-key SECRET_KEY [env: S3_SECRET_KEY]
  --s3-disable-ssl [default: false, env: S3_DISABLE_SSL]
  --address ADDRESS      what address to listen on [default: :3000, env: ADDRESS]
  --api-username USERNAME
                         username for API [env: API_USERNAME]
  --api-password PASSWORD
                         password for API [env: API_PASSWORD]
  --db DB                DSN in format: https://github.com/go-sql-driver/mysql#dsn-data-source-name [env: DB_CONNECTION]
  --help, -h             display this help and exit
  --version              display version and exit

API

Use the provided username and password with basic auth.

Shares ids consist of six alphanumeric characters e.g. jW8ADy.

  • GET /api/share: Get a list of all shares
  • GET /api/share/:id: Get a share by id. Result:
{"slug":"jW8ADy","key":"/myObj.txt"}
  • POST /api/share: Create a new share. Data to send:
{"key":"/myObj.txt"}
  • DELETE /api/share/:id: Delete a share

Other urls are:

  • /:id to get the default site to display the share.
  • /s/:id to get the shared file directly.

When you request a shared file directly, you can add anything after a dot behind the id e.g. /s/jW8ADy.png. This is done to make the browser display the file correctly. On the server side, this will be stripped away.

Tech stack

Backend

  • Go
  • Minio s3 client
  • Mux

Frontend

  • Svelte
  • Highlight.js
  • Typescript