From 5f3e9ed0ea6e77704b7d1bad2d458bbd59f01df7 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Mon, 11 May 2026 10:06:01 +0200 Subject: [PATCH] feat(xray/nord): searchable server list + colored load tag, surface API errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frontend (NordModal.vue): - Server selector gets show-search with the option label set to `${cityName} ${name} ${hostname}` so admins can find a specific server inside a 100+ entry country list by typing. - Each option renders the load as a colored a-tag (green <30%, orange 30-70%, red >70%) instead of plain text — quicker visual scan when sorting through servers in the dropdown. Backend (nord.go): - GetCountries / GetServers now check resp.StatusCode and return "NordVPN API error: " on non-200, matching the pattern GetCredentials already used. Previously a 4xx/5xx body was returned as a "success" string and the frontend silently failed to parse it, surfacing only as an empty "No servers found". - GetCredentials drops its own ad-hoc 10s http.Client and reuses the shared nordHTTPClient (15s) — one client, one timeout. --- frontend/src/pages/xray/NordModal.vue | 34 ++++++++++++++++++++++++--- web/service/nord.go | 9 +++++-- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/xray/NordModal.vue b/frontend/src/pages/xray/NordModal.vue index b23f4e83..7689845d 100644 --- a/frontend/src/pages/xray/NordModal.vue +++ b/frontend/src/pages/xray/NordModal.vue @@ -222,6 +222,12 @@ function resetOutbound() { } function close() { emit('update:open', false); } + +function loadColor(load) { + if (load < 30) return 'green'; + if (load < 70) return 'orange'; + return 'red'; +}