Giter Site home page Giter Site logo

tannerreynolds / sharex-upload-server Goto Github PK

View Code? Open in Web Editor NEW
392.0 7.0 110.0 622 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 91.24% Shell 0.99% Dockerfile 0.18% CSS 7.59%
nodejs sharex-server webserver file-upload discord discordapp discordbot url-shortener sharex gallery

sharex-upload-server's Introduction

ShareS - A Nodejs ShareX Upload Server

Join Our Discord!

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)

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

Docker

docker build -t sharex-upload-server .
docker run --name "sharex-upload-server" -d \
    -v $(pwd)/src/config.json:/usr/src/app/config.json \
    -v $(pwd)/src/db.json:/usr/src/app/db.json \
    -v $(pwd)/src/server/uploads/:/usr/src/app/server/uploads/ \
    -p 8000:80 -p 8443:443 \
    sharex-upload-server
docker logs -f sharex-upload-server

/src/config.json will be the config file used if you used the above command to start the server. The web UI will be available on https://server-ip:8443 if https is enabled, and http://server-ip:8000 if it isn't.

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)
  "fileNameLength": 4, // File name length
  "shortUrlLength": 3, // File name length for short URLs
  "securePort": 443, // Port to use when secure is true
  "ratelimit": 1000, // Ratelimit for POSTing in milliseconds
  "dateURLPath": false, // Set to true to prefix uploads with the date (Ex: https://domain.com/2020/04/22/ghNa.pdf)
  "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

Using with Flameshot (Linux)

In order to use ShareS with Flameshot you will need to use a simple script, here is an example:

