This commit is contained in:
onysd 2026-08-25 00:20:05 +03:00
parent fe1cf1184f
commit e6a777983c
10 changed files with 174 additions and 2 deletions

View file

@ -126,6 +126,7 @@ func (s *server) routes() http.Handler {
mux.Handle("POST /api/actions/set-gif-catalog-sort-order", s.requireAuthAPI(http.HandlerFunc(s.handleSetGifCatalogSortOrderAPI)))
mux.Handle("POST /api/actions/set-gif-catalog-category", s.requireAuthAPI(http.HandlerFunc(s.handleSetGifCatalogCategoryAPI)))
mux.Handle("POST /api/actions/auto-categorize-gif-catalog", s.requireAuthAPI(http.HandlerFunc(s.handleAutoCategorizeGifCatalogAPI)))
mux.Handle("POST /api/actions/delete-uncategorized-gifs", s.requireAuthAPI(http.HandlerFunc(s.handleDeleteUncategorizedGifsAPI)))
mux.Handle("POST /api/actions/delete-gif-catalog-entry", s.requireAuthAPI(http.HandlerFunc(s.handleDeleteGifCatalogEntryAPI)))
mux.Handle("POST /api/actions/mint-collectible-username", s.requireAuthAPI(http.HandlerFunc(s.handleMintCollectibleUsernameAPI)))
mux.Handle("POST /api/actions/transfer-collectible-username", s.requireAuthAPI(http.HandlerFunc(s.handleTransferCollectibleUsernameAPI)))
@ -1961,6 +1962,24 @@ func (s *server) handleAutoCategorizeGifCatalogAPI(w http.ResponseWriter, r *htt
writeCommandResultAPI(w, result, err)
}
type deleteUncategorizedGifsAPIRequest struct {
CommandID string `json:"command_id"`
Reason string `json:"reason"`
Confirm bool `json:"confirm"`
}
func (s *server) handleDeleteUncategorizedGifsAPI(w http.ResponseWriter, r *http.Request) {
var body deleteUncategorizedGifsAPIRequest
if !decodeAction(w, r, &body) {
return
}
req := admin.DeleteUncategorizedGifsRequest{
CommandMeta: s.commandMetaFromAPI(r, body.CommandID, body.Reason, body.Confirm, "delete-uncategorized-gifs"),
}
result, err := s.callAdminAPI(r.Context(), "/v1/gif-catalog/delete-uncategorized", req)
writeCommandResultAPI(w, result, err)
}
type deleteGifCatalogEntryAPIRequest struct {
CommandID string `json:"command_id"`
Reason string `json:"reason"`

View file

@ -23,7 +23,7 @@
})();
</script>
<script type="module" crossorigin src="/assets/index-CUyr22ox.js"></script>
<script type="module" crossorigin src="/assets/index-Bt9UBcEE.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CQKJMNpu.css">
</head>
<body>

View file

@ -104,6 +104,13 @@ export function GifCatalogPage() {
payload={() => ({})}
onDone={() => void load()}
/>
<ActionButton
tone="danger"
label={"Delete uncategorized"}
path="/api/actions/delete-uncategorized-gifs"
payload={() => ({})}
onDone={() => void load()}
/>
<button className="btn primary" type="button" onClick={() => setCreateOpen(true)}>
<Plus size={15} /> {"Add GIF"}
</button>