From d922de564dd221d5e75a7b654fa99c3daa5f752d Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 10 Sep 2019 23:28:15 -0400 Subject: [PATCH 1/2] Added new admin endpoints --- README.MD | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 159fd12..7e6ea3d 100644 --- a/README.MD +++ b/README.MD @@ -150,7 +150,9 @@ __________________________________________________________________ ``` { userID: string, - userName: string + userName: string, + //optional + adminUserID: string //This is if you want to change someone elses username from the admin account } ``` @@ -238,3 +240,81 @@ __________________________________________________________________ **Error codes**: None +__________________________________________________________________ + +**GET** `/api/getDaysSavedFormatted` + +**Input**: +``` +{ + Nothing +} +``` + +**Response**: +``` +{ + daysSaved: float (2 decimal places) +} +``` + +**Error codes**: + +None +__________________________________________________________________ + +### Admin Calls + +These can only be called by the server administrator, set in the config. + +**POST** `/api/shadowBanUser` + +Shadow banned submissions are hidden for everyone but the IP that originally submitted it. Shadow banning a user shadow bans all future submissions. + +**Input**: +``` +{ + userID: string, //public userID of the user you want to shadowBan + adminUserID: string, //your userID as an admin + enabled: boolean, //optional, to be able to add and remove users + unHideOldSubmissions: boolean //optional, should all previous submissions be banned as well? +} +``` + +**Response**: +``` +{ + Nothing (status code 200) +} +``` + +**Error codes**: + +400: Bad Request (Your inputs are wrong/impossible) +403: Unauthorized (You are not an admin) +__________________________________________________________________ + +**POST** `/api/addUserAsVIP` + +VIPs have extra privileges and their votes count more. + +**Input**: +``` +{ + userID: string, //public userID of the user you want to add to the VIP list + adminUserID: string, //your userID as an admin + enabled: boolean //optional, to be able to add and remove users +} +``` + +**Response**: +``` +{ + Nothing (status code 200) +} +``` + +**Error codes**: + +400: Bad Request (Your inputs are wrong/impossible) +403: Unauthorized (You are not an admin) From c4c6a07aebf26d161e0eb13119625beb4d3701bf Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 10 Sep 2019 23:31:16 -0400 Subject: [PATCH 2/2] Added install instructions --- README.MD | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.MD b/README.MD index 7e6ea3d..654e4c4 100644 --- a/README.MD +++ b/README.MD @@ -16,6 +16,16 @@ Hopefully this project can be combined with projects like [this](https://github. The client web browser extension is available here: https://github.com/ajayyy/SponsorBlock +# Build At Home + +This is a node.js server, so clone this repo and run `npm install` to install all dependencies. + +Make sure to create the databases in the `databases` folder out of the database schemas. + +Rename `config.json.example` to `config.json` and fill the parameters inside. + +Run the server with `npm start`. + # API Docs Public API available at https://sponsor.ajay.app.