From 7d20118f389ea7644ca424f7ba6cddad828f118e Mon Sep 17 00:00:00 2001 From: ssongliu Date: Tue, 26 May 2026 17:28:26 +0800 Subject: [PATCH] feat: add router expires alert (#12855) --- core/middleware/operation.go | 12 +- .../src/components/router-button/index.vue | 120 +++++++++++++++--- frontend/src/lang/modules/en.ts | 10 +- frontend/src/lang/modules/es-es.ts | 10 +- frontend/src/lang/modules/ja.ts | 10 +- frontend/src/lang/modules/ko.ts | 10 +- frontend/src/lang/modules/ms.ts | 10 +- frontend/src/lang/modules/pt-br.ts | 10 +- frontend/src/lang/modules/ru.ts | 10 +- frontend/src/lang/modules/tr.ts | 10 +- frontend/src/lang/modules/zh-Hant.ts | 5 +- frontend/src/lang/modules/zh.ts | 5 +- frontend/src/views/app-store/apps/index.vue | 2 +- 13 files changed, 160 insertions(+), 64 deletions(-) diff --git a/core/middleware/operation.go b/core/middleware/operation.go index 16edab468..7fcae5dc4 100644 --- a/core/middleware/operation.go +++ b/core/middleware/operation.go @@ -106,7 +106,7 @@ func OperationLog() gin.HandlerFunc { writer := responseBodyWriter{ ResponseWriter: c.Writer, body: &bytes.Buffer{}, - captureBody: shouldCaptureResponseBody(c.Request.URL.Path), + captureBody: !strings.Contains(strings.ToLower(c.Request.URL.Path), "download"), } c.Writer = &writer now := time.Now() @@ -272,16 +272,8 @@ func (r *responseBodyWriter) Write(b []byte) (int, error) { return r.ResponseWriter.Write(b) } -func shouldCaptureResponseBody(reqPath string) bool { - reqPath = strings.ToLower(reqPath) - if strings.Contains(reqPath, "download") { - return false - } - return true -} - func loadLogInfo(path string) string { - path = replaceStr(path, "/api/v2", "/core", "/xpack") + path = replaceStr(path, "/api/v2", "/core", "/xpack", "/enterprise") if !strings.Contains(path, "/") { return "" } diff --git a/frontend/src/components/router-button/index.vue b/frontend/src/components/router-button/index.vue index c4e7f9942..e08011b94 100644 --- a/frontend/src/components/router-button/index.vue +++ b/frontend/src/components/router-button/index.vue @@ -1,25 +1,44 @@