Skip to content

Improve DNS upstream table - #3827

Open
yubiuser wants to merge 4 commits into
developmentfrom
fix/upstream
Open

Improve DNS upstream table#3827
yubiuser wants to merge 4 commits into
developmentfrom
fix/upstream

Conversation

@yubiuser

@yubiuser yubiuser commented Jul 28, 2026

Copy link
Copy Markdown
Member

What does this PR aim to accomplish?:
This PR does two things: 1) fix the DNS upstream table 2) improve the custom upstream input box


Fix DNS upstream table.

Main fix: DNSupstreamsTable does not exist, but DNSupstreamsTable-plan, DNSupstreamsTable-doh and DNSupstreamsTable-dot.

Additionally, if no title is set (DNS server address), return early.
Additionally 2: also break on Windows CRLF and remove empty entries from the input field.


The last commit improves the custom upstream input box to really only show entries that do not match any selected entry from the table above. I always found it confusing that the "custom upstream" box also contained non-custom but selected upstreams. It now keeps both things separate and only merged them before the list of upstreams is send to the API


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered, and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  9. I give this submission freely, and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

Signed-off-by: yubiuser <github@yubiuser.dev>
@yubiuser
yubiuser requested a review from a team as a code owner July 28, 2026 19:56
Comment thread scripts/js/settings-dns.js Outdated
Signed-off-by: yubiuser <github@yubiuser.dev>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes the upstream DNS selection UI logic by targeting the correct upstream tables across Plain/DoT/DoH tabs and improving parsing of the custom-upstreams textarea.

Changes:

  • Adds a stable wrapper ID (DNSupstreamTabs) around the upstream tabs to scope DOM queries correctly.
  • Updates checkbox-change handling to iterate over all upstream tables (plain/dot/doh) instead of a non-existent #DNSupstreamsTable.
  • Improves textarea splitting for Windows CRLF and filters out empty lines (with a remaining whitespace-only edge case noted in review).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
settings-dns.lp Adds id="DNSupstreamTabs" to the upstream tabs container so JS can reliably scope table/checkbox queries.
scripts/js/settings-dns.js Fixes checkbox iteration selector to cover all upstream tables and improves newline parsing of the custom upstreams textarea.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/js/settings-dns.js Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: yubiuser <github@yubiuser.dev>
@yubiuser yubiuser changed the title Fix DNS upstream table Improve DNS upstream table Jul 31, 2026
@yubiuser
yubiuser requested a review from Copilot July 31, 2026 19:10
@yubiuser

Copy link
Copy Markdown
Member Author

The last commit improves the custom upstream input box to really only show entries that do not match any selected entry from the table above. I always found it confusing that the "custom upstream" box also contained non-custom but selected upstreams. It now keeps both things separate and only merged them before the list of upstreams is send to the API

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (2)

scripts/js/settings-dns.js:12

  • Grammar in the comment: “manual entered” should be “manually entered”.
// Get the manual entered upstream servers from the textarea

scripts/js/settings.js:146

  • For robustness and consistency with other textarea parsing in this codebase (e.g., settings-dns.js/settings-dhcp.js), consider splitting textarea values with /\r?\n/ instead of "\n" so CRLF inputs don’t leave trailing "\r" characters in array entries.
    if ($(this).is("textarea")) {
      value = $(this).val();
      value = value === "" ? [] : value.split("\n");

      // On DNS settings page, upstream table selections are merged at save
      // time so the textarea can remain manual-only in the UI.
      if (key === "dns.upstreams" && typeof globalThis.getMergedDNSupstreams === "function") {
        value = globalThis.getMergedDNSupstreams(value);

… field

Signed-off-by: yubiuser <github@yubiuser.dev>
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.

3 participants