Skip to content

SolidProgramming/ShareXUploadApi

Repository files navigation

.NET

ShareXUploadApi

ASP.NET Core API Backend for ShareX(with Docker support)

Getting started

Prerequisites

1. MySQL Database

The table needed for uploads is created on the first request if the table doesn't exist.

CREATE TABLE IF NOT EXISTS `uploads` (
  `guid` varchar(50) COLLATE utf8mb4_bin NOT NULL,
  `file_extension` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

The table needed for authentication of users is created on the first request if the table doesn't exist(the default user is admin:admin).

CREATE TABLE IF NOT EXISTS `users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `username` varchar(50) COLLATE utf8mb4_bin NOT NULL,
  `password` varchar(50) COLLATE utf8mb4_bin NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
INSERT INTO `users` (`id`, `username`, `password`) VALUES
	(1, 'admin', 'admin');

2. Settings file settings.json. Copy this file to the unraid appdata folder '/mnt/user/appdata/sharexuploadapi/'

{
  "uriSettings":{
	  "public_uri": "https://mypublicurl/myimages/"
  },
  "pathSettings": {
    "dockerFolder": "/sharex/",
    "desktopFolder": "//myshareorsomething/imgstorage/"
  },
  "dbSettings": {
    "ip": "DBIP",
    "database": "DBNAME",
    "username": "USERNAME",
    "password": "PASSWORD"
  }
}

❗❗The "dockerFolder" setting needs to be the same as the unraid container path variable❗❗

3. Proxy/Tunnel. You need a reverse proxy or cloudflare tunnel to access the api on your unraid system from the internet.

Unraid Docker

  1. Login to your UnRaid dashboard.
  2. Go to tab 'Docker'.
  3. Click on 'Add Container' button.
  4. Fill fields.
  5. Click on 'Add another Path...'
  6. Fill fields.
    • Config Type => Path
    • Name => Host Path
    • Container Path => /sharex
    • Host Path => /mnt/user/... (use your own share/folder)
    • Access Mode => Read/Write
  7. Click on 'Add another Path...' again
    • Config Type => Path
    • Name => Appdata
    • Container Path => /app/appdata
    • Host Path => /mnt/user/appdata/sharexuploadapi/
    • Access Mode => Read/Write
  8. Cick on 'Apply' button.

About

ASP.NET Core API Backend for ShareX(with Docker support)

Resources

Stars

Watchers

Forks