(f apiRequestFunc)
| 328 | type isAuthorizedFunc func(ctx context.Context, rc requestContext) bool |
| 329 | |
| 330 | func (s *Server) handleServerControlAPI(f apiRequestFunc) http.HandlerFunc { |
| 331 | return s.handleServerControlAPIPossiblyNotConnected(func(ctx context.Context, rc requestContext) (any, *apiError) { |
| 332 | if rc.rep == nil { |
| 333 | return nil, requestError(serverapi.ErrorNotConnected, "not connected") |
| 334 | } |
| 335 | |
| 336 | return f(ctx, rc) |
| 337 | }) |
| 338 | } |
| 339 | |
| 340 | func (s *Server) handleServerControlAPIPossiblyNotConnected(f apiRequestFunc) http.HandlerFunc { |
| 341 | return s.handleRequestPossiblyNotConnected(requireServerControlUser, csrfTokenNotRequired, func(ctx context.Context, rc requestContext) (any, *apiError) { |
no test coverage detected