mirror of
https://github.com/navidrome/navidrome.git
synced 2026-06-02 07:01:36 +00:00
refactor(plugins): update newWebSocketService to use WebSocketPermission for allowed hosts
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
17d0e48a01
commit
5201f8a5eb
@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user