Skip to content
A Node.js API for ShareX.
TypeScript JavaScript CSS Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
migrations use longtext instead of text Oct 31, 2019
public/css
readme add start to docs Oct 10, 2019
src
sxcu
.dockerignore
.editorconfig init comimit Oct 7, 2019
.env.example add config file generation Nov 4, 2019
.eslintignore
.eslintrc.js init comimit Oct 7, 2019
.gitignore add config file generation Nov 4, 2019
.prettierrc
Dockerfile Remove stage from Dockerfile Nov 1, 2019
LICENSE update naming Oct 10, 2019
docker-compose.yml Docker stuff Nov 1, 2019
docker.md
ecosystem.config.js add start to docs Oct 10, 2019
highlight.html better syntax highlighting. move uploads to own folder Oct 8, 2019
knexfile.js
nginx.conf make nginx config reflect docs Oct 10, 2019
package-lock.json Add a package-lock.json. I used yarn import to keep them synced. Nov 1, 2019
package.json bump version Nov 4, 2019
readme.md
syntax-languages.txt
tsconfig.json
yarn.lock

readme.md

Node TypeScript ShareX API

This is a Node.js API for ShareX. This is ideal if you want to use ShareX with your own server and domain.

Discord

Features

  • Full ShareX feature support
  • Thumbnail support
  • Deletion URL support
  • Syntax highlighting
  • Discord Logging (optional)

Requirements

  • Node.js
  • Yarn
    • You can use npm but the readme will use Yarn.
  • MySQL Database
  • git
    • You can place the folder there manually.
  • pm2
    • If you want to run in background.

Installation

Clone the repository.

git clone https://github.com/busheezy/node-ts-sharex-api

Navigate inside of the directory.

cd node-ts-sharex-api

Install the dependencies.

yarn

Build the project

yarn build

Run the database migration.

yarn migrate

Edit the config file. You can rename .env.example to .env and edit the values.

You should proxy this with nginx or apache. There is a config here.

Edit API Config

# MySQL database auth information.
DB_NAME=sharex
DB_HOST=localhost
DB_USERNAME=sharex
DB_PASSWORD=

# This is the API Key we validate ShareX calls with.
API_KEY=hunter1

# The Discord webhook URL is for discord loggging via the ShareX "share" feature.
# It is optional.
DISCORD_WEBHOOK_URL=

# We autogenerate thumbnails. Choose how many pixels wide or tall it can be.
THUMBNAIL_SIZE=64

# Enable automatic SXCU (ShareX config) file generation
# Outputs to /sxcu_generated
SXCU=true
# The url used to talk to the API.
UPLOAD_URL=http://localhost:3000
# The url used for sharing.
# Enter the same as UPLOAD_URL for a standard configuration.
RETURN_URL=http://localhost:3000

Import ShareX configs

The ShareX configurations are here. You need to import these into ShareX.

Import ShareX configs

Edit the request and response tab for every configuration to reflect your domain.

Starting

pm2

pm2 start --env production

or

yarn

yarn start

or

node

NODE_ENV=proudction node dist/index.js

Usage

Use ShareX like normal.

Syntax Highlighting

  • Upload text
  • Append forward slash and language
    • example.com/abcdef/javascript

The languages are listed here.

Delete via API

Snag your delete url from ShareX. Navigate to the url. The page will give you a code. Append a trailing slash and the code it gives you to complete deletion.

  • Load page
    • example.com/api/delete/abcd
  • Get code (the response)
  • Load page with code appended.
    • example.com/api/delete/abcd/efgh
  • Deleted.

Screenshots

Syntax Highlighting

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Credits

Ruto

  • Docker support

License

GNU GPLv3

You can’t perform that action at this time.