mirror of
https://codeberg.org/SafeTwitch/safetwitch-backend.git
synced 2024-12-22 13:13:00 -05:00
Merge pull request 'New Instance: streamapi.whateveritworks.org' (#2) from WhateverItWorks/my-safetwitch-backend-docker-compose:master into master
Reviewed-on: https://codeberg.org/dragongoose/safetwitch-backend/pulls/2
This commit is contained in:
commit
e54c610848
3 changed files with 68 additions and 14 deletions
18
README.md
18
README.md
|
@ -16,7 +16,7 @@ Every endpoint can return a 500 status code, and it follows this schema:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### /api/users/:username
|
### https://streamapi.whateveritworks.org/api/users/xqc
|
||||||
|
|
||||||
**GET** - :username is any streamer
|
**GET** - :username is any streamer
|
||||||
Gets a specific twitch streamer
|
Gets a specific twitch streamer
|
||||||
|
@ -62,7 +62,7 @@ The request was successful, returns data of type [Streamer](https://codeberg.org
|
||||||
|
|
||||||
The streamer was not found
|
The streamer was not found
|
||||||
|
|
||||||
### /api/discover
|
### https://streamapi.whateveritworks.org/api/discover
|
||||||
|
|
||||||
**GET**
|
**GET**
|
||||||
Gets the discover page of twitch, a list of categories
|
Gets the discover page of twitch, a list of categories
|
||||||
|
@ -93,7 +93,7 @@ The request was successful, returns a [CategoryData[]](https://codeberg.org/drag
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### /api/discover/:game
|
### https://streamapi.whateveritworks.org/api/discover/Grand Theft Auto V
|
||||||
|
|
||||||
**GET** - :game is a name of a twitch category
|
**GET** - :game is a name of a twitch category
|
||||||
Gets a specific twitch category
|
Gets a specific twitch category
|
||||||
|
@ -144,7 +144,7 @@ The server found the category, returns data of type [CategoryPreview[]](https://
|
||||||
|
|
||||||
The category was not found
|
The category was not found
|
||||||
|
|
||||||
### /api/badges?streamerName=NAME
|
### https://streamapi.whateveritworks.org/api/badges?streamerName=xqc
|
||||||
|
|
||||||
**GET**
|
**GET**
|
||||||
Gets global twitch chat badges
|
Gets global twitch chat badges
|
||||||
|
@ -178,7 +178,7 @@ Server retrieved the badges, returns type [Badge[]](hhttps://codeberg.org/dragon
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### /api/search?query=SEARCHQUERY
|
### https://streamapi.whateveritworks.org/api/search?query=xqc
|
||||||
|
|
||||||
**GET** - SEARCHQUERY is any string
|
**GET** - SEARCHQUERY is any string
|
||||||
Searches for categories, streamers, tags, and live streamers. Returns data of type [SearchResult](https://codeberg.org/dragongoose/safetwitch-backend/src/branch/master/extractor/structs/parsed.go)
|
Searches for categories, streamers, tags, and live streamers. Returns data of type [SearchResult](https://codeberg.org/dragongoose/safetwitch-backend/src/branch/master/extractor/structs/parsed.go)
|
||||||
|
@ -271,7 +271,7 @@ The server found the search data, returns:
|
||||||
|
|
||||||
## Proxying Endpoints
|
## Proxying Endpoints
|
||||||
|
|
||||||
### /proxy/img/:base64Url
|
### https://streamapi.whateveritworks.org/proxy/img/base64Url
|
||||||
|
|
||||||
**GET**
|
**GET**
|
||||||
Proxies an image through the server
|
Proxies an image through the server
|
||||||
|
@ -287,7 +287,7 @@ Server returns the requested image
|
||||||
|
|
||||||
The requested image was invalid
|
The requested image was invalid
|
||||||
|
|
||||||
### /proxy/stream/:username/hls.m3u8
|
### https://streamapi.whateveritworks.org/proxy/stream/xqc/hls.m3u8
|
||||||
|
|
||||||
**GET**
|
**GET**
|
||||||
Gets the m3u8 manifest for a streamer. This manifest will contain all stream qualities if they are live
|
Gets the m3u8 manifest for a streamer. This manifest will contain all stream qualities if they are live
|
||||||
|
@ -310,7 +310,7 @@ The streamer is not live
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### /proxy/stream/sub/:encodedUrl
|
### https://streamapi.whateveritworks.org/proxy/stream/sub/encodedUrl
|
||||||
|
|
||||||
**GET**
|
**GET**
|
||||||
Returns the m3u8 manifest for a specific quality under the [master manifest](#/proxy/stream/:username/hls.m3u8)
|
Returns the m3u8 manifest for a specific quality under the [master manifest](#/proxy/stream/:username/hls.m3u8)
|
||||||
|
@ -319,7 +319,7 @@ Returns the m3u8 manifest for a specific quality under the [master manifest](#/p
|
||||||
|
|
||||||
Returns the manifest file
|
Returns the manifest file
|
||||||
|
|
||||||
### /proxy/stream/segment/:encodedUrl
|
### https://streamapi.whateveritworks.org/proxy/stream/segment/encodedUrl
|
||||||
|
|
||||||
**GET**
|
**GET**
|
||||||
Gets a segment from one of the quality's manifest file. This is the actual video thats displayed on your screen
|
Gets a segment from one of the quality's manifest file. This is the actual video thats displayed on your screen
|
||||||
|
|
|
@ -1,10 +1,22 @@
|
||||||
version: "3.9"
|
version: "3.7"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
backend:
|
safetwitch-backend:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
#image: codeberg.org/dragongoose/safetwitch-backend:latest
|
||||||
|
restart: always
|
||||||
|
container_name: safetwitch-backend
|
||||||
|
hostname: safetwitch-backend
|
||||||
|
user: 65534:65534
|
||||||
|
read_only: true
|
||||||
|
security_opt:
|
||||||
|
- no-new-privileges:true
|
||||||
|
cap_drop:
|
||||||
|
- ALL
|
||||||
ports:
|
ports:
|
||||||
- "7000:8080"
|
- "127.0.0.1:7100:7000"
|
||||||
environment:
|
environment:
|
||||||
- URL=http://localhost:7000
|
- PORT=7000
|
||||||
|
- URL=https://changethis
|
42
nginx.conf
Normal file
42
nginx.conf
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
server {
|
||||||
|
server_name changethis;
|
||||||
|
|
||||||
|
listen 443 ssl;
|
||||||
|
listen [::]:443 ssl;
|
||||||
|
http2 on;
|
||||||
|
ssl_certificate /etc/letsencrypt/live/changethis/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/changethis/privkey.pem;
|
||||||
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||||
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||||
|
|
||||||
|
add_header strict_sni on;
|
||||||
|
add_header strict_sni_header on;
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||||
|
add_header Content-Security-Policy upgrade-insecure-requests;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-Frame-Options "DENY";
|
||||||
|
add_header Clear-Site-Data "cookies";
|
||||||
|
add_header Referrer-Policy "no-referrer";
|
||||||
|
add_header Permissions-Policy "interest-cohort=(),accelerometer=(),ambient-light-sensor=(),autoplay=(),camera=(),encrypted-media=(),focus-without-user-activation=(),geolocation=(),gyroscope=(),magnetometer=(),microphone=(),midi=(),payment=(),picture-in-picture=(),speaker=(),sync-xhr=(),usb=(),vr=()";
|
||||||
|
resolver 1.1.1.1;
|
||||||
|
|
||||||
|
ssl_trusted_certificate /etc/letsencrypt/live/changethis/chain.pem;
|
||||||
|
ssl_stapling on;
|
||||||
|
ssl_stapling_verify on;
|
||||||
|
|
||||||
|
access_log /dev/null;
|
||||||
|
error_log /dev/null;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_pass http://localhost:7100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name changethis;
|
||||||
|
return 301 https://changethis$request_uri;
|
||||||
|
}
|
Loading…
Reference in a new issue