From 07017848acdbd8f3f4e3cc054e56d86a9aca0ff3 Mon Sep 17 00:00:00 2001 From: Dharmik Parmar Date: Tue, 22 Sep 2026 08:53:22 +0530 Subject: [PATCH 1/2] luci-proto-wireguard: download current peer configuration The export preview is regenerated whenever its fields change, but the download button keeps using the configuration created when the dialog was opened. This can leave changes such as added DNS servers out of the downloaded file. Read the current preview when the download is requested so the file matches what LuCI displays. Signed-off-by: Dharmik Parmar --- .../htdocs/luci-static/resources/protocol/wireguard.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js index c04c940cd115..c8f9b34f4a5c 100644 --- a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js +++ b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js @@ -816,7 +816,8 @@ return network.registerProtocol('wireguard', { 'click'(ev) { ev.preventDefault(); - const blob = new Blob([peer_config], { type: 'text/plain' }); + const current_config = node.querySelector('.client-config').textContent; + const blob = new Blob([current_config], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); From 73b24a2b78d2921f1ad19cbc1f9eb7585bd5a10b Mon Sep 17 00:00:00 2001 From: Dharmik Parmar Date: Tue, 22 Sep 2026 08:53:39 +0530 Subject: [PATCH 2/2] luci-proto-wireguard: lint fix Fix the ESLint no-useless-escape errors reported by the CI by removing the unnecessary backslashes in front of the forward slashes inside the Base64 character class regex. Signed-off-by: Dharmik Parmar --- .../htdocs/luci-static/resources/protocol/wireguard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js index c8f9b34f4a5c..965f11efe4ba 100644 --- a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js +++ b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js @@ -34,7 +34,7 @@ function validateBase64(section_id, value) { if (value.length == 0) return true; - if (value.length != 44 || !value.match(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)) + if (value.length != 44 || !value.match(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/)) return _('Invalid Base64 key string'); if (value[43] != "=" )