Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
fix(plugins): make strike auto-disable stop all of a plugin's work
Gabe Kangas1bb1ab2033af
diff --git a/services/plugins/manager.go b/services/plugins/manager.goindex 437aa29c04..7c487d8076 100644--- a/services/plugins/manager.go+++ b/services/plugins/manager.go@@ -142,8 +142,9 @@ func sharedCompilationCache() wazero.CompilationCache {}// IsDisabled reports whether the plugin has been auto-disabled by the-// strike system. Disabled plugins are skipped by both the filter chain-// and the notification dispatcher.+// strike system. Disabled plugins are omitted from Manager.Snapshot, so they+// are skipped by every dispatch and serve path (filter chain, notifications,+// HTTP/SSE routing, timers, and CSS/JS/tab/action contributions).func (l *Loaded) IsDisabled() bool {return l.disabled.Load()}@@ -580,14 +581,23 @@ func hasPerm(perms []string, want string) bool {return false}-// Snapshot returns the currently-loaded plugins. Dispatcher and Server call-// this on every operation so changes from Enable/Disable take effect+// Snapshot returns the currently-loaded, active plugins. Dispatcher and Server+// call this on every operation so changes from Enable/Disable take effect// without restarting anything.+//+// Strike-disabled plugins are omitted: a plugin auto-disabled by the strike+// system must stop doing ALL work — events, HTTP/SSE, timers, and CSS/JS/tab+// contributions all dispatch off this snapshot — not just drop out of the+// filter chain. (The admin UI still sees them via List(), which reports+// AutoDisabled separately.)func (m *Manager) Snapshot() []*Loaded {m.mu.RLock()defer m.mu.RUnlock()out := make([]*Loaded, 0, len(m.loaded))for _, l := range m.loaded {+ if l.IsDisabled() {+ continue+ }out = append(out, l)}return outdiff --git a/services/plugins/manager_test.go b/services/plugins/manager_test.goindex 2e7238a1d1..204748af47 100644--- a/services/plugins/manager_test.go+++ b/services/plugins/manager_test.go@@ -12,6 +12,27 @@ import ("time")+// TestSnapshot_OmitsStrikeDisabledPlugins is the C4 regression: a plugin the+// strike system auto-disabled must drop out of Snapshot, which every dispatch+// and serve path reads from, so it stops doing all work (not just filtering).+func TestSnapshot_OmitsStrikeDisabledPlugins(t *testing.T) {+ m := NewManager(t.TempDir(), &HostEnv{})+ active := &Loaded{Manifest: &Manifest{Slug: "active"}}+ struck := &Loaded{Manifest: &Manifest{Slug: "struck"}}+ struck.disabled.Store(true)+ m.loaded["active"] = active+ m.loaded["struck"] = struck++ got := m.Snapshot()+ if len(got) != 1 || got[0].Manifest.Slug != "active" {+ var slugs []string+ for _, l := range got {+ slugs = append(slugs, l.Manifest.Slug)+ }+ t.Fatalf("Snapshot should omit strike-disabled plugins; got %v", slugs)+ }+}+// makePluginFiles drops a sidecar wasm + manifest pair into dir. The manifest// name is what the manager keys discovered/enabled state by.func makePluginFiles(t *testing.T, dir, name string, wasmBytes []byte) {