From b4503d34f33ad0f48bd9a112525f14f717f3c731 Mon Sep 17 00:00:00 2001 From: Felix van Hove Date: Wed, 11 Jun 2025 19:32:36 +0200 Subject: [PATCH] fix: Improve login, server selection and proxy configuration (#2511) No potentially malicious URLs referenced in markdown; added servers stays in server selector list; the currently active server is visible on the bottom right of smaller screens; a proxy configuration can be provided now and works; a trailing slash in the added server is no problem anymore, because it's removed. FIXES: WEB-193 --- docs/backend-proxy.md | 2 +- proxy.conf.js | 12 +++++++----- src/app/login/login.component.html | 4 ++-- src/app/shared/footer/footer.component.html | 7 ++++--- .../server-selector/server-selector.component.ts | 8 ++++++-- src/app/web-app.component.ts | 6 ++++-- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/docs/backend-proxy.md b/docs/backend-proxy.md index f4f43de1d..e79b6e573 100644 --- a/docs/backend-proxy.md +++ b/docs/backend-proxy.md @@ -20,7 +20,7 @@ const proxyConfig = [ { context: '/api', pathRewrite: { '^/api': '' }, - target: 'http://api.icndb.com', + target: 'https://api.chucknorris.io', changeOrigin: true } ]; diff --git a/proxy.conf.js b/proxy.conf.js index 899183914..839646ab6 100644 --- a/proxy.conf.js +++ b/proxy.conf.js @@ -1,6 +1,6 @@ 'use strict'; -const HttpsProxyAgent = require('https-proxy-agent'); +const { HttpsProxyAgent } = require('https-proxy-agent'); /* * API proxy configuration. @@ -19,9 +19,9 @@ const proxyConfig = [ ]; /* - * Configures a corporate proxy agent for the API proxy if needed. + * Configures a proxy agent for the API proxy if needed. */ -function setupForCorporateProxy(proxyConfig) { +function setupForProxy(proxyConfig) { if (!Array.isArray(proxyConfig)) { proxyConfig = [proxyConfig]; } @@ -30,14 +30,16 @@ function setupForCorporateProxy(proxyConfig) { let agent = null; if (proxyServer) { - console.log(`Using corporate proxy server: ${proxyServer}`); + console.log(`Using proxy server: ${proxyServer}`); agent = new HttpsProxyAgent(proxyServer); proxyConfig.forEach((entry) => { entry.agent = agent; }); + } else { + console.warn('No proxy server configured. API requests will not be proxied.'); } return proxyConfig; } -module.exports = setupForCorporateProxy(proxyConfig); +module.exports = setupForProxy(proxyConfig); diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html index b7c931200..ef5b92df5 100644 --- a/src/app/login/login.component.html +++ b/src/app/login/login.component.html @@ -66,11 +66,11 @@ --> -
+
-
+
+