streamd: serve start/stop/update, streamd.yaml, egress, module panel fixes

- Add streamd serve start|stop|restart|status|update with auto-written streamd.yaml
- Panel modules: STREAMD_MODULES_DIR for describe, YAML channel fallback, textarea value fix
- Per-stream WireGuard/SOCKS egress profiles + Settings UI
- Drop drm-* from release builds; track streamd-bg.sh / streamd-update.sh wrappers
- Docs: streamd-server-setup lifecycle and update flow
This commit is contained in:
404errordeveloper 2026-10-10 18:05:51 +02:00
parent da8e1123ec
commit 8fc7e4c0b8
57 changed files with 4031 additions and 257 deletions

View file

@ -28,6 +28,9 @@ const (
var NameRe = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$`)
// archDirRe matches .bin/<goos>-<goarch>/ folder names (never a module name).
var archDirRe = regexp.MustCompile(`^[a-z0-9]+-(amd64|arm64|386|arm)$`)
// Info is one module's metadata for the API and agent sync.
type Info struct {
Name string `json:"name"`
@ -387,23 +390,7 @@ func inspectZipReader(zr *zip.Reader, nameHint string) (string, []zipEntry, erro
}
if hint == "" {
// Try to infer from .bin/<arch>/<name> or .bin/<name>.
for _, f := range zr.File {
n := strings.ReplaceAll(f.Name, "\\", "/")
n = strings.TrimPrefix(n, "./")
if prefix != "" {
if !strings.HasPrefix(n, prefix) {
continue
}
n = strings.TrimPrefix(n, prefix)
}
base := filepath.Base(n)
base = strings.TrimSuffix(base, ".exe")
if strings.HasPrefix(n, ".bin/") && NameRe.MatchString(base) && base != ".bin" {
hint = base
break
}
}
hint = inferNameFromBinEntries(zr, prefix)
}
if hint == "" {
return "", nil, fmt.Errorf("cannot infer module name from zip; pass name=")
@ -476,6 +463,47 @@ func extractZipEntries(zipBytes []byte, entries []zipEntry, destDir string) erro
return nil
}
// inferNameFromBinEntries picks the module binary basename from
// .bin/<arch>/<name>[.exe] or .bin/<name>[.exe]. Directory entries and
// arch folder names (linux-amd64, darwin-arm64, …) are skipped — those used
// to be mistaken for the module name on flat release zips.
func inferNameFromBinEntries(zr *zip.Reader, prefix string) string {
var fallback string
for _, f := range zr.File {
if f.FileInfo().IsDir() {
continue
}
n := strings.ReplaceAll(f.Name, "\\", "/")
n = strings.TrimPrefix(n, "./")
if prefix != "" {
if !strings.HasPrefix(n, prefix) {
continue
}
n = strings.TrimPrefix(n, prefix)
}
n = strings.TrimSuffix(n, "/")
if !strings.HasPrefix(n, ".bin/") {
continue
}
rel := strings.TrimPrefix(n, ".bin/")
parts := strings.Split(rel, "/")
base := parts[len(parts)-1]
base = strings.TrimSuffix(base, ".exe")
if !NameRe.MatchString(base) || archDirRe.MatchString(base) {
continue
}
// Prefer .bin/<arch>/<name>
if len(parts) >= 2 && archDirRe.MatchString(parts[0]) {
return base
}
// .bin/<name>
if len(parts) == 1 && fallback == "" {
fallback = base
}
}
return fallback
}
func isUnder(root, path string) bool {
absRoot, err1 := filepath.Abs(root)
absPath, err2 := filepath.Abs(path)