Rework utils/restendpointhelper to use the new chi router functionality (#3750)

* Remove old implementation, add new function to work with the chi router

* Use new URL Param function to get clientID instead

* Remove usage of old restendpoint functions

* Fix typo in url param name

* Remove unused tests
This commit is contained in:
mahmed2000
2024-05-31 00:31:07 +05:00
committed by GitHub
parent a529502809
commit 414a8aeed8
4 changed files with 9 additions and 103 deletions

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncast/owncast/controllers/admin"
"github.com/owncast/owncast/core/user"
"github.com/owncast/owncast/router/middleware"
"github.com/owncast/owncast/utils"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
@@ -20,8 +19,6 @@ func (*ServerInterfaceImpl) SendSystemMessageOptions(w http.ResponseWriter, r *h
}
func (*ServerInterfaceImpl) SendSystemMessageToConnectedClient(w http.ResponseWriter, r *http.Request, clientId int) {
// doing this hack to make the new system work with the old system
r.Header[utils.RestURLPatternHeaderKey] = []string{`/api/integrations/chat/system/client/{clientId}`}
middleware.RequireExternalAPIAccessToken(user.ScopeCanSendSystemMessages, admin.SendSystemMessageToConnectedClient)(w, r)
}