From ee94dc9d0756efadb307bd20429851152c00cd08 Mon Sep 17 00:00:00 2001 From: ShareVB Date: Sun, 19 Apr 2026 11:26:27 +0200 Subject: [PATCH] feat(Visual Subnet Calculator): update js --- public/visualsubnetcalc/js/main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/public/visualsubnetcalc/js/main.js b/public/visualsubnetcalc/js/main.js index 0e78dc1a..d2b366db 100644 --- a/public/visualsubnetcalc/js/main.js +++ b/public/visualsubnetcalc/js/main.js @@ -5,12 +5,18 @@ let infoColumnCount = 5 // Default without additional columns let additionalColumnsVisible = false; const FEEDBACK_DURATION_MS = 1000; // Duration for UI feedback messages -const vscHash = window.location.hash ? window.location.hash.substr(1) : ''; -const vscUrlParams = vscHash.split('&').reduce(function (res, item) { +// handle passing params by #fragment +// to allows integration in Vite Vue app using a Vue router and iframe (IT Tools) +const vscHash = window.location.hash ? window.location.hash.substring(1) : ''; +let vscUrlParams = vscHash.split('&').reduce(function (res, item) { var parts = item.split('='); res[parts[0]] = decodeURIComponent(parts[1]); return res; }, {}); +if (!vscUrlParams.parent || !vscUrlParams.parent.startsWith(window.location.origin)) { + // only allows to pass parent and html if same origin (else could be a injection) + vscUrlParams = {}; +} const vscParentUrl = vscUrlParams.parent; const vscHtmlFileName = vscUrlParams.html || 'index.html'; if (vscParentUrl) {