Skip to content

Network rules: fix double quote display#2315

Merged
limetech merged 3 commits into
unraid:masterfrom
bergware:master
Jul 29, 2025
Merged

Network rules: fix double quote display#2315
limetech merged 3 commits into
unraid:masterfrom
bergware:master

Conversation

@bergware

@bergware bergware commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved display of gateway IP addresses by showing a placeholder when values are missing.
  • User Interface
    • Updated Docker settings labels to clarify units.
    • Enhanced form input markup for better clarity and consistency.
    • Activated additional styling for network-related elements to improve layout.
  • Improvements
    • Sanitized DHCP pool input values to prevent submission errors.
    • Added validation to prevent incorrect routing rule configurations in WireGuard integration.

@coderabbitai

coderabbitai Bot commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

"""

Walkthrough

The code modifies string splitting logic in the emhttp/plugins/dynamix/NetworkRules.page file. Specifically, it replaces a custom my_explode function with PHP's native explode in one context, and swaps from explode to my_explode in another, affecting how strings are parsed during rule processing. Additionally, UI markup and behavior improvements were made in Docker settings pages, including input attribute cleanup, consistent display of missing gateway values, HTML restructuring, and CSS style activation. A WireGuard routing rule addition condition was tightened to require a non-empty tunnel IP.

Changes

Cohort / File(s) Change Summary
NetworkRules String Splitting
emhttp/plugins/dynamix/NetworkRules.page
Changed string splitting in the strip function from my_explode to PHP's explode for splitting by double quotes, and changed rule splitting from explode to my_explode for splitting by commas.
Docker Settings UI and Behavior Updates
emhttp/plugins/dynamix.docker.manager/DockerSettings.page
Removed class='narrow' from inputs, added "(GB)" unit label, displayed '---' fallback for empty gateway IPs, tightened PHP short tags, added class="auto" to select elements, reorganized DHCP pool input markup, and sanitized DHCP pool subnet input in JavaScript.
Docker Settings CSS Activation
emhttp/plugins/dynamix.docker.manager/sheets/DockerSettings.css
Uncommented CSS rules for span.net, span.ip4, and span.gw6 selectors to activate margin and display styles.
WireGuard Routing Rule Condition
emhttp/plugins/dynamix/include/update.wireguard.php
Added additional non-empty check for $tunip before appending WireGuard routing rules, tightening condition to prevent adding rules if tunnel IP is empty.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

7.2

Poem

A rabbit hopped through code so neat,
Swapping explode for my_explode—what a feat!
Strings now split just as they should,
In network rules, all understood.
Docker inputs clean and bright,
Gateways show with fallback light.
Styles now shine, the UI’s right! 🐇✨
"""

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4da4750 and 655b9a0.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/include/update.wireguard.php (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Squidly271
PR: unraid/webgui#2293
File: emhttp/plugins/dynamix.docker.manager/include/Helpers.php:302-304
Timestamp: 2025-07-11T17:24:33.977Z
Learning: In the Unraid WebGUI Docker manager (emhttp/plugins/dynamix.docker.manager/include/Helpers.php), the xmlSecurity() function call is intentionally commented out to allow users to include < and > characters in their Docker template variables on their own servers. Default templates still explicitly disallow tags, but users can customize templates as needed in their self-hosted environment.
Learnt from: zackspear
PR: unraid/webgui#2099
File: emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php:13-19
Timestamp: 2025-03-27T22:04:34.550Z
Learning: The file emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php is synced from another repository and should not be modified directly in the webgui repository.
Learnt from: zackspear
PR: unraid/webgui#2258
File: emhttp/plugins/dynamix/DashStats.page:0-0
Timestamp: 2025-06-21T00:10:40.789Z
Learning: In the Unraid webgui codebase (emhttp/plugins/dynamix), replacing `<i>` elements with `<button>` elements for accessibility would require extensive CSS refactoring due to legacy CSS having direct button styles that would conflict with icon-based toggles.
Learnt from: zackspear
PR: unraid/webgui#2230
File: emhttp/plugins/dynamix/include/Templates.php:63-74
Timestamp: 2025-06-03T21:27:15.912Z
Learning: In the Unraid WebGUI codebase (emhttp/plugins/dynamix/include/Templates.php), there are known duplicate ID issues in checkbox templates across multiple template instances that the maintainers are aware of but have chosen not to address due to the effort required for legacy code improvements.
Learnt from: zackspear
PR: unraid/webgui#2099
File: emhttp/plugins/dynamix.my.servers/include/activation-code-extractor.php:58-74
Timestamp: 2025-03-27T22:04:00.594Z
Learning: The file `emhttp/plugins/dynamix.my.servers/include/activation-code-extractor.php` is synced from a different repository, and modifications should not be suggested in this repository's context. Changes should be proposed in the source repository instead.
Learnt from: zackspear
PR: unraid/webgui#2185
File: emhttp/plugins/dynamix/Shares.page:5-15
Timestamp: 2025-05-08T18:20:16.531Z
Learning: In the Unraid WebGUI codebase, translation strings can use Markdown syntax (like `**text**` for bold) which will be properly parsed and rendered in the UI, rather than requiring HTML tags.
Learnt from: SimonFair
PR: unraid/webgui#1992
File: emhttp/plugins/dynamix/include/CPUset.php:0-0
Timestamp: 2025-02-01T15:12:16.914Z
Learning: In the unRAID WebGUI, button text should be wrapped in _() for translation support and htmlspecialchars() for security, with a preference for using ternary operators for simple conditional text assignments.
Learnt from: SimonFair
PR: unraid/webgui#1992
File: emhttp/plugins/dynamix/include/CPUset.php:0-0
Timestamp: 2025-02-01T15:12:16.914Z
Learning: In the unRAID WebGUI, when both translation and HTML escaping are needed, always apply translation (_()) first, then escape the translated text with htmlspecialchars() to ensure proper handling of translation placeholders.
Learnt from: zackspear
PR: unraid/webgui#0
File: :0-0
Timestamp: 2025-05-28T20:54:31.390Z
Learning: In the unraid/webgui repository, the CSS rule `div.title.ud, div#title.ud { margin-top: 0 !important; }` uses `!important` specifically to override CSS that's added by a plugin, which is a necessary approach for ensuring proper title positioning and preventing overlap with tabs.
Learnt from: zackspear
PR: unraid/webgui#2184
File: emhttp/plugins/dynamix/include/DefaultPageLayout/MainContent.php:91-105
Timestamp: 2025-05-07T23:18:10.602Z
Learning: The Markdown parsing logic in the Unraid webgui follows the pattern where Markdown is applied when the page's Markdown property is either empty or explicitly set to 'true'. This pattern was maintained during the refactoring for compatibility reasons.
🔇 Additional comments (1)
emhttp/plugins/dynamix/include/update.wireguard.php (1)

282-282: Good defensive validation for tunnel IP.

The additional check for !empty($tunip) prevents malformed routing commands when the tunnel IP is not properly set. This is a solid improvement that aligns with the existing validation pattern for other network parameters.

Note: The change doesn't appear to relate to "double quote display" as mentioned in the PR title - this seems to be a network validation enhancement instead.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@limetech limetech merged commit 221d551 into unraid:master Jul 29, 2025
1 check passed
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.

2 participants