docs: reconcile overview, README, and proto comments with DEC-3/4/8

- Update docs/overview.md to reflect pluggable reverse-proxy/OIDC SSO (DEC-8), hard-fail sanitizer behavior on dangerous payloads (DEC-3), and Stage 1 TMDB resolution at ingestion (DEC-4) instead of hardcoded Authelia/Traefik/domain examples.
- Update README.md quick-start sync command to uv sync --all-packages and remove unimplemented docker-compose.yml from the current directory tree.
- Update proto/magnetflix/v1/pipeline.proto comments to reference generic upstream SSO identity headers and info_hash deduplication, and regenerate protobuf stubs + docs/api_spec.md via buf generate.
- Update DownloadJob.requested_by column doc metadata in services/worker/src/worker/db/models.py to match configurable AUTH_HEADER_USER.
This commit is contained in:
kiskaadee committed 2026-11-14 00:16:55 -05:00
1 parent e0d6cd7959
commit b7aeee9fe8
8 files changed
+24 -24

No files matched your search

+2 -3
View File
@@ -24,8 +24,8 @@
# 1. Enter hermetic dev shell (Nix) # 1. Enter hermetic dev shell (Nix)
nix develop nix develop
# 2. Or install dependencies with uv workspace # 2. Or install dependencies for all workspace packages with uv
uv sync uv sync --all-packages
# 3. Generate protobuf stubs & documentation # 3. Generate protobuf stubs & documentation
make generate make generate
@@ -49,7 +49,6 @@ make check
├── README.md # Project landing page ├── README.md # Project landing page
├── buf.gen.yaml # Buf code generation configuration ├── buf.gen.yaml # Buf code generation configuration
├── buf.yaml # Buf module configuration ├── buf.yaml # Buf module configuration
├── docker-compose.yml # Multi-container Compose stack specification
├── docs/ # Authoritative architecture and operations documentation ├── docs/ # Authoritative architecture and operations documentation
│ ├── adr/ # Architecture Decision Records (ADRs) │ ├── adr/ # Architecture Decision Records (ADRs)
│ ├── history/ # Audit logs and review ledgers │ ├── history/ # Audit logs and review ledgers
+2 -2
View File
@@ -158,7 +158,7 @@ Request to submit a new movie download.
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| magnet_uri | [string](#string) | | Magnet URI of the torrent to fetch. | | magnet_uri | [string](#string) | | Magnet URI of the torrent to fetch. |
| imdb_id | [string](#string) | | IMDb ID of the movie (e.g., "tt1375666"). | | imdb_id | [string](#string) | | IMDb ID of the movie (e.g., "tt1375666"). |
| requested_by | [string](#string) | | Username of the user requesting the download (from Authelia Remote-User). | | requested_by | [string](#string) | | Username of the user requesting the download (from upstream SSO identity header). |
@@ -212,7 +212,7 @@ PipelineService coordinates movie download jobs, safety scans, and library reloc
| Method Name | Request Type | Response Type | Description | | Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------| | ----------- | ------------ | ------------- | ------------|
| SubmitDownload | [SubmitDownloadRequest](#magnetflix-v1-SubmitDownloadRequest) | [SubmitDownloadResponse](#magnetflix-v1-SubmitDownloadResponse) | SubmitDownload enqueues a new movie download job. Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library. | | SubmitDownload | [SubmitDownloadRequest](#magnetflix-v1-SubmitDownloadRequest) | [SubmitDownloadResponse](#magnetflix-v1-SubmitDownloadResponse) | SubmitDownload enqueues a new movie download job. Rejects duplicate submissions if an active job for the same IMDb ID or info_hash exists, or if already in library. |
| GetJob | [GetJobRequest](#magnetflix-v1-GetJobRequest) | [GetJobResponse](#magnetflix-v1-GetJobResponse) | GetJob retrieves the current status and metadata of a specific job. | | GetJob | [GetJobRequest](#magnetflix-v1-GetJobRequest) | [GetJobResponse](#magnetflix-v1-GetJobResponse) | GetJob retrieves the current status and metadata of a specific job. |
| StreamJobStatus | [StreamJobStatusRequest](#magnetflix-v1-StreamJobStatusRequest) | [StreamJobStatusResponse](#magnetflix-v1-StreamJobStatusResponse) stream | StreamJobStatus streams real-time status updates. Semantics: Emits an immediate snapshot of matching active jobs upon connection, followed by subsequent state and progress change events. | | StreamJobStatus | [StreamJobStatusRequest](#magnetflix-v1-StreamJobStatusRequest) | [StreamJobStatusResponse](#magnetflix-v1-StreamJobStatusResponse) stream | StreamJobStatus streams real-time status updates. Semantics: Emits an immediate snapshot of matching active jobs upon connection, followed by subsequent state and progress change events. |
| ListJobs | [ListJobsRequest](#magnetflix-v1-ListJobsRequest) | [ListJobsResponse](#magnetflix-v1-ListJobsResponse) | ListJobs returns a paginated list of download jobs. | | ListJobs | [ListJobsRequest](#magnetflix-v1-ListJobsRequest) | [ListJobsResponse](#magnetflix-v1-ListJobsResponse) | ListJobs returns a paginated list of download jobs. |
+12 -11
View File
@@ -11,10 +11,10 @@ When self-hosting a media server (Jellyfin/Plex):
2. In multi-user setups, tracking who requested what and keeping track of download failures is difficult without a dedicated audit log. 2. In multi-user setups, tracking who requested what and keeping track of download failures is difficult without a dedicated audit log.
**MagNetFlix** solves this with an end-to-end automated workflow: **MagNetFlix** solves this with an end-to-end automated workflow:
- **Input**: A simple web form protected by **Authelia SSO** accepting an **IMDb ID** and a **Magnet URI**. - **Input**: A simple web form protected by **pluggable reverse-proxy / OIDC SSO** accepting an **IMDb ID** and a **Magnet URI**.
- **Processing**: A background **gRPC worker** handles downloading via Transmission into a sandboxed staging directory. - **Processing**: A background **gRPC worker** handles downloading via Transmission into a sandboxed staging directory.
- **Safety**: Recursively scans and purges all non-media/dangerous executable files. - **Safety**: Recursively scans staging payloads, ignoring benign clutter while hard-failing jobs containing dangerous executables, archives, symlinks, or path traversal.
- **Organization**: Fetches official metadata for the IMDb ID, verifies movie details, and places renamed media files into your library structure. - **Organization**: Resolves official TMDB metadata for the IMDb ID at ingestion, verifies movie tokens post-download, and atomically places renamed media files into your library structure.
- **Observability**: Live status tracking and persistent audit logs. - **Observability**: Live status tracking and persistent audit logs.
--- ---
@@ -25,24 +25,25 @@ When self-hosting a media server (Jellyfin/Plex):
sequenceDiagram sequenceDiagram
autonumber autonumber
actor User as Authenticated User actor User as Authenticated User
participant Traefik as Traefik (SSO Protected) participant Proxy as Reverse Proxy (SSO Protected)
participant BFF as FastAPI (BFF Gateway) participant BFF as FastAPI (BFF Gateway)
participant Worker as gRPC Pipeline Worker participant Worker as gRPC Pipeline Worker
participant Engine as Transmission Daemon participant Engine as Transmission Daemon
participant Media as Jellyfin / Plex Library participant Media as Jellyfin / Plex Library
User->>Traefik: GET addmovie.roadtotech.me User->>Proxy: GET https://<MAGNETFLIX_HOST>
Traefik->>User: Renders MagNetFlix Web Form Proxy->>User: Renders MagNetFlix Web Form
User->>Traefik: Submit form (magnet URI + IMDb ID: tt1375666) User->>Proxy: Submit form (magnet URI + IMDb ID: tt1375666)
Traefik->>BFF: POST /api/v1/downloads (includes Remote-User header) Proxy->>BFF: POST /api/v1/downloads (includes AUTH_HEADER_USER header)
BFF->>Worker: gRPC SubmitDownload(magnet, imdb_id, user) BFF->>Worker: gRPC SubmitDownload(magnet, imdb_id, user)
Worker->>Worker: Resolve TMDB title/year (Stage 1)
Worker-->>BFF: Acknowledged (Job ID: job-42) Worker-->>BFF: Acknowledged (Job ID: job-42)
BFF-->>User: Enqueued! Showing live progress BFF-->>User: Enqueued! Showing live progress
Worker->>Engine: Start torrent download in /data/staging/job-42 Worker->>Engine: Start torrent download in /data/staging/job-42
Engine-->>Worker: Download Completed Engine-->>Worker: Download Completed
Worker->>Worker: Run Security Whitelist Scan (Purge .exe/.bat) Worker->>Worker: Run Two-Tier Security Scan (Hard-fail .exe/.bat)
Worker->>Worker: Verify IMDb metadata & rename files Worker->>Worker: Verify cached TMDB title/year tokens & rename files
Worker->>Media: Move to /media/movies/Inception (2010) [imdbid-tt1375666]/ Worker->>Media: Atomic swap to /media/movies/Inception (2010) [imdbid-tt1375666]/
Worker-->>BFF: Status: COMPLETED Worker-->>BFF: Status: COMPLETED
BFF-->>User: Notification: Movie ready in library! BFF-->>User: Notification: Movie ready in library!
``` ```
+2 -2
View File
@@ -7,7 +7,7 @@ import "google/protobuf/timestamp.proto";
// PipelineService coordinates movie download jobs, safety scans, and library relocation. // PipelineService coordinates movie download jobs, safety scans, and library relocation.
service PipelineService { service PipelineService {
// SubmitDownload enqueues a new movie download job. // SubmitDownload enqueues a new movie download job.
// Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library. // Rejects duplicate submissions if an active job for the same IMDb ID or info_hash exists, or if already in library.
rpc SubmitDownload (SubmitDownloadRequest) returns (SubmitDownloadResponse); rpc SubmitDownload (SubmitDownloadRequest) returns (SubmitDownloadResponse);
// GetJob retrieves the current status and metadata of a specific job. // GetJob retrieves the current status and metadata of a specific job.
@@ -40,7 +40,7 @@ message SubmitDownloadRequest {
string magnet_uri = 1; string magnet_uri = 1;
// IMDb ID of the movie (e.g., "tt1375666"). // IMDb ID of the movie (e.g., "tt1375666").
string imdb_id = 2; string imdb_id = 2;
// Username of the user requesting the download (from Authelia Remote-User). // Username of the user requesting the download (from upstream SSO identity header).
string requested_by = 3; string requested_by = 3;
} }
@@ -62,7 +62,7 @@ class SubmitDownloadRequest(_message.Message):
imdb_id: _builtins.str imdb_id: _builtins.str
"""IMDb ID of the movie (e.g., "tt1375666").""" """IMDb ID of the movie (e.g., "tt1375666")."""
requested_by: _builtins.str requested_by: _builtins.str
"""Username of the user requesting the download (from Authelia Remote-User).""" """Username of the user requesting the download (from upstream SSO identity header)."""
def __init__( def __init__(
self, self,
*, *,
@@ -43,7 +43,7 @@ class PipelineServiceServicer:
def SubmitDownload(self, request, context): def SubmitDownload(self, request, context):
"""SubmitDownload enqueues a new movie download job. """SubmitDownload enqueues a new movie download job.
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library. Rejects duplicate submissions if an active job for the same IMDb ID or info_hash exists, or if already in library.
""" """
context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!') context.set_details('Method not implemented!')
@@ -35,7 +35,7 @@ class PipelineServiceStub:
def __new__(cls, channel: _aio.Channel) -> PipelineServiceAsyncStub: ... def __new__(cls, channel: _aio.Channel) -> PipelineServiceAsyncStub: ...
SubmitDownload: _grpc.UnaryUnaryMultiCallable[_pipeline_pb2.SubmitDownloadRequest, _pipeline_pb2.SubmitDownloadResponse] SubmitDownload: _grpc.UnaryUnaryMultiCallable[_pipeline_pb2.SubmitDownloadRequest, _pipeline_pb2.SubmitDownloadResponse]
"""SubmitDownload enqueues a new movie download job. """SubmitDownload enqueues a new movie download job.
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library. Rejects duplicate submissions if an active job for the same IMDb ID or info_hash exists, or if already in library.
""" """
GetJob: _grpc.UnaryUnaryMultiCallable[_pipeline_pb2.GetJobRequest, _pipeline_pb2.GetJobResponse] GetJob: _grpc.UnaryUnaryMultiCallable[_pipeline_pb2.GetJobRequest, _pipeline_pb2.GetJobResponse]
"""GetJob retrieves the current status and metadata of a specific job.""" """GetJob retrieves the current status and metadata of a specific job."""
@@ -54,7 +54,7 @@ class PipelineServiceAsyncStub(PipelineServiceStub):
def __init__(self, channel: _aio.Channel) -> None: ... def __init__(self, channel: _aio.Channel) -> None: ...
SubmitDownload: _aio.UnaryUnaryMultiCallable[_pipeline_pb2.SubmitDownloadRequest, _pipeline_pb2.SubmitDownloadResponse] # type: ignore[assignment] SubmitDownload: _aio.UnaryUnaryMultiCallable[_pipeline_pb2.SubmitDownloadRequest, _pipeline_pb2.SubmitDownloadResponse] # type: ignore[assignment]
"""SubmitDownload enqueues a new movie download job. """SubmitDownload enqueues a new movie download job.
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library. Rejects duplicate submissions if an active job for the same IMDb ID or info_hash exists, or if already in library.
""" """
GetJob: _aio.UnaryUnaryMultiCallable[_pipeline_pb2.GetJobRequest, _pipeline_pb2.GetJobResponse] # type: ignore[assignment] GetJob: _aio.UnaryUnaryMultiCallable[_pipeline_pb2.GetJobRequest, _pipeline_pb2.GetJobResponse] # type: ignore[assignment]
"""GetJob retrieves the current status and metadata of a specific job.""" """GetJob retrieves the current status and metadata of a specific job."""
@@ -76,7 +76,7 @@ class PipelineServiceServicer(metaclass=_abc_1.ABCMeta):
context: _ServicerContext, context: _ServicerContext,
) -> _typing.Union[_pipeline_pb2.SubmitDownloadResponse, _abc.Awaitable[_pipeline_pb2.SubmitDownloadResponse]]: ) -> _typing.Union[_pipeline_pb2.SubmitDownloadResponse, _abc.Awaitable[_pipeline_pb2.SubmitDownloadResponse]]:
"""SubmitDownload enqueues a new movie download job. """SubmitDownload enqueues a new movie download job.
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library. Rejects duplicate submissions if an active job for the same IMDb ID or info_hash exists, or if already in library.
""" """
@_abc_1.abstractmethod @_abc_1.abstractmethod
+1 -1
View File
@@ -140,7 +140,7 @@ class DownloadJob(Base):
String(128), String(128),
nullable=False, nullable=False,
index=True, index=True,
doc="Authenticated user from Remote-User SSO header", doc="Authenticated user from upstream SSO identity header",
) )
state: Mapped[str] = mapped_column( state: Mapped[str] = mapped_column(
String(32), String(32),