-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Hostname unification #4751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Hostname unification #4751
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e2edd38
Hostname unification
blazoncek 2509b1c
New hostname handling - add option to enable mDNS in settings - move …
blazoncek 31cdbb1
Fix cherry-pick error
blazoncek 0c791e8
Merge branch 'main' into unify-hostname
blazoncek 929f58f
Hostname save bugfix
blazoncek 661e1ee
Merge branch 'main' into unify-hostname
netmindz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
<head> | ||
<meta charset="utf-8"> | ||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"> | ||
<title>WiFi Settings</title> | ||
<title>Network Settings</title> | ||
<script src="common.js" async type="text/javascript"></script> | ||
<script> | ||
var scanLoops = 0, preScanSSID = ""; | ||
|
@@ -134,7 +134,7 @@ | |
} | ||
function S() { | ||
getLoc(); | ||
loadJS(getURL('/settings/s.js?p=1'), false); // If we set async false, file is loaded and executed, then next statement is processed | ||
loadJS(getURL('/settings/s.js?p=1'), false, undefined, genUrl); // If we set async false, file is loaded and executed, then next statement is processed | ||
if (loc) d.Sf.action = getURL('/settings/wifi'); | ||
setTimeout(tE, 500); // wait for DOM to load before calling tE() | ||
} | ||
|
@@ -144,6 +144,7 @@ | |
function tE() { | ||
// keep the hidden input with MAC addresses, only toggle visibility of the list UI | ||
gId('rlc').style.display = d.Sf.RE.checked ? 'block' : 'none'; | ||
if (d.Sf.RE.checked) d.Sf.ETH.selectedIndex = 0; // disable Ethernet if ESPNOW is enabled | ||
} | ||
// reset remotes: initialize empty list (called from xml.cpp) | ||
function rstR() { | ||
|
@@ -176,7 +177,10 @@ | |
rC++; | ||
gId('+').style.display = gId("rml").childElementCount < 10 ? 'inline' : 'none'; // can't append to list anymore, hide button | ||
} | ||
|
||
function genUrl() { | ||
gId("ml").textContent = d.Sf.CM.value; | ||
gId('mi').style.display = d.Sf.MD.checked?'inline':'none' | ||
} | ||
</script> | ||
<style>@import url("style.css");</style> | ||
</head> | ||
|
@@ -186,36 +190,75 @@ | |
<div class="helpB"><button type="button" onclick="H('features/settings/#wifi-settings')">?</button></div> | ||
<button type="button" onclick="B()">Back</button><button type="submit">Save & Connect</button><hr> | ||
</div> | ||
<h2>WiFi setup</h2> | ||
<h3>Connect to existing network</h3> | ||
<h2>Network setup</h2> | ||
Hostname<br> | ||
<input type="text" name="CM" minlength="2" maxlength="32" pattern="[a-zA-Z0-9_\-]*" oninput="genUrl()"><br> | ||
Enable mDNS: <input type="checkbox" name="MD" checked onchange="genUrl()"><br> | ||
<div id="mi"><i>http://<span id="ml">wled</span>.local</i><br></div> | ||
Client IP: <span class="sip"> Not connected </span><br> | ||
<h3>WiFi</h3> | ||
<button type="button" id="scan" onclick="N()">Scan</button><br> | ||
<div id="wifi"> | ||
Wireless networks | ||
<div id="wifi_entries"></div> | ||
<hr class="sml"> | ||
<button type="button" id="wifi_add" onclick="addWiFi()">+</button> | ||
<button type="button" id="wifi_rem" onclick="remWiFi()">-</button><br> | ||
</div> | ||
DNS server address:<br> | ||
<input name="D0" type="number" class="s" min="0" max="255" required>.<input name="D1" type="number" class="s" min="0" max="255" required>.<input name="D2" type="number" class="s" min="0" max="255" required>.<input name="D3" type="number" class="s" min="0" max="255" required><br> | ||
<br> | ||
mDNS address (leave empty for no mDNS):<br> | ||
http:// <input type="text" name="CM" maxlength="32"> .local<br> | ||
Client IP: <span class="sip"> Not connected </span> <br> | ||
<h3>Configure Access Point</h3> | ||
AP SSID (leave empty for no AP):<br> <input type="text" name="AS" maxlength="32"><br> | ||
<hr class="sml"> | ||
<h3>Access Point</h3> | ||
AP SSID (empty for no AP):<br><input type="text" name="AS" maxlength="32" pattern="[a-zA-Z0-9_\-]*"><br> | ||
Hide AP name: <input type="checkbox" name="AH"><br> | ||
AP password (leave empty for open):<br> <input type="password" name="AP" maxlength="63" pattern="(.{8,63})|()" title="Empty or min. 8 characters"><br> | ||
AP password (empty for open):<br><input type="password" name="AP" maxlength="63" pattern="(.{8,63})|()" title="Empty or min. 8 characters"><br> | ||
Access Point WiFi channel: <input name="AC" type="number" class="xs" min="1" max="13" required><br> | ||
AP opens: | ||
AP opens:<br> | ||
<select name="AB"> | ||
<option value="0">No connection after boot</option> | ||
<option value="1">Disconnected</option> | ||
<option value="2">Always</option> | ||
<option value="3">Never (not recommended)</option> | ||
<option value="4">Temporary (no connection after boot)</option> | ||
<option value="3">Never (use button!)</option> | ||
<option value="4">Temporary</option> | ||
</select><br> | ||
AP IP: <span class="sip"> Not active </span><br> | ||
AP IP: <span class="sip">Not active</span><br> | ||
<hr class="sml"> | ||
<div id="ethd"> | ||
<h3>Ethernet Type</h3> | ||
<select name="ETH" onchange="if(this.selectedIndex!=0)d.Sf.RE.checked=false;"> | ||
<option value="0">None</option> | ||
<option value="9">ABC! WLED V43 & compatible</option> | ||
<option value="2">ESP32-POE</option> | ||
<option value="11">ESP32-POE-WROVER</option> | ||
<option value="6">ESP32Deux/RGB2Go</option> | ||
<option value="7">KIT-VE</option> | ||
<option value="12">LILYGO T-POE Pro</option> | ||
<option value="8">QuinLED-Dig-Octa & T-ETH-POE</option> | ||
<option value="4">QuinLED-ESP32</option> | ||
<option value="10">Serg74-ETH32</option> | ||
<option value="5">TwilightLord-ESP32</option> | ||
<option value="3">WESP32</option> | ||
<option value="1">WT32-ETH01</option> | ||
</select><br> | ||
<i class="warn">ESP-NOW is incompatible with Ethernet.</i> | ||
</div> | ||
<hr class="sml"> | ||
<h3>ESP-NOW Wireless</h3> | ||
<div id="NoESPNOW" class="hide"> | ||
<i class="warn">This firmware build does not include ESP-NOW support.<br></i> | ||
</div> | ||
<div id="ESPNOW"> | ||
Enable ESP-NOW: <input type="checkbox" name="RE" onchange="tE()"><br> | ||
<i>Listen for events over ESP-NOW<br> | ||
Keep disabled if not using a remote or wireless sync, increases power consumption.<br></i> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. name it ESPNow-Sync instead of wireless sync? |
||
<div id="rlc"> | ||
Last device seen: <span class="rlid" id="ld"></span> | ||
<button type="button" class="sml" id="+" onclick="aR(gId('ld').textContent)">+</button><br> | ||
Linked MACs:<br> | ||
<div id="rml"></div> | ||
</div> | ||
<input type="hidden" name="RMAC" id="rmacs"> | ||
</div> | ||
<hr class="sml"> | ||
<h3>Experimental</h3> | ||
Force 802.11g mode (ESP8266 only): <input type="checkbox" name="FG"><br> | ||
Disable WiFi sleep: <input type="checkbox" name="WS"><br> | ||
|
@@ -236,42 +279,6 @@ <h3>Experimental</h3> | |
</select><br> | ||
<i class="warn">WARNING: Modifying TX power may render device unreachable.</i> | ||
</div> | ||
|
||
<h3>ESP-NOW Wireless</h3> | ||
<div id="NoESPNOW" class="hide"> | ||
<i class="warn">This firmware build does not include ESP-NOW support.<br></i> | ||
</div> | ||
<div id="ESPNOW"> | ||
Enable ESP-NOW: <input type="checkbox" name="RE" onchange="tE()"><br> | ||
<i>Listen for events over ESP-NOW<br> | ||
Keep disabled if not using a remote or ESP-NOW sync, increases power consumption.<br></i> | ||
<div id="rlc"> | ||
Last device seen: <span class="rlid" id="ld">None</span> | ||
<button type="button" class="sml" id="+" onclick="aR('RM'+rC,gId('ld').textContent)">+</button><br> | ||
Linked MACs (10 max):<br> | ||
<div id="rml"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div id="ethd"> | ||
<h3>Ethernet Type</h3> | ||
<select name="ETH"> | ||
<option value="0">None</option> | ||
<option value="9">ABC! WLED V43 & compatible</option> | ||
<option value="2">ESP32-POE</option> | ||
<option value="11">ESP32-POE-WROVER</option> | ||
<option value="6">ESP32Deux/RGB2Go</option> | ||
<option value="7">KIT-VE</option> | ||
<option value="12">LILYGO T-POE Pro</option> | ||
<option value="8">QuinLED-Dig-Octa & T-ETH-POE</option> | ||
<option value="4">QuinLED-ESP32</option> | ||
<option value="10">Serg74-ETH32</option> | ||
<option value="5">TwilightLord-ESP32</option> | ||
<option value="3">WESP32</option> | ||
<option value="1">WT32-ETH01</option> | ||
</select><br><br> | ||
</div> | ||
<hr> | ||
<button type="button" onclick="B()">Back</button><button type="submit">Save & Connect</button> | ||
</form> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ button.sml { | |
.hide { | ||
display: none; | ||
} | ||
.err { | ||
.err, input:invalid { | ||
color: #f00; | ||
} | ||
.warn { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be changed to use the existing logic, for example my current hostname of window is because i have the WLED device called Window
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses existing logic. If
{"id":{"mdns":....}, ...}
exists, it uses that name. Only if someone disabled mDNS (by entering empty name) then new hostname is generated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's using the mDNS name, personally I've never edited that as I'm using regular DNS which uses the device name from the UI settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure which we choose, but whatever we choose it won't be the right option for 100% of users.
Certainly if the device name in UI settings is still "WLED" then we could definitely ignore that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the non-mDNS hostname is wled-{serverDescription}, so actually you get "wled-window" not just "window"
wled-window.ftriz.box for example - when name in server description in the UI settings is "Window"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmDNS
andserverDescription
are only created during 1st boot. Each consecutive boot will use stored values if they were modified by user or not.The only difference this PR does (regarding network naming) is the change of DHCP lease names (and dnsmasqd responses to DNS querires (non-mDNS) if your router supported that). Those were missing in case of ESP32 (producing
esp-xxxxxx
registration) or constructed fromserverDescription
(producingwled-zzzzzzz
name, where zzzzzz conformed to[0-9a-zA-Z\-\_]+
regexp). DNS queries were never officially supported or advertised by WLED.The mDNS name and hostname are now (with this PR) the same (as is usual or common practice).
However, I am loosing interest in pursuing this PR further (since none of the OP responded to my queires, these include: @tablatronix, @huggy-d1, @mateuszdrab, @b3-4r, @Rodney2K, @BBaoVanC, @schildbach and @Colbyjdx) so do whatever pleases you (merge, edit or abandon), I am not going to update it any more.