Skip to content

Commit 87cb617

Browse files
committed
settings_um: Use live config
Add a new JSON out target to pull the live config data and use that for the usermod settings page. Should fix issues with outdated contents.
1 parent 4ab9387 commit 87cb617

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

wled00/data/settings_um.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
function S() {
1414
getLoc();
1515
// load settings and insert values into DOM
16-
fetch(getURL('/cfg.json'), {
16+
fetch(getURL('/json/cfg'), {
1717
method: 'get'
1818
})
1919
.then(res => {

wled00/json.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ class LockedJsonResponse: public AsyncJsonResponse {
10281028
void serveJson(AsyncWebServerRequest* request)
10291029
{
10301030
enum class json_target {
1031-
all, state, info, state_info, nodes, effects, palettes, fxdata, networks
1031+
all, state, info, state_info, nodes, effects, palettes, fxdata, networks, config
10321032
};
10331033
json_target subJson = json_target::all;
10341034

@@ -1041,6 +1041,7 @@ void serveJson(AsyncWebServerRequest* request)
10411041
else if (url.indexOf(F("palx")) > 0) subJson = json_target::palettes;
10421042
else if (url.indexOf(F("fxda")) > 0) subJson = json_target::fxdata;
10431043
else if (url.indexOf(F("net")) > 0) subJson = json_target::networks;
1044+
else if (url.indexOf(F("cfg")) > 0) subJson = json_target::config;
10441045
#ifdef WLED_ENABLE_JSONLIVE
10451046
else if (url.indexOf("live") > 0) {
10461047
serveLiveLeds(request);
@@ -1051,9 +1052,6 @@ void serveJson(AsyncWebServerRequest* request)
10511052
request->send_P(200, FPSTR(CONTENT_TYPE_JSON), JSON_palette_names);
10521053
return;
10531054
}
1054-
else if (url.indexOf(F("cfg")) > 0 && handleFileRead(request, F("/cfg.json"))) {
1055-
return;
1056-
}
10571055
else if (url.length() > 6) { //not just /json
10581056
serveJsonError(request, 501, ERR_NOT_IMPL);
10591057
return;
@@ -1085,6 +1083,8 @@ void serveJson(AsyncWebServerRequest* request)
10851083
serializeModeData(lDoc); break;
10861084
case json_target::networks:
10871085
serializeNetworks(lDoc); break;
1086+
case json_target::config:
1087+
serializeConfig(lDoc); break;
10881088
case json_target::state_info:
10891089
case json_target::all:
10901090
JsonObject state = lDoc.createNestedObject("state");

0 commit comments

Comments
 (0)