- Preview player can select FHD/HD/SD (or ABR master) from publish links - Embed dashboard screenshots in README; Linux streamd+agent setup guide - C4 Widevine wrap license mode + require --wvd; prefer Widevine PSSH - Channel 4 and My5 modules; streamd auth, variants, schedules, HLS gate
57 lines
1.5 KiB
Go
57 lines
1.5 KiB
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"drmdecryption/apps/streamd/internal/auth"
|
|
"drmdecryption/modhost"
|
|
"drmdecryption/mpd"
|
|
"drmdecryption/repo"
|
|
)
|
|
|
|
// appInfo describes one modules/<name>/ provider 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 exist under modules/.
|
|
func (h *Handler) apps(w http.ResponseWriter, r *http.Request) {
|
|
if r.Method != http.MethodGet {
|
|
writeErr(w, http.StatusMethodNotAllowed, "method not allowed")
|
|
return
|
|
}
|
|
if _, ok := auth.Guard(w, r, auth.RoleViewer); !ok {
|
|
return
|
|
}
|
|
out := []appInfo{}
|
|
listed, err := modhost.ListAll(repo.Root())
|
|
if err != nil {
|
|
writeErr(w, http.StatusInternalServerError, err.Error())
|
|
return
|
|
}
|
|
for _, L := range listed {
|
|
d := L.Desc
|
|
info := appInfo{Name: d.Name, Channels: []channelInfo{}, Rewriter: "none"}
|
|
for _, ch := range d.Channels {
|
|
info.Channels = append(info.Channels, channelInfo{ID: ch.ID, Label: ch.Label})
|
|
}
|
|
info.HasConfig = len(info.Channels) > 0
|
|
if d.Rewriter != "" {
|
|
info.Rewriter = d.Rewriter
|
|
}
|
|
out = append(out, info)
|
|
}
|
|
writeJSON(w, http.StatusOK, map[string]any{
|
|
"apps": out,
|
|
"rewriters": mpd.Names(),
|
|
})
|
|
}
|