From b1468b48a2e68c9ac43eb7a516ffe9f5e8de9208 Mon Sep 17 00:00:00 2001 From: kappa Date: Tue, 20 Jan 2026 23:35:46 +0900 Subject: [PATCH] Improve security, accessibility, and performance - Add Content Security Policy meta tag for XSS protection - Add width/height to image for CLS prevention - Add aria-hidden to decorative SVG icons (7 locations) - Refactor inline onclick to addEventListener for CSP compliance - Add visibility-aware setInterval for ping updates - Add keyboard navigation (Arrow keys) for tab panels Co-Authored-By: Claude Opus 4.5 --- app.js | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- index.html | 23 +++++++++++--------- 2 files changed, 73 insertions(+), 12 deletions(-) diff --git a/app.js b/app.js index 9803fd0..e27d24f 100644 --- a/app.js +++ b/app.js @@ -323,5 +323,63 @@ function updatePing() { }); } -// Ping 업데이트 시작 -setInterval(updatePing, 2000); +// Ping 업데이트 시작 (visibility-aware) +let pingInterval; + +function startPingUpdates() { + if (!pingInterval) { + pingInterval = setInterval(updatePing, 2000); + } +} + +function stopPingUpdates() { + if (pingInterval) { + clearInterval(pingInterval); + pingInterval = null; + } +} + +// Visibility change handler +document.addEventListener('visibilitychange', () => { + if (document.hidden) { + stopPingUpdates(); + } else { + startPingUpdates(); + } +}); + +// Initial start +startPingUpdates(); + +// Tab switching with event listeners and keyboard navigation +document.addEventListener('DOMContentLoaded', () => { + const btnN8n = document.getElementById('btn-n8n'); + const btnTf = document.getElementById('btn-tf'); + + if (btnN8n && btnTf) { + // Click event listeners + btnN8n.addEventListener('click', () => switchTab('n8n')); + btnTf.addEventListener('click', () => switchTab('tf')); + + // Keyboard navigation (Arrow keys) + [btnN8n, btnTf].forEach(btn => { + btn.addEventListener('keydown', (e) => { + const currentTab = btn.getAttribute('data-tab'); + + if (e.key === 'ArrowRight') { + e.preventDefault(); + if (currentTab === 'n8n') { + btnTf.focus(); + switchTab('tf'); + } + } else if (e.key === 'ArrowLeft') { + e.preventDefault(); + if (currentTab === 'tf') { + btnN8n.focus(); + switchTab('n8n'); + } + } + }); + }); + } +}); diff --git a/index.html b/index.html index e22929a..3e15538 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ + Anvil Hosting - 개발자를 위한 컨테이너 클라우드 @@ -66,7 +67,7 @@ - + Console 시작 @@ -103,7 +104,7 @@
@@ -143,8 +144,8 @@
bot
- - + +
@@ -285,7 +286,7 @@