From bacc6b994df24075073445355cb182ff724d4f68 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Tue, 10 Mar 2026 22:10:16 +0100 Subject: [PATCH] refactor(clickTtHttpPageRoutes): standardize variable names for clarity in proxy response handling - Renamed variables for the response body and content type to improve code readability and maintainability. - Ensured consistent usage of the new variable names throughout the proxy response processing logic, enhancing overall code clarity. --- backend/routes/clickTtHttpPageRoutes.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/routes/clickTtHttpPageRoutes.js b/backend/routes/clickTtHttpPageRoutes.js index 21aee5df..bfb5f030 100644 --- a/backend/routes/clickTtHttpPageRoutes.js +++ b/backend/routes/clickTtHttpPageRoutes.js @@ -272,22 +272,22 @@ router.post('/proxy', async (req, res, next) => { } } - let body = result.body; - const contentType = result.contentType || ''; - if (body && contentType.includes('text/html')) { + let responseBody = result.body; + const responseContentType = result.contentType || ''; + if (responseBody && responseContentType.includes('text/html')) { const baseUrl = process.env.BACKEND_BASE_URL || process.env.BASE_URL || `${req.protocol || 'http'}://${req.get('host') || 'localhost:' + (process.env.PORT || 3005)}`; const proxyBase = baseUrl.replace(/\/$/, '') + '/api/clicktt/proxy'; - body = body + responseBody = responseBody .replace(/]*http-equiv=["']content-security-policy["'][^>]*>/gi, '') .replace(/]*http-equiv=["']x-frame-options["'][^>]*>/gi, ''); const pageOrigin = (() => { try { return new URL(targetUrl).origin + '/'; } catch { return null; } })(); if (pageOrigin) { - body = body.replace(/]*>/gi, ''); - body = body.replace(/]*)>/i, ``); + responseBody = responseBody.replace(/]*>/gi, ''); + responseBody = responseBody.replace(/]*)>/i, ``); } - body = rewriteLinksInHtml(body, proxyBase, targetUrl, sid); - body = rewriteFormActionsInHtml(body, proxyBase, targetUrl, sid); + responseBody = rewriteLinksInHtml(responseBody, proxyBase, targetUrl, sid); + responseBody = rewriteFormActionsInHtml(responseBody, proxyBase, targetUrl, sid); } res.set({ @@ -297,7 +297,7 @@ router.post('/proxy', async (req, res, next) => { 'Content-Security-Policy': 'frame-ancestors *;', 'Cache-Control': 'no-cache, no-store, must-revalidate', }); - res.status(result.status).send(body); + res.status(result.status).send(responseBody); } catch (error) { console.error('ClickTT Proxy POST Fehler:', error); res.status(500).send(