v0.1.1: external modules, publish YAML, proxy reset, binary-first README
- Host discovers/builds modules under modules/ (bbc, rte, tg4) - module-publish.yaml tracked; local module.yaml gitignored - drm --modules-dir / DRM_MODULES_DIR - drm proxy reset; Magisk reinject reliability - modules-v* Forgejo release workflow + build scripts - BBC full Explore channel map including S4C - README quickstart based on release binaries
This commit is contained in:
parent
1d36961a7c
commit
f9c28be3f1
52 changed files with 2915 additions and 636 deletions
|
|
@ -17,34 +17,35 @@ What it deliberately does not do: break DRM. The CDM used is a provisioned
|
|||
Widevine device you supply (`.wvd`); the system only automates the request flow a
|
||||
real client performs.
|
||||
|
||||
## One binary
|
||||
## Host + external modules
|
||||
|
||||
```text
|
||||
┌──────────────────────── bin/drm ────────────────────────┐
|
||||
│ │
|
||||
modules ───┤ capture catalog agent serve proxy │
|
||||
linked in │ │
|
||||
└─────────────────────────────────────────────────────────┘
|
||||
│ capture catalog agent serve proxy │
|
||||
│ │ │
|
||||
│ └── modhost: discover / build / exec │
|
||||
└───────────────────────┬─────────────────────────────────┘
|
||||
│
|
||||
modules/<name>/ (Go CLI + module.yaml + .bin/)
|
||||
```
|
||||
|
||||
`apps/cli` is the only `main`. It blank-imports `drmdecryption/modules/all`, which
|
||||
is what makes `--app <name>` resolve. Each app module registers itself:
|
||||
`apps/cli` is the only host `main`. Providers are **not** linked into `drm.exe`.
|
||||
Each `modules/<name>/` is a small CLI (`describe`, `launch`, `autoplay`, `catalog`)
|
||||
that the host builds on demand into `modules/<name>/.bin/` and runs as a
|
||||
subprocess. Shared library code may still live under `apps/modules/<name>/` for
|
||||
the external CLI to import via `replace`.
|
||||
|
||||
```go
|
||||
func init() {
|
||||
appreg.Register(Name, New) // --app rte
|
||||
appreg.RegisterFlags(bindFlags) // --rte.<field> overrides
|
||||
}
|
||||
```
|
||||
Adding a provider means adding a folder under `modules/` — no rebuild of `drm`.
|
||||
Point at another tree with `drm --modules-dir DIR` or `$DRM_MODULES_DIR`.
|
||||
|
||||
Adding a provider means adding a package and one import line. There is no plugin
|
||||
loading, no scripting runtime, and nothing to deploy beside the binary.
|
||||
Host releases use `v*` tags. Provider zips use separate `modules-v*` tags
|
||||
(`module-bbc-….zip`, `module-rte-….zip`, `module-tg4-….zip`). Tracked
|
||||
`module-publish.yaml` is renamed to `module.yaml` inside those zips; local
|
||||
secrets stay in a gitignored `module.yaml` on disk.
|
||||
|
||||
## Logic vs values
|
||||
|
||||
This is the central constraint:
|
||||
|
||||
| `apps/modules/<name>/*.go` — **tracked** | `apps/modules/<name>/module.yaml` — **gitignored** (bbc published) |
|
||||
| `modules/<name>/*.go` (+ optional `apps/modules/<name>/`) | `modules/<name>/module.yaml` |
|
||||
|---|---|
|
||||
| launch + auto-play sequence | android package id |
|
||||
| navigation idioms (chip→Play, drawer→Live) | license URL, origin hostnames |
|
||||
|
|
@ -53,24 +54,10 @@ This is the central constraint:
|
|||
| which capture fields are required | UI selector regexes, labels, aliases |
|
||||
|
||||
Module Go source contains no account id, policy key, video id, license URL, origin
|
||||
host or KID. Values arrive by **flag → environment → module.yaml → Go default**,
|
||||
host or KID. Values arrive by **environment → module.yaml → Go default**,
|
||||
and only mechanical things (timeouts, DASH timescales, card geometry) have
|
||||
defaults in code.
|
||||
|
||||
`.gitignore` enforces the split:
|
||||
|
||||
```gitignore
|
||||
apps/modules/**
|
||||
!apps/modules/README.md
|
||||
!apps/modules/go.mod
|
||||
!apps/modules/go.sum
|
||||
!apps/modules/*/
|
||||
!apps/modules/*/*.go
|
||||
!apps/modules/*/**/*.go
|
||||
```
|
||||
|
||||
The directory re-include is required — git will not descend into an excluded
|
||||
directory to find negated files.
|
||||
defaults in code. BBC's `module.yaml` is published; other providers' values stay
|
||||
local.
|
||||
|
||||
## Go modules
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
# Writing an app module
|
||||
|
||||
A module teaches the binary how to drive one streaming app. It is a Go package, it
|
||||
is compiled in, and it contains no secrets.
|
||||
A module teaches the host how to drive one streaming app. Provider code lives
|
||||
under `modules/<name>/` on disk. The host (`drm`) discovers it, builds it, and
|
||||
runs it — it is **not** compiled into `drm.exe`. Shared library helpers may live
|
||||
under `apps/modules/<name>/` and be imported by the external CLI via `replace`.
|
||||
|
||||
Work through [capture.md](capture.md) first — you need the app's package id,
|
||||
license URL, manifest host and UI selectors before you can write any of this.
|
||||
|
|
@ -9,17 +11,21 @@ license URL, manifest host and UI selectors before you can write any of this.
|
|||
## Anatomy
|
||||
|
||||
```text
|
||||
apps/modules/myapp/
|
||||
config.go Config struct + defaults + flag binding
|
||||
myapp.go init(), the App type, Launch, AutoPlay, capability methods
|
||||
modules/myapp/
|
||||
main.go CLI: describe | launch | autoplay | catalog
|
||||
go.mod replace drmdecryption => ../../apps/pkg
|
||||
module.yaml your values (bbc published; others often gitignored)
|
||||
.bin/myapp.exe built on demand by drm
|
||||
|
||||
apps/modules/myapp/ (optional shared library used by the CLI)
|
||||
config.go Config struct + defaults
|
||||
myapp.go the App type, Launch, AutoPlay, capability methods
|
||||
steps.go navigation idioms specific to this app
|
||||
catalog.go optional: resolve channels without a phone
|
||||
mpd.go optional: manifest rewriting
|
||||
module.yaml GITIGNORED - your values
|
||||
```
|
||||
|
||||
Everything is registered from `init()`, and one line in `apps/modules/all/all.go`
|
||||
links it into the binary.
|
||||
See `modules/bbc/` for the reference external module.
|
||||
|
||||
## 1. Config
|
||||
|
||||
|
|
@ -317,22 +323,17 @@ func (a *App) TSReadyBytes() int64 { return 2 << 20 }
|
|||
Without this, streamd uses neutral defaults. This is what replaced guessing from
|
||||
app and stream names.
|
||||
|
||||
## 7. Link it in
|
||||
## 7. Drop it under modules/
|
||||
|
||||
```go
|
||||
// apps/modules/all/all.go
|
||||
import (
|
||||
_ "drmdecryption/modules/myapp"
|
||||
_ "drmdecryption/modules/rte"
|
||||
_ "drmdecryption/modules/tg4"
|
||||
)
|
||||
```
|
||||
No host rebuild. Put the CLI + `module.yaml` under `modules/myapp/`, then:
|
||||
|
||||
```bash
|
||||
go -C apps/cli build -o ../../bin/drm .
|
||||
./bin/drm modules
|
||||
./bin/drm capture --app myapp --channel …
|
||||
```
|
||||
|
||||
The host builds `modules/myapp/.bin/myapp` on first use (Go must be on PATH).
|
||||
|
||||
## 8. Test it
|
||||
|
||||
Assert the interfaces at compile time and prove no secrets leaked:
|
||||
|
|
@ -352,9 +353,12 @@ func TestNoHardcodedCredentials(t *testing.T) {
|
|||
}
|
||||
```
|
||||
|
||||
`apps/modules/all/all_test.go` already checks every registered module constructs
|
||||
with no values file present, reports a valid key mode, and — if it declares a
|
||||
rewriter name — actually registered one.
|
||||
Smoke-test the external CLI:
|
||||
|
||||
```bash
|
||||
go -C modules/myapp build -o .bin/myapp.exe .
|
||||
./modules/myapp/.bin/myapp.exe describe
|
||||
```
|
||||
|
||||
For anything needing the live service or your local values, use a build tag so the
|
||||
normal run stays hermetic:
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ BBC iPlayer (Android). Streams from the `mobile-phone-main` mediaset are **clear
|
|||
(CDN signed URLs); capture only needs the **MPD/HLS master**. Transparent MITM keeps
|
||||
NordVPN UK on the phone.
|
||||
|
||||
`apps/modules/bbc/module.yaml` is published in the repo (package + channel map only;
|
||||
no secrets). Skeleton:
|
||||
Universal values live in `modules/bbc/module-publish.yaml` (package + full Explore
|
||||
channel map, including S4C). Local `module.yaml` is gitignored and only needs
|
||||
install overrides. Release zips rename publish → `module.yaml`. Skeleton:
|
||||
|
||||
```yaml
|
||||
package: bbc.iplayer.android
|
||||
|
|
@ -68,14 +69,17 @@ adb pull /data/local/tmp/capture/bbc.iplayer.android .\bbc-cap
|
|||
|
||||
### Module-driven capture
|
||||
|
||||
Same transparent path under the hood; waits for `mpd` and writes a session:
|
||||
Same transparent path under the hood. With `--channel`, the module **auto-plays**:
|
||||
Explore → channel logo → Watch live (uiautomator scan, same idea as RTE/TG4).
|
||||
|
||||
```powershell
|
||||
# NordVPN UK ON. Magisk CA should already be mounted.
|
||||
# NordVPN UK ON. Magisk CA should already be mounted. Phone unlocked.
|
||||
.\bin\drm.exe capture --app bbc --channel bbcone --wait 120
|
||||
# Play BBC One on the phone when prompted.
|
||||
```
|
||||
|
||||
`--channel` implies interactive navigation. Drop the channel flag and play by hand
|
||||
if you only want launch + MITM.
|
||||
|
||||
Console prints the MPD in a banner; `outputs/bbc/<stamp>/session.json` holds the
|
||||
same fields (`mpd` required; no `key` / `pssh` for clear streams).
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ entirely for passive mode — the MITM records whatever you play.
|
|||
```
|
||||
|
||||
Open <http://127.0.0.1:8083>. The app and channel pickers are populated from
|
||||
`GET /api/apps`, i.e. from the modules compiled into the binary.
|
||||
`GET /api/apps`, i.e. from providers discovered under `modules/`.
|
||||
|
||||
Create a stream from a capture:
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ go -C apps/modules test -tags live ./rte/ -v
|
|||
|
||||
| Symptom | Cause |
|
||||
|---|---|
|
||||
| `unknown app "x"` | not compiled in — check `apps/modules/all/all.go`, then rebuild |
|
||||
| `unknown module "x"` / `unknown app "x"` | missing under `modules/<name>/` — add the folder or check `drm modules` |
|
||||
| `channels 0` in `drm modules` | no `module.yaml`, or `channels:` is empty |
|
||||
| `unknown channel "y"` | id not in `channels:` and not in `aliases:` |
|
||||
| `tls: unknown certificate` on the phone | CA not mounted — `drm proxy install-ca --reinject` |
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ capture_wait_sec: 180
|
|||
# agent_id: defaults to hostname
|
||||
```
|
||||
|
||||
There is no modules directory to configure — app modules are compiled into the
|
||||
binary.
|
||||
Providers are discovered under `modules/<name>/` next to the install (built and
|
||||
run by the host; not linked into `drm.exe`).
|
||||
|
||||
`wvd` must be set (here or on the phone capture) or key fetches fail.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue