Companion for Stremio.
- HTTP(S) Proxy
- Proxy Authorization
- Byte Serving
Store is an external service that provides access to content. StremThru acts as an interface for the store.
StremThru can proxy the content from the store. For proxy authorized requests, this is enabled by default.
sequenceDiagram
participant User as User Device
participant StremThru as StremThru
participant Store as Store
User->>StremThru: Request Content
StremThru->>Store: Request Content
loop Byte Serving
Store-->>StremThru: Content Chunk
StremThru-->>User: Content Chunk
end
If you can't access the store using your IP, you can use HTTP(S) Proxy to tunnel the traffic to the store.
sequenceDiagram
participant Client as StremThru
participant Proxy as HTTP(S) Proxy
participant Server as Store
Client->>Proxy: HTTP Request
Proxy->>Server: Forward HTTP Request
Server->>Proxy: HTTP Response
Proxy->>Client: Forward HTTP Response
Configuration is done using environment variables.
HTTP Proxy URL.
HTTPS Proxy URL.
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.
Comma separated list of store credentials, in username:store_name:store_token
format.
For proxy-authorized requests, these credentials will be used.
If username
is *
, it is used as fallback for users without explicit store credentials.
Store | store_name |
store_token |
---|---|---|
AllDebrid | alldebrid |
<api-key> |
Debrid-Link | debridlink |
<api-key> |
EasyDebrid | easydebrid |
<api-key> |
Offcloud | offcloud |
<email>:<password> |
PikPak | pikpak |
<email>:<password> |
Premiumize | premiumize |
<api-key> |
RealDebrid | realdebrid |
<api-token> |
Torbox | torbox |
<api-key> |
Comma separated list of tunnel config for stores, in store_name:tunnel_config
format.
tunnel_config |
Description |
---|---|
true |
Enable |
false |
Disable |
api |
Enable for API only |
If store_name
is *
, it is used as fallback.
When enabled, STREMTHRU_HTTP_PROXY
and STREMTHRU_HTTPS_PROXY
will be used to tunnel traffic for the store.
Comma separated list of store content proxy config, in store_name:content_proxy_config
format.
content_proxy_config |
Description |
---|---|
true |
Enable |
false |
Disable |
If store_name
is *
, it is used as fallback.
When enabled, StremThru will proxy the content from the store.
URI for peer StremThru instance, in format https://:<pass>@<host>[:<port>]
.
URI for Redis, in format redis://<user>:<pass>@<host>[:<port>][/<db>]
.
If provided, it'll be used for caching instead of in-memory storage.
URI for Database, in format <scheme>://<user>:<pass>@<host>[:<port>][/<db>]
.
Supports sqlite
and postgresql
.
Comma separated list of Stremio Addon names to enable. All available addons are enabled by default.
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 magnet 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"
}
],
"added_at": "datetime"
}
}
If .status
is downloaded
, .files
will have the list of files.
GET /v0/store/magnets
List magnets on user's account.
Query Parameter:
-
limit
: min1
, max500
, default100
-
offset
: min0
, default0
Response:
{
"data": {
"items": [
{
"id": "string",
"hash": "string",
"name": "string",
"status": "MagnetStatus",
"added_at": "datetime"
}
],
"total_items": "int"
}
}
GET /v0/store/magnets/{magnetId}
Get magnet 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"
}
],
"added_at": "datetime"
}
}
DELETE /v0/store/magnets/{magnetId}
Remove magnet from user's account.
Path Parameter:
-
magnetId
: magnet id
GET /v0/store/magnets/check
Check magnet links.
Query Parameter:
-
magnet
: comma seperated magnet links -
sid
: strmeio stream id
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.
[!NOTE] For
offcloud
, the.files
list is always empty.
If .files[].index
is -1
, the index of the file is unknown and you should rely on .name
instead.
If .files[].size
is -1
, the size of the file is unknown.
POST /v0/store/link/generate
Generate direct link for a file link.
Request:
{
"link": "string"
}
Response:
{
"data": {
"link": "string"
}
}
[!NOTE] The generated direct link should be valid for 12 hours.
/stremio/store
Store Catalog and Search.
/stremio/wrap
Wrap another Addon with StremThru.
/stremio/sidekick
Extra Features for Stremio.
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.