Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

fix(plugins): catch package load regressions before push

Gabe Kangas0da9311fac0a
diff --git a/lefthook.yml b/lefthook.yml
index 56330a6a63..a0b045c0a9 100644
--- a/lefthook.yml
+++ b/lefthook.yml
@@ -15,6 +15,9 @@
pre-push:
parallel: true
commands:
+ go-test:
+ glob: '*.{go,mod,sum}'
+ run: go test ./... > /dev/null
web-build:
root: web/
run: npm run build
diff --git a/services/plugins/manager.go b/services/plugins/manager.go
index 3e69d558f8..97e502f9ac 100644
--- a/services/plugins/manager.go
+++ b/services/plugins/manager.go
@@ -526,7 +526,15 @@ func validateUploadedPackage(ctx context.Context, env *HostEnv, packageBytes []b
// "install" successfully from the catalog, then only surfaces as a
// discovered-but-broken plugin later. The admin clicked Install, so the
// operation should fail up front if the package cannot be loaded.
- loaded, err := loadFromBytes(ctx, env, manifestBytes, wasmBytes, manifest.Slug)
+ // Extract assetsFS from the zip before calling loadFromBytes so register()
+ // sees the same owncast_asset_read host function behavior as a real load.
+ var assetsFS fs.FS
+ if hasZipDir(zr, pkgAssetsPrefix) {
+ if sub, err := fs.Sub(zr, strings.TrimSuffix(pkgAssetsPrefix, "/")); err == nil {
+ assetsFS = sub
+ }
+ }
+ loaded, err := loadFromBytes(ctx, env, manifestBytes, wasmBytes, manifest.Slug, assetsFS)
if err != nil {
return nil, err
}