Wireless: fix potential double entries in station list#2084
Conversation
WalkthroughThe pull request updates the Changes
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Also added wireless band under "info"
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)
📒 Files selected for processing (1)
emhttp/plugins/dynamix/include/Wireless.php(4 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
emhttp/plugins/dynamix/include/Wireless.php (1)
emhttp/plugins/dynamix/include/NetworkInfo.php (1)
port(23-28)
🔇 Additional comments (6)
emhttp/plugins/dynamix/include/Wireless.php (6)
38-38: Improved scan command with better output formatting.The command now includes frequency information in the scan results and uses
sedto format the output into a more processable form. This is a good improvement as it enriches the network data.
39-51: Enhanced network processing with better deduplication.The new approach effectively addresses the previous duplicate entries issue by:
- Using network names as array keys (inherent deduplication)
- Adding validation to skip incomplete entries and null networks
- Properly grouping frequency information for the same network
This implementation fixes the issue identified in the past review where
array_column($scan, 'ssid')was being applied to raw text output.
98-102: Added error handling for file operations.Good addition of a try-catch block for reading the carrier file, which prevents potential exceptions from breaking the UI if the file is inaccessible.
107-112: Updated attribute handling for consistency.The attribute handling has been updated to work with the new array structure, ensuring consistency with the changes made to the
scanWififunction.
178-178: Added frequency information to form.The hidden field for ATTR4 has been added to store the frequency information, which aligns with the changes to include frequency data in the network scanning process.
53-53:Details
❓ Verification inconclusive
Return value change - verify downstream impacts.
The function now returns the
$wlanarray instead of the filtered$scanarray, which has a different structure. Ensure all code that calls this function is updated to handle the new return format.
🏁 Script executed:
#!/bin/bash # Find all calls to scanWifi function to verify they handle the new return format rg -A 3 -B 3 "scanWifi\(" --type phpLength of output: 1104
Attention: Verify Downstream Handling of New Return Format
The
scanWififunction now returns the$wlanarray (with its updated structure) rather than the previously filtered$scanarray. Our search indicates that the only call toscanWifiis the internal (recursive) usage withinemhttp/plugins/dynamix/include/Wireless.php. Please confirm that this recursive call—and any other potential downstream consumers—are properly adjusted to work with the new structure of$wlan.
- Verify that the processing logic in the internal recursive call (around line 53 in Wireless.php) correctly handles the structure of
$wlan.- Ensure that future external calls (if any) are also updated to accommodate the change in return value.
Summary by CodeRabbit