feat(ops): add object storage management and site-mapping CSV import/export

Ship the Ops backstage 对象存储 page (browse / upload / move / delete /
folder ops) backed by a new object-storage service + handler, with the
shared storage client extended with List/Stat/Copy/Usage/DownloadURL so
both MinIO and Aliyun providers cover the new surface. Add
ForcePathStyle to the object-storage config and treat r2/s3/custom_s3
as external providers so Cloudflare R2 and other S3-compatibles can
share the MinIO client path without spinning up the bundled MinIO.

Also add CSV import/export + template download to the site-domain
mappings page, raise gin MaxMultipartMemory to 8 MiB for the new
multipart endpoints, register Ops swagger routes, and extend the
descriptions-parity test to cover the ops router.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 01:19:01 +08:00
parent 5f6e9f11da
commit 7d8e82c69f
37 changed files with 5111 additions and 66 deletions
@@ -13,14 +13,17 @@ import (
// TestRouteDocs_CoversEveryRouterEntry parses the tenant-api router source and
// asserts that every registered route has a corresponding entry in routeDocs.
// This is a static-analysis safety net: when a new handler is wired up in
// internal/tenant/transport/router.go, this test fails until a Chinese
// tenant or ops transport routers, this test fails until a Chinese
// summary is added.
func TestRouteDocs_CoversEveryRouterEntry(t *testing.T) {
routerPath, bootstrapPath := findRepoSources(t)
routerPaths, bootstrapPath := findRepoSources(t)
routes := append(parseRoutes(t, routerPath), parseEngineRoutes(t, bootstrapPath)...)
routes := parseEngineRoutes(t, bootstrapPath)
for _, routerPath := range routerPaths {
routes = append(routes, parseRoutes(t, routerPath)...)
}
if len(routes) == 0 {
t.Fatalf("could not extract any routes from %s", routerPath)
t.Fatalf("could not extract any routes from %s", strings.Join(routerPaths, ", "))
}
missing := make([]string, 0)
@@ -133,7 +136,7 @@ func parseEngineRoutes(t *testing.T, path string) []parsedRoute {
return routes
}
func findRepoSources(t *testing.T) (router, bootstrap string) {
func findRepoSources(t *testing.T) (routers []string, bootstrap string) {
t.Helper()
_, file, _, ok := runtime.Caller(0)
if !ok {
@@ -142,6 +145,9 @@ func findRepoSources(t *testing.T) (router, bootstrap string) {
// .../server/internal/shared/swagger/descriptions_parity_test.go ->
// .../server is three levels up from this file's parent dir.
serverRoot := filepath.Clean(filepath.Join(filepath.Dir(file), "..", "..", ".."))
return filepath.Join(serverRoot, "internal", "tenant", "transport", "router.go"),
return []string{
filepath.Join(serverRoot, "internal", "tenant", "transport", "router.go"),
filepath.Join(serverRoot, "internal", "ops", "transport", "router.go"),
},
filepath.Join(serverRoot, "internal", "bootstrap", "bootstrap.go")
}