handler.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package handlers
  2. import (
  3. "net/http"
  4. "github.com/owncast/owncast/webserver/handlers/admin"
  5. "github.com/owncast/owncast/webserver/handlers/generated"
  6. "github.com/owncast/owncast/webserver/router/middleware"
  7. "github.com/owncast/owncast/yp"
  8. )
  9. type ServerInterfaceImpl struct{}
  10. // ensure ServerInterfaceImpl implements ServerInterface.
  11. var _ generated.ServerInterface = &ServerInterfaceImpl{}
  12. func New() *ServerInterfaceImpl {
  13. return &ServerInterfaceImpl{}
  14. }
  15. func (s *ServerInterfaceImpl) Handler() http.Handler {
  16. return generated.Handler(s)
  17. }
  18. func (*ServerInterfaceImpl) GetStatus(w http.ResponseWriter, r *http.Request) {
  19. GetStatus(w, r)
  20. }
  21. func (*ServerInterfaceImpl) GetCustomEmojiList(w http.ResponseWriter, r *http.Request) {
  22. GetCustomEmojiList(w, r)
  23. }
  24. func (*ServerInterfaceImpl) GetChatMessages(w http.ResponseWriter, r *http.Request, params generated.GetChatMessagesParams) {
  25. middleware.RequireUserAccessToken(GetChatMessages)(w, r)
  26. }
  27. func (*ServerInterfaceImpl) RegisterAnonymousChatUser(w http.ResponseWriter, r *http.Request, params generated.RegisterAnonymousChatUserParams) {
  28. RegisterAnonymousChatUser(w, r)
  29. }
  30. func (*ServerInterfaceImpl) RegisterAnonymousChatUserOptions(w http.ResponseWriter, r *http.Request) {
  31. RegisterAnonymousChatUser(w, r)
  32. }
  33. func (*ServerInterfaceImpl) UpdateMessageVisibility(w http.ResponseWriter, r *http.Request, params generated.UpdateMessageVisibilityParams) {
  34. middleware.RequireUserModerationScopeAccesstoken(admin.UpdateMessageVisibility)(w, r)
  35. }
  36. func (*ServerInterfaceImpl) UpdateUserEnabled(w http.ResponseWriter, r *http.Request, params generated.UpdateUserEnabledParams) {
  37. middleware.RequireUserModerationScopeAccesstoken(admin.UpdateUserEnabled)(w, r)
  38. }
  39. func (*ServerInterfaceImpl) GetWebConfig(w http.ResponseWriter, r *http.Request) {
  40. GetWebConfig(w, r)
  41. }
  42. func (*ServerInterfaceImpl) GetYPResponse(w http.ResponseWriter, r *http.Request) {
  43. yp.GetYPResponse(w, r)
  44. }
  45. func (*ServerInterfaceImpl) GetAllSocialPlatforms(w http.ResponseWriter, r *http.Request) {
  46. GetAllSocialPlatforms(w, r)
  47. }
  48. func (*ServerInterfaceImpl) GetVideoStreamOutputVariants(w http.ResponseWriter, r *http.Request) {
  49. GetVideoStreamOutputVariants(w, r)
  50. }
  51. func (*ServerInterfaceImpl) Ping(w http.ResponseWriter, r *http.Request) {
  52. Ping(w, r)
  53. }
  54. func (*ServerInterfaceImpl) RemoteFollow(w http.ResponseWriter, r *http.Request) {
  55. RemoteFollow(w, r)
  56. }
  57. func (*ServerInterfaceImpl) GetFollowers(w http.ResponseWriter, r *http.Request, params generated.GetFollowersParams) {
  58. middleware.HandlePagination(GetFollowers)(w, r)
  59. }
  60. func (*ServerInterfaceImpl) ReportPlaybackMetrics(w http.ResponseWriter, r *http.Request) {
  61. ReportPlaybackMetrics(w, r)
  62. }
  63. func (*ServerInterfaceImpl) RegisterForLiveNotifications(w http.ResponseWriter, r *http.Request, params generated.RegisterForLiveNotificationsParams) {
  64. middleware.RequireUserAccessToken(RegisterForLiveNotifications)(w, r)
  65. }