### Docker run example for TorrServer Source: https://github.com/yourok/torrserver/blob/master/docker/README.md Starts a TorrServer container with all supported environment variables configured. The server binary is downloaded from GitHub on first start; repull the container to update to the latest version. Port 8090 is exposed for the web interface. ```bash docker run -p 8090:8090 \ -e TS_PORT=8090 \ -e TS_PATH="/opt/torrserver/config" \ -e TS_LOGPATHDIR="/opt/torrserver/log/" \ -e TS_LOGFILE="ts.log" \ -e TS_WEBLOGFILE="tsweb.log" \ -e TS_RDB=true \ -e TS_HTTPAUTH=true \ -e TS_DONTKILL=true \ -e TS_TORRENTSDIR="/opt/torrserver/torrents" \ -e TS_TORRENTADDR=32000 \ -e TS_PUBIPV4=publicIP \ -e TS_PUBIPV6=publicIP \ -e TS_SEARCHWA=true \ yourok/torrserver ``` -------------------------------- ### Start the project with NODE_OPTIONS flag Source: https://github.com/yourok/torrserver/blob/master/web/README.md Run the development server. Requires a `.env` file with `REACT_APP_SERVER_HOST` (no trailing slash) and a TMDB API key. The `--openssl-legacy-provider` flag is needed for compatibility with older OpenSSL versions. ```bash NODE_OPTIONS=--openssl-legacy-provider yarn start ``` -------------------------------- ### Install GStreamer on Debian/Ubuntu Source: https://github.com/yourok/torrserver/blob/master/README.md Installs GStreamer 1.22+ and required plugins for TorrServer on Debian/Ubuntu. Includes core libraries, base/good/bad/ugly plugins, libav, tools, OpenCL loader, and CA certificates. Hardware encoders are optional; TorrServer falls back to x264enc if none can start. ```bash sudo apt-get update sudo apt-get install -y --no-install-recommends \ libgstreamer1.0-0 \ libgstreamer-plugins-base1.0-0 \ gstreamer1.0-plugins-base \ gstreamer1.0-plugins-good \ gstreamer1.0-plugins-bad \ gstreamer1.0-plugins-base-apps \ gstreamer1.0-plugins-ugly \ gstreamer1.0-libav \ gstreamer1.0-tools \ ocl-icd-libopencl1 \ ca-certificates ``` -------------------------------- ### Linux Interactive Install (Download First) Source: https://github.com/yourok/torrserver/blob/master/README.md Preferred interactive install for Linux. Downloads the install script, makes it executable, and runs it with sudo. Avoids issues with curl | sudo bash on modern sudo with use_pty. ```bash curl -fsSL https://raw.githubusercontent.com/YouROK/TorrServer/master/installTorrServerLinux.sh -o installTorrServerLinux.sh && chmod 755 installTorrServerLinux.sh && sudo bash ./installTorrServerLinux.sh ``` -------------------------------- ### Install swag and generate Swagger docs Source: https://github.com/yourok/torrserver/blob/master/README.md Install the swag CLI, generate Swagger documentation from the server code, and lint it with `swag fmt`. ```bash go install github.com/swaggo/swag/cmd/swag@latest cd server swag init -g web/server.go --parseInternal --parseDepth 5 # Documentation can be linted using swag fmt ``` -------------------------------- ### Start TorrServer with SSL certificate Source: https://github.com/yourok/torrserver/blob/master/README.md Starts TorrServer with SSL using the full chain certificate and key. Use the full chain file because TVs and Android players reject certificates without the intermediate. Alternatively, start with just --ssl and set the paths in the web UI. ```bash TorrServer --ssl --sslcert /opt/torrserver/tls/fullchain.pem --sslkey /opt/torrserver/tls/key.pem ``` -------------------------------- ### macOS Interactive Install Source: https://github.com/yourok/torrserver/blob/master/README.md Interactive install for macOS. Downloads the macOS install script, makes it executable, and runs it in Terminal.app. ```bash curl -s https://raw.githubusercontent.com/YouROK/TorrServer/master/installTorrServerMac.sh -o installTorrServerMac.sh && chmod 755 installTorrServerMac.sh && bash ./installTorrServerMac.sh ``` -------------------------------- ### Start TorrServer with Telegram bot token using --tgtoken Source: https://github.com/yourok/torrserver/blob/master/server/tgbot/README.md Launch TorrServer with a Telegram bot token obtained from @BotFather. This enables the Telegram bot functionality. ```bash TorrServer --tgtoken YOUR_BOT_TOKEN ``` -------------------------------- ### Install GStreamer on Arch Linux Source: https://github.com/yourok/torrserver/blob/master/README.md Installs GStreamer and plugins on Arch Linux using pacman with --needed to avoid reinstalling up-to-date packages. ```bash sudo pacman -S --needed \ gstreamer \ gst-plugins-base \ gst-plugins-good \ gst-plugins-bad \ gst-plugins-ugly \ gst-libav \ ocl-icd \ ca-certificates ``` -------------------------------- ### Run Go server locally Source: https://github.com/yourok/torrserver/blob/master/README.md Navigate to the server directory and start the Go server with `go run ./cmd`. ```bash cd server go run ./cmd ``` -------------------------------- ### macOS Install GStreamer Build Source: https://github.com/yourok/torrserver/blob/master/README.md Installs the GStreamer build with transcoding support (141.10+) using the macOS install script. ```bash bash ./installTorrServerMac.sh --install --gst ``` -------------------------------- ### Start TorrServer with Telegram bot token using -T flag Source: https://github.com/yourok/torrserver/blob/master/server/tgbot/README.md Alternative way to start TorrServer with a Telegram bot token using the short -T flag instead of --tgtoken. ```bash TorrServer -T YOUR_BOT_TOKEN ``` -------------------------------- ### Run web server locally Source: https://github.com/yourok/torrserver/blob/master/README.md Start the web development server using Yarn. ```bash yarn start ``` -------------------------------- ### macOS Install Latest Version Source: https://github.com/yourok/torrserver/blob/master/README.md Installs the latest TorrServer version using the macOS install script. ```bash bash ./installTorrServerMac.sh --install ``` -------------------------------- ### Install GStreamer on macOS via Homebrew Source: https://github.com/yourok/torrserver/blob/master/README.md Installs the current Homebrew GStreamer formula, which includes the plugin sets. Set GSTPath if auto-detection fails; common roots are /Library/Frameworks/GStreamer.framework/Versions/1.0, /opt/homebrew, and /usr/local. ```bash brew install gstreamer ``` -------------------------------- ### Linux Install GStreamer Build Source: https://github.com/yourok/torrserver/blob/master/README.md Installs the GStreamer build with transcoding support (141.10+). Two commands: interactive install and silent update with --gst. ```bash sudo bash ./installTorrServerLinux.sh --install --gst ``` ```bash sudo bash ./installTorrServerLinux.sh --update --gst --silent ``` -------------------------------- ### Linux Install Specific Version Source: https://github.com/yourok/torrserver/blob/master/README.md Installs a specific TorrServer version (e.g., 135) silently using the Linux install script. ```bash sudo bash ./installTorrServerLinux.sh --install 135 --silent ``` -------------------------------- ### Default GStreamer root on Windows Source: https://github.com/yourok/torrserver/blob/master/README.md Default installation root for the MinGW x86_64 runtime on Windows. The runtime installer is sufficient; development files are not required. Do not mix MSVC paths with MinGW libraries. ```text C:\Program Files\gstreamer\1.0\mingw_x86_64 ``` -------------------------------- ### GET /gst/:hash/init.mp4 Source: https://github.com/yourok/torrserver/blob/master/README.md Returns the initialization segment for HLS streaming. Available in -gst builds. ```APIDOC ## GET /gst/:hash/init.mp4 ### Description Returns the initialization segment for HLS streaming. Available in -gst builds. ### Method GET ### Endpoint /gst/:hash/init.mp4 ### Parameters #### Path Parameters - **hash** (string) - Required - Torrent info hash. ### Response #### Success Response (200) Returns initialization segment (MP4). ``` -------------------------------- ### Docker Compose example for TorrServer Source: https://github.com/yourok/torrserver/blob/master/docker/README.md Defines a TorrServer service using the ghcr.io/yourok/torrserver image with restart policy, environment variables, port mapping, and volume mounts for config, logs, and torrents. The TS_TORRENTADDR is set to :32000 (with colon) unlike the docker run example. ```yaml version: '3.6' services: torrserver: container_name: torrserver image: ghcr.io/yourok/torrserver restart: unless-stopped environment: - TS_PORT=8090 - TS_PATH=/opt/torrserver/config - TS_LOGPATHDIR=/opt/torrserver/log - TS_LOGFILE=ts.log - TS_WEBLOGFILE=tsweb.log - TS_RDB=false - TS_HTTPAUTH=true - TS_DONTKILL=true - TS_TORRENTSDIR=/opt/torrserver/torrents - TS_TORRENTADDR=:32000 - TS_PUBIPV4=publicIP - TS_PUBIPV6=publicIP - TS_SEARCHWA=true ports: - 8090:8090 volumes: - ./torrserver/config:/opt/torrserver/config - ./torrserver/log:/opt/torrserver/log - ./torrserver/torrents:/opt/torrserver/torrents ``` -------------------------------- ### Install GStreamer on Fedora/RHEL/Rocky/AlmaLinux Source: https://github.com/yourok/torrserver/blob/master/README.md Installs GStreamer and plugins on Fedora/RHEL/Rocky/AlmaLinux using dnf. gstreamer1 provides gst-inspect-1.0; gstreamer1-plugins-base-tools provides gst-discoverer-1.0. On RHEL derivatives, gstreamer1-plugin-libav may require EPEL; full x264enc support may require RPM Fusion. ```bash sudo dnf install -y \ gstreamer1 \ gstreamer1-plugins-base \ gstreamer1-plugins-base-tools \ gstreamer1-plugins-good \ gstreamer1-plugins-bad-free \ gstreamer1-plugins-ugly-free \ gstreamer1-plugin-libav \ ocl-icd \ ca-certificates ``` -------------------------------- ### Linux Non-Interactive Silent Install Source: https://github.com/yourok/torrserver/blob/master/README.md Non-interactive install for Linux when there are no prompts. Pipes the script to sudo bash with --install and --silent flags. ```bash curl -fsSL https://raw.githubusercontent.com/YouROK/TorrServer/master/installTorrServerLinux.sh | sudo bash -s -- --install --silent ``` -------------------------------- ### Example tg.cfg configuration file Source: https://github.com/yourok/torrserver/blob/master/server/tgbot/README.md JSON configuration file (tg.cfg) in the TorrServer data directory. Fields: HostTG (Telegram API URL, default https://api.telegram.org), HostWeb (base URL for stream links, auto-detected if empty), Socks5 (optional SOCKS5 proxy for Telegram access), WhiteIds (allowed user IDs, empty = allow all), BlackIds (blocked user IDs). ```json { "HostTG": "https://api.telegram.org", "HostWeb": "http://192.168.1.100:8090", "Socks5": "127.0.0.1:1080", "WhiteIds": [123456789], "BlackIds": [] } ``` -------------------------------- ### Jackett Torznab Host URL examples Source: https://github.com/yourok/torrserver/blob/master/README.md TorrServer accepts Host URLs with or without a trailing /api or /api/; it will not be doubled. Either form works for Jackett. ```shell http://192.168.1.10:9117/api/v2.0/indexers/all/results/torznab/ http://192.168.1.10:9117/api/v2.0/indexers/all/results/torznab/api ``` -------------------------------- ### TorrServer command-line usage example Source: https://github.com/yourok/torrserver/blob/master/README.md Shows the full set of command-line arguments accepted by the TorrServer binary (TorrServer-darwin-arm64). All options are optional and enclosed in square brackets; the default web server port is 8090 and the default HTTPS port is 8091. Use --help or -h to display this help and exit, and --version to display version and exit. ```bash TorrServer-darwin-arm64 [--port PORT] [--ip IP ...] [--path PATH] [--logpath LOGPATH] [--weblogpath WEBLOGPATH] [--rdb] [--httpauth] [--dontkill] [--ui] [--torrentsdir TORRENTSDIR] [--torrentaddr TORRENTADDR] [--pubipv4 PUBIPV4] [--pubipv6 PUBIPV6] [--searchwa] [--maxsize MAXSIZE] [--tgtoken TGTOKEN] [--fusepath FUSEPATH] [--webdav] [--ssl] [--sslport PORT] [--sslcert PATH] [--sslkey PATH] [--force-https] [--http-media] [--https-only] ``` -------------------------------- ### Run TorrServer with Full Environment Override Source: https://github.com/yourok/torrserver/blob/master/README.md Starts TorrServer with multiple environment variables overriding default settings, including port, authentication, proxy, and paths. Adjust the port mapping to match TS_PORT. ```bash docker run --rm -d -e TS_PORT=5665 -e TS_DONTKILL=1 -e TS_HTTPAUTH=1 -e TS_RDB=1 -e TS_CONF_PATH=/opt/ts/config -e TS_LOG_PATH=/opt/ts/log -e TS_TORR_DIR=/opt/ts/torrents -e TS_PROXYURL=socks5h://user:password@example.com:2080 -e TS_PROXYMODE=tracker --name torrserver -v ~/ts:/opt/ts -p 5665:5665 ghcr.io/yourok/torrserver:latest ``` -------------------------------- ### settings.json GStreamer configuration example Source: https://github.com/yourok/torrserver/blob/master/README.md Shows the top-level `gstreamer` key structure for GStreamer options in `settings.json`. Legacy keys `gst` and `GStreamer` are still read on load, but saving writes the `gstreamer` key. Platform defaults differ: Windows uses `GSTVersion: 1.28` and `GSTPath: "C:\\Program Files\\gstreamer\\1.0\\mingw_x86_64"`, while other platforms default to version `1.22` and an empty path. ```json { "gstreamer": { "GSTVersion": 1.22, "GSTPath": "", "Source": "stream", "MaxTasks": 0, "InactiveMinutes": 5, "AACBitrateKbps": 256, "AACChannels": 0, "AACSamplerate": 0, "SegmentSeconds": 6, "SegmentDiff": 20, "Subtitles": true, "TranscodeH264": false, "TranscodeH265": false, "TranscodeAV1": false, "TranscodeVP9": false, "TranscodeVP8": false, "TranscodeAVI": false, "HDRToSDR": false, "HardwareAcceleration": true, "UseGPU": true, "X264Ultrafast": false, "VideoBitrate": 10000 } } ``` -------------------------------- ### WAF settings.json configuration Source: https://github.com/yourok/torrserver/blob/master/README.md Defines the top-level 'waf' object in settings.json with version, whitelist, blacklist, and referers arrays. On first start, legacy wip.txt/bip.txt files are imported if no waf key exists; manual edits require a restart. ```json { "waf": { "version": 1, "whitelist": [ "127.0.0.1", "::1", "10.0.0.0/8" ], "blacklist": [ "203.0.113.0/24" ], "referers": [ "example.com" ] } } ``` -------------------------------- ### Linux Interactive Install One-Liner (Process Substitution) Source: https://github.com/yourok/torrserver/blob/master/README.md Another interactive one-liner for Linux using process substitution. Avoids curl | sudo bash, which hangs on modern sudo with use_pty. ```bash sudo bash <(curl -fsSL https://raw.githubusercontent.com/YouROK/TorrServer/master/installTorrServerLinux.sh) ``` -------------------------------- ### Run TorrServer in Docker Source: https://github.com/yourok/torrserver/blob/master/README.md Starts a TorrServer container in the background, mapping port 8090 to the host. Use this for a quick, non-persistent run. ```bash docker run --rm -d --name torrserver -p 8090:8090 ghcr.io/yourok/torrserver:latest ``` -------------------------------- ### Linux Check for Updates Source: https://github.com/yourok/torrserver/blob/master/README.md Checks for updates (version info only) using the Linux install script. ```bash sudo bash ./installTorrServerLinux.sh --check ``` -------------------------------- ### Run ESLint to find linting problems Source: https://github.com/yourok/torrserver/blob/master/web/README.md Use `yarn lint` to identify all linting issues in the codebase. Prettier will automatically fix code on save. ```bash yarn lint ``` -------------------------------- ### Self-signed certificate with HTTP media Source: https://github.com/yourok/torrserver/blob/master/README.md Starts TorrServer with HTTPS for the web UI and API, but serves media over HTTP for players and TVs that cannot use the self-signed certificate. Requires --ssl and --force-https; --http-media is only allowed with --force-https. ```bash TorrServer --ssl --force-https --http-media ``` -------------------------------- ### Generate PWA assets with pwa-asset-generator Source: https://github.com/yourok/torrserver/blob/master/web/README.md Generates PWA icons and splash screens from `public/logo.png` into the `public` directory, updates `site.webmanifest`, and injects meta tags into `index.html`. The `-f` flag forces overwriting existing files. ```bash npx pwa-asset-generator public/logo.png public -m public/site.webmanifest -p "calc(50vh - 25%) calc(50vw - 25%)" -b "linear-gradient(135deg, rgb(50,54,55), rgb(84,90,94))" -q 100 -i public/index.html -f ``` -------------------------------- ### Linux Remove/Uninstall Source: https://github.com/yourok/torrserver/blob/master/README.md Uninstalls TorrServer silently using the Linux install script. ```bash sudo bash ./installTorrServerLinux.sh --remove --silent ``` -------------------------------- ### Linux Reconfigure Settings Interactively Source: https://github.com/yourok/torrserver/blob/master/README.md Reconfigures TorrServer settings (port, auth, read-only mode, logging, BBR) interactively using the Linux install script. ```bash sudo bash ./installTorrServerLinux.sh --reconfigure ``` -------------------------------- ### Prowlarr Torznab Host URL example Source: https://github.com/yourok/torrserver/blob/master/README.md Prowlarr indexer base URL; TorrServer always calls the /api endpoint. ```shell http://localhost:9696/1 ``` -------------------------------- ### GET /gst/:hash/video.m3u8 Source: https://github.com/yourok/torrserver/blob/master/README.md Returns the HLS media playlist referenced by the master playlist. Available in -gst builds. ```APIDOC ## GET /gst/:hash/video.m3u8 ### Description Returns the HLS media playlist referenced by the master playlist. Available in -gst builds. ### Method GET ### Endpoint /gst/:hash/video.m3u8 ### Parameters #### Path Parameters - **hash** (string) - Required - Torrent info hash. ### Response #### Success Response (200) Returns HLS media playlist (M3U8). ``` -------------------------------- ### GET /gst/:hash/master.m3u8 Source: https://github.com/yourok/torrserver/blob/master/README.md Creates or reuses a task and returns the HLS master playlist. Available in -gst builds. ```APIDOC ## GET /gst/:hash/master.m3u8 ### Description Creates or reuses a task and returns the HLS master playlist. Available in -gst builds. ### Method GET ### Endpoint /gst/:hash/master.m3u8 ### Parameters #### Path Parameters - **hash** (string) - Required - Torrent info hash. #### Query Parameters - **index** (integer) - Optional - File index. - **audio** (string) - Optional - Audio track identifier. - **seconds** (integer) - Optional - Segment duration in seconds. ### Response #### Success Response (200) Returns HLS master playlist (M3U8). ``` -------------------------------- ### GET /gst/echo Source: https://github.com/yourok/torrserver/blob/master/README.md Health check for GStreamer and gst-discoverer. Available in -gst builds. ```APIDOC ## GET /gst/echo ### Description Health check for GStreamer and gst-discoverer. Available in -gst builds. ### Method GET ### Endpoint /gst/echo ### Response #### Success Response (200) No response body specified. ``` -------------------------------- ### Integrate TorrServerKit in Swift Source: https://github.com/yourok/torrserver/blob/master/README.md Start and stop the TorrServer in-process server using the gomobile API. The HTTP API is available at http://127.0.0.1:8090 with endpoints like /echo, /stream, and /torrents. ```swift import TorrServerKit let err = TorrserverkitStartServer(8090, dataDir) if !err.isEmpty { /* handle error */ } // HTTP API: http://127.0.0.1:8090 (/echo, /stream, /torrents, …) TorrserverkitStopServer() ``` -------------------------------- ### GET /gst/settings Source: https://github.com/yourok/torrserver/blob/master/README.md Retrieves GStreamer settings. On -gst builds, returns built_in flag, current config, and platform defaults; on standard builds, returns only built_in: false. ```APIDOC ## GET /gst/settings ### Description Retrieves GStreamer settings. On -gst builds, returns built_in flag, current config, and platform defaults; on standard builds, returns only built_in: false. ### Method GET ### Endpoint /gst/settings ### Response #### Success Response (200) - **built_in** (boolean) - Indicates if settings are built-in. - **config** (object) - Current GStreamer configuration (on -gst builds). - **defaults** (object) - Platform defaults (on -gst builds). #### Response Example { "built_in": true, "config": { "GSTVersion": 1.22, "Source": "stream" }, "defaults": { "GSTVersion": 1.22, "GSTPath": "" } } ``` -------------------------------- ### Linux Update to Latest Version Source: https://github.com/yourok/torrserver/blob/master/README.md Updates TorrServer to the latest version silently using the Linux install script. ```bash sudo bash ./installTorrServerLinux.sh --update --silent ``` -------------------------------- ### GET /gst/remove Source: https://github.com/yourok/torrserver/blob/master/README.md Disposes the task and drops the torrent cache. Available in -gst builds. ```APIDOC ## GET /gst/remove ### Description Disposes the task and drops the torrent cache. Available in -gst builds. ### Method GET ### Endpoint /gst/remove ### Parameters #### Query Parameters - **hash** (string) - Optional - Torrent info hash. - **id** (string) - Optional - Task ID. ### Response #### Success Response (200) No response body specified. ``` -------------------------------- ### Install certificate on Android TV box via ADB Source: https://github.com/yourok/torrserver/blob/master/README.md Copies the renewed certificate to an Android TV box over ADB. Requires network debugging enabled on the box and the computer to be on around renewal time (every ~60 days). The box runs TorrServer with --ssl and the pushed file paths. ```bash acme.sh --install-cert -d mytorr.duckdns.org --key-file ~/tls/key.pem --fullchain-file ~/tls/fullchain.pem --reloadcmd "adb connect 192.168.1.50 && adb push ~/tls/fullchain.pem ~/tls/key.pem /sdcard/torrserver/tls/" ``` -------------------------------- ### Run ESLint to fix code Source: https://github.com/yourok/torrserver/blob/master/web/README.md Use `yarn fix` to automatically fix linting problems. This is part of the ESLint workflow alongside `yarn lint`. ```bash yarn fix ``` -------------------------------- ### Verify GStreamer runtime and plugins Source: https://github.com/yourok/torrserver/blob/master/README.md Checks the GStreamer runtime and required plugins. avenc_aac is needed when audio is not already AAC; x264enc is the CPU fallback for video transcoding. Check hdrtonemap only when HDRToSDR is required. Requires GStreamer bin on PATH; for embedded Windows use GET /gst/echo or the GStreamer settings tab. ```bash gst-inspect-1.0 --version gst-discoverer-1.0 --version gst-inspect-1.0 souphttpsrc gst-inspect-1.0 matroskademux gst-inspect-1.0 mp4mux gst-inspect-1.0 appsink gst-inspect-1.0 avenc_aac gst-inspect-1.0 x264enc ``` -------------------------------- ### Linux Interactive Install One-Liner (sudo bash -c) Source: https://github.com/yourok/torrserver/blob/master/README.md Alternative interactive one-liner for Linux. Uses sudo bash -c to run the downloaded script directly. Avoids curl | sudo bash, which hangs on modern sudo with use_pty. ```bash sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/YouROK/TorrServer/master/installTorrServerLinux.sh)" ``` -------------------------------- ### GET /gst/:hash/subs/:track/:segment.vtt Source: https://github.com/yourok/torrserver/blob/master/README.md Returns a WebVTT subtitle segment. Available in -gst builds. ```APIDOC ## GET /gst/:hash/subs/:track/:segment.vtt ### Description Returns a WebVTT subtitle segment. Available in -gst builds. ### Method GET ### Endpoint /gst/:hash/subs/:track/:segment.vtt ### Parameters #### Path Parameters - **hash** (string) - Required - Torrent info hash. - **track** (string) - Required - Subtitle track identifier. - **segment** (string) - Required - Segment identifier. ### Response #### Success Response (200) Returns WebVTT subtitle segment. ``` -------------------------------- ### Docker run example for TorrServer lite Source: https://github.com/yourok/torrserver/blob/master/docker/lite/README.md Runs the TorrServer lite container, mapping port 8090 and passing optional arguments. Replace TAG with a Docker Hub version tag (e.g., MatriX.134) and ARGS with TorrServer arguments. Mount a directory to /cfg to persist logs and other data. ```bash docker run -p 8090:8090 yourok/torrlite:TAG [ ARGS ] ``` -------------------------------- ### GET /gst/:hash/subs/:track.m3u8 Source: https://github.com/yourok/torrserver/blob/master/README.md Returns a segmented WebVTT subtitle playlist. Available in -gst builds. ```APIDOC ## GET /gst/:hash/subs/:track.m3u8 ### Description Returns a segmented WebVTT subtitle playlist. Available in -gst builds. ### Method GET ### Endpoint /gst/:hash/subs/:track.m3u8 ### Parameters #### Path Parameters - **hash** (string) - Required - Torrent info hash. - **track** (string) - Required - Subtitle track identifier. ### Response #### Success Response (200) Returns WebVTT subtitle playlist (M3U8). ``` -------------------------------- ### GET /gst/:hash/seg/*segment Source: https://github.com/yourok/torrserver/blob/master/README.md Returns a media segment for HLS streaming. Available in -gst builds. ```APIDOC ## GET /gst/:hash/seg/*segment ### Description Returns a media segment for HLS streaming. Available in -gst builds. ### Method GET ### Endpoint /gst/:hash/seg/*segment ### Parameters #### Path Parameters - **hash** (string) - Required - Torrent info hash. - **segment** (string) - Required - Segment identifier. ### Response #### Success Response (200) Returns media segment. ``` -------------------------------- ### macOS Update Silently Source: https://github.com/yourok/torrserver/blob/master/README.md Updates TorrServer to the latest version silently using the macOS install script. ```bash bash ./installTorrServerMac.sh --update --silent ``` -------------------------------- ### POST /gst/settings reset to defaults request Source: https://github.com/yourok/torrserver/blob/master/README.md Example request body for resetting GStreamer settings to defaults via the API. The `action` field is `def`. Requires authentication when `--httpauth` is enabled and is only available in `-gst` builds. ```json { "action": "def" } ``` -------------------------------- ### GET /waf Source: https://github.com/yourok/torrserver/blob/master/README.md Retrieves the active editable WAF lists (whitelist, blacklist, referers), status flags, and parse warnings. This endpoint is available even in read-only mode. ```APIDOC ## GET /waf ### Description Retrieves the active editable WAF lists (whitelist, blacklist, referers), status flags, and parse warnings. ### Method GET ### Endpoint /waf ### Authentication Basic authentication required (username and password). ### Request Example ```shell curl -u USER:PASSWORD http://127.0.0.1:8090/waf ``` ### Response #### Success Response (200) Returns the active editable lists, status flags, and parse warnings. #### Response Example (No explicit response body provided in the source.) ``` -------------------------------- ### Linux Downgrade to Specific Version Source: https://github.com/yourok/torrserver/blob/master/README.md Downgrades TorrServer to a specific version (e.g., 135) using the Linux install script. ```bash sudo bash ./installTorrServerLinux.sh --down 135 ``` -------------------------------- ### HTTPS only with trusted certificate Source: https://github.com/yourok/torrserver/blob/master/README.md Starts TorrServer with HTTPS only, using a trusted certificate. The HTTP port is not opened, so all traffic is encrypted. Requires --ssl and a trusted certificate; startup logs a warning if a self-signed certificate is used with --https-only. ```bash TorrServer --ssl --https-only --sslcert /opt/torrserver/tls/fullchain.pem --sslkey /opt/torrserver/tls/key.pem ``` -------------------------------- ### GET /subs/{hash}/{id} Source: https://github.com/yourok/torrserver/blob/master/README.md Lists subtitle tracks for a video file inside a torrent. This endpoint returns the available subtitle tracks for the specified video file. ```APIDOC ## GET /subs/{hash}/{id} ### Description Lists subtitle tracks for the video file identified by {id} within the torrent identified by {hash}. ### Method GET ### Endpoint /subs/{hash}/{id} ### Parameters #### Path Parameters - **hash** (string) - Required - The torrent hash. - **id** (string) - Required - The video file identifier. ### Response #### Success Response (200) - **subtitle tracks** (array) - List of available subtitle tracks. #### Response Example ```json { "tracks": [ { "index": 0, "language": "eng", "format": "vtt" } ] } ``` ``` -------------------------------- ### GET /gst/:hash/probe Source: https://github.com/yourok/torrserver/blob/master/README.md Probes torrent file metadata. Successful probes are cached for one hour. Available in -gst builds. ```APIDOC ## GET /gst/:hash/probe ### Description Probes torrent file metadata. Successful probes are cached for one hour. Available in -gst builds. ### Method GET ### Endpoint /gst/:hash/probe ### Parameters #### Path Parameters - **hash** (string) - Required - Torrent info hash. #### Query Parameters - **index** (integer) - Optional - File index. - **id** (string) - Optional - File ID. - **fileID** (string) - Optional - File ID. ### Response #### Success Response (200) No response body specified. ``` -------------------------------- ### POST /gst/settings update config request Source: https://github.com/yourok/torrserver/blob/master/README.md Example request body for updating GStreamer settings via the API. The `action` field is `set` and `config` contains the fields to update. Requires authentication when `--httpauth` is enabled and is only available in `-gst` builds. ```json { "action": "set", "config": { "GSTVersion": 1.22, "Source": "stream" } } ``` -------------------------------- ### GET /subs/{hash}/{id}?track={index} Source: https://github.com/yourok/torrserver/blob/master/README.md Returns a single subtitle file, converted to WebVTT by default. The track query parameter selects the subtitle track, and additional query parameters allow specifying the output format and encoding. ```APIDOC ## GET /subs/{hash}/{id}?track={index} ### Description Returns one subtitle file for the video file identified by {id} within the torrent identified by {hash}. The track query parameter selects the subtitle track, and the format and encoding can be specified via additional query parameters. ### Method GET ### Endpoint /subs/{hash}/{id}?track={index} ### Parameters #### Path Parameters - **hash** (string) - Required - The torrent hash. - **id** (string) - Required - The video file identifier. #### Query Parameters - **track** (integer) - Required - The index of the subtitle track to return. - **format** (string) - Optional - Output format: `vtt` (default) or `original`. - **encoding** (string) - Optional - Encoding: `utf8` or `windows-1251`. ### Response #### Success Response (200) - **subtitle file** (string) - The subtitle content in the requested format and encoding. #### Response Example ``` WEBVTT 00:00:00.000 --> 00:00:05.000 Hello world ``` ``` -------------------------------- ### GET /gst/:hash/heartbeat Source: https://github.com/yourok/torrserver/blob/master/README.md Keeps the task and its torrent active. Returns torrent state details. Available in -gst builds. ```APIDOC ## GET /gst/:hash/heartbeat ### Description Keeps the task and its torrent active. Returns torrent state details. Available in -gst builds. ### Method GET ### Endpoint /gst/:hash/heartbeat ### Parameters #### Path Parameters - **hash** (string) - Required - Torrent info hash. ### Response #### Success Response (200) Returns torrent state details. ``` -------------------------------- ### Linux Change Systemd Service User Source: https://github.com/yourok/torrserver/blob/master/README.md Changes the systemd service user to root silently using the Linux install script. ```bash sudo bash ./installTorrServerLinux.sh --change-user root --silent ``` -------------------------------- ### WAF API curl commands Source: https://github.com/yourok/torrserver/blob/master/README.md GET /waf retrieves active lists and status; POST /waf atomically replaces all three lists with newline-delimited strings. POST returns 403 in read-only mode. ```shell curl -u USER:PASSWORD http://127.0.0.1:8090/waf curl -u USER:PASSWORD \ -H 'Content-Type: application/json' \ -d '{"whitelist":"127.0.0.1\n::1\n10.0.0.0/8","blacklist":"","referers":"example.com"}' \ http://127.0.0.1:8090/waf ``` -------------------------------- ### GET /subs/{hash}/{id} Source: https://github.com/yourok/torrserver/blob/master/server/subs/README.md Lists subtitle tracks for a video file in a torrent. Returns an array of track objects with metadata and URLs. ```APIDOC ## GET /subs/{hash}/{id} ### Description Lists subtitle tracks for the video file identified by `{id}` in the torrent identified by `{hash}`. Returns an array of track objects with metadata and URLs. ### Method GET ### Endpoint /subs/{hash}/{id} ### Parameters #### Path Parameters - **hash** (string) - Required - Torrent hash, same as in `/play/{hash}/{id}`. - **id** (integer) - Required - Video file ID, same as in `/play/{hash}/{id}`. If the torrent contains a single file, `id` is treated as `1`. Must be a video file (by extension), otherwise response is `400`. ### Response #### Success Response (200) - **array** - List of subtitle tracks, each with: - **index** (integer) - Index of the subtitle file in the torrent (use as `track`). - **name** (string) - File name. - **title** (string) - Display name; if several tracks have the same file name, folder name is prepended (e.g., `Subs [Exmel & Reddog]/ep01.ass` becomes `Exmel & Reddog - ep01.ass`; square brackets and words `Subs`, `Sub`, `Subtitles`, `Субтитры` are removed). - **lang** (string) - Detected language code or `und`. - **format** (string) - Source file format (`srt`, `ass`, `ssa`, `vtt`). - **url** (string) - Relative link to the track (prepend scheme and host). #### Response Example ```json [ {"index": 3, "name": "ep01.eng.ass", "title": "ep01.eng.ass", "lang": "en", "format": "ass", "url": "/subs//1?track=3"}, {"index": 2, "name": "ep01.rus.srt", "title": "ep01.rus.srt", "lang": "ru", "format": "srt", "url": "/subs//1?track=2"} ] ``` ### Status Codes | Code | Reason | |------|--------| | 400 | invalid file or track index, `id` is not a video, unknown `format` or `encoding` | | 401 | authentication required | | 404 | torrent, video file or track not found | | 422 | the subtitle file could not be converted (e.g. no dialogue lines) | | 500 | torrent error (e.g. no metadata, read error) | | 504 | the subtitle file could not be read from the torrent within 60 seconds | ``` -------------------------------- ### GET /subs/{hash}/{id}?track={index} Source: https://github.com/yourok/torrserver/blob/master/server/subs/README.md Returns a single subtitle file, optionally converted to WebVTT or in original format with specified encoding. Supports query parameters for format and encoding. ```APIDOC ## GET /subs/{hash}/{id}?track={index} ### Description Returns one subtitle file from the torrent. The `track` query parameter specifies the subtitle track index. The response can be converted to WebVTT (default) or returned in original format, with configurable character encoding. ### Method GET ### Endpoint /subs/{hash}/{id}?track={index} ### Parameters #### Path Parameters - **hash** (string) - Required - Torrent hash, same as in `/play/{hash}/{id}`. - **id** (integer) - Required - Video file ID, same as in `/play/{hash}/{id}`. If the torrent contains a single file, `id` is treated as `1`. Must be a video file (by extension), otherwise response is `400`. #### Query Parameters - **track** (integer) - Required - Index of the subtitle file in the torrent (from the track list). - **format** (string) - Optional - `vtt` (default) converts the file to WebVTT; `original` returns the file as is (no conversion). - **encoding** (string) - Optional - Character encoding of the response: `utf8` (default) or `windows-1251` (alias `cp1251`). ### Response #### Success Response (200) - **body** - Subtitle file content. `Content-Type` is `text/vtt; charset=...` for `format=vtt` and `text/plain; charset=...` for `format=original`. #### Response Example ``` /subs//1?track=5 WebVTT, UTF-8 /subs//1?track=5&format=original original ASS/SRT, UTF-8 /subs//1?track=5&format=original&encoding=cp1251 original, Windows-1251 ``` ### Status Codes | Code | Reason | |------|--------| | 400 | invalid file or track index, `id` is not a video, unknown `format` or `encoding` | | 401 | authentication required | | 404 | torrent, video file or track not found | | 422 | the subtitle file could not be converted (e.g. no dialogue lines) | | 500 | torrent error (e.g. no metadata, read error) | | 504 | the subtitle file could not be read from the torrent within 60 seconds | ``` -------------------------------- ### Build iOS server with build-ios.sh Source: https://github.com/yourok/torrserver/blob/master/README.md Build the iOS XCFramework on macOS using the provided build script. ```bash ./build-ios.sh ``` -------------------------------- ### Build TorrServer with GStreamer support Source: https://github.com/yourok/torrserver/blob/master/README.md Builds a gst-enabled binary from the repository root. Requires GStreamer 1.22+ and gst-discoverer-1.0 at runtime. Supported targets: Windows amd64, Linux amd64/arm64, macOS amd64/arm64. ```bash cd server CGO_ENABLED=0 go build -tags="nosqlite gst" -trimpath -o TorrServer-gst ./cmd ``` -------------------------------- ### accs.db JSON format for Basic auth Source: https://github.com/yourok/torrserver/blob/master/README.md JSON file with username/password pairs for Basic authentication. Must be located near the settings file. Enable authentication with the -a (--httpauth) TorrServer startup option. ```json { "User1": "Pass1", "User2": "Pass2" } ``` -------------------------------- ### Run TorrServer in Docker with Persistence Source: https://github.com/yourok/torrserver/blob/master/README.md Mounts the host directory ~/ts to /opt/ts inside the container to persist configuration and torrent data. Replace ~/ts with your desired host path. ```bash docker run --rm -d --name torrserver -v ~/ts:/opt/ts -p 8090:8090 ghcr.io/yourok/torrserver:latest ``` -------------------------------- ### Supported IP rule formats Source: https://github.com/yourok/torrserver/blob/master/README.md Shows valid array entries for whitelist/blacklist: comments, IPv4/IPv6, ranges, CIDR blocks, and optional 'local:'/'lan:' descriptions. Invalid entries are skipped with warnings. ```json [ "# comment", "127.0.0.1", "local:127.0.0.1", "127.0.0.0-127.0.0.255", "local:127.0.0.0-127.0.0.255", "10.0.0.0/8", "lan:10.0.0.0/8", "2001:db8::1", "local:2001:db8::1", "2001:db8::/32" ] ``` -------------------------------- ### POST /gst/settings Source: https://github.com/yourok/torrserver/blob/master/README.md Updates or resets GStreamer settings. Requires authentication when --httpauth is enabled. Returns 404 on standard builds. ```APIDOC ## POST /gst/settings ### Description Updates or resets GStreamer settings. Requires authentication when --httpauth is enabled. Returns 404 on standard builds. ### Method POST ### Endpoint /gst/settings ### Request Body - **action** (string) - Required - Action to perform: "set" to update config, "def" to reset to defaults. - **config** (object) - Optional - Configuration to apply when action is "set". ### Request Example { "action": "set", "config": { "GSTVersion": 1.22, "Source": "stream" } } ### Response #### Success Response (200) No response body specified. #### Error Response (404) Returned on standard builds. ``` -------------------------------- ### Caddy reverse proxy for TorrServer Source: https://github.com/yourok/torrserver/blob/master/README.md Caddy configuration to expose TorrServer under a domain, handling certificates automatically. Disable response buffering to avoid playback stutter. TorrServer should run without --ssl and with --httpauth. ```caddyfile tv.example.com { reverse_proxy 127.0.0.1:8090 { flush_interval -1 } } ``` -------------------------------- ### iOS Info.plist network permissions Source: https://github.com/yourok/torrserver/blob/master/README.md Required Info.plist keys to allow local networking and arbitrary loads for TorrServer on iOS. ```xml NSAppTransportSecurity NSAllowsArbitraryLoads NSAllowsLocalNetworking NSLocalNetworkUsageDescription TorrServer discovers local peers and streams media over local HTTP. ``` -------------------------------- ### Caddy reverse proxy with DuckDNS TLS Source: https://github.com/yourok/torrserver/blob/master/README.md Caddy configuration for an always-on device (NAS, Raspberry Pi, router) to handle HTTPS and forward to the TorrServer box. Requires Caddy built with the DuckDNS plugin. The box runs TorrServer without --ssl. ```caddyfile mytorr.duckdns.org { tls { dns duckdns YOUR_TOKEN } reverse_proxy 192.168.1.50:8090 { flush_interval -1 } } ``` -------------------------------- ### OpenClaw CLI commands to add and probe MCP server Source: https://github.com/yourok/torrserver/blob/master/server/mcp/README.md Use the OpenClaw CLI to add the TorrServer MCP server and run a diagnostic probe. The --probe flag checks connectivity and configuration. ```bash openclaw mcp add torrserver --url http://127.0.0.1:8090/mcp --transport streamable-http openclaw mcp doctor torrserver --probe ``` -------------------------------- ### Referer rules configuration Source: https://github.com/yourok/torrserver/blob/master/README.md Defines the 'referers' array with hostnames and comments. Each entry blocks the hostname and all subdomains; requests without Referer/Origin are allowed. ```json { "referers": [ "example.com", "evil.example.org", "# comment" ] } ``` -------------------------------- ### get_server_info Source: https://github.com/yourok/torrserver/blob/master/server/mcp/README.md Retrieves server information including version, base URL, categories, and search/auth flags. ```APIDOC ## Tool: get_server_info ### Description Returns server metadata such as version, base URL, categories, and flags for search and authentication. ### Parameters None. ### Response - **version** (string) - TorrServer version - **baseUrl** (string) - Base URL of the server - **categories** (array) - List of library categories - **searchEnabled** (boolean) - Whether search is enabled - **authEnabled** (boolean) - Whether authentication is enabled ```