From 545b9983f7a023ce4697e3fbd7d3ab087341ac4c Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Wed, 21 Aug 2024 14:16:49 -0700 Subject: [PATCH] fix(api): return http 405 if federation is diabled --- activitypub/controllers/nodeinfo.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/activitypub/controllers/nodeinfo.go b/activitypub/controllers/nodeinfo.go index aeb9832dd..ddddf4def 100644 --- a/activitypub/controllers/nodeinfo.go +++ b/activitypub/controllers/nodeinfo.go @@ -284,6 +284,12 @@ func writeResponse(payload interface{}, w http.ResponseWriter) error { // HostMetaController points to webfinger. func HostMetaController(w http.ResponseWriter, r *http.Request) { + if !data.GetFederationEnabled() { + w.WriteHeader(http.StatusMethodNotAllowed) + log.Debugln("host meta request rejected! Federation is not enabled") + return + } + serverURL := data.GetServerURL() if serverURL == "" { w.WriteHeader(http.StatusNotFound)