Initial commit: Null DRM Official
Capture, decrypt, and restream toolkit with compiled-in app modules (RTE, TG4, BBC), on-device MITM proxy, streamd control plane, and www. BBC module.yaml is published (clear streams); other module values stay local.
This commit is contained in:
commit
2fa8f2435f
121 changed files with 17802 additions and 0 deletions
47
apps/streamd/internal/api/apps.go
Normal file
47
apps/streamd/internal/api/apps.go
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"drmdecryption/app"
|
||||
"drmdecryption/mpd"
|
||||
)
|
||||
|
||||
// appInfo describes one compiled-in app module to the dashboard, so the UI never
|
||||
// has to hardcode a provider or channel name.
|
||||
type appInfo struct {
|
||||
Name string `json:"name"`
|
||||
Channels []channelInfo `json:"channels"`
|
||||
Rewriter string `json:"rewriter"`
|
||||
HasConfig bool `json:"has_config"`
|
||||
}
|
||||
|
||||
type channelInfo struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
}
|
||||
|
||||
// apps answers GET /api/apps: which providers this binary was built with.
|
||||
func (h *Handler) apps(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodGet {
|
||||
writeErr(w, http.StatusMethodNotAllowed, "method not allowed")
|
||||
return
|
||||
}
|
||||
out := []appInfo{}
|
||||
for _, a := range app.All() {
|
||||
info := appInfo{Name: a.Name(), Channels: []channelInfo{}, Rewriter: "none"}
|
||||
for _, ch := range a.Channels() {
|
||||
info.Channels = append(info.Channels, channelInfo{ID: ch.ID, Label: ch.Label})
|
||||
}
|
||||
// A module with no local values file has no channels to offer yet.
|
||||
info.HasConfig = len(info.Channels) > 0
|
||||
if sd, ok := a.(app.StreamDefaults); ok {
|
||||
info.Rewriter = sd.RewriterName()
|
||||
}
|
||||
out = append(out, info)
|
||||
}
|
||||
writeJSON(w, http.StatusOK, map[string]any{
|
||||
"apps": out,
|
||||
"rewriters": mpd.Names(),
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue