Code Monkey home page Code Monkey logo

muiton / sharex-upload-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tannerreynolds/sharex-upload-server

0.0 0.0 0.0 557 KB

AKA ShareS - Feature full & Stable ShareX and file server in node. Includes images, videos, code, text, markdown rendering, password protected uploads, logging via discord, administration through Discord, url shortening, and a full front end. Use standalone or via reverse proxy

License: GNU General Public License v3.0

JavaScript 98.87% Shell 1.13%

sharex-upload-server's Introduction

Hosting Discord Version

ShareS - A Nodejs ShareX Upload Server

Features

  • Image/Video/General file uploading

  • URL shortening + a front end for the URL shortener as well

  • Logging via a Discord channel

  • Password protected uploading (Uploads that require file-specific password to view/download)

  • Server Administration using Discord bot commands

  • Front end upload page [Example]

  • Password protected gallery page (password is admin key)

  • Showcase images (image display pages that show metadata for photography) [Example]

Installation (Ubuntu 16.04 Server)

https://github.com/TannerReynolds/ShareX-Upload-Server.git
cd ShareX-Upload-Server
chmod +x install.sh
./install.sh

Configuration

In the files you downloaded from this repository, you will see a file called config.json You must fill this out for the webserver to work properly. Below explains the configuration file and what each part does

{
  "key": [""], // Password(s) for private uploading
  "domain": "*.example.com", // Domain server will use. Will error if domain not used in request. Place "*" as the subdomain to enable wildcard subdomains for the webserver.
  "puploadKeyGenLength": 64, // Amount of characters server should use for pupload files
  "public": false, // Disables auth and does not render a password field for /upload
  "maxUploadSize": 50, // max upload size for non-admins using regular key in MB
  "markdown": true, // enables markdown rendering (upload whole .md file for render)
  "port": 80, // port to listen on
  "secure": true, // Whether or not you want https. (make sure key and cert.pem are in src directory)
  "securePort": 443, // Port to use when secure is true
  "ratelimit": 1000, // Ratelimit for POSTing in milliseconds
  "allowed":[
    "png", "jpg", "gif", "mp4", "mp3", "jpeg", "tiff", "bmp", "ico", "psd", "eps", "raw", "cr2", "nef", "sr2", "orf", "svg", "wav", "webm", "aac", "flac", "ogg", "wma", "m4a", "gifv"
  ], // Allowed file types for non-admins
  "admin":{
    "key": [""], // Admin password(s) for uploading & for gallery access
    "maxUploadSize": 1024, // Max upload size for admin in MB
    "allowed": [
    "png", "jpg", "gif", "mp4", "mp3","jpeg", "tiff", "bmp", "ico", "psd", "eps", "raw", "cr2", "nef", "sr2", "orf", "svg", "wav", "webm", "aac", "flac", "ogg", "wma", "m4a", "gifv", "html"
     ] // Allowed file types for admins
  },
  "paste": {
    "maxUploadSize": 20 // allowed paste upload size in MB
  },
  "discordToken": "", // Discord bot token
  "discordAdminIDs": ["discord IDs of people who can run commands go here", "Like this"], // User IDs in an array
  "discordChannelID": "", // Channel ID for monitoring uploads to
  "prefix": "" // Bot Prefix
}

Running The Server

Once you've properly configured your server, you can run node index.js in the src folder to start the server. You can keep your server running forever if you use a process manager, like pm2. pm2 installs along with your server if you used the install.sh script to install your server. Otherwise you can run npm i -g pm2 to install pm2. Then you can run your server by running pm2 start index.js, and monitor logs and such using pm2 monit

Note: Nginx/reverse proxy users

If you're configuring this webserver to run through an Nginx reverse proxy, make sure you add these lines to your reverse proxy config

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;

This is generally some things you want to add to your config, and is what's actually required for ShareS to work properly. This is because ShareS returns uploads like [http/https]://[requested url]/[filename] and since you're running ShareS through a reverse proxy, unless you're passing along the original headers, ShareS is most likely just going to send you something like http://[server's real ip address]/[filename]

Note: Users of multiple domains

If you have multiple domains pointed to this webserver, only one (can include wildcard subdomain) can be used, unless the domain setting is set to just a single * like so: "domain": "*",. This means that any domain will be accepted as a valid domain by the server, regardless of subdomain.

Setting up Discord logging

if you wish to log your webserver's activity in a Discord channel for whatever reason, you can. Here is information on how to setup a bot account and get the information needed for Discord logging

Configuring Your ShareX Client

Configuring for Password Protected Uploading

  • Add a field to your body called pupload, and then make the value whatever you want the password to be
  • Upload something, and the upload will give you a url to the authentication page
  • Type in your password, and it will display/download the file!

Auto Password Generation

In addition to being able to use any password you want for puploads, if you type in *random* as your pupload field, the server will automatically generate a password for you. This password will include letters, numbers, and special characters. It will generate a key based on the length you specify in your config (puploadKeyGenLength). When making requests, the server will return the image URL with the key like so URL: https://qoilo.com/lhHr | KEY: Np$[CBk>X[c^YY{MDlCHH0|Qfm1uK0*lld^Mi$f4d62R5x6C2>~yaL}3*QYnziuZ

Showcase Field

  • Add a field to your body called showCase, and then make the value true
  • Upload an image
  • Click the image to view image's metadata like camera, lens, iso, shutter speed, etc.
  • Requires extra software to be installed to your server, called Exiftool to read metadata from uploaded images. The install file will automatically install this software on ubuntu.
  • Windows servers using this feature wil need the Windows executable for exiftool and it will need to be added to your environment variables or ShareS will throw errors on upload and return 404s

Credits

Ken - Initial File Uploader

Aetheryx - Webserver Structure

Jaex - ShareX

FancyApps - Gallery lightbox script for displaying images, videos and more

sharex-upload-server's People

Contributors

tannerreynolds avatar toastdc avatar 4xx22 avatar eramsorgr avatar officialpiyush avatar gaeta avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.