Simple file host for ShareX that abuses wildcard hostname for file code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Lamp 35b07880eb add command lines for mac 1 week ago
files/tmp nicer logging 3 months ago
.gitignore Update 2 weeks ago
README.md add command lines for mac 1 week ago
discord-preloader.js catch error 4 months ago
package-lock.json Update 2 weeks ago
package.json Update 2 weeks ago
qonq.js Update 2 weeks ago

README.md

qonq

Simple file host that puts the file code in the hostname. The leftmost part of the Host (i.e. 1234 of 1234.qonq.gq) is used to serve a corresponding folder (i.e. files/1234/); if the folder contains one file then it is served directly, but if it contains multiple files then it is served as a webroot with a directory index. Designed for use as a ShareX Custom Uploader, but you can drop any lowercase alphanumeric folder into the files directory to serve it instantly.

Note: Please refrain from using your own file server if you cannot commit to maintaining it indefinitely, because all links you post will depend on your server and dead servers cause link rot.

Usage

Clone repository and install dependencies with npm ci.

The following environment variables are required for operation. You can put them in an .env file, which the program will load itself.

Variable Description
AUTH_TOKEN Unique confidential key to authenticate uploads

The following environment variables are optional.

Variable Description Default
HOSTNAMES Comma-separated list of hostnames that will be chosen at random for the URL sent back after an upload. request hostname
DISCORD_WEBHOOK Discord webhook url that uploads will be sent to to make them pre-load the embed, which theoretically makes it faster. undefined (disabled)
PORT TCP port to listen on 8568
ADDRESS Address to bind to 0.0.0.0 (all)
FILES_DIR Directory to store the files in files (relative of working directory)
TMP_DIR Directory to store pending uploads in os.tmpdir()

Run with node qonq.js or your favorite init system.

ShareX config

{
  "Version": "12.4.1",
  "DestinationType": "ImageUploader, TextUploader, FileUploader",
  "RequestMethod": "POST",
  "RequestURL": "http://localhost:8568/upload",
  "Headers": {
    "authentication": "paste value of AUTH_TOKEN here"
  },
  "Body": "MultipartFormData",
  "FileFormName": "file"
}

You can import this custom uploader config and modify the Request URL and authentication fields as necessary.

Nginx config example

server {
        server_name qonq.gq *.qonq.gq;
        listen 443 ssl;
        ssl_certificate /etc/letsencrypt/live/qonq.gq/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/qonq.gq/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
        client_max_body_size 1G;
        location / {
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_pass http://localhost:8568;
        }
}
server {
        server_name qonq.gq *.qonq.gq;
        listen 80;
        return 308 https://$host$request_uri;
}

Command lines for Mac

There is no ShareX for Mac so here are some command lines you can use with iCanHazShortcut

# for fullscreen
SS=${TMPDIR}screenshot.png; screencapture -Cdt jpg $SS && URL=$(curl -H "Authentication: your_auth_token" -F "file=@$SS" https://qonq.gq/upload) && tr -d '\n' <<< $URL | pbcopy && osascript -e "display notification \"$URL\" with title \"Screenshot upload complete\"" && rm $SS

# for interactive
SS=${TMPDIR}screenshot.png; screencapture -idt png $SS && URL=$(curl -H "Authentication: your_auth_token" -F "file=@$SS" https://qonq.gq/upload) && tr -d '\n' <<< $URL | pbcopy && osascript -e "display notification \"$URL\" with title \"Screenshot upload complete\"" && rm $SS