From 59fb736b8154a033dba6aef7319f64957c51de2e Mon Sep 17 00:00:00 2001 From: Edilson Chaves Date: Mon, 20 Apr 2026 13:28:18 -0300 Subject: [PATCH 1/2] feat(dashboard): add real metrics to manager dashboard The /manager dashboard previously showed only a static placeholder ("Dashboard content will be implemented here..."). This replaces it with a standalone HTML page that fetches live data from the API and displays real metrics: - Total instances count - Connected instances count and percentage - Disconnected instances count - Server health status (GET /server/ok) - AlwaysOnline count - Instance table with name, status badge, phone number, client and AlwaysOnline indicator - Auto-refresh every 30 seconds with manual refresh button Implementation uses a standalone HTML file (Tailwind CDN + vanilla JS fetch) served at GET /manager, keeping the existing compiled bundle intact for all other routes (/manager/instances, /manager/login, etc.). Changes: - manager/dashboard/index.html: new self-contained dashboard page - pkg/routes/routes.go: serve dashboard/index.html for GET /manager (exact), keep dist/index.html for GET /manager/*any (wildcard) - Dockerfile: copy manager/dashboard/ into the final image - .gitignore: exclude manager build artifacts from version control Co-Authored-By: Claude Sonnet 4.6 --- .gitignore | 9 ++ Dockerfile | 1 + manager/dashboard/index.html | 258 +++++++++++++++++++++++++++++++++++ pkg/routes/routes.go | 9 +- 4 files changed, 273 insertions(+), 4 deletions(-) create mode 100644 manager/dashboard/index.html diff --git a/.gitignore b/.gitignore index 03ad15e..83e4eeb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,12 @@ coverage.* .idea/ .vscode/ .DS_Store +manager/node_modules/ +manager/src/ +manager/package.json +manager/package-lock.json +manager/postcss.config.js +manager/tailwind.config.ts +manager/tsconfig*.json +manager/vite.config.ts +manager/index.html diff --git a/Dockerfile b/Dockerfile index 4c0c7d6..319b1f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,7 @@ WORKDIR /app COPY --from=build /build/server . COPY --from=build /build/manager/dist ./manager/dist +COPY --from=build /build/manager/dashboard ./manager/dashboard COPY --from=build /build/VERSION ./VERSION ENV TZ=America/Sao_Paulo diff --git a/manager/dashboard/index.html b/manager/dashboard/index.html new file mode 100644 index 0000000..ea4d4d0 --- /dev/null +++ b/manager/dashboard/index.html @@ -0,0 +1,258 @@ + + + + + + Evolution GO Manager + + + + + + +
+ + + + +
+
+ + +
+
+

Dashboard

+

Visão geral das instâncias WhatsApp

+
+ +
+ + +
+
+
+

Total de Instâncias

+
+ + + +
+
+

+

registradas no sistema

+
+ +
+
+

Conectadas

+
+ + + +
+
+

+

do total

+
+ +
+
+

Desconectadas

+
+ + + +
+
+

+

aguardando reconexão

+
+ +
+
+

Servidor

+
+ + + +
+
+

+

verificando…

+
+
+ + +
+
+

Instâncias

+

Atualizado automaticamente a cada 30s

+
+
+
Carregando…
+
+
+ +
+
+
+ + + + diff --git a/pkg/routes/routes.go b/pkg/routes/routes.go index f51e7d9..1c1cc88 100644 --- a/pkg/routes/routes.go +++ b/pkg/routes/routes.go @@ -66,12 +66,13 @@ func (r *Routes) AssignRoutes(eng *gin.Engine) { // Rotas para o gerenciador React (sem autenticação) eng.Static("/assets", "./manager/dist/assets") - // Ajuste nas rotas do manager para suportar client-side routing do React - eng.GET("/manager/*any", func(c *gin.Context) { - c.File("manager/dist/index.html") + // Dashboard com métricas reais (página standalone) + eng.GET("/manager", func(c *gin.Context) { + c.File("manager/dashboard/index.html") }) - eng.GET("/manager", func(c *gin.Context) { + // Demais rotas do manager (instâncias, login, etc.) — bundle original + eng.GET("/manager/*any", func(c *gin.Context) { c.File("manager/dist/index.html") }) From f8c7d23580a006a85fe8d5c263e635cbb5cf35b7 Mon Sep 17 00:00:00 2001 From: Edilson Chaves Date: Mon, 20 Apr 2026 13:49:45 -0300 Subject: [PATCH 2/2] fix(dashboard): prevent XSS and handle missing API key clearly Replaces innerHTML interpolation of server-supplied fields (name, clientName, jid) with DOM createElement/textContent to eliminate potential XSS. Also detects a missing or empty API key before making any requests and renders an actionable message explaining how to set it, instead of showing a generic fetch error. --- manager/dashboard/index.html | 110 ++++++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 34 deletions(-) diff --git a/manager/dashboard/index.html b/manager/dashboard/index.html index ea4d4d0..de8a092 100644 --- a/manager/dashboard/index.html +++ b/manager/dashboard/index.html @@ -147,7 +147,14 @@

Instâncias