mirror of
https://github.com/Dasemu/Maskarr.git
synced 2026-11-26 15:26:10 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f36e1d7640 | ||
|
|
2f34fab341 | ||
|
|
2463a700dd | ||
|
|
6c6c2bfc69 | ||
|
|
b9e66533e3 | ||
|
|
dedc3937d3 | ||
|
|
cafa281d45 | ||
|
|
871cbd9851 | ||
|
|
bf5dde103b | ||
|
|
c79480eddd | ||
|
|
cdb1898c3e | ||
|
|
6dab117041 | ||
|
|
d881a36355 | ||
|
|
4ed8ab0a0c | ||
|
|
4f0a0423be |
No files matched your search
@@ -0,0 +1 @@
|
||||
2
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "file=$(cat | python3 -c 'import json,sys; print(json.load(sys.stdin).get(\"tool_input\",{}).get(\"file_path\",\"\"))'); case \"$file\" in *.py) python3 -m py_compile \"$file\" ;; esac"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Stop": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "python3 -m py_compile maskarr.py"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [development]
|
||||
push:
|
||||
branches: [development, main]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
cache: "pip"
|
||||
|
||||
- run: pip install -r requirements.txt
|
||||
|
||||
# No linter or test suite is configured for this project yet.
|
||||
# This is a lightweight sanity check (syntax/import compile), not a test run.
|
||||
- run: python3 -m py_compile maskarr.py
|
||||
@@ -1,84 +0,0 @@
|
||||
name: Build and Publish Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Set image name
|
||||
id: image
|
||||
run: |
|
||||
# Normalize repository name to lowercase
|
||||
REPO_LOWER=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
|
||||
GITEA_REGISTRY="${{ gitea.server_url }}"
|
||||
|
||||
# Remove https:// from server URL for registry
|
||||
GITEA_HOST=$(echo "$GITEA_REGISTRY" | sed 's|https://||' | sed 's|http://||')
|
||||
|
||||
echo "gitea_host=${GITEA_HOST}" >> $GITHUB_OUTPUT
|
||||
echo "gitea_image=${GITEA_HOST}/${REPO_LOWER}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ steps.image.outputs.gitea_host }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.AUTH_TOKEN }}
|
||||
|
||||
- name: Generate tags
|
||||
id: tags
|
||||
run: |
|
||||
GITEA_IMG="${{ steps.image.outputs.gitea_image }}"
|
||||
|
||||
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
TAGS="${GITEA_IMG}:${VERSION},${GITEA_IMG}:latest"
|
||||
else
|
||||
TAGS="${GITEA_IMG}:latest"
|
||||
fi
|
||||
|
||||
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.tags.outputs.tags }}
|
||||
labels: |
|
||||
org.opencontainers.image.title=Maskarr
|
||||
org.opencontainers.image.description=Tracker Proxy for *arr Applications
|
||||
org.opencontainers.image.source=${{ gitea.server_url }}/${{ gitea.repository }}
|
||||
org.opencontainers.image.revision=${{ gitea.sha }}
|
||||
org.opencontainers.image.created=${{ gitea.event.repository.updated_at }}
|
||||
|
||||
- name: Print summary
|
||||
if: github.event_name != 'pull_request'
|
||||
run: |
|
||||
echo "✅ Docker image published successfully!"
|
||||
echo ""
|
||||
echo "Gitea Registry:"
|
||||
echo " ${{ steps.image.outputs.gitea_image }}:latest"
|
||||
@@ -0,0 +1,90 @@
|
||||
name: Version
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [development, main]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: version-${{ gitea.ref_name }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
bump:
|
||||
if: ${{ !contains(gitea.event.head_commit.message, '[skip ci]') && gitea.actor != 'gitea-actions' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ gitea.ref_name }}
|
||||
fetch-depth: 0
|
||||
token: ${{ gitea.token }}
|
||||
|
||||
- name: Configure git identity
|
||||
run: |
|
||||
git config user.name "gitea-actions"
|
||||
git config user.email "gitea-actions@noreply.git.zenvairo.es"
|
||||
|
||||
- name: Determine bump type
|
||||
id: bump
|
||||
run: |
|
||||
if [ "${{ gitea.ref_name }}" = "development" ]; then
|
||||
echo "type=patch" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
# main: minor bump only when this push is a merge (an approved
|
||||
# development -> main PR), otherwise a direct hotfix push.
|
||||
MERGE_COMMIT=$(git log -1 --merges --pretty=%H || true)
|
||||
if [ -n "$MERGE_COMMIT" ]; then
|
||||
echo "type=minor" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "type=patch" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Bump VERSION
|
||||
id: version
|
||||
run: |
|
||||
current=$(cat VERSION)
|
||||
IFS='.' read -r major minor patch <<< "$current"
|
||||
if [ "${{ steps.bump.outputs.type }}" = "minor" ]; then
|
||||
minor=$((minor + 1))
|
||||
patch=0
|
||||
else
|
||||
patch=$((patch + 1))
|
||||
fi
|
||||
new="$major.$minor.$patch"
|
||||
echo "$new" > VERSION
|
||||
echo "new=$new" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Commit and push version bump
|
||||
run: |
|
||||
git add VERSION
|
||||
git commit -m "chore(release): v${{ steps.version.outputs.new }} [skip ci]"
|
||||
git pull --rebase origin ${{ gitea.ref_name }}
|
||||
git push origin HEAD:${{ gitea.ref_name }}
|
||||
|
||||
- name: Create release
|
||||
if: gitea.ref_name == 'main'
|
||||
env:
|
||||
TOKEN: ${{ gitea.token }}
|
||||
TAG: v${{ steps.version.outputs.new }}
|
||||
API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
||||
run: |
|
||||
status=$(curl -s -o /dev/null -w '%{http_code}' -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG")
|
||||
if [ "$status" = "200" ]; then
|
||||
echo "Release $TAG already exists, skipping"
|
||||
exit 0
|
||||
fi
|
||||
curl -sf -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\": \"$TAG\", \"target_commitish\": \"$(git rev-parse HEAD)\", \"name\": \"$TAG\", \"body\": \"Release $TAG\"}" \
|
||||
"$API/releases"
|
||||
|
||||
- name: Merge main back into development
|
||||
if: gitea.ref_name == 'main'
|
||||
run: |
|
||||
git fetch origin development
|
||||
git checkout development
|
||||
git merge --no-edit origin/main
|
||||
git push origin development
|
||||
@@ -0,0 +1,61 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [development]
|
||||
push:
|
||||
branches: [development, main]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
cache: "pip"
|
||||
|
||||
- run: pip install -r requirements.txt
|
||||
|
||||
# No linter or test suite is configured for this project yet.
|
||||
# This is a lightweight sanity check (syntax/import compile), not a test run.
|
||||
- run: python3 -m py_compile maskarr.py
|
||||
|
||||
release:
|
||||
needs: check
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# The version bump lands as a later "chore(release)" commit on main, so
|
||||
# wait for it and release that commit instead of the pre-bump one.
|
||||
- name: Resolve release commit
|
||||
id: rel
|
||||
run: |
|
||||
sha="${{ github.sha }}"
|
||||
for i in $(seq 1 30); do
|
||||
git fetch -q origin main
|
||||
bump=$(git log --reverse --format='%H %s' "$sha..origin/main" | grep -m1 ' chore(release): v' | cut -d' ' -f1 || true)
|
||||
if [ -n "$bump" ]; then sha="$bump"; break; fi
|
||||
sleep 20
|
||||
done
|
||||
echo "sha=$sha" >> "$GITHUB_OUTPUT"
|
||||
echo "version=$(git show "$sha:VERSION")" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Create release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
tag="v${{ steps.rel.outputs.version }}"
|
||||
if gh release view "$tag" >/dev/null 2>&1; then
|
||||
echo "Release $tag already exists, skipping"
|
||||
else
|
||||
gh release create "$tag" --target "${{ steps.rel.outputs.sha }}" --title "$tag" --generate-notes
|
||||
fi
|
||||
@@ -0,0 +1,29 @@
|
||||
# CLAUDE.md
|
||||
|
||||
## Overview
|
||||
Maskarr: a single-file Python HTTP proxy that rewrites User-Agent and headers so *arr stack apps (Prowlarr, Jackett) can reach private trackers. Includes a web UI for managing trackers and a JSON REST API.
|
||||
|
||||
## Commands
|
||||
- Install: `pip install -r requirements.txt`
|
||||
- Run (dev): `python3 maskarr.py`
|
||||
- Quick check (no test suite exists yet): `python3 -m py_compile maskarr.py`
|
||||
- Docker build: `docker build -t maskarr .`
|
||||
- Docker run: `docker-compose up -d`
|
||||
|
||||
## Architecture
|
||||
Everything lives in `maskarr.py`: an `http.server`-based proxy that forwards requests to the configured tracker domain with a rewritten User-Agent/headers, plus a small web UI and `/api/trackers` REST endpoints. Configuration persists to `maskarr_config.json` (path overridable via `CONFIG_PATH`). See `docs/usage.md` and `docs/deployment.md`.
|
||||
|
||||
## Conventions
|
||||
- Only `CONFIG_PATH` is read from the environment (`maskarr.py`); everything else lives in `maskarr_config.json`.
|
||||
- Keep `.env.example` limited to variable names actually read from the environment.
|
||||
|
||||
## Workflow quirks
|
||||
- No linter/formatter (ruff/black/flake8) or test suite (pytest) is configured yet. The only available check is a syntax compile (`py_compile`); see LESSONS.md.
|
||||
- No `development` branch exists yet; CI and the version workflow reference it per the standard shape, but they won't trigger until it's created.
|
||||
|
||||
## Deployment
|
||||
Docker image published to GHCR only, on push to `main`/tags (`.github/workflows/docker-publish.yml`). Version workflow lives in `.gitea/workflows/`; CI runs in both `.gitea/workflows/` and `.github/workflows/`. On pushes to `main`, a `vX.Y.Z` release is created on Gitea (last step of `version.yml`, after the bump) and on GitHub (`release` job in `.github/workflows/ci.yml`, which waits for the bump commit). See `docs/deployment.md` for systemd and Docker instructions.
|
||||
|
||||
## Gotchas
|
||||
- `maskarr_config.json` is tracked as an empty template; don't commit it populated with real tracker credentials/cookies.
|
||||
- This proxy is meant for local/private-network use only (see Security notes in `docs/usage.md`).
|
||||
@@ -0,0 +1,6 @@
|
||||
# LESSONS.md
|
||||
|
||||
Recurring mistakes and how to avoid them. Read before starting work; add an entry when a mistake repeats.
|
||||
|
||||
## No linter or test suite configured
|
||||
There is no `ruff`/`black`/`flake8`/`pytest` configuration in this repo. Don't assume a `lint`/`test` command exists — the closest available quick check is `python3 -m py_compile maskarr.py`.
|
||||
@@ -12,349 +12,27 @@ An HTTP proxy server that allows modifying User-Agent and headers to access priv
|
||||
- **No crashes**: Robust exception and error handling
|
||||
- **Logging**: Detailed request logging (optional)
|
||||
|
||||
## Requirements
|
||||
## Quick start
|
||||
|
||||
```bash
|
||||
pip install requests
|
||||
```
|
||||
# Install dependencies
|
||||
pip install -r requirements.txt
|
||||
|
||||
## Installation
|
||||
|
||||
1. Clone or download the repository:
|
||||
```bash
|
||||
git clone <repo-url>
|
||||
cd maskarr
|
||||
```
|
||||
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
pip install requests
|
||||
```
|
||||
|
||||
3. Run the server:
|
||||
```bash
|
||||
# Run the server
|
||||
python3 maskarr.py
|
||||
```
|
||||
|
||||
Or make it executable:
|
||||
```bash
|
||||
chmod +x maskarr.py
|
||||
./maskarr.py
|
||||
```
|
||||
Then open `http://localhost:8888` to configure your first tracker.
|
||||
|
||||
## Usage
|
||||
## Documentation
|
||||
|
||||
### 1. Start the server
|
||||
|
||||
```bash
|
||||
python3 maskarr.py
|
||||
```
|
||||
|
||||
You'll see something like:
|
||||
```
|
||||
🎭 Maskarr - Tracker Proxy Server
|
||||
==================================================
|
||||
🌐 Server running on http://0.0.0.0:8888
|
||||
📊 Web UI: http://localhost:8888
|
||||
📝 Config file: /path/to/maskarr_config.json
|
||||
==================================================
|
||||
Press Ctrl+C to stop
|
||||
```
|
||||
|
||||
### 2. Configure a tracker
|
||||
|
||||
1. Open your browser at `http://localhost:8888`
|
||||
2. Fill in the form:
|
||||
- **Tracker ID**: Unique identifier (e.g., `divteam`)
|
||||
- **Domain**: Tracker domain (e.g., `divteam.com`)
|
||||
- **User-Agent**: Browser user-agent you want to use
|
||||
- **Additional headers**: JSON with extra headers (optional)
|
||||
- **Timeout**: Timeout in seconds (default: 30)
|
||||
- **Verify SSL**: Verify SSL certificate (recommended: enabled)
|
||||
|
||||
3. Click **Save Tracker**
|
||||
|
||||
### 3. Use the proxy in Prowlarr/Jackett
|
||||
|
||||
Each configured tracker will have a unique proxy URL:
|
||||
|
||||
```
|
||||
http://localhost:8888/proxy/{tracker_id}/
|
||||
```
|
||||
|
||||
For example, if you configured `divteam`:
|
||||
```
|
||||
http://localhost:8888/proxy/divteam/
|
||||
```
|
||||
|
||||
In Prowlarr:
|
||||
1. Go to Settings → Indexers
|
||||
2. Add the indexer manually
|
||||
3. In "Base URL", use: `http://localhost:8888/proxy/divteam`
|
||||
4. Configure the rest of the parameters normally
|
||||
|
||||
## Configuration Examples
|
||||
|
||||
### DivTeam
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "divteam",
|
||||
"domain": "divteam.com",
|
||||
"user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0",
|
||||
"headers": {},
|
||||
"timeout": 30,
|
||||
"verify_ssl": true
|
||||
}
|
||||
```
|
||||
|
||||
### Tracker with custom headers
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "mytracker",
|
||||
"domain": "tracker.example.com",
|
||||
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
|
||||
"headers": {
|
||||
"Referer": "https://tracker.example.com",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
"timeout": 45,
|
||||
"verify_ssl": true
|
||||
}
|
||||
```
|
||||
|
||||
## REST API
|
||||
|
||||
### GET /api/trackers
|
||||
Get all configured trackers.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"trackers": {
|
||||
"divteam": {
|
||||
"domain": "divteam.com",
|
||||
"user_agent": "Mozilla/5.0...",
|
||||
"headers": {},
|
||||
"timeout": 30,
|
||||
"verify_ssl": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### POST /api/trackers
|
||||
Add or update a tracker.
|
||||
|
||||
**Body:**
|
||||
```json
|
||||
{
|
||||
"id": "divteam",
|
||||
"domain": "divteam.com",
|
||||
"user_agent": "Mozilla/5.0...",
|
||||
"headers": {},
|
||||
"timeout": 30,
|
||||
"verify_ssl": true
|
||||
}
|
||||
```
|
||||
|
||||
### DELETE /api/trackers/{tracker_id}
|
||||
Delete a tracker.
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
### Change the port
|
||||
|
||||
Edit `maskarr_config.json`:
|
||||
```json
|
||||
{
|
||||
"port": 9999,
|
||||
"log_requests": true,
|
||||
"trackers": {}
|
||||
}
|
||||
```
|
||||
|
||||
### Disable request logging
|
||||
|
||||
In `maskarr_config.json`:
|
||||
```json
|
||||
{
|
||||
"log_requests": false
|
||||
}
|
||||
```
|
||||
|
||||
### Run as a service (systemd)
|
||||
|
||||
Create `/etc/systemd/system/maskarr.service`:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Maskarr Tracker Proxy
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=youruser
|
||||
WorkingDirectory=/path/to/maskarr
|
||||
ExecStart=/usr/bin/python3 /path/to/maskarr/maskarr.py
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Enable and start:
|
||||
```bash
|
||||
sudo systemctl enable maskarr
|
||||
sudo systemctl start maskarr
|
||||
sudo systemctl status maskarr
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
#### Using Docker Compose (recommended)
|
||||
|
||||
```bash
|
||||
# Download docker-compose.yml
|
||||
wget https://raw.githubusercontent.com/yourusername/maskarr/main/docker-compose.yml
|
||||
|
||||
# Create config directory
|
||||
mkdir -p config
|
||||
|
||||
# Start the service
|
||||
docker-compose up -d
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
#### Using Docker directly
|
||||
|
||||
From GitHub Container Registry:
|
||||
```bash
|
||||
docker run -d \
|
||||
--name maskarr \
|
||||
-p 8888:8888 \
|
||||
-v $(pwd)/config:/app/config \
|
||||
--restart unless-stopped \
|
||||
ghcr.io/yourusername/maskarr:latest
|
||||
```
|
||||
|
||||
Or build the image locally:
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/yourusername/maskarr.git
|
||||
cd maskarr
|
||||
|
||||
# Build the image
|
||||
docker build -t maskarr .
|
||||
|
||||
# Run the container
|
||||
docker run -d \
|
||||
--name maskarr \
|
||||
-p 8888:8888 \
|
||||
-v $(pwd)/config:/app/config \
|
||||
--restart unless-stopped \
|
||||
maskarr:latest
|
||||
```
|
||||
|
||||
#### Multi-architecture
|
||||
|
||||
Images support multiple architectures:
|
||||
- `linux/amd64` (x86_64)
|
||||
- `linux/arm64` (ARM 64-bit, Raspberry Pi 4, Apple Silicon)
|
||||
- `linux/arm/v7` (ARM 32-bit, Raspberry Pi 3)
|
||||
|
||||
## CI/CD - Automatic Docker Image Publishing
|
||||
|
||||
The project includes workflows for **GitHub Actions** and **Gitea Actions** that automatically publish Docker images.
|
||||
|
||||
### Supported Registries
|
||||
|
||||
Each push to `main`/`master` or tag `v*.*.*` will publish to:
|
||||
|
||||
1. **GitHub Container Registry** (`ghcr.io`) - Primary and most reliable ⭐
|
||||
2. **Gitea Container Registry** (your private instance)
|
||||
|
||||
### Quick Setup
|
||||
|
||||
**📖 [Read the complete setup guide: SETUP_CI.md](SETUP_CI.md)**
|
||||
|
||||
The guide includes:
|
||||
- Step-by-step configuration for GitHub and Gitea
|
||||
- How to create access tokens
|
||||
- How to configure secrets
|
||||
- Common troubleshooting
|
||||
- Usage examples
|
||||
|
||||
### Quick Start
|
||||
|
||||
#### GitHub:
|
||||
1. Upload code to GitHub
|
||||
2. Push or create a tag → Image builds automatically
|
||||
3. Make the package public to allow `docker pull` without authentication
|
||||
|
||||
#### Gitea:
|
||||
1. Enable Actions and Container Registry on your instance
|
||||
2. Configure the secret `PACKAGE_TOKEN` with `write:package` permissions
|
||||
3. Push or create a tag → Image builds automatically
|
||||
|
||||
### Using Published Images
|
||||
|
||||
```bash
|
||||
# From GitHub Container Registry (recommended)
|
||||
docker pull ghcr.io/your-username/maskarr:latest
|
||||
|
||||
# From Gitea
|
||||
docker pull gitea.yourdomain.com/your-username/maskarr:latest
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Port in use
|
||||
```
|
||||
Error: Port 8888 might be already in use
|
||||
```
|
||||
Change the port in `maskarr_config.json` or close the application using port 8888.
|
||||
|
||||
### Permission denied
|
||||
```
|
||||
Error: Permission denied to bind to port 8888
|
||||
```
|
||||
Use a port > 1024 or run with privileges (not recommended).
|
||||
|
||||
### SSL Certificate Verify Failed
|
||||
If the tracker uses a self-signed certificate, disable "Verify SSL" in the tracker configuration.
|
||||
|
||||
### Request timeout
|
||||
Increase the "Timeout" value in the tracker configuration.
|
||||
|
||||
## Security
|
||||
|
||||
- **Don't expose the server to the internet**: It's designed for local use
|
||||
- **Use HTTPS if exposing**: Consider a reverse proxy (nginx, Caddy)
|
||||
- **Protect your cookies**: Cookies are passed through the proxy
|
||||
- **Check the logs**: Enable `log_requests` for debugging
|
||||
|
||||
## Roadmap
|
||||
|
||||
- [ ] Basic authentication for the UI
|
||||
- [ ] Proxy chain support
|
||||
- [ ] Usage statistics per tracker
|
||||
- [ ] Rate limiting per tracker
|
||||
- [ ] Configuration import/export
|
||||
- [ ] User-Agent rotation support
|
||||
- [Usage, configuration and REST API](docs/usage.md)
|
||||
- [Deployment (systemd, Docker, CI/CD)](docs/deployment.md)
|
||||
|
||||
## License
|
||||
|
||||
GNU GPL V3.0
|
||||
GNU GPL v3.0
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests welcome. For major changes, please open an issue first.
|
||||
|
||||
## Author
|
||||
|
||||
Created to facilitate the use of private trackers with *arr applications.
|
||||
@@ -0,0 +1,90 @@
|
||||
# Deployment
|
||||
|
||||
## Run as a service (systemd)
|
||||
|
||||
Create `/etc/systemd/system/maskarr.service`:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Maskarr Tracker Proxy
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=youruser
|
||||
WorkingDirectory=/path/to/maskarr
|
||||
ExecStart=/usr/bin/python3 /path/to/maskarr/maskarr.py
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Enable and start:
|
||||
```bash
|
||||
sudo systemctl enable maskarr
|
||||
sudo systemctl start maskarr
|
||||
sudo systemctl status maskarr
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
### Using Docker Compose (recommended)
|
||||
|
||||
```bash
|
||||
# Download docker-compose.yml
|
||||
wget https://raw.githubusercontent.com/yourusername/maskarr/main/docker-compose.yml
|
||||
|
||||
# Create config directory
|
||||
mkdir -p config
|
||||
|
||||
# Start the service
|
||||
docker-compose up -d
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
### Using Docker directly
|
||||
|
||||
From GitHub Container Registry:
|
||||
```bash
|
||||
docker run -d \
|
||||
--name maskarr \
|
||||
-p 8888:8888 \
|
||||
-v $(pwd)/config:/app/config \
|
||||
--restart unless-stopped \
|
||||
ghcr.io/yourusername/maskarr:latest
|
||||
```
|
||||
|
||||
Or build the image locally:
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/yourusername/maskarr.git
|
||||
cd maskarr
|
||||
|
||||
# Build the image
|
||||
docker build -t maskarr .
|
||||
|
||||
# Run the container
|
||||
docker run -d \
|
||||
--name maskarr \
|
||||
-p 8888:8888 \
|
||||
-v $(pwd)/config:/app/config \
|
||||
--restart unless-stopped \
|
||||
maskarr:latest
|
||||
```
|
||||
|
||||
## CI/CD - automatic Docker image publishing
|
||||
|
||||
The GitHub Actions workflow `.github/workflows/docker-publish.yml` publishes the Docker image to
|
||||
**GitHub Container Registry** (`ghcr.io`) on each push to `main`/`master` or tag `v*.*.*`.
|
||||
CI and versioning run on Gitea Actions (`.gitea/workflows/` (CI also runs on GitHub)).
|
||||
Every push to `main` creates a `vX.Y.Z` tag and release on both Gitea (`version.yml`, after the version bump) and GitHub (`release` job in `ci.yml`).
|
||||
|
||||
### Using published images
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/dasemu/maskarr:latest
|
||||
```
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
# Usage
|
||||
|
||||
## 1. Start the server
|
||||
|
||||
```bash
|
||||
python3 maskarr.py
|
||||
```
|
||||
|
||||
You'll see something like:
|
||||
```
|
||||
Maskarr - Tracker Proxy Server
|
||||
==================================================
|
||||
Server running on http://0.0.0.0:8888
|
||||
Web UI: http://localhost:8888
|
||||
Config file: /path/to/maskarr_config.json
|
||||
==================================================
|
||||
Press Ctrl+C to stop
|
||||
```
|
||||
|
||||
## 2. Configure a tracker
|
||||
|
||||
1. Open your browser at `http://localhost:8888`
|
||||
2. Fill in the form:
|
||||
- **Tracker ID**: Unique identifier (e.g., `mytracker`)
|
||||
- **Domain**: Tracker domain (e.g., `mytracker.com`)
|
||||
- **User-Agent**: Browser user-agent you want to use
|
||||
- **Additional headers**: JSON with extra headers (optional)
|
||||
- **Timeout**: Timeout in seconds (default: 30)
|
||||
- **Verify SSL**: Verify SSL certificate (recommended: enabled)
|
||||
|
||||
3. Click **Save Tracker**
|
||||
|
||||
## 3. Use the proxy in Prowlarr/Jackett
|
||||
|
||||
Each configured tracker will have a unique proxy URL:
|
||||
|
||||
```
|
||||
http://localhost:8888/proxy/{tracker_id}/
|
||||
```
|
||||
|
||||
For example, if you configured `mytracker`:
|
||||
```
|
||||
http://localhost:8888/proxy/mytracker/
|
||||
```
|
||||
|
||||
You will have to create a custom definition for the indexer, copying one which has been
|
||||
created already, and modifying its `base_url` to:
|
||||
`http://localhost:8888/proxy/mytracker`
|
||||
|
||||
## Configuration examples
|
||||
|
||||
### Tracker without custom headers
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "mytracker",
|
||||
"domain": "mytracker.com",
|
||||
"user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0",
|
||||
"headers": {},
|
||||
"timeout": 30,
|
||||
"verify_ssl": true
|
||||
}
|
||||
```
|
||||
|
||||
### Tracker with custom headers
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "mytracker",
|
||||
"domain": "tracker.example.com",
|
||||
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
|
||||
"headers": {
|
||||
"Referer": "https://tracker.example.com",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
"timeout": 45,
|
||||
"verify_ssl": true
|
||||
}
|
||||
```
|
||||
|
||||
## REST API
|
||||
|
||||
### GET /api/trackers
|
||||
Get all configured trackers.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"trackers": {
|
||||
"mytracker": {
|
||||
"domain": "mytracker.com",
|
||||
"user_agent": "Mozilla/5.0...",
|
||||
"headers": {},
|
||||
"timeout": 30,
|
||||
"verify_ssl": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### POST /api/trackers
|
||||
Add or update a tracker.
|
||||
|
||||
**Body:**
|
||||
```json
|
||||
{
|
||||
"id": "mytracker",
|
||||
"domain": "mytracker.com",
|
||||
"user_agent": "Mozilla/5.0...",
|
||||
"headers": {},
|
||||
"timeout": 30,
|
||||
"verify_ssl": true
|
||||
}
|
||||
```
|
||||
|
||||
### DELETE /api/trackers/{tracker_id}
|
||||
Delete a tracker.
|
||||
|
||||
## Advanced configuration
|
||||
|
||||
### Change the port
|
||||
|
||||
Edit `maskarr_config.json`:
|
||||
```json
|
||||
{
|
||||
"port": 9999,
|
||||
"log_requests": true,
|
||||
"trackers": {}
|
||||
}
|
||||
```
|
||||
|
||||
### Disable request logging
|
||||
|
||||
In `maskarr_config.json`:
|
||||
```json
|
||||
{
|
||||
"log_requests": false
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Port in use
|
||||
```
|
||||
Error: Port 8888 might be already in use
|
||||
```
|
||||
Change the port in `maskarr_config.json` or close the application using port 8888.
|
||||
|
||||
### Permission denied
|
||||
```
|
||||
Error: Permission denied to bind to port 8888
|
||||
```
|
||||
Use a port > 1024 or run with privileges (not recommended).
|
||||
|
||||
### SSL certificate verify failed
|
||||
If the tracker uses a self-signed certificate, disable "Verify SSL" in the tracker configuration.
|
||||
|
||||
### Request timeout
|
||||
Increase the "Timeout" value in the tracker configuration.
|
||||
|
||||
## Security
|
||||
|
||||
- **Don't expose the server to the internet**: it's designed for local use.
|
||||
- **Use HTTPS if exposing**: consider a reverse proxy (nginx, Caddy).
|
||||
- **Protect your cookies**: cookies are passed through the proxy.
|
||||
- **Check the logs**: enable `log_requests` for debugging.
|
||||
Reference in new issue
Block a user