Repository navigation
Fix welcome page persisting with Ethernet connection #5905
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -827,6 +827,7 @@ void serveSettings(AsyncWebServerRequest* request, bool post) { | |||||||||||
| String contentType = FPSTR(CONTENT_TYPE_HTML); | ||||||||||||
| const uint8_t* content; | ||||||||||||
| size_t len; | ||||||||||||
| uint16_t eTagSuffix = 0; | ||||||||||||
|
|
||||||||||||
| switch (subPage) { | ||||||||||||
| case SUBPAGE_WIFI : content = PAGE_settings_wifi; len = PAGE_settings_wifi_length; break; | ||||||||||||
|
|
@@ -866,8 +867,13 @@ void serveSettings(AsyncWebServerRequest* request, bool post) { | |||||||||||
| case SUBPAGE_PINREQ : content = PAGE_settings_pin; len = PAGE_settings_pin_length; code = 401; break; | ||||||||||||
| case SUBPAGE_CSS : content = PAGE_settingsCss; len = PAGE_settingsCss_length; contentType = FPSTR(CONTENT_TYPE_CSS); break; | ||||||||||||
| case SUBPAGE_JS : serveSettingsJS(request); return; | ||||||||||||
| case SUBPAGE_WELCOME : content = PAGE_welcome; len = PAGE_welcome_length; break; | ||||||||||||
| case SUBPAGE_WELCOME : { | ||||||||||||
|
Member
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. This is a quite strange
Author
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. I was not sure which syntax i should use, so i just followed the syntax from some lines above: Lines 861 to 865 in 2b116e1
|
||||||||||||
| content = PAGE_welcome; | ||||||||||||
| len = PAGE_welcome_length; | ||||||||||||
| eTagSuffix = 0xFFFF; | ||||||||||||
| break; | ||||||||||||
| } | ||||||||||||
| default: content = PAGE_settings; len = PAGE_settings_length; break; | ||||||||||||
| } | ||||||||||||
| handleStaticContent(request, "", code, contentType, content, len); | ||||||||||||
| handleStaticContent(request, "", code, contentType, content, len, true, eTagSuffix); | ||||||||||||
| } | ||||||||||||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: wled/WLED
Length of output: 2493
🏁 Script executed:
Repository: wled/WLED
Length of output: 44058
🏁 Script executed:
Repository: wled/WLED
Length of output: 29505
🏁 Script executed:
Repository: wled/WLED
Length of output: 27221
🏁 Script executed:
Repository: wled/WLED
Length of output: 6618
Clear
showWelcomePagebefore the first server start.On an Ethernet-only boot,
showWelcomePagecan be set totrueafter Ethernet initialization. The firsthandleConnection()call then starts the AP server throughinitConnection()and returns before the Ethernet check at line 1050. A request to/during this interval can receive the welcome page. Clear the flag in the initial connection path.Suggested fix
selectedWiFi = findWiFi(); // find strongest WiFi + if (WLEDNetwork.isEthernet()) showWelcomePage = false; initConnection();🤖 Prompt for AI Agents