mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-08 12:37:00 +03:00
Merge branch 'master' of https://github.com/ajayyy/SponsorBlockServer into experimental
# Conflicts: # index.js
This commit is contained in:
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Ajay Ramachandran
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
223
README.MD
223
README.MD
@@ -15,3 +15,226 @@ Hopefully this project can be combined with projects like [this](https://github.
|
||||
# Client
|
||||
|
||||
The client web browser extension is available here: https://github.com/ajayyy/SponsorBlock
|
||||
|
||||
# API Docs
|
||||
|
||||
Public API available at https://sponsor.ajay.app.
|
||||
|
||||
________________________________________________________________________________
|
||||
|
||||
**GET** `/api/getVideoSponsorTimes`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
{
|
||||
videoID: string
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
{
|
||||
sponorTimes: array [float],
|
||||
UUIDs: array [string] //The ID for this sponsor time, used to submit votes
|
||||
}
|
||||
```
|
||||
|
||||
**Error codes**:
|
||||
|
||||
404: Not Found
|
||||
|
||||
__________________________________________________________________
|
||||
|
||||
**GET** `/api/postVideoSponsorTimes`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
{
|
||||
videoID: string,
|
||||
startTime: float,
|
||||
endTime: float,
|
||||
userID: string //This should be a randomly generated UUID
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
```
|
||||
|
||||
**Error codes**:
|
||||
|
||||
400: Bad Request (Your inputs are wrong/impossible)
|
||||
|
||||
429: Rate Limit (Too many for the same user or IP)
|
||||
|
||||
409: Duplicate
|
||||
|
||||
__________________________________________________________________
|
||||
|
||||
**GET** `/api/voteOnSponsorTime`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
{
|
||||
UUID: string, //id of the sponsor being voted on
|
||||
userID: string,
|
||||
type: int //0 for downvote, 1 for upvote
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
```
|
||||
|
||||
**Error codes**:
|
||||
|
||||
400: Bad Request (Your inputs are wrong/impossible)
|
||||
|
||||
405: Duplicate
|
||||
|
||||
__________________________________________________________________
|
||||
|
||||
**GET** `/api/viewedVideoSponsorTime`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
{
|
||||
UUID: string
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
```
|
||||
|
||||
**Error codes**:
|
||||
|
||||
400: Bad Request (Your inputs are wrong/impossible)
|
||||
|
||||
__________________________________________________________________
|
||||
|
||||
**GET** `/api/getViewsForUser`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
{
|
||||
userID: string
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
{
|
||||
viewCount: int
|
||||
}
|
||||
```
|
||||
|
||||
**Error codes**:
|
||||
|
||||
404: Not Found
|
||||
|
||||
__________________________________________________________________
|
||||
|
||||
**POST** `/api/setUsername`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
{
|
||||
userID: string,
|
||||
userName: string
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
```
|
||||
|
||||
**Error codes**:
|
||||
|
||||
400: Bad Request (Your inputs are wrong/impossible)
|
||||
|
||||
__________________________________________________________________
|
||||
|
||||
**GET** `/api/getUsername`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
{
|
||||
userID: string
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
{
|
||||
userName: string //will send back hashed userID if no username has been set
|
||||
}
|
||||
```
|
||||
|
||||
**Error codes**:
|
||||
|
||||
400: Bad Request (Your inputs are wrong/impossible)
|
||||
|
||||
__________________________________________________________________
|
||||
|
||||
### Stats Calls
|
||||
|
||||
**GET** `/api/getTopUsers`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
{
|
||||
sortType: int //0 for by minutes saved, 1 for by view count, 2 for by total submissions
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
{
|
||||
userNames: array [string],
|
||||
viewCounts: array [int],
|
||||
totalSubmissions: array [int],
|
||||
minutesSaved: array [float]
|
||||
}
|
||||
```
|
||||
|
||||
**Error codes**:
|
||||
|
||||
400: Bad Request (Your inputs are wrong/impossible)
|
||||
|
||||
__________________________________________________________________
|
||||
|
||||
**GET** `/api/getTotalStats`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
{
|
||||
Nothing
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
{
|
||||
userCount: int,
|
||||
viewCount: int,
|
||||
totalSubmissions: int,
|
||||
minutesSaved: float
|
||||
}
|
||||
```
|
||||
|
||||
**Error codes**:
|
||||
|
||||
None
|
||||
|
||||
2
index.js
2
index.js
@@ -17,7 +17,7 @@ http.createServer(app).listen(80);
|
||||
|
||||
//global salt that is added to every ip before hashing to
|
||||
// make it even harder for someone to decode the ip
|
||||
var globalSalt = "49cb0d52-1aec-4b89-85fc-fab2c53062fb"; // Should not be global
|
||||
var globalSalt = "49cb0d52-1aec-4b89-85fc-fab2c53062fb";
|
||||
//this is the user that can add shadow bans
|
||||
var adminUserID = "7b89ea26f77bda8176e655eee86029f28c1e6514b6d6e3450bce362b5b126ca3";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user