From 5e060d0bcb9af77e7b6d11acba99db6219d4f68e Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sat, 10 Dec 2022 22:43:11 +0100 Subject: [feature] Start implementing refetch of lost media files via `/api/v1/admin/media_refetch` (#1221) * [chore] Move ShortcodeDomain to its own little util func * [feature] Add RefetchEmojis function to media manager * [feature] Expose admin media refresh via admin API * update following review feedback - change/fix log levels - make sure not to try to refetch local emojis - small style refactoring + comments * log on emoji refetch start Signed-off-by: kim Co-authored-by: kim --- internal/api/client/admin/admin.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/api/client/admin/admin.go') diff --git a/internal/api/client/admin/admin.go b/internal/api/client/admin/admin.go index 7032a5b95..569354c96 100644 --- a/internal/api/client/admin/admin.go +++ b/internal/api/client/admin/admin.go @@ -46,6 +46,7 @@ const ( // AccountsActionPath is used for taking action on a single account. AccountsActionPath = AccountsPathWithID + "/action" MediaCleanupPath = BasePath + "/media_cleanup" + MediaRefetchPath = BasePath + "/media_refetch" // ExportQueryKey is for requesting a public export of some data. ExportQueryKey = "export" @@ -63,6 +64,8 @@ const ( MinShortcodeDomainKey = "min_shortcode_domain" // LimitKey is for specifying maximum number of results to return. LimitKey = "limit" + // DomainQueryKey is for specifying a domain during admin actions. + DomainQueryKey = "domain" ) // Module implements the ClientAPIModule interface for admin-related actions (reports, emojis, etc) @@ -90,6 +93,7 @@ func (m *Module) Route(r router.Router) error { r.AttachHandler(http.MethodDelete, DomainBlocksPathWithID, m.DomainBlockDELETEHandler) r.AttachHandler(http.MethodPost, AccountsActionPath, m.AccountActionPOSTHandler) r.AttachHandler(http.MethodPost, MediaCleanupPath, m.MediaCleanupPOSTHandler) + r.AttachHandler(http.MethodPost, MediaRefetchPath, m.MediaRefetchPOSTHandler) r.AttachHandler(http.MethodGet, EmojiCategoriesPath, m.EmojiCategoriesGETHandler) return nil } -- cgit v1.2.3