Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tombl/upload.

s3 presigned URL uploader
https://github.com/tombl/upload.

s3 self-hosted svelte5

Last synced: 7 days ago
JSON representation

s3 presigned URL uploader

Awesome Lists containing this project

README

        

# upload.

A tiny clientside uploader for s3 presigned URLs.

Built with SvelteKit+Svelte 5 and compiled into a single zip.

## Setup

You'll need a bucket for the uploaded files, with CORS enabled.

```sh
$ aws s3api put-bucket-cors --bucket uploads --cors-configuration '{
"CORSRules": [{
"AllowedHeaders": ["*"],
"AllowedMethods": ["PUT"],
"AllowedOrigins": ["*"]
}]
}'
```

If you want to deploy your own copy of the site, deploy
[it](https://nightly.link/tombl/upload./workflows/build/main/site.zip) to your
static host of choice (S3?), substituting `PREFIX = "https://YOUR_S3_BUCKET/"`
at the top of every `.html` file with your S3 bucket's domain.

```
$ cd $(mktemp -d)
$ curl -LO https://nightly.link/tombl/upload./workflows/build/main/site.zip
$ unzip site.zip
$ rm site.zip
$ find . -name "*.html" -exec sed -i 's/YOUR_S3_BUCKET/your-bucket/g' {} +
$ deploy .
```

To obtain an S3 presigned PUT URL, you can head to [https://your-deployment/sign](https://upload.on.tombl.net/sign).

## Usage

Navigate to
[https://your-deployment/#https://your-bucket/example.txt?X-Amz-...](https://upload.on.tombl.net/#https://your-bucket/example.txt?X-Amz-...),
substituting your presigned URL after the `#`.

The URL will be compressed via
[a custom compression scheme](https://github.com/tombl/upload./blob/main/src/lib/qpack.ts)
to ~2x shorter.

Copy the new shortened URL from the address bar and send it to your recipient,
who can upload one or more files. If they upload multiple files, they'll be
automatically zipped together.

## Potential improvements

This is a tiny tool right now, built to meet very slim requirements. Here's a
handful of polish/feature ideas:

- ~~A second page to sign URLs in the browser~~
- An upload speed graph
- Multipart uploads
- Faster and resumable
- Likely requires a backend
- Text animations inspired by SwiftUI's
`.contentTransition(.numericText(value:))`
- Picked file preview (thumbnails etc)