Companion for Stremio.
- HTTP Proxy
- Proxy Authorization
- Byte Serving
Configuration is done using environment variables.
STREMTHRU_HTTP_PROXY
HTTP Proxy URL.
STREMTHRU_HTTPS_PROXY
HTTPS Proxy URL.
STREMTHRU_PROXY_AUTH
Comma separated list of credentials, in the following formats:
- plain text credentials, e.g.
username:password
- or base64 encoded credentials, e.g.
dXNlcm5hbWU6cGFzc3dvcmQ=
These will be used for proxy authorization.
STREMTHRU_STORE_AUTH
Comma separated list of store credentials, in username:store_name:api_key
format.
For proxy-authorized requests, these credentials will be used.
If username
is *
, it is used as fallback for users without explicit store credentials.
Proxy-Authorization
Header
Basic auth header, e.g. Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Proxy-Authorization
header is checked against STREMTHRU_PROXY_AUTH
config.
This is a common interface for interacting with external stores.
If X-StremThru-Store-Name
header is present, the value is used as store name. Otherwise,
the first store configured for the user using STREMTHRU_STORE_AUTH
config is used.
Authentication
If STREMTHRU_STORE_AUTH
is configured, then proxy-authorized requests will be
automatically authenticated for external stores.
For non-proxy-authorized requests, the following HTTP headers are used:
X-StremThru-Store-Authorization
Authorization
Values for these headers will be forwarded to the external store.
GET /v0/store/user
Get information about authenticated user.
Response:
{
"data": {
"id": "string",
"email": "string",
"subscription_status": "UserSubscriptionStatus"
}
}
POST /v0/store/magnets
Add manget link for download.
Request:
{
"magnet": "string"
}
Response:
{
"data": {
"id": "string",
"hash": "string",
"magnet": "string",
"name": "string",
"status": "MagnetStatus",
"files": [
{
"index": "int",
"link": "string",
"name": "string",
"path": "string",
"size": "int"
}
]
}
}
If .status
is downloaded
, .files
will have the list of files.
GET /v0/store/magnets
List mangets on user's account.
Response:
{
"data": {
"items": [
{
"id": "string",
"hash": "string",
"name": "string",
"status": "MagnetStatus"
}
]
}
}
GET /v0/store/magnets/{magnetId}
Get manget on user's account.
Path Parameter:
magnetId
: magnet id
Response:
{
"data": {
"id": "string",
"hash": "string",
"name": "string",
"status": "MagnetStatus",
"files": [
{
"index": "int",
"link": "string",
"name": "string",
"path": "string",
"size": "int"
}
]
}
}
DELETE /v0/store/magnets/{magnetId}
Remove manget from user's account.
Path Parameter:
magnetId
: magnet id
GET /v0/store/magnets/check
Check manget links.
Query Parameter:
magnet
: comma seperated magnet links
Response:
{
"data": {
"items": [
{
"hash": "string",
"magnet": "string",
"status": "MagnetStatus",
"files": [
{
"index": "int",
"name": "string",
"size": "int"
}
]
}
]
}
}
If .status
is cached
, .files
will have the list of files.
POST /v0/store/link/generate
Generate direct link for a file link.
Request:
{
"link": "string"
}
Response:
{
"data": {
"link": "string"
}
}
The generated direct link should be valid for 24 hours.
cached
queued
downloading
processing
downloaded
uploading
failed
invalid
unknown
expired
premium
trial
Source
git clone https://github.com/MunifTanjim/stremthru
cd stremthru
# configure
export STREMTHRU_PROXY_AUTH=username:password
# run
make run
# build and run
make build
./stremthru
Docker
docker run --name stremthru -p 8080:8080 \
-e STREMTHRU_PROXY_AUTH=username:password \
muniftanjim/stremthru
Docker Compose
cp compose.example.yaml compose.yaml
docker compose up stremthru
Cloudflare WARP:
Licensed under the MIT License. Check the LICENSE file for details.