From bdd4b6acecb8011d01d47aaf6b8916b16c31fbc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Tue, 30 Dec 2025 19:41:23 +0100 Subject: feat(backend): does not update stats if user is admin --- backend/router.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'backend') diff --git a/backend/router.go b/backend/router.go index e11db94..3928119 100644 --- a/backend/router.go +++ b/backend/router.go @@ -124,8 +124,12 @@ func NewRouter(debug bool, cfg *Config, db *sql.DB, assets fs.FS) *chi.Mux { if strings.HasPrefix(r.RequestURI, "/static") { return } - statusCode := GetStatusCode(ctx)() logger := GetLogger(ctx) + if ctx.Value(loginKey).(bool) { + logger.Debug("not updating stats because user is admin logged") + return + } + statusCode := GetStatusCode(ctx)() if statusCode >= 299 && r.RequestURI != storage.HumanPageLoad { logger.Debug("not updating stats for status code above 299", "status", statusCode) return -- cgit v1.2.3