Create simple shares with s3 as the backend.
Go to file
Djeeberjr 12ee768f11
All checks were successful
continuous-integration/drone/push Build is passing
add drone file
2022-05-17 18:20:31 +02:00
cmd use sql as db driver instead of sqlite 2022-05-16 00:27:52 +02:00
internal get single share 2022-05-17 01:14:45 +02:00
public added noscript 2022-05-10 23:19:38 +02:00
web improved opening images 2022-05-14 23:06:16 +02:00
.dockerignore added docker stuff 2022-05-17 01:56:05 +02:00
.drone.yml add drone file 2022-05-17 18:20:31 +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 docker stuff 2022-05-17 01:56:05 +02:00
go.mod use sql as db driver instead of sqlite 2022-05-16 00:27:52 +02:00
go.sum use sql as db driver instead of sqlite 2022-05-16 00:27:52 +02:00
LICENSE added LICENSE 2022-05-17 01:25:02 +02:00
Makefile improved Makefile 2022-05-17 01:55:32 +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
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