refactor(plugins): update newWebSocketService to use WebSocketPermission for allowed hosts

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan 2025-12-28 13:48:21 -05:00
parent 17d0e48a01
commit 5201f8a5eb
2 changed files with 3 additions and 3 deletions

View File

@ -59,11 +59,11 @@ type webSocketServiceImpl struct {
}
// newWebSocketService creates a new WebSocketService for a plugin.
func newWebSocketService(pluginName string, manager *Manager, allowedHosts []string) *webSocketServiceImpl {
func newWebSocketService(pluginName string, manager *Manager, permission *WebSocketPermission) *webSocketServiceImpl {
return &webSocketServiceImpl{
pluginName: pluginName,
manager: manager,
allowedHosts: allowedHosts,
allowedHosts: permission.AllowedHosts,
connections: make(map[string]*wsConnection),
}
}

View File

@ -63,7 +63,7 @@ var hostServices = []hostServiceEntry{
registerStubs: func() []extism.HostFunction { return host.RegisterWebSocketHostFunctions(nil) },
create: func(ctx *serviceContext) ([]extism.HostFunction, io.Closer) {
perm := ctx.permissions.Websocket
service := newWebSocketService(ctx.pluginName, ctx.manager, perm.AllowedHosts)
service := newWebSocketService(ctx.pluginName, ctx.manager, perm)
return host.RegisterWebSocketHostFunctions(service), service
},
},