diff options
author | 2024-05-29 12:56:17 +0200 | |
---|---|---|
committer | 2024-05-29 12:56:17 +0200 | |
commit | f9a4a6120db69e5ead542cb130533b0c20e2cd66 (patch) | |
tree | f2b465c2e79fb63908e8bb7c642f089b0e653020 /internal/api/client/admin/admin.go | |
parent | [chore/bugfix] Don't cache MovedTo account (#2939) (diff) | |
download | gotosocial-f9a4a6120db69e5ead542cb130533b0c20e2cd66.tar.xz |
[feature] Debug admin endpoint to clear caches (#2940)
* [feature] Debug admin endpoint to clear caches
* go fmt
Diffstat (limited to 'internal/api/client/admin/admin.go')
-rw-r--r-- | internal/api/client/admin/admin.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/api/client/admin/admin.go b/internal/api/client/admin/admin.go index e898bca46..ef54f0b50 100644 --- a/internal/api/client/admin/admin.go +++ b/internal/api/client/admin/admin.go @@ -23,6 +23,7 @@ import ( "codeberg.org/gruf/go-debug" "github.com/gin-gonic/gin" "github.com/superseriousbusiness/gotosocial/internal/processing" + "github.com/superseriousbusiness/gotosocial/internal/state" ) const ( @@ -56,6 +57,7 @@ const ( InstanceRulesPathWithID = InstanceRulesPath + "/:" + IDKey DebugPath = BasePath + "/debug" DebugAPUrlPath = DebugPath + "/apurl" + DebugClearCachesPath = DebugPath + "/caches/clear" IDKey = "id" FilterQueryKey = "filter" @@ -73,11 +75,13 @@ const ( type Module struct { processor *processing.Processor + state *state.State } -func New(processor *processing.Processor) *Module { +func New(state *state.State, processor *processing.Processor) *Module { return &Module{ processor: processor, + state: state, } } @@ -145,5 +149,6 @@ func (m *Module) Route(attachHandler func(method string, path string, f ...gin.H // debug stuff if debug.DEBUG { attachHandler(http.MethodGet, DebugAPUrlPath, m.DebugAPUrlHandler) + attachHandler(http.MethodPost, DebugClearCachesPath, m.DebugClearCachesHandler) } } |