key="YourPassword"
# Only needed for multi-domain support, if you only have one simply set the url
# 2 lines below to url="https://your.domain/api/files"
urls=("https://example.com/api/files" "https://example.org/api/files")
url=${urls[$RANDOM % ${#urls[@]}]}

temp_file="/tmp/screenshot.png"

# Run flameshot --help for options
flameshot gui -r > $temp_file

# For some reason flameshot always seems to exit with 0 even when aborting the process
# so we had to find a way around that.
if [[ $(file --mime-type -b $temp_file) != "image/png" ]]; then
	rm $temp_file
  notify-send "Screenshot aborted" -a "Flameshot" && exit 1
fi

image_url=$(curl -X POST -F "fdata=@"$temp_file -F "key="$key -v "$url" 2>/dev/null)
echo -n $image_url | xclip -sel c
notify-send "Image URL copied to clipboard" "$image_url" -a "Flameshot" -i $temp_file
rm $temp_file

When running this script simply hit enter when you're satisfied with your image, Flameshot will then save the image to your clipboard which will then be replaced with the image URL once it's uploaded. For the best results I suggest disabling notifications in the Flameshot app.

Contributing

Pull Requests

  • Be sure you properly lint your files prior to making a pull request. eslint file available
  • Do your own testing
  • Properly comment your code. My code isn't really commented on because it's my code and I understand how everything fits together and works. It isn't a very large project. You will need to comment on your code though so that I could understand going forward when more features get added
  • Not all features are going to be added. Just because you code something that may be useful to you, that does not mean it will for sure be added.
  • Update the version of ShareS when you create a pull request. If the current version at the time of your PR is 4.5.6, make sure to change the shield in the README and the package.json file to say version 4.5.7. If the version is 4.5.10, then update it to 4.5.11. Only update the last digit. Updates/PRs that are not code (README.md, install.sh, sxcu files, package.json, etc.) should not constitute an updated version number for the project, so PRs for those specific files will not increment the version number

Bug Reports

  • Follow the issue template format or your issue will likely not be solved. If you do not follow the format I won't have enough information to diagnose the problem and fix it.
  • If I ask questions and you do not respond on the thread, and I'm not experiencing the issue / am not able to replicate the issue, I will close the issue thread, and you'll have to make another one if the problem persists.
  • Please make sure your system setup isn't the cause of your issue. This webserver can be ran through several different pieces of software, reverse proxies, operating systems, network types, just please make sure that you havent made in error in setting up your system before submitting the issue. We do not help people with every combination of setup that exists, if you're using some weird OS, runnning ShareS through your own custom reverse proxy, don't expect much support from us if it doesn't work.
  • Ensure your config isn't the issue. Most issues people have with setting up the server and experiencing crashes are due to an error in how you made your config file. Be sure to read the descriptions for each one and use the correct data type (array, string, number, array with strings, etc.)

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

4nt0n10m4 avatar 4xx22 avatar dependabot-preview[bot] avatar eramsorgr avatar gaeta avatar guillaumearnx avatar josephyi avatar kanin avatar makeshift avatar officialpiyush avatar tannerreynolds avatar toastdc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sharex-upload-server's Issues

ipban dosnt work :(

Describe the bug
ipbanning people dosnt work

To Reproduce
Steps to reproduce the behavior:

  1. go to discord with the bot
  2. use the ipban command on a ip
  3. bot responds but the ip can still use uploader

Expected behavior
user cant use the uploader

ShareS Version
latest

Screenshots
(IPbanning)
https://ss.2mpcraft.xyz/998GiZtx
(after you get ip banned)
https://ss.2mpcraft.xyz/fJqSFD3z.gif

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser firefox
  • Version 74.0 (64 bit)

docker version not working

Describe the bug
docker won't start

To Reproduce
Steps to reproduce the behavior:

  1. run the command
docker run --name "sharex-upload-server" -d \
    -v $(pwd)/src/config.json:/usr/src/app/config.json \
    -v $(pwd)/src/db.json:/usr/src/app/db.json \
    -v $(pwd)/src/server/uploads/:/usr/src/app/server/uploads/ \
    -p 805:80 -p 4435:443 \
    sharex-upload-server

and docker logs

chchang@hqdc039:~/docker/ShareX-Upload-Server$ docker logs -f sharex-upload-server 
linkify option is removed. Use linkify plugin instead:

import Remarkable from 'remarkable';
import linkify from 'remarkable/linkify';
new Remarkable().use(linkify)


  ======================================================================
  |  ________  ___  ___  ________  ________  _______   ________        |
  | |\   ____\|\  \|\  \|\   __  \|\   __  \|\  ___ \ |\   ____\       |
  | \ \  \___|\ \  \\\  \ \  \|\  \ \  \|\  \ \   __/|\ \  \___|_      |
  |  \ \_____  \ \   __  \ \   __  \ \   _  _\ \  \_|/_\ \_____  \     |
  |   \|____|\  \ \  \ \  \ \  \ \  \ \  \\  \\ \  \_|\ \|____|\  \    |
  |     ____\_\  \ \__\ \__\ \__\ \__\ \__\\ _\\ \_______\____\_\  \   |
  |    |\_________\|__|\|__|\|__|\|__|\|__|\|__|\|_______|\_________\  |
  |    \|_________|                                      \|_________|  |
  |                                                                    |
  |                                                                    |
  ======================================================================
  |  Creator: github.com/TannerReynolds                                |
  |  Discord: https://discord.gg/QTcU89d                               |
  ======================================================================
  |> [5:55:19 AM] | Connecting to Discord...
  |> [5:55:19 AM] | Secure server listening on port 443
  |> [5:55:19 AM] | Server using flexible SSL secure setting
To run a full SSL setting, ensure key.pem and cert.pem are in the /src folder
  |> [5:55:19 AM] | Loaded Command: banIP.js
  |> [5:55:19 AM] | Loaded Command: deleteFile.js
  |> [5:55:19 AM] | Loaded Command: eval.js
  |> [5:55:19 AM] | Loaded Command: exec.js
  |> [5:55:19 AM] | Loaded Command: help.js
  |> [5:55:19 AM] | Loaded Command: recentVisitors.js
  |> [5:55:19 AM] | Loaded Command: rename.js
  |> [5:55:19 AM] | Loaded Command: restart.js
  |> [5:55:19 AM] | Loaded Command: trafficfor.js
  |> [5:55:19 AM] | Loaded Command: unbanIP.js

and then nothing happened .
can't open the web in http/https
and no more log messages.

ShareS Version

Docker version

Desktop (please complete the following information):

  • OS: ubuntu 20.04
  • Browser : Firefox
  • Version : 89.0.1

Site Name Config

Is your feature request related to a problem? Please describe.
N/A

Describe the solution you'd like
Allow the configuration of the site name via the config.json file.

Describe alternatives you've considered
The only alternative currently available is to modify the site files directly.

Additional context
Concept: https://cdn.foxybots.xyz/aIkkh7

Gallery Admin Key Refused

Describe the bug
When attempting to access the gallery using the admin key. It returns unauthorized.

To Reproduce
Steps to reproduce the behavior:

  1. Install latest version of the repo
  2. Configure server settings
  3. Configure admin key
  4. Start server
  5. Go to yourdomain.com/gallery
  6. Input admin key

Expected behavior
When inputting a valid admin key, it should return the gallery page

ShareS Version
v4.5.3

Screenshots
https://cdn.sigmabot.xyz/lTW7pL

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Firefox
  • Version: 77.0.1

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser: N/A
  • Version: N/A

Additional context
None

Can'play some files

mp3, mp4, m4a have errors so when I uploaded the files they didn't work, according to mp3 they can't play, and mp4 downloaded without indicating its type so it can't play.

Can I test the server on localhost?

I tried testing the server on localhost by setting the domain to http://localhost and the port to 3000, localhost:3000 said my domain is unauthorized, is it possible to test this server on localhost? Please help.......

Unable to use admin key

I setup an admin key, but when I try to use it ShareX returns URL: Unauthorized. When I use the normal key, it does work.

Cannot install ShareS Server, fails during install, refuses to run.

Describe the bug
Cannot install ShareS Server, fails during install, refuses to run.

To Reproduce
Steps to reproduce the behavior:
Attempt to run install.sh
Watch it fail when attempting to download Image-ExifTool from Sourceforge.

Expected behavior
Installer expected to install ShareS Server, fails at downloading Image-ExifTool as URL 404's

ShareS Version
Latest Release

Screenshots
image

Desktop (please complete the following information):

  • OS: Ubuntu 16.04
  • Browser N/A
  • Version Release

Additional context

HTTP request sent, awaiting response... 302 Found
Location: https://downloads.sourceforge.net/project/exiftool/Image-ExifTool-11.80.tar.gz?download&failedmirror=iweb.dl.sourceforge.net [following]
--2020-01-15 17:10:41--  https://downloads.sourceforge.net/project/exiftool/Image-ExifTool-11.80.tar.gz?download&failedmirror=iweb.dl.sourceforge.net
Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 216.105.38.13
Connecting to downloads.sourceforge.net (downloads.sourceforge.net)|216.105.38.13|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-01-15 17:10:41 ERROR 404: Not Found.

tar: Image-ExifTool-11.80.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
./install.sh: line 24: cd: Image-ExifTool-11.80: No such file or directory
Can't open perl script "Makefile.PL": No such file or directory
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target 'test'.  Stop.
make: *** No rule to make target 'install'.  Stop.
Finished installing dependencies!
root@hornyfur-server:/home/phoenix/ShareX-Upload-Server#```

robots.txt

Discord is not embedding with https, i think it needs a robots.txt but i am not sure

Key is undefined

Describe the bug
Both console logs and Discord bot logs for uploads (including puploads) show the key as undefined.

To Reproduce
Steps to reproduce the behavior:

  1. Install the latest version of the Repo
  2. Configure Discord bot settings
  3. Upload a file as a pupload
  4. View console logs and Discord bot log

Expected behavior
The logs should display Key: SomeKeyGoesHere

ShareS Version
v4.5.3

Screenshots
Discord Log: https://cdn.foxybots.xyz/5fQtZ2
Console Log: https://cdn.foxybots.xyz/QhaC5n

Desktop (please complete the following information):

  • OS: Windows 10 x64
  • Browser: Firefox
  • Version: 81.0.1

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser: N/A
  • Version: N/A

Additional context
None able to be provided.

Fails to install ExifTool

Describe the bug
I ran the ./install.sh, and everything went fine until it tried to install ExifTool. It fails to connect to there. It waits a bit, then says the connection timed out, then tries again forever.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the installation instructions.
  2. Wait until it tries to install ExifTool

Expected behavior
For it to install everything smoothly.

ShareS Version
4.5.3

Screenshots
https://heroku.is-a-bad.host/i/6rwm.png

Desktop (please complete the following information):
[N/A]

Smartphone (please complete the following information):
[N/A]

Additional context
None

Random crashes and errors

The process randomly crashed, and threw this err:

3|i.smc.wt | TypeError: Cannot read property 'get' of undefined
3|i.smc.wt |     at Shard.wsEvent (/root/projects/i.smc.wtf/node_modules/eris/lib/gateway/Shard.js:433:48)
3|i.smc.wt |     at Shard.onWSMessage (/root/projects/i.smc.wtf/node_modules/eris/lib/gateway/Shard.js:1721:26)
3|i.smc.wt |     at WebSocket.ws.onmessage (/root/projects/i.smc.wtf/node_modules/eris/lib/gateway/Shard.js:1598:33)
3|i.smc.wt |     at WebSocket.onMessage (/root/projects/i.smc.wtf/node_modules/ws/lib/event-target.js:120:16)
3|i.smc.wt |     at WebSocket.emit (events.js:197:13)
3|i.smc.wt |     at Receiver.receiverOnMessage (/root/projects/i.smc.wtf/node_modules/ws/lib/websocket.js:720:20)
3|i.smc.wt |     at Receiver.emit (events.js:197:13)
3|i.smc.wt |     at Receiver.dataMessage (/root/projects/i.smc.wtf/node_modules/ws/lib/receiver.js:414:14)
3|i.smc.wt |     at Receiver.getData (/root/projects/i.smc.wtf/node_modules/ws/lib/receiver.js:346:17)
3|i.smc.wt |     at Receiver.startLoop (/root/projects/i.smc.wtf/node_modules/ws/lib/receiver.js:133:22)

Firefox

When on Firefox, the webpage is essentially broken, there are no boxes and everything is edge to edge.

TypeError when opening Gallary tab

When opening the gallery tab on the upload server, this Typeerror shows in pm2 logs:

5||index    | TypeError: Cannot read property 'includes' of undefined
5|index    |     at ShareXAPI.auth (/root/projects/ShareX-Upload-Server/src/util/auth.js:2:15)
5|index    |     at ShareXAPI.post (/root/projects/ShareX-Upload-Server/src/server/routes/gallery.js:13:15)
5|index    |     at Layer.handle [as handle_request] (/root/projects/ShareX-Upload-Server/node_modules/express/lib/router/layer.js:95:5)
5|index    |     at next (/root/projects/ShareX-Upload-Server/node_modules/express/lib/router/route.js:137:13)
5|index    |     at Route.dispatch (/root/projects/ShareX-Upload-Server/node_modules/express/lib/router/route.js:112:3)
5|index    |     at Layer.handle [as handle_request] (/root/projects/ShareX-Upload-Server/node_modules/express/lib/router/layer.js:95:5)
5|index    |     at /root/projects/ShareX-Upload-Server/node_modules/express/lib/router/index.js:281:22
5|index    |     at Function.process_params (/root/projects/ShareX-Upload-Server/node_modules/express/lib/router/index.js:335:12)
5|index    |     at next (/root/projects/ShareX-Upload-Server/node_modules/express/lib/router/index.js:275:10)
5|index    |     at serveStatic (/root/projects/ShareX-Upload-Server/node_modules/serve-static/index.js:75:16)

gallery not working.

Describe the bug
gallery doesnt work. Just tries to load then fails after about 2 - 3mins

To Reproduce
Just run the latest version of this and try and access the gallery

Expected behavior
To show screenshots, etc

ShareS Version
Latest

Desktop (please complete the following information):

  • OS: Windows 10 (Will all latest updates)
  • Browser Google Chrome
  • Version 80.0.3987.132

Navbar

Navbar not working on the phone, so when I click it doesn't give me anything

No Input Filtering for Discord

Describe the bug
When using the discord integration, using [prefix]rv will display the 10 most recent visited pages. if you send a crafted payload, you can do things like ping everyone.

To Reproduce
Steps to reproduce the behavior:

  1. curl https://[DOMAIN]/```@everyone - ``` breaks out of the code block, @everyone is just a PoC ping
  2. run [prefix]rv
  3. See injectionon

Expected behavior
Strip or Escaped characters so that this can't happen

ShareS Version
4.5.3

Screenshots

Hosting Question

Can I use Pterodactyl Panel to host this? And can I use an custom port? (like 8100)

Custom port

Don't force 80/443, allow for specifying port.

Ubuntu 20.04 support

Is your feature request related to a problem? Please describe.
So I was trying to install it on Ubuntu 20.04 with node v10.22.0 but it errored out with
`internal/modules/cjs/loader.js:638
throw err;
^

Error: Cannot find module 'express'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/sharex/img/src/server/app.js:2:17)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)`
Describe the solution you'd like
Would it work on Node 8 or something?

Feature request

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
When pictures are sent to Discord other platform, it will just send the picture, me personally, i would like the picture to be in an embed, and then in the title the file name, and the url is the url of the picture, i would like this to be an optional option in config.json

Describe alternatives you've considered
None.

Additional context
What it looks like right now:
image

What i want it to be:
image

Background of .txt files makes it almost unreadable

Is your feature request related to a problem? Please describe.
When looking at a txt file Click Me! its almost impossible to read it due to gray on black text. But the issue doesn't happen for .md files. Example

Describe the solution you'd like
Make .txt files like .md files. (Readable)

Describe alternatives you've considered
Color Picker for Theme and or background colors

Discord Embeds

Hi, is there any way to make discord preview an embed that contains the image instead of just the image? I’ve been trying cloudflare workers but they seem to not be working for me, how can I make the link preview an embed? Thanks
The discord server links that is shown on startup doesn’t work btw

Unable to start server

Describe the bug
Process gives error:

ShareS > TypeError: Cannot read property 'log' of undefined
ShareS > at process. (/home/chloe/ShareX-Upload-Server/src/index.js:43:54)
ShareS > at process.emit (events.js:322:22)
ShareS > at processPromiseRejections (internal/process/promises.js:209:33)
ShareS > at processTicksAndRejections (internal/process/task_queues.js:98:32)

Continuously

To Reproduce
This happens when I start the app through pm2

Expected behavior
I expected the service to start, and the web server to be available

I am unable to load the web page

ShareS Version
4.5.2 running on Ubuntu 16.04 LTS

SSL: Failed Handshake using Cloudflare

Hiya, bit stuck on setting up the server. Whenever I head over to my cdn domain I get a Cloudflare error saying that the SSL failed to Handshake. Are there any fixes I can do to solve this?

404 error on /api/files

Describe the bug
Hey! I wanted to start using this for my screenshots, but when I tried using the sxcu file for the images and files part, I got a site not found error... Am I doing something wrong?

Expected behavior
To find the website

ShareS Version
4.5.3

Screenshots
Cant really take screenshots

Desktop (please complete the following information):

  • OS: Linux PopOS 20
  • Browser FireFox

Additional context
I am using sharenix, but configs should be the same as windows sharex

Can't use full SSL in docker

Describe the bug
Despite placing key.pem and cert.pem in /src the SSL is not working. It says, working in flexible SSL mode.

To Reproduce
Place ssl certs in /src as displayed in the docker logs

Expected behavior
load page on https://SERVERIP:8443

ShareS Version
4.5.3

Screenshots
ERR_SSL_PROTOCOL_ERROR

Desktop (please complete the following information):

  • OS: Windows 10
  • Chrome
  • Latest

certs:

ls src/*.pem

src/cert.pem src/key.pem

also a bit more documentation or detailed readme would be nice!

docker issue

So, I'm attempting to run this in a docker container. It works as expected in a container, but if I attempt to mount 'uploads' to a host directory (i.e. -v /path/to/host/uploads:/sharex/uploads), I then get an error when I attempt to upload files

sharex-server_1  | TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string or Buffer. Received type object
sharex-server_1  |     at write_ (_http_outgoing.js:601:11)
sharex-server_1  |     at ServerResponse.write (_http_outgoing.js:573:10)
sharex-server_1  |     at fs.rename.err (/sharex/app.js:301:32)
sharex-server_1  |     at FSReqWrap.oncomplete (fs.js:145:20)

Any ideas?

If it's helpful, my Dockerfile is

from node:alpine

RUN apk add --no-cache git
RUN git clone https://github.com/TannerReynolds/node-sharex-server /sharex

WORKDIR /sharex

RUN npm install
RUN npm install -g pm2

VOLUME ["/sharex/pages", "/sharex/uploads"]

EXPOSE 80

cmd ["pm2-docker", "start", "app.js"]

Edit:

Okay. I figured it out. the actual error is:

{ [Error: EXDEV: cross-device link not permitted, rename '/tmp/upload_20130982b474a921caed4722c2fbba20' -> './uploads/MFA6Y9.png']
sharex-server_1  |   errno: -18,
sharex-server_1  |   code: 'EXDEV',
sharex-server_1  |   syscall: 'rename',
sharex-server_1  |   path: '/tmp/upload_20130982b474a921caed4722c2fbba20',
sharex-server_1  |   dest: './uploads/MFA6Y9.png' }

After some googling, I installed fs-extra and replaced all instances of fs.rename with fs.move, which seems to have fixed the problem with Docker.

meteor/meteor#7852 (comment)

Calling rename(2) for a directory is not fully supported on AUFS.  It returns EXDEV 
(“cross-device link not permitted”),  even when both of the source and the destination path
are on a same AUFS layer, unless the directory  has no children.  So your application has to 
be designed so that it can handle  EXDEV and fall back to a “copy and unlink” strategy.

That said, the fs-extra npm package has the fs.move method which implements error handling 
for that EXDEV error. It has moveDirAcrossDevice and moveFileAcrossDevice methods that 
presumably fix it.

Can't install

Describe the bug

1|cdn-padow |     at Module._compile (node:internal/modules/cjs/loader:1101:14)
1|cdn-padow |     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
1|cdn-padow |     at Module.load (node:internal/modules/cjs/loader:981:32)
1|cdn-padow |     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
1|cdn-padow |     at Module.require (node:internal/modules/cjs/loader:1005:19)
1|cdn-padow |     at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39) {
1|cdn-padow |   code: 'MODULE_NOT_FOUND',
1|cdn-padow |   requireStack: [
1|cdn-padow |     '/var/www/cdn-padow/src/server/routes/files.js',
1|cdn-padow |     '/var/www/cdn-padow/src/server/routes/index.js',
1|cdn-padow |     '/var/www/cdn-padow/src/server/app.js',
1|cdn-padow |     '/var/www/cdn-padow/src/index.js'
1|cdn-padow |   ]
1|cdn-padow | }

To Reproduce

  1. Install fresh version of the upload server
  2. Run the script
  3. Run the index.js

Expected behavior
It should start

ShareS Version
4.5.3

Desktop

  • OS: Ubuntu 20.04
  • Browser: chrome
  • Version: don't get it

Additional context
Running npm i just gets an another error, even if I'm root and the folder's perms are -R 777

npm ERR! syscall symlink
npm ERR! path ../acorn/bin/acorn
npm ERR! dest /var/www/cdn-padow/node_modules/.bin/acorn
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, symlink '../acorn/bin/acorn' -> '/var/www/cdn-padow/node_modules/.bin/acorn'
npm ERR!  [Error: EPERM: operation not permitted, symlink '../acorn/bin/acorn' -> '/var/www/cdn-padow/node_modules/.bin/acorn'] {
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../acorn/bin/acorn',
npm ERR!   dest: '/var/www/cdn-padow/node_modules/.bin/acorn'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user

Popups

When I go to the site and upload the url changes but the popup box never comes up

Add config setting to overwrite http/https prefix on return adress

It would be a good idea to have a setting to always return the https prefix even when the application is running with the "secure": false setting.
If you run Nginx as a reverse proxy to handle the HTTPS stuff for you and run the actual app in HTTP mode, you get a link prefixed with http, even though your actual connection to the server from the outside is done securely.
The current bypass is to regex the ShareX return adress to have http://(.*) in the Regex-List and https://$regex:1|1$ in the URL and Thumbnail URL field in your custom uploader settings.

Dockerfile wrong

Hey,

The docker file is wrong currently it is

FROM node:alpine

WORKDIR /usr/src/app
COPY src/ package.json .

RUN apk --no-cache add exiftool &&
npm i

EXPOSE 80 443
CMD ["node", "index.js"]

And to get it working had to change it to:

FROM node:alpine

WORKDIR /usr/src/app
COPY src/ package.json /usr/src/app/

RUN apk --no-cache add exiftool &&
npm i

EXPOSE 80 443
CMD ["node", "index.js"]

Also you have the docker command as docker built instead of docker build

Other then that it works great except the discord bot seems to stop working after around an hour, to replicate that just set it up as you say and then let it run for a while and it will throw an error in console or pm2 whichever, to fix this I restart my docker container every 30 mins

https issues

The gallery will load images over http. I've noticed http being used instead of https in a few places like after you submit a url it gives you http.

Set data folder

I would like to be able to set the data folder to something else than the default. I'm running this in a VM and I'd enjoy being able to instead send it to a Shared Folder.

Is this something that would be reasonable?

Images not previewing in Discord when using SSL (LetsEncrypt/Certbot certificate)

Basically title.
I tried a few different servers, domains and certificates now.
As soon as you swap from http to https the image previews in Skype, Telegram, Twitter and a few others when the link is posted, just Discord decides to not preview it. Clicking the link displays the image/video/text just fine.

Using Certbot to generate certificates for domain.com and *.domain.com

If "secure": is set to false it works and previews.

Domains tested on: https://valorant.dev and https://files.mango.sd. (both are set to public)

Tested with Ubuntu 16.04 and 20.04.

If this is an error on the ShareX Upload Server side it would be wonderful if it could be fixed.

Edit: example config (currently the one from https://valorant.dev
Edit2: Neither Nginx nor Apache are running on those servers, its just the ShareX Server

{
  "key": [""],
  "domain": "valorant.dev",
  "puploadKeyGenLength": 64,
  "public": true,
  "maxUploadSize": 50,
  "markdown": true,
  "port": 80,
  "secure": true,
  "fileNameLength": 4,
  "shortUrlLength": 3,
  "securePort": 443,
  "ratelimit": 1000,
  "dateURLPath": false,
  "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"
  ],
  "admin":{
    "key": ["admin pass key goes here"],
    "maxUploadSize": 1024,
    "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"
     ]
  },
  "paste": {
    "maxUploadSize": 20
  },
  "discordToken": "Discord Token Here (required if you want API monitoring through Discord)",
  "discordAdminIDs": ["discord IDs of people who can run commands go here", "Like this"],
  "discordChannelID": "the channel you're trying to send api monitor updates to",
  "prefix": "enter prefix for bot commands here"
}

docker terminated with NODULE_NOT_FOUND error

Describe the bug
docker terminated with NODULE_NOT_FOUND error

To Reproduce
Steps to reproduce the behavior:

  1. docker build -t sharex-upload-server .
  2. docker run --name "sharex-upload-server" -d -v $(pwd)/src/config.json:/usr/src/app/config.json -v $(pwd)/src/db.json:/usr/src/app/db.json -v $(pwd)/src/server/uploads/:/usr/src/app/server/uploads/ -p 8181:80 -p 44304:443 sharex-upload-server

Desktop (please complete the following information):

  • OS: ubuntu 18.04
  • Browser : Firefox

Additional context
Dockerfile

2021-04-20 08:32:08 [changch@hqdc034 ShareX-Upload-Server]$ cat Dockerfile 
FROM node:alpine

WORKDIR /usr/src/app
COPY src .
COPY package.json .

RUN apk --no-cache add exiftool && \
    npm i

EXPOSE 80 443
CMD ["node", "index.js"]

docker build log

2021-04-20 08:35:27 [changch@hqdc034 ShareX-Upload-Server]$ docker build -t sharex-upload-server .
Sending build context to Docker daemon  51.02MB
Step 1/7 : FROM node:alpine
 ---> 75631da67663
Step 2/7 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 3509c4e7f7c2
Step 3/7 : COPY src .
 ---> 24adb30b7eaf
Step 4/7 : COPY package.json .
 ---> 63bf2db75f8e
Step 5/7 : RUN apk --no-cache add exiftool &&     npm i
 ---> Running in 5d54d764fd52
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/4) Installing libbz2 (1.0.8-r1)
(2/4) Installing perl (5.30.3-r0)
(3/4) Installing perl-image-exiftool (11.79-r0)
(4/4) Installing exiftool (11.79-r0)
Executing busybox-1.31.1-r10.trigger
OK: 58 MiB in 20 packages

added 269 packages, and audited 270 packages in 14s

42 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm notice 
npm notice New minor version of npm available! 7.7.6 -> 7.10.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.10.0>
npm notice Run `npm install -g [email protected]` to update!
npm notice 
Removing intermediate container 5d54d764fd52
 ---> a9701460b9a6
Step 6/7 : EXPOSE 80 443
 ---> Running in b867ae5502ac
Removing intermediate container b867ae5502ac
 ---> 5476bbd24b34
Step 7/7 : CMD ["node", "index.js"]
 ---> Running in f8164722d9c3
Removing intermediate container f8164722d9c3
 ---> 72407ede49b3
Successfully built 72407ede49b3
Successfully tagged sharex-upload-server:latest

start docker with

docker run --name "sharex-upload-server" -d -v $(pwd)/src/config.json:/usr/src/app/config.json -v $(pwd)/src/db.json:/usr/src/app/db.json -v $(pwd)/src/server/uploads/:/usr/src/app/server/uploads/ -p 8181:80 -p 44304:443 sharex-upload-server

and docker immediately terminated with error

2021-04-20 08:42:40 [changch@hqdc034 ShareX-Upload-Server]$ docker logs sharex-upload-server 
node:internal/modules/cjs/loader:927
  throw err;
  ^

Error: Cannot find module '/usr/src/app/index.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Not Starting

I've been using this for a while now and I've never had a problem starting it until now. Whenever I start my server it says Continuing without Discord connection... but never continues.

Text uploader failing

Following your tutorial, the text uploader is not passing the sharex test. Image, file, url shortener, are all working.

Thanks.

Running via IIS

Hello,

I'm trying to run this through IIS Rewrite module as a subfolder.
https://xyz.com/upload

Browsing https://xyz.com/upload works fine but the paths however are broken, since they all point to the root domain https://xyz.com.

I could just switch the paths in each file (under src/app/) but that seems like taking the wrong path.
Any idea on how one would be able to fix this?

If not for IIS then I'd love to know how I could do this on nginx.

Thank you advance!

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.