Streamd v0.2.0: rename, modules panel, stable/beta channels
All checks were successful
release / build-and-upload (push) Successful in 7m5s

- Rename product/host binary to streamd (drm compat copy still shipped)
- Go module path streamd; STREAMD_* env aliases; agent UA streamd-agent
- Panel Modules store + agent pull sync (modstore / modsync)
- Rolling stable + beta download tags; README/docs channel curl blocks
- Release notes in docs/releases/v0.2.0.md attached by Forgejo Actions
This commit is contained in:
404errordeveloper 2026-10-10 15:58:26 +02:00
parent 066e018749
commit da8e1123ec
140 changed files with 2949 additions and 851 deletions

View file

@ -7,6 +7,7 @@ import (
"fmt"
"io"
"net/http"
"os"
"strings"
"time"
)
@ -180,9 +181,13 @@ func (c *Client) PostEvent(streamID int64, kind, message string, detail map[stri
// ModuleInfo is one modules/<name>/ entry from GET /api/modules.
type ModuleInfo struct {
Name string `json:"name"`
HasYAML bool `json:"has_yaml"`
YAMLSHA256 string `json:"yaml_sha256,omitempty"`
Name string `json:"name"`
HasYAML bool `json:"has_yaml"`
YAMLSHA256 string `json:"yaml_sha256,omitempty"`
HasPackage bool `json:"has_package"`
PackageSHA256 string `json:"package_sha256,omitempty"`
Arches []string `json:"arches,omitempty"`
SizeBytes int64 `json:"size_bytes,omitempty"`
}
func (c *Client) ListModules() ([]ModuleInfo, error) {
@ -199,30 +204,64 @@ func (c *Client) ListModules() ([]ModuleInfo, error) {
return wrap.Modules, nil
}
// PutModuleYAML uploads raw module.yaml bytes for name (Content-Type text/yaml).
func (c *Client) PutModuleYAML(name string, yamlBytes []byte) error {
req, err := http.NewRequest(http.MethodPut, c.BaseURL+"/api/modules/"+name, bytes.NewReader(yamlBytes))
// GetModuleYAML downloads raw module.yaml bytes for name.
func (c *Client) GetModuleYAML(name string) ([]byte, error) {
req, err := http.NewRequest(http.MethodGet, c.BaseURL+"/api/modules/"+name+"/yaml", nil)
if err != nil {
return nil, err
}
c.setHeaders(req)
resp, err := c.HTTP.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, _ := io.ReadAll(io.LimitReader(resp.Body, 2<<20))
if resp.StatusCode >= 300 {
return nil, c.statusError(http.MethodGet, "/api/modules/"+name+"/yaml", resp, body)
}
return body, nil
}
// DownloadModulePackage writes the module zip to destPath.
func (c *Client) DownloadModulePackage(name, destPath string) error {
req, err := http.NewRequest(http.MethodGet, c.BaseURL+"/api/modules/"+name+"/package", nil)
if err != nil {
return err
}
req.Header.Set("Content-Type", "text/yaml")
c.setHeaders(req)
resp, err := c.HTTP.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
body, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
if resp.StatusCode >= 300 {
return c.statusError(http.MethodPut, "/api/modules/"+name, resp, body)
body, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
return c.statusError(http.MethodGet, "/api/modules/"+name+"/package", resp, body)
}
return nil
tmp := destPath + ".partial"
f, err := os.OpenFile(tmp, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0o644)
if err != nil {
return err
}
_, copyErr := io.Copy(f, io.LimitReader(resp.Body, 100<<20))
closeErr := f.Close()
if copyErr != nil {
_ = os.Remove(tmp)
return copyErr
}
if closeErr != nil {
_ = os.Remove(tmp)
return closeErr
}
_ = os.Remove(destPath)
return os.Rename(tmp, destPath)
}
func (c *Client) setHeaders(req *http.Request) {
ua := c.UserAgent
if ua == "" {
ua = "drm-agent/" + Version
ua = "streamd-agent/" + Version
}
req.Header.Set("User-Agent", ua)
if c.Token != "" {