Home

Awesome

Delta - file uploader + url shortner

delta is a small hobby project that I did in my free time. It's a self-hosted file uploader + URL shortner. In short, you can fire a simple curl command with a file name, and that file will be uploaded to your server, after that you'll have a short url as a reponse of upload. And you can use this URL to fetch the uploaded file. Same goes with URL shortner

Demo

Demo

Features

Installation

Clone

git clone https://github.com/fosslife/delta.git

Or, download zip from master branch

Configuration

Open config.js. it has multiple things you need to configure

Install dependencies

There are two ways to use delta

Docker

| although I have created basic Dockerfile and docker-compose.yml, and it works, I don't know much docker I need help with persistance storage/volume etc. If you know Docker, that'd be a great help :)

Redis
Debian/Ubuntu etc
sudo apt-get install redis-server
sudo systemctl enable --now redis-server.service
fedora etc
sudo dnf -y install redis
sudo systemctl enable --now redis

| for other OS: https://www.google.com/search?q=install+redis+on+my+os

Node
npm install # or yarn install

Enjoy

If ther's something not working, please submit an issue, I will make sure I fix it in upcoming weekend :D

Usage

If you have installed everything correctly, and server is working it's really easy to use it.

curl Method

Most basic method, and it will work with just simple curl command or alternative.

for files
for urls

See Examples for more details.

Examples and API

Considering apiKey = 1234:

curl -H 'api-key: 1234' -F file=@dogs.jpg http://url.com/
curl -H 'api-key: 1234' -d 'url=https://github.com/fosslife/delta.git' http://url.com/
curl -H 'api-key: 1234' -d 'url=https://github.com/fosslife/dekta.git' -d 'custom=delta' http://url.com/
curl -H 'api-key: 1234' -d 'url=https://example.com/' -d 'expires=15m'
curl -H 'api-key: 1234' -F file=@cats.png -F 'pass=eNcRyPt' http://url.com/

of course, file uploads don't have custom URLs, both files and URLs can have password and expiry duration. keep in mind expiry duration can only be in format {number}{s|m|h|d|w|M} (stands for Seconds, Minutes, Hours, Days, Weeks, Months respectively) like 15s for 15 seconds, 1d for 1 day, 2M for two months etc.

Multiuser

delta is a private file uploader, and it's supposed to be used for personal use only. Unlike many other famous file uploaders it's not open to all. for that purpose, you can just keep your API key simple like a or something and distribute it publicly somewhere so that everyone can use your servers instance. But what if you don't want to distribute your api key but still let other people use the server? what if each users data is supposed to be stored in different directory? what if other users don't want your hostname in return but something different? :grin: delta supports all of it. multiuser branch lets you host delta for multiple users on the same instance. just edit the given config.json and you are good to go. The structure of config.json is a littlebit different than that of master branch

Example: this is current configuration:

{
    users: [
        ['Spark', 'spark1234', 'https://i.spark.pepe/'],
        ['John', '1234John', 'https://john.meme/']
    ];
}

And, If spark makes a request to the server with his own api key, the server will store the uploaded file inside a different dir called spark in uploads/ folder, and will return https://i.sprk.pw/7HgY as shortened URL, but if John makes a request to same server with his private api key, his files will be stored in John directory under uploads/ folder, and he will get https://john.meme/8Hy in return :)

Licence

delta is Licensed under MIT