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
|
|
@ -1,11 +1,13 @@
|
|||
// Command drm is the single entry point for the toolchain: phone capture,
|
||||
// catalog lookups, the always-on agent, the streamd control plane and the
|
||||
// on-device MITM. Every app module under apps/modules is compiled in.
|
||||
// on-device MITM. Providers live under modules/<name>/ and are discovered,
|
||||
// built, and executed by the host — they are not linked into this binary.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"drmdecryption/apps/agent/agentcmd"
|
||||
"drmdecryption/apps/capture/capturecmd"
|
||||
|
|
@ -14,22 +16,33 @@ import (
|
|||
"drmdecryption/apps/proxy/proxyctlcmd"
|
||||
"drmdecryption/apps/streamd/servecmd"
|
||||
"drmdecryption/bootstrap"
|
||||
|
||||
// Links every app module into this binary.
|
||||
_ "drmdecryption/modules/all"
|
||||
"drmdecryption/modhost"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
args := os.Args[1:]
|
||||
modulesDir, args := peelGlobalFlags(args)
|
||||
|
||||
if len(args) < 1 {
|
||||
usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
cmd, args := os.Args[1], os.Args[2:]
|
||||
cmd, args := args[0], args[1:]
|
||||
|
||||
// Materialise apps/, bin/, outputs/, … next to this exe when missing
|
||||
// so a lone downloaded drm.exe becomes a GitHub-like install tree.
|
||||
if modulesDir != "" {
|
||||
if err := modhost.SetModulesDir(modulesDir); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "[!] --modules-dir:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
} else if err := modhost.ApplyEnvModulesDir(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "[!] DRM_MODULES_DIR:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Materialise apps/, bin/, modules/, outputs/, … next to this exe when
|
||||
// missing so a lone downloaded drm.exe becomes a GitHub-like install tree.
|
||||
if cmd != "help" && cmd != "-h" && cmd != "--help" {
|
||||
if err := bootstrap.EnsureAndLog(); err != nil {
|
||||
if err := bootstrap.EnsureAndLogFor(cmd); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "[!] bootstrap:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
@ -62,27 +75,45 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
// peelGlobalFlags extracts host-level flags that may appear before the subcommand.
|
||||
func peelGlobalFlags(args []string) (modulesDir string, rest []string) {
|
||||
rest = make([]string, 0, len(args))
|
||||
for i := 0; i < len(args); i++ {
|
||||
a := args[i]
|
||||
switch {
|
||||
case a == "--modules-dir" || a == "-modules-dir":
|
||||
if i+1 >= len(args) {
|
||||
fmt.Fprintln(os.Stderr, "[!] --modules-dir requires a path")
|
||||
os.Exit(2)
|
||||
}
|
||||
modulesDir = args[i+1]
|
||||
i++
|
||||
case strings.HasPrefix(a, "--modules-dir="):
|
||||
modulesDir = strings.TrimPrefix(a, "--modules-dir=")
|
||||
default:
|
||||
rest = append(rest, a)
|
||||
}
|
||||
}
|
||||
return modulesDir, rest
|
||||
}
|
||||
|
||||
func usage() {
|
||||
fmt.Fprint(os.Stderr, `drm — DRM capture / restream toolchain
|
||||
|
||||
Usage:
|
||||
drm modules list compiled-in app modules and their channels
|
||||
drm capture --app NAME [--channel ID] [--auto-play] [--wvd PATH]
|
||||
one-shot phone MITM capture
|
||||
drm catalog --app NAME --channel ID [--keys] [--json] [--list]
|
||||
resolve a channel from its public catalog (no phone)
|
||||
drm [--modules-dir DIR] modules
|
||||
drm [--modules-dir DIR] capture --app NAME [--channel ID] [--wvd PATH]
|
||||
drm [--modules-dir DIR] catalog --app NAME --channel ID [--keys] [--json]
|
||||
drm agent run|status|devices|enqueue|cancel [--config …]
|
||||
always-on credential refresher
|
||||
drm serve [--bind …] [--data …] [--token …]
|
||||
streamd control plane + dashboard
|
||||
drm proxy build|push|install-ca|start|stop|discover|pull|clear-proxy
|
||||
on-device HTTPS MITM
|
||||
drm proxy build|push|install-ca|start|stop|reset|discover|pull|clear-proxy|transparent
|
||||
|
||||
App module *code* is compiled in; module *values* are never inside the exe.
|
||||
Put configs at apps/modules/<name>/module.yaml yourself (see the GitHub repo).
|
||||
On first run, drm only creates the scaffold (apps/pkg, bin/proxy, outputs, …).
|
||||
Global flags:
|
||||
--modules-dir DIR provider folder (default: <install>/modules, or $DRM_MODULES_DIR)
|
||||
|
||||
Overrides: --<app>.<field> flags or <APP>_<FIELD> environment variables.
|
||||
Providers live under modules/<name>/ (Go source + module-publish.yaml).
|
||||
Local module.yaml holds secrets and is never published; release zips ship
|
||||
module-publish.yaml renamed to module.yaml. The host builds modules on demand.
|
||||
|
||||
Run any subcommand with --help for its own flags.
|
||||
`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue