Skip to content

luci-proto-wireguard: download current peer configuration - #8966

Open
dhrm1k wants to merge 2 commits into
openwrt:masterfrom
dhrm1k:fix/wireguard-peer-config-download
Open

dhrm1k wants to merge 2 commits into
openwrt:masterfrom
dhrm1k:fix/wireguard-peer-config-download

Conversation

@dhrm1k

@dhrm1k dhrm1k commented Aug 23, 2026

Copy link
Copy Markdown

Pull request details

Description

The WireGuard 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.

Fixes openwrt/packages#30358

Screenshot or video of changes (if applicable)

Not applicable. This changes the downloaded configuration rather than the visible layout.

Maintainer (preferred)

@danrl


Tested on

OpenWrt version: OpenWrt 25.12.2 (r32802-f505120278)
LuCI version: LuCI openwrt-25.12 branch (26.082.75780~067535e)
Web browser(s): Firefox 151.0.2

Tested on an x86/64 OpenWrt VM. After adding 9.9.9.9 as a DNS server, the downloaded wireguard-peer.conf exactly matched the updated preview and contained:

DNS = 192.168.1.1, 9.9.9.9

node --check and git diff --check also pass.


Checklist

@openwrt openwrt Bot added the not following guidelines Pull request does not follow formatting guidelines label Aug 23, 2026
@dhrm1k
dhrm1k force-pushed the fix/wireguard-peer-config-download branch from 00b9ac7 to 0363a9e Compare August 23, 2026 05:30
@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Aug 23, 2026

@danrl danrl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit; no new issues found.


Generated by Claude Code

@BKPepe

BKPepe commented Sep 14, 2026

Copy link
Copy Markdown
Member

@dhrm1k Can you take a look, why the CI/CD fails for you in this case?

Output:

/home/runner/work/luci/luci/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js
Error:   37:57  error  Unnecessary escape character: \/  no-useless-escape
Error:   37:79  error  Unnecessary escape character: \/  no-useless-escape
Error:   37:99  error  Unnecessary escape character: \/  no-useless-escape

@dhrm1k
dhrm1k force-pushed the fix/wireguard-peer-config-download branch from 0363a9e to cacb550 Compare September 16, 2026 20:32
@dhrm1k

dhrm1k commented Sep 16, 2026

Copy link
Copy Markdown
Author

@BKPepe, found it. The ESLint job lints the whole changed file, not just the diff, so it flagged three pre-existing / escapes in the Base64 regex. Removed them and amended the commit.

@dhrm1k
dhrm1k force-pushed the fix/wireguard-peer-config-download branch from cacb550 to fdc366e Compare September 16, 2026 20:54

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit.


Generated by Claude Code

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}=)?$/))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this no-useless-escape cleanup is unrelated to the download fix the commit message describes, leaving an undocumented hunk. Either mention it in the commit body or split it into its own commit.


Generated by Claude Code

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, please put this in a separate commit with a subject line like:

luci-proto-wireguard: lint fix

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 <dharmikparmar2004@yahoo.com>
@dhrm1k
dhrm1k force-pushed the fix/wireguard-peer-config-download branch from fdc366e to 564f833 Compare September 22, 2026 03:24
@openwrt openwrt Bot added the not following guidelines Pull request does not follow formatting guidelines label Sep 22, 2026
@dhrm1k
dhrm1k force-pushed the fix/wireguard-peer-config-download branch from 564f833 to ed88746 Compare September 22, 2026 03:26
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 <dharmikparmar2004@yahoo.com>
@dhrm1k
dhrm1k force-pushed the fix/wireguard-peer-config-download branch from ed88746 to 73b24a2 Compare September 22, 2026 03:28
@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Sep 22, 2026

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 new commits; no new issues found.


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

luci-app-wireguard: dns ignored in generated config

5 participants