From 130b25fbe9d437873a3ef2665e4e6616d092f0d9 Mon Sep 17 00:00:00 2001 From: Amolith Date: Tue, 18 Nov 2025 16:42:06 -0700 Subject: [PATCH] fix(webui): move script to file because csp --- pkg/web/static/url-switcher.js | 17 +++++++++++++++++ pkg/web/templates/overview.html | 15 +-------------- 2 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 pkg/web/static/url-switcher.js diff --git a/pkg/web/static/url-switcher.js b/pkg/web/static/url-switcher.js new file mode 100644 index 0000000000000000000000000000000000000000..270c2846ef2a278e730b180431d79816a0fc5cfb --- /dev/null +++ b/pkg/web/static/url-switcher.js @@ -0,0 +1,17 @@ +document.addEventListener('DOMContentLoaded', function() { + const urlTypeSwitch = document.querySelector('input[name="url-type"]'); + if (!urlTypeSwitch) return; + + urlTypeSwitch.addEventListener('change', function() { + const sshUrl = document.getElementById('ssh-url'); + const httpUrl = document.getElementById('http-url'); + + if (this.checked) { + sshUrl.style.display = 'none'; + httpUrl.style.display = 'block'; + } else { + sshUrl.style.display = 'block'; + httpUrl.style.display = 'none'; + } + }); +}); diff --git a/pkg/web/templates/overview.html b/pkg/web/templates/overview.html index 78cfaa1b5232694411660af49cce60e5787b1ec9..39f113103bbbf589d69464d72998534e9a92e5f6 100644 --- a/pkg/web/templates/overview.html +++ b/pkg/web/templates/overview.html @@ -21,20 +21,7 @@ git push -u origin main - + {{if .ReadmeHTML}}