My very own ShareX server - written in TypeScript.
Contents:
To run this project, you will need to add the following environment variables to your .env file
MONGO_URL = a MongoDB URL (ex.: mongodb://localhost:27017/sharex)
SUPERADMIN_UUID = a superadmin UUID key, for easier remote management
DISCORD_BOT_TOKEN = a Discord bot token, to fetch profile pictures from users
GET /api/counterReturns the current amount of files stored in the uploads folder.
GET /api/oembed| Parameter | Type | Description |
|---|---|---|
author |
string |
Required. Text shown in the embed |
file |
string |
Required. Filename |
POST /api/users/upload| Parameter | Type | Description |
|---|---|---|
username |
string |
Required. Username |
password |
string |
Required. Password |
file |
file |
Required. A file to upload |
POST /api/users/register| Parameter | Type | Description | Default value |
|---|---|---|---|
username |
string |
Required. Username | - |
domain |
string |
Required. SX domain to use | - |
inviteCode |
string |
Required. Invite code | - |
displayName |
string |
Your display name on the page | username |
embedTitle |
string |
Text displayed in the embed | displayName or username |
embedColor |
string |
Color of the embed on Twitter and Discord | #050505 |
Response (automatically downloaded SXCU file)
{
"Name": "liba sharex - username",
"DestinationType": "ImageUploader, FileUploader",
"RequestMethod": "POST",
"RequestURL": "https://[USER SELECTED DOMAIN]/api/users/upload",
"Body": "MultipartFormData",
"Arguments": {
"username": "username",
"password": "password"
},
"FileFormName": "file",
"URL": "https://{json:host}{json:path}",
"ThumbnailURL": "https://{json:host}/uploads/og/{json:file_name}",
"DeletionURL": "https://{json:host}/api/delete?token={json:delete_token}"
} POST /api/users/login| Parameter | Type | Description |
|---|---|---|
username |
string |
Required. Username |
password |
string |
Required. Password |
Response: Either a 200 or 401 status code
GET /api/discord-profile-picture| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Discord ID |
GET /api/delete| Parameter | Type | Description |
|---|---|---|
token |
string |
Required. Deletion token |
Responses
If token is valid:
File deleted successfully!
If token is invalid:
There was an error deleting the uploaded file. Did you provide the correct token?
Create a user (SuperAdmin (you should use invite codes instead!))
POST /api/users/createAuthentication: Bearer SUPERADMIN_UUID
| Parameter | Type | Description |
|---|---|---|
username |
string |
Required. Username |
password |
string |
Required. Password |
Response
true
POST /api/users/genInviteAuthentication: Bearer SUPERADMIN_UUID
Response
{
"success": true,
"code": "invite-code-here"
} POST /api/users/changeDisplayNameAuthentication: Bearer SUPERADMIN_UUID
| Parameter | Type | Description |
|---|---|---|
username |
string |
Required. Username |
displayName |
string |
Required. New display Name |
Response
true
POST /api/users/changePasswordAuthentication: Bearer SUPERADMIN_UUID
| Parameter | Type | Description |
|---|---|---|
username |
string |
Required. Username |
newPassword |
string |
Required. New password |
Response
true
To deploy this project run
git clone https://github.com/chlkrisz/sharex.git && cd sharex
mkdir uploads
npm install
npx ts-node src/index.ts