Cross Compile Go / build (push) Canceled after 0s
- compute duplicate-hash statistics in their own job (startup, hourly, on demand) so they no longer block the table stats - single-pass query over DISTINCT (hash, addon_id), 15 min timeout - record errors and panics; never stay stuck in a computing state - whitelist page polls while computing, shows errors and a Recompute button; tab is linkable via ?tab=shared
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
package admin
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitea.tbdevent.eu/TBD/reforger_crawler_main/auth"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// Register mounts the admin JSON API under /admin/api and the legacy
|
|
// header-authenticated /admin/addWhitelistedHash endpoint.
|
|
func Register(r *gin.Engine) {
|
|
r.POST("/admin/addWhitelistedHash", auth.RequireAdminHeader, legacyAddWhitelistedHash)
|
|
|
|
api := r.Group("/admin/api")
|
|
api.POST("/auth/login", login)
|
|
api.POST("/auth/logout", logout)
|
|
|
|
p := api.Group("", auth.RequireAdmin)
|
|
p.GET("/auth/me", me)
|
|
|
|
p.GET("/overview", overview)
|
|
p.GET("/overview/duplicates", duplicateHashes)
|
|
p.POST("/overview/duplicates/refresh", refreshDuplicates)
|
|
|
|
p.GET("/queue", queue)
|
|
p.POST("/queue/reset-stuck", resetStuck)
|
|
|
|
p.GET("/addons", listAddons)
|
|
p.GET("/addons/:id", addonDetail)
|
|
p.GET("/addons/:id/files", addonFiles)
|
|
p.POST("/addons/:id/:action", addonAction)
|
|
p.DELETE("/addons/:id", deleteAddon)
|
|
p.DELETE("/addons/:id/purge", purgeAddon)
|
|
p.POST("/bulk/addons", bulkAddons)
|
|
|
|
p.GET("/whitelist", listWhitelist)
|
|
p.POST("/whitelist", addWhitelist)
|
|
p.DELETE("/whitelist/:id", deleteWhitelist)
|
|
p.GET("/hashes/:hash", hashUsage)
|
|
|
|
p.GET("/metrics/catalog", metricsCatalog)
|
|
p.GET("/metrics/query", metricsQuery)
|
|
p.GET("/traffic", traffic)
|
|
p.GET("/top", topItems)
|
|
|
|
p.GET("/services", listServices)
|
|
p.GET("/services/events", listEvents)
|
|
p.DELETE("/services/:id", deleteService)
|
|
|
|
p.GET("/system", system)
|
|
p.POST("/system/maintenance", maintenance)
|
|
}
|
|
|
|
// StartBackground runs the periodic heavy statistics job.
|
|
func StartBackground(ctx context.Context) {
|
|
go heavyStatsLoop(ctx)
|
|
}
|