diff --git a/examples/uart-bridge/net.c b/examples/uart-bridge/net.c index 86dfd9bd..b1d5ffa0 100644 --- a/examples/uart-bridge/net.c +++ b/examples/uart-bridge/net.c @@ -75,7 +75,7 @@ static void ws_fn(struct mg_connection *c, int ev, void *evd, void *fnd) { // Event handler for a connected TCP client static void tcp_fn(struct mg_connection *c, int ev, void *evd, void *fnd) { - if (ev == MG_EV_OPEN) { + if (ev == MG_EV_ACCEPT) { // c->is_hexdumping = 1; c->label[0] = 'T'; // When client is connected, mark us as TCP client } else if (ev == MG_EV_READ) { @@ -98,8 +98,8 @@ static struct mg_str mqtt_topic(const char *name, const char *dflt) { static void mq_fn(struct mg_connection *c, int ev, void *evd, void *fnd) { if (ev == MG_EV_OPEN) { // c->is_hexdumping = 1; - c->label[0] = 'M'; } else if (ev == MG_EV_MQTT_OPEN) { + c->label[0] = 'M'; mg_mqtt_sub(c, mqtt_topic("rx", "b/rx"), 1); // Subscribe to RX topic } else if (ev == MG_EV_MQTT_MSG) { struct mg_mqtt_message *mm = evd; // MQTT message @@ -139,17 +139,25 @@ static void timer_fn(void *param) { } } +static void update_string(struct mg_str json, const char *path, char **value) { + char *jval; + if ((jval = mg_json_get_str(json, path)) != NULL) { + free(*value); + *value = strdup(jval); + } +} + static void config_apply(struct mg_str s) { MG_INFO(("Applying config: %.*s", (int) s.len, s.ptr)); - mg_json_get_bool(s, "$.tcp.enable", &s_state.tcp.enable); - mg_json_get_bool(s, "$.ws.enable", &s_state.websocket.enable); - mg_json_get_bool(s, "$.mqtt.enable", &s_state.mqtt.enable); + bool b; + if (mg_json_get_bool(s, "$.tcp.enable", &b)) s_state.tcp.enable = b; + if (mg_json_get_bool(s, "$.ws.enable", &b)) s_state.websocket.enable = b; + if (mg_json_get_bool(s, "$.mqtt.enable", &b)) s_state.mqtt.enable = b; - free(s_state.tcp.url), s_state.tcp.url = mg_json_get_str(s, "$.tcp.url"); - free(s_state.mqtt.url), s_state.mqtt.url = mg_json_get_str(s, "$.mqtt.url"); - free(s_state.websocket.url), - s_state.websocket.url = mg_json_get_str(s, "$.ws.url"); + update_string(s, "$.tcp.url", &s_state.tcp.url); + update_string(s, "$.mqtt.url", &s_state.mqtt.url); + update_string(s, "$.ws.url", &s_state.websocket.url); double v; if (mg_json_get_num(s, "$.rx", &v)) s_state.rx = (int) v; diff --git a/examples/uart-bridge/packed_fs.c b/examples/uart-bridge/packed_fs.c index 115dcfef..3a17bc34 100644 --- a/examples/uart-bridge/packed_fs.c +++ b/examples/uart-bridge/packed_fs.c @@ -37,495 +37,6 @@ static const unsigned char v1[] = { 10, 0 // . }; static const unsigned char v2[] = { - 39, 117, 115, 101, 32, 115, 116, 114, 105, 99, 116, 39, // 'use strict' - 59, 10, 105, 109, 112, 111, 114, 116, 32, 123, 67, 111, // ;.import {Co - 109, 112, 111, 110, 101, 110, 116, 44, 32, 104, 44, 32, // mponent, h, - 104, 116, 109, 108, 44, 32, 114, 101, 110, 100, 101, 114, // html, render - 44, 32, 117, 115, 101, 69, 102, 102, 101, 99, 116, 44, // , useEffect, - 32, 117, 115, 101, 83, 116, 97, 116, 101, 44, 32, 117, // useState, u - 115, 101, 82, 101, 102, 125, 32, 102, 114, 111, 109, 32, // seRef} from - 39, 46, 47, 112, 114, 101, 97, 99, 116, 46, 109, 105, // './preact.mi - 110, 46, 106, 115, 39, 59, 10, 10, 99, 111, 110, 115, // n.js';..cons - 116, 32, 77, 101, 115, 115, 97, 103, 101, 32, 61, 32, // t Message = - 109, 32, 61, 62, 32, 104, 116, 109, 108, 96, 60, 115, // m => html`. - 32, 36, 123, 109, 46, 109, 101, 115, 115, 97, 103, 101, // ${m.message - 46, 100, 97, 116, 97, 125, 10, 60, 47, 115, 112, 97, // .data}.`;..const - 65, 112, 112, 32, 61, 32, 102, 117, 110, 99, 116, 105, // App = functi - 111, 110, 40, 112, 114, 111, 112, 115, 41, 32, 123, 10, // on(props) {. - 32, 32, 99, 111, 110, 115, 116, 32, 91, 99, 102, 103, // const [cfg - 44, 32, 115, 101, 116, 67, 102, 103, 93, 32, 61, 32, // , setCfg] = - 117, 115, 101, 83, 116, 97, 116, 101, 40, 123, 116, 99, // useState({tc - 112, 58, 32, 123, 125, 44, 32, 119, 115, 58, 32, 123, // p: {}, ws: { - 125, 44, 32, 109, 113, 116, 116, 58, 32, 123, 125, 125, // }, mqtt: {}} - 41, 59, 10, 32, 32, 99, 111, 110, 115, 116, 32, 91, // );. const [ - 109, 101, 115, 115, 97, 103, 101, 115, 44, 32, 115, 101, // messages, se - 116, 77, 101, 115, 115, 97, 103, 101, 115, 93, 32, 61, // tMessages] = - 32, 117, 115, 101, 83, 116, 97, 116, 101, 40, 91, 93, // useState([] - 41, 59, 10, 32, 32, 99, 111, 110, 115, 116, 32, 91, // );. const [ - 99, 111, 110, 110, 101, 99, 116, 101, 100, 44, 32, 115, // connected, s - 101, 116, 67, 111, 110, 110, 101, 99, 116, 101, 100, 93, // etConnected] - 32, 61, 32, 117, 115, 101, 83, 116, 97, 116, 101, 40, // = useState( - 102, 97, 108, 115, 101, 41, 59, 10, 32, 32, 99, 111, // false);. co - 110, 115, 116, 32, 91, 116, 120, 116, 44, 32, 115, 101, // nst [txt, se - 116, 84, 120, 116, 93, 32, 61, 32, 117, 115, 101, 83, // tTxt] = useS - 116, 97, 116, 101, 40, 39, 39, 41, 59, 10, 32, 32, // tate('');. - 99, 111, 110, 115, 116, 32, 91, 119, 115, 44, 32, 115, // const [ws, s - 101, 116, 87, 115, 93, 32, 61, 32, 117, 115, 101, 83, // etWs] = useS - 116, 97, 116, 101, 40, 110, 117, 108, 108, 41, 59, 10, // tate(null);. - 10, 32, 32, 99, 111, 110, 115, 116, 32, 114, 101, 102, // . const ref - 114, 101, 115, 104, 32, 61, 32, 40, 41, 32, 61, 62, // resh = () => - 10, 32, 32, 32, 32, 32, 32, 102, 101, 116, 99, 104, // . fetch - 40, 39, 47, 97, 112, 105, 47, 99, 111, 110, 102, 105, // ('/api/confi - 103, 47, 103, 101, 116, 39, 41, 46, 116, 104, 101, 110, // g/get').then - 40, 114, 32, 61, 62, 32, 114, 46, 106, 115, 111, 110, // (r => r.json - 40, 41, 41, 46, 116, 104, 101, 110, 40, 114, 32, 61, // ()).then(r = - 62, 32, 115, 101, 116, 67, 102, 103, 40, 114, 41, 41, // > setCfg(r)) - 59, 10, 10, 32, 32, 99, 111, 110, 115, 116, 32, 103, // ;.. const g - 101, 116, 112, 111, 114, 116, 32, 61, 32, 40, 117, 114, // etport = (ur - 108, 44, 32, 118, 41, 32, 61, 62, 32, 40, 40, 117, // l, v) => ((u - 114, 108, 32, 124, 124, 32, 39, 39, 41, 46, 109, 97, // rl || '').ma - 116, 99, 104, 40, 47, 46, 42, 58, 40, 92, 100, 43, // tch(/.*:(.d+ - 41, 47, 41, 32, 124, 124, 32, 91, 39, 39, 44, 32, // )/) || ['', - 118, 93, 41, 91, 49, 93, 59, 10, 10, 32, 32, 99, // v])[1];.. c - 111, 110, 115, 116, 32, 119, 97, 116, 99, 104, 87, 101, // onst watchWe - 98, 115, 111, 99, 107, 101, 116, 32, 61, 32, 102, 117, // bsocket = fu - 110, 99, 116, 105, 111, 110, 40, 41, 32, 123, 10, 32, // nction() {. - 32, 32, 32, 47, 47, 32, 67, 111, 110, 110, 101, 99, // // Connec - 116, 32, 116, 111, 32, 119, 101, 98, 115, 111, 99, 107, // t to websock - 101, 114, 32, 112, 111, 114, 116, 44, 32, 116, 111, 32, // er port, to - 105, 109, 112, 108, 101, 109, 101, 110, 116, 32, 87, 83, // implement WS - 32, 99, 111, 110, 115, 111, 108, 101, 10, 32, 32, 32, // console. - 32, 118, 97, 114, 32, 114, 101, 99, 111, 110, 110, 101, // var reconne - 99, 116, 32, 61, 32, 102, 117, 110, 99, 116, 105, 111, // ct = functio - 110, 40, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, // n() {. - 118, 97, 114, 32, 112, 111, 114, 116, 32, 61, 32, 103, // var port = g - 101, 116, 112, 111, 114, 116, 40, 99, 102, 103, 46, 119, // etport(cfg.w - 115, 46, 117, 114, 108, 44, 32, 52, 48, 48, 50, 41, // s.url, 4002) - 59, 10, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, // ;. var - 108, 32, 61, 32, 119, 105, 110, 100, 111, 119, 46, 108, // l = window.l - 111, 99, 97, 116, 105, 111, 110, 44, 32, 112, 114, 111, // ocation, pro - 116, 111, 32, 61, 32, 108, 46, 112, 114, 111, 116, 111, // to = l.proto - 99, 111, 108, 46, 114, 101, 112, 108, 97, 99, 101, 40, // col.replace( - 39, 104, 116, 116, 112, 39, 44, 32, 39, 119, 115, 39, // 'http', 'ws' - 41, 59, 10, 32, 32, 32, 32, 32, 32, 118, 97, 114, // );. var - 32, 116, 105, 100, 44, 32, 117, 114, 108, 32, 61, 32, // tid, url = - 96, 36, 123, 112, 114, 111, 116, 111, 125, 47, 47, 36, // `${proto}//$ - 123, 108, 46, 104, 111, 115, 116, 110, 97, 109, 101, 125, // {l.hostname} - 58, 36, 123, 112, 111, 114, 116, 125, 47, 119, 115, 96, // :${port}/ws` - 59, 10, 32, 32, 32, 32, 32, 32, 47, 47, 32, 99, // ;. // c - 111, 110, 115, 111, 108, 101, 46, 108, 111, 103, 40, 117, // onsole.log(u - 114, 108, 41, 59, 10, 32, 32, 32, 32, 32, 32, 118, // rl);. v - 97, 114, 32, 119, 115, 32, 61, 32, 110, 101, 119, 32, // ar ws = new - 87, 101, 98, 83, 111, 99, 107, 101, 116, 40, 117, 114, // WebSocket(ur - 108, 41, 59, 10, 32, 32, 32, 32, 32, 32, 119, 115, // l);. ws - 46, 111, 110, 111, 112, 101, 110, 32, 61, 32, 40, 41, // .onopen = () - 32, 61, 62, 32, 123, 10, 32, 32, 32, 32, 32, 32, // => {. - 32, 32, 115, 101, 116, 67, 111, 110, 110, 101, 99, 116, // setConnect - 101, 100, 40, 116, 114, 117, 101, 41, 59, 10, 32, 32, // ed(true);. - 32, 32, 32, 32, 32, 32, 115, 101, 116, 87, 115, 40, // setWs( - 119, 115, 41, 59, 10, 32, 32, 32, 32, 32, 32, 125, // ws);. } - 59, 10, 32, 32, 32, 32, 32, 32, 119, 115, 46, 111, // ;. ws.o - 110, 109, 101, 115, 115, 97, 103, 101, 32, 61, 32, 101, // nmessage = e - 118, 32, 61, 62, 32, 123, 10, 32, 32, 32, 32, 32, // v => {. - 32, 32, 32, 47, 47, 32, 99, 111, 110, 115, 111, 108, // // consol - 101, 46, 108, 111, 103, 40, 101, 118, 44, 32, 101, 118, // e.log(ev, ev - 46, 100, 97, 116, 97, 41, 59, 10, 32, 32, 32, 32, // .data);. - 32, 32, 32, 32, 115, 101, 116, 77, 101, 115, 115, 97, // setMessa - 103, 101, 115, 40, 120, 32, 61, 62, 32, 120, 46, 99, // ges(x => x.c - 111, 110, 99, 97, 116, 40, 91, 123, 100, 97, 116, 97, // oncat([{data - 58, 32, 101, 118, 46, 100, 97, 116, 97, 44, 32, 117, // : ev.data, u - 97, 114, 116, 58, 32, 116, 114, 117, 101, 125, 93, 41, // art: true}]) - 41, 59, 10, 32, 32, 32, 32, 32, 32, 125, 59, 10, // );. };. - 32, 32, 32, 32, 32, 32, 119, 115, 46, 111, 110, 99, // ws.onc - 108, 111, 115, 101, 32, 61, 32, 102, 117, 110, 99, 116, // lose = funct - 105, 111, 110, 40, 41, 32, 123, 10, 32, 32, 32, 32, // ion() {. - 32, 32, 32, 32, 99, 108, 101, 97, 114, 84, 105, 109, // clearTim - 101, 111, 117, 116, 40, 116, 105, 100, 41, 59, 10, 32, // eout(tid);. - 32, 32, 32, 32, 32, 32, 32, 116, 105, 100, 32, 61, // tid = - 32, 115, 101, 116, 84, 105, 109, 101, 111, 117, 116, 40, // setTimeout( - 114, 101, 99, 111, 110, 110, 101, 99, 116, 44, 32, 49, // reconnect, 1 - 48, 48, 48, 41, 59, 10, 32, 32, 32, 32, 32, 32, // 000);. - 32, 32, 115, 101, 116, 67, 111, 110, 110, 101, 99, 116, // setConnect - 101, 100, 40, 102, 97, 108, 115, 101, 41, 59, 10, 32, // ed(false);. - 32, 32, 32, 32, 32, 32, 32, 115, 101, 116, 87, 115, // setWs - 40, 110, 117, 108, 108, 41, 59, 10, 32, 32, 32, 32, // (null);. - 32, 32, 125, 59, 10, 32, 32, 32, 32, 125, 59, 10, // };. };. - 32, 32, 32, 32, 114, 101, 99, 111, 110, 110, 101, 99, // reconnec - 116, 40, 41, 59, 10, 32, 32, 125, 59, 10, 10, 32, // t();. };.. - 32, 117, 115, 101, 69, 102, 102, 101, 99, 116, 40, 40, // useEffect(( - 41, 32, 61, 62, 32, 123, 10, 32, 32, 32, 32, 114, // ) => {. r - 101, 102, 114, 101, 115, 104, 40, 41, 59, 10, 32, 32, // efresh();. - 32, 32, 119, 97, 116, 99, 104, 87, 101, 98, 115, 111, // watchWebso - 99, 107, 101, 116, 40, 41, 59, 10, 32, 32, 125, 44, // cket();. }, - 32, 91, 93, 41, 59, 10, 10, 10, 32, 32, 99, 111, // []);... co - 110, 115, 116, 32, 115, 101, 110, 100, 109, 101, 115, 115, // nst sendmess - 97, 103, 101, 32, 61, 32, 101, 118, 32, 61, 62, 32, // age = ev => - 123, 10, 32, 32, 32, 32, 115, 101, 116, 77, 101, 115, // {. setMes - 115, 97, 103, 101, 115, 40, 120, 32, 61, 62, 32, 120, // sages(x => x - 46, 99, 111, 110, 99, 97, 116, 40, 91, 123, 100, 97, // .concat([{da - 116, 97, 58, 32, 116, 120, 116, 32, 43, 32, 39, 92, // ta: txt + '. - 110, 39, 44, 32, 117, 97, 114, 116, 58, 32, 102, 97, // n', uart: fa - 108, 115, 101, 125, 93, 41, 41, 59, 10, 32, 32, 32, // lse}]));. - 32, 105, 102, 32, 40, 119, 115, 41, 32, 119, 115, 46, // if (ws) ws. - 115, 101, 110, 100, 40, 116, 120, 116, 32, 43, 32, 39, // send(txt + ' - 92, 110, 39, 41, 59, 10, 32, 32, 32, 32, 115, 101, // .n');. se - 116, 84, 120, 116, 40, 39, 39, 41, 59, 10, 32, 32, // tTxt('');. - 125, 59, 10, 10, 32, 32, 99, 111, 110, 115, 116, 32, // };.. const - 111, 110, 99, 104, 97, 110, 103, 101, 32, 61, 32, 101, // onchange = e - 118, 32, 61, 62, 32, 102, 101, 116, 99, 104, 40, 39, // v => fetch(' - 47, 97, 112, 105, 47, 99, 111, 110, 102, 105, 103, 47, // /api/config/ - 115, 101, 116, 39, 44, 32, 123, 10, 32, 32, 32, 32, // set', {. - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 109, // m - 101, 116, 104, 111, 100, 58, 32, 39, 80, 79, 83, 84, // ethod: 'POST - 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, // ',. - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // - 32, 32, 32, 32, 32, 32, 104, 101, 97, 100, 101, 114, // header - 115, 58, 32, 123, 39, 67, 111, 110, 116, 101, 110, 116, // s: {'Content - 45, 84, 121, 112, 101, 39, 58, 32, 39, 97, 112, 112, // -Type': 'app - 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, // lication/jso - 110, 39, 125, 44, 10, 32, 32, 32, 32, 32, 32, 32, // n'},. - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // - 32, 32, 32, 32, 32, 32, 32, 32, 98, 111, 100, 121, // body - 58, 32, 74, 83, 79, 78, 46, 115, 116, 114, 105, 110, // : JSON.strin - 103, 105, 102, 121, 40, 99, 102, 103, 41, 44, 10, 32, // gify(cfg),. - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // - 125, 41, 46, 116, 104, 101, 110, 40, 114, 32, 61, 62, // }).then(r => - 32, 119, 115, 32, 38, 38, 32, 119, 115, 46, 99, 108, // ws && ws.cl - 111, 115, 101, 40, 41, 41, 59, 10, 10, 32, 32, 99, // ose());.. c - 111, 110, 115, 116, 32, 115, 101, 116, 32, 61, 32, 111, // onst set = o - 98, 106, 32, 61, 62, 32, 115, 101, 116, 67, 102, 103, // bj => setCfg - 40, 120, 32, 61, 62, 32, 79, 98, 106, 101, 99, 116, // (x => Object - 46, 97, 115, 115, 105, 103, 110, 40, 120, 44, 32, 111, // .assign(x, o - 98, 106, 41, 41, 59, 10, 32, 32, 99, 111, 110, 115, // bj));. cons - 116, 32, 115, 101, 116, 84, 120, 32, 61, 32, 101, 118, // t setTx = ev - 32, 61, 62, 32, 115, 101, 116, 40, 123, 116, 120, 58, // => set({tx: - 32, 112, 97, 114, 115, 101, 73, 110, 116, 40, 101, 118, // parseInt(ev - 46, 116, 97, 114, 103, 101, 116, 46, 118, 97, 108, 117, // .target.valu - 101, 41, 125, 41, 59, 10, 32, 32, 99, 111, 110, 115, // e)});. cons - 116, 32, 115, 101, 116, 82, 120, 32, 61, 32, 101, 118, // t setRx = ev - 32, 61, 62, 32, 115, 101, 116, 40, 123, 114, 120, 58, // => set({rx: - 32, 112, 97, 114, 115, 101, 73, 110, 116, 40, 101, 118, // parseInt(ev - 46, 116, 97, 114, 103, 101, 116, 46, 118, 97, 108, 117, // .target.valu - 101, 41, 125, 41, 59, 10, 32, 32, 99, 111, 110, 115, // e)});. cons - 116, 32, 115, 101, 116, 66, 97, 117, 100, 32, 61, 32, // t setBaud = - 101, 118, 32, 61, 62, 32, 115, 101, 116, 40, 123, 98, // ev => set({b - 97, 117, 100, 58, 32, 112, 97, 114, 115, 101, 73, 110, // aud: parseIn - 116, 40, 101, 118, 46, 116, 97, 114, 103, 101, 116, 46, // t(ev.target. - 118, 97, 108, 117, 101, 41, 125, 41, 59, 10, 32, 32, // value)});. - 99, 111, 110, 115, 116, 32, 115, 101, 116, 84, 99, 112, // const setTcp - 85, 114, 108, 32, 61, 32, 101, 118, 32, 61, 62, 32, // Url = ev => - 115, 101, 116, 40, 123, 116, 99, 112, 58, 32, 123, 117, // set({tcp: {u - 114, 108, 58, 32, 96, 116, 99, 112, 58, 47, 47, 48, // rl: `tcp://0 - 46, 48, 46, 48, 46, 48, 58, 36, 123, 101, 118, 46, // .0.0.0:${ev. - 116, 97, 114, 103, 101, 116, 46, 118, 97, 108, 117, 101, // target.value - 125, 96, 125, 125, 41, 59, 10, 32, 32, 99, 111, 110, // }`}});. con - 115, 116, 32, 115, 101, 116, 87, 115, 85, 114, 108, 32, // st setWsUrl - 61, 32, 101, 118, 32, 61, 62, 32, 115, 101, 116, 40, // = ev => set( - 123, 119, 115, 58, 32, 123, 117, 114, 108, 58, 32, 96, // {ws: {url: ` - 119, 115, 58, 47, 47, 48, 46, 48, 46, 48, 46, 48, // ws://0.0.0.0 - 58, 36, 123, 101, 118, 46, 116, 97, 114, 103, 101, 116, // :${ev.target - 46, 118, 97, 108, 117, 101, 125, 96, 125, 125, 41, 59, // .value}`}}); - 10, 32, 32, 99, 111, 110, 115, 116, 32, 115, 101, 116, // . const set - 77, 113, 116, 116, 85, 114, 108, 32, 61, 32, 101, 118, // MqttUrl = ev - 32, 61, 62, 32, 115, 101, 116, 40, 123, 109, 113, 116, // => set({mqt - 116, 58, 32, 123, 117, 114, 108, 58, 32, 101, 118, 46, // t: {url: ev. - 116, 97, 114, 103, 101, 116, 46, 118, 97, 108, 117, 101, // target.value - 125, 125, 41, 59, 10, 32, 32, 99, 111, 110, 115, 116, // }});. const - 32, 115, 101, 116, 84, 99, 112, 69, 110, 97, 32, 61, // setTcpEna = - 32, 101, 118, 32, 61, 62, 32, 40, 115, 101, 116, 40, // ev => (set( - 123, 116, 99, 112, 58, 32, 123, 101, 110, 97, 98, 108, // {tcp: {enabl - 101, 58, 32, 101, 118, 46, 116, 97, 114, 103, 101, 116, // e: ev.target - 46, 99, 104, 101, 99, 107, 101, 100, 125, 125, 41, 44, // .checked}}), - 32, 111, 110, 99, 104, 97, 110, 103, 101, 40, 41, 41, // onchange()) - 59, 10, 32, 32, 99, 111, 110, 115, 116, 32, 115, 101, // ;. const se - 116, 87, 115, 69, 110, 97, 32, 61, 32, 101, 118, 32, // tWsEna = ev - 61, 62, 32, 40, 115, 101, 116, 40, 123, 119, 115, 58, // => (set({ws: - 32, 123, 101, 110, 97, 98, 108, 101, 58, 32, 101, 118, // {enable: ev - 46, 116, 97, 114, 103, 101, 116, 46, 99, 104, 101, 99, // .target.chec - 107, 101, 100, 125, 125, 41, 44, 32, 111, 110, 99, 104, // ked}}), onch - 97, 110, 103, 101, 40, 41, 41, 59, 10, 32, 32, 99, // ange());. c - 111, 110, 115, 116, 32, 115, 101, 116, 77, 113, 116, 116, // onst setMqtt - 69, 110, 97, 32, 61, 32, 101, 118, 32, 61, 62, 10, // Ena = ev =>. - 32, 32, 32, 32, 32, 32, 40, 115, 101, 116, 40, 123, // (set({ - 109, 113, 116, 116, 58, 32, 123, 101, 110, 97, 98, 108, // mqtt: {enabl - 101, 58, 32, 101, 118, 46, 116, 97, 114, 103, 101, 116, // e: ev.target - 46, 99, 104, 101, 99, 107, 101, 100, 125, 125, 41, 44, // .checked}}), - 32, 111, 110, 99, 104, 97, 110, 103, 101, 40, 41, 41, // onchange()) - 59, 10, 10, 32, 32, 114, 101, 116, 117, 114, 110, 32, // ;.. return - 104, 116, 109, 108, 96, 10, 60, 100, 105, 118, 32, 99, // html`.
.

UART .u27F - 55, 32, 110, 101, 116, 119, 111, 114, 107, 32, 98, 114, // 7 network br - 105, 100, 103, 101, 32, 60, 47, 104, 49, 62, 10, 32, // idge

. - 32, 60, 112, 114, 101, 32, 99, 108, 97, 115, 115, 61, //
${J
-  83,  79,  78,  46, 115, 116, 114, 105, 110, 103, 105, 102, // SON.stringif
- 121,  40,  99, 102, 103,  44,  32, 110, 117, 108, 108,  44, // y(cfg, null,
-  32,  50,  41, 125,  60,  47, 112, 114, 101,  62,  10,  32, //  2)}
. - 32, 60, 100, 105, 118, 32, 99, 108, 97, 115, 115, 61, //
. < - 100, 105, 118, 32, 99, 108, 97, 115, 115, 61, 34, 99, // div class="c - 111, 108, 32, 99, 111, 108, 45, 52, 34, 62, 10, 32, // ol col-4">. - 32, 32, 32, 32, 32, 60, 104, 51, 62, 85, 65, 82, //

UAR - 84, 32, 99, 111, 110, 102, 105, 103, 117, 114, 97, 116, // T configurat - 105, 111, 110, 60, 47, 104, 51, 62, 10, 32, 32, 32, // ion

. - 32, 32, 32, 60, 100, 105, 118, 32, 99, 108, 97, 115, //
. - 32, 32, 32, 32, 32, 32, 60, 108, 97, 98, 101, 108, // . - 32, 32, 32, 32, 32, 32, 32, 60, 105, 110, 112, 117, // . < - 47, 100, 105, 118, 62, 60, 100, 105, 118, 32, 99, 108, // /div>
. - 32, 32, 32, 32, 32, 32, 32, 32, 60, 108, 97, 98, // UART RX - 32, 112, 105, 110, 60, 47, 108, 97, 98, 101, 108, 62, // pin - 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 105, 110, // . . - 32, 60, 47, 100, 105, 118, 62, 60, 100, 105, 118, 32, //
. UART - 66, 97, 117, 100, 60, 47, 108, 97, 98, 101, 108, 62, // Baud - 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 105, 110, // . . - 32, 32, 32, 32, 32, 60, 47, 100, 105, 118, 62, 10, //
. - 32, 32, 32, 32, 60, 47, 100, 105, 118, 62, 10, 32, //
. - 32, 32, 32, 60, 100, 105, 118, 32, 99, 108, 97, 115, //
.

Network con - 102, 105, 103, 117, 114, 97, 116, 105, 111, 110, 60, 47, // figuration. . - 32, 32, 32, 32, 32, 32, 32, 32, 60, 108, 97, 98, // Local T - 67, 80, 32, 112, 111, 114, 116, 60, 47, 108, 97, 98, // CP port. - 60, 105, 110, 112, 117, 116, 32, 115, 116, 121, 108, 101, // . enabl - 101, 60, 47, 108, 97, 98, 101, 108, 62, 10, 32, 32, // e. - 32, 32, 32, 32, 60, 47, 100, 105, 118, 62, 60, 100, //

. - 32, 32, 32, 32, 32, 32, 32, 32, 60, 108, 97, 98, // Local W - 83, 32, 112, 111, 114, 116, 60, 47, 108, 97, 98, 101, // S port. < - 105, 110, 112, 117, 116, 32, 115, 116, 121, 108, 101, 61, // input style= - 34, 102, 108, 101, 120, 58, 32, 49, 32, 49, 48, 48, // "flex: 1 100 - 37, 59, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32, // %;". - 32, 32, 118, 97, 108, 117, 101, 61, 36, 123, 103, 101, // value=${ge - 116, 112, 111, 114, 116, 40, 99, 102, 103, 46, 119, 115, // tport(cfg.ws - 46, 117, 114, 108, 44, 32, 52, 48, 48, 50, 41, 125, // .url, 4002)} - 32, 111, 110, 99, 104, 97, 110, 103, 101, 61, 36, 123, // onchange=${ - 111, 110, 99, 104, 97, 110, 103, 101, 125, 10, 32, 32, // onchange}. - 32, 32, 32, 32, 32, 32, 32, 32, 111, 110, 105, 110, // onin - 112, 117, 116, 61, 36, 123, 115, 101, 116, 87, 115, 85, // put=${setWsU - 114, 108, 125, 32, 47, 62, 10, 32, 32, 32, 32, 32, // rl} />. - 32, 32, 32, 60, 108, 97, 98, 101, 108, 32, 99, 108, // - 10, 32, 32, 32, 32, 32, 32, 60, 47, 100, 105, 118, // .
. < - 108, 97, 98, 101, 108, 32, 99, 108, 97, 115, 115, 61, // label class= - 34, 97, 100, 100, 111, 110, 34, 62, 82, 101, 109, 111, // "addon">Remo - 116, 101, 32, 77, 81, 84, 84, 60, 47, 108, 97, 98, // te MQTT. - 60, 105, 110, 112, 117, 116, 32, 115, 116, 121, 108, 101, // - 115, 101, 116, 77, 113, 116, 116, 40, 101, 118, 46, 116, // setMqtt(ev.t - 97, 114, 103, 101, 116, 46, 118, 97, 108, 117, 101, 41, // arget.value) - 125, 32, 47, 62, 10, 32, 32, 32, 32, 32, 32, 32, // } />. - 32, 60, 108, 97, 98, 101, 108, 32, 99, 108, 97, 115, //
. - 10, 32, 32, 60, 100, 105, 118, 32, 99, 108, 97, 115, // .
. - 32, 78, 111, 116, 101, 58, 32, 116, 111, 32, 99, 111, // Note: to co - 110, 110, 101, 99, 116, 32, 111, 118, 101, 114, 32, 77, // nnect over M - 81, 84, 84, 44, 32, 10, 32, 32, 32, 32, 32, 32, // QTT, . - 111, 112, 101, 110, 32, 60, 97, 32, 104, 114, 101, 102, // open . co - 110, 115, 111, 108, 101, 60, 47, 97, 62, 44, 32, 115, // nsole, s - 117, 98, 115, 99, 114, 105, 98, 101, 32, 116, 111, 32, // ubscribe to - 98, 47, 116, 120, 32, 97, 110, 100, 32, 112, 117, 98, // b/tx and pub - 108, 105, 115, 104, 32, 116, 111, 32, 98, 47, 114, 120, // lish to b/rx - 60, 98, 114, 47, 62, 10, 32, 32, 32, 32, 78, 111, //
. No - 116, 101, 58, 32, 116, 111, 32, 99, 111, 110, 110, 101, // te: to conne - 99, 116, 32, 111, 118, 101, 114, 32, 84, 67, 80, 44, // ct over TCP, - 32, 117, 115, 101, 32, 110, 101, 116, 99, 97, 116, 32, // use netcat - 117, 116, 105, 108, 105, 116, 121, 58, 60, 98, 114, 47, // utility:
. $ nc $ - 123, 108, 111, 99, 97, 116, 105, 111, 110, 46, 104, 111, // {location.ho - 115, 116, 110, 97, 109, 101, 125, 32, 36, 123, 103, 101, // stname} ${ge - 116, 112, 111, 114, 116, 40, 99, 102, 103, 46, 116, 99, // tport(cfg.tc - 112, 46, 117, 114, 108, 44, 32, 52, 48, 48, 49, 41, // p.url, 4001) - 125, 10, 32, 32, 60, 47, 100, 105, 118, 62, 10, 10, // }.
.. - 32, 32, 60, 100, 105, 118, 32, 115, 116, 121, 108, 101, //
. - 32, 60, 98, 62, 85, 65, 82, 84, 32, 99, 111, 110, // UART con - 115, 111, 108, 101, 60, 47, 98, 62, 60, 115, 112, 97, // soleworks . - 32, 32, 32, 32, 111, 118, 101, 114, 32, 116, 104, 101, // over the - 32, 108, 111, 99, 97, 108, 32, 87, 83, 32, 112, 111, // local WS po - 114, 116, 46, 32, 87, 101, 98, 83, 111, 99, 107, 101, // rt. WebSocke - 116, 32, 115, 116, 97, 116, 117, 115, 58, 32, 60, 47, // t status: . .u - 50, 53, 99, 102, 32, 36, 123, 99, 111, 110, 110, 101, // 25cf ${conne - 99, 116, 101, 100, 32, 63, 32, 39, 99, 111, 110, 110, // cted ? 'conn - 101, 99, 116, 101, 100, 39, 32, 58, 32, 39, 100, 105, // ected' : 'di - 115, 99, 111, 110, 110, 101, 99, 116, 101, 100, 39, 125, // sconnected'} - 32, 60, 47, 115, 112, 97, 110, 62, 10, 32, 32, 60, // . < - 47, 100, 105, 118, 62, 10, 32, 32, 60, 100, 105, 118, // /div>.
. s - 101, 116, 84, 120, 116, 40, 101, 118, 46, 116, 97, 114, // etTxt(ev.tar - 103, 101, 116, 46, 118, 97, 108, 117, 101, 41, 125, 32, // get.value)} - 47, 62, 10, 32, 32, 32, 32, 60, 98, 117, 116, 116, // />. setMessag - 101, 115, 40, 91, 93, 41, 125, 62, 99, 108, 101, 97, // es([])}>clea - 114, 60, 47, 98, 117, 116, 116, 111, 110, 62, 10, 32, // r. - 32, 60, 47, 100, 105, 118, 62, 10, 32, 32, 60, 112, //
.

. ${ - 109, 101, 115, 115, 97, 103, 101, 115, 46, 109, 97, 112, // messages.map - 40, 109, 101, 115, 115, 97, 103, 101, 32, 61, 62, 32, // (message => - 104, 40, 77, 101, 115, 115, 97, 103, 101, 44, 32, 123, // h(Message, { - 109, 101, 115, 115, 97, 103, 101, 125, 41, 41, 125, 10, // message}))}. - 32, 32, 60, 47, 112, 114, 101, 62, 10, 10, 60, 47, // ..`;.};..w - 105, 110, 100, 111, 119, 46, 111, 110, 108, 111, 97, 100, // indow.onload - 32, 61, 32, 40, 41, 32, 61, 62, 32, 114, 101, 110, // = () => ren - 100, 101, 114, 40, 104, 40, 65, 112, 112, 41, 44, 32, // der(h(App), - 100, 111, 99, 117, 109, 101, 110, 116, 46, 98, 111, 100, // document.bod - 121, 41, 59, 10, 0 // y);. -}; -static const unsigned char v3[] = { 118, 97, 114, 32, 101, 44, 110, 44, 95, 44, 116, 44, // var e,n,_,t, 111, 44, 114, 44, 117, 44, 108, 61, 123, 125, 44, 105, // o,r,u,l={},i 61, 91, 93, 44, 99, 61, 47, 97, 99, 105, 116, 124, // =[],c=/acit| @@ -1627,7 +1138,7 @@ static const unsigned char v3[] = { 115, 101, 69, 114, 114, 111, 114, 66, 111, 117, 110, 100, // seErrorBound 97, 114, 121, 125, 59, 10, 0 // ary};. }; -static const unsigned char v4[] = { +static const unsigned char v3[] = { 42, 32, 123, 32, 98, 111, 120, 45, 115, 105, 122, 105, // * { box-sizi 110, 103, 58, 32, 98, 111, 114, 100, 101, 114, 45, 98, // ng: border-b 111, 120, 59, 32, 125, 10, 104, 116, 109, 108, 44, 32, // ox; }.html, @@ -1800,6 +1311,500 @@ static const unsigned char v4[] = { 32, 119, 105, 100, 116, 104, 58, 32, 49, 48, 48, 37, // width: 100% 59, 32, 125, 32, 125, 10, 0 // ; } }. }; +static const unsigned char v4[] = { + 39, 117, 115, 101, 32, 115, 116, 114, 105, 99, 116, 39, // 'use strict' + 59, 10, 105, 109, 112, 111, 114, 116, 32, 123, 67, 111, // ;.import {Co + 109, 112, 111, 110, 101, 110, 116, 44, 32, 104, 44, 32, // mponent, h, + 104, 116, 109, 108, 44, 32, 114, 101, 110, 100, 101, 114, // html, render + 44, 32, 117, 115, 101, 69, 102, 102, 101, 99, 116, 44, // , useEffect, + 32, 117, 115, 101, 83, 116, 97, 116, 101, 44, 32, 117, // useState, u + 115, 101, 82, 101, 102, 125, 32, 102, 114, 111, 109, 32, // seRef} from + 39, 46, 47, 112, 114, 101, 97, 99, 116, 46, 109, 105, // './preact.mi + 110, 46, 106, 115, 39, 59, 10, 10, 99, 111, 110, 115, // n.js';..cons + 116, 32, 77, 101, 115, 115, 97, 103, 101, 32, 61, 32, // t Message = + 109, 32, 61, 62, 32, 104, 116, 109, 108, 96, 60, 115, // m => html`. + 32, 36, 123, 109, 46, 109, 101, 115, 115, 97, 103, 101, // ${m.message + 46, 100, 97, 116, 97, 125, 10, 60, 47, 115, 112, 97, // .data}.`;..const + 65, 112, 112, 32, 61, 32, 102, 117, 110, 99, 116, 105, // App = functi + 111, 110, 40, 112, 114, 111, 112, 115, 41, 32, 123, 10, // on(props) {. + 32, 32, 99, 111, 110, 115, 116, 32, 91, 99, 102, 103, // const [cfg + 44, 32, 115, 101, 116, 67, 102, 103, 93, 32, 61, 32, // , setCfg] = + 117, 115, 101, 83, 116, 97, 116, 101, 40, 123, 116, 99, // useState({tc + 112, 58, 32, 123, 125, 44, 32, 119, 115, 58, 32, 123, // p: {}, ws: { + 125, 44, 32, 109, 113, 116, 116, 58, 32, 123, 125, 125, // }, mqtt: {}} + 41, 59, 10, 32, 32, 99, 111, 110, 115, 116, 32, 91, // );. const [ + 109, 101, 115, 115, 97, 103, 101, 115, 44, 32, 115, 101, // messages, se + 116, 77, 101, 115, 115, 97, 103, 101, 115, 93, 32, 61, // tMessages] = + 32, 117, 115, 101, 83, 116, 97, 116, 101, 40, 91, 93, // useState([] + 41, 59, 10, 32, 32, 99, 111, 110, 115, 116, 32, 91, // );. const [ + 99, 111, 110, 110, 101, 99, 116, 101, 100, 44, 32, 115, // connected, s + 101, 116, 67, 111, 110, 110, 101, 99, 116, 101, 100, 93, // etConnected] + 32, 61, 32, 117, 115, 101, 83, 116, 97, 116, 101, 40, // = useState( + 102, 97, 108, 115, 101, 41, 59, 10, 32, 32, 99, 111, // false);. co + 110, 115, 116, 32, 91, 116, 120, 116, 44, 32, 115, 101, // nst [txt, se + 116, 84, 120, 116, 93, 32, 61, 32, 117, 115, 101, 83, // tTxt] = useS + 116, 97, 116, 101, 40, 39, 39, 41, 59, 10, 32, 32, // tate('');. + 99, 111, 110, 115, 116, 32, 91, 119, 115, 44, 32, 115, // const [ws, s + 101, 116, 87, 115, 93, 32, 61, 32, 117, 115, 101, 83, // etWs] = useS + 116, 97, 116, 101, 40, 110, 117, 108, 108, 41, 59, 10, // tate(null);. + 10, 32, 32, 99, 111, 110, 115, 116, 32, 114, 101, 102, // . const ref + 114, 101, 115, 104, 32, 61, 32, 40, 41, 32, 61, 62, // resh = () => + 10, 32, 32, 32, 32, 32, 32, 102, 101, 116, 99, 104, // . fetch + 40, 39, 47, 97, 112, 105, 47, 99, 111, 110, 102, 105, // ('/api/confi + 103, 47, 103, 101, 116, 39, 41, 46, 116, 104, 101, 110, // g/get').then + 40, 114, 32, 61, 62, 32, 114, 46, 106, 115, 111, 110, // (r => r.json + 40, 41, 41, 46, 116, 104, 101, 110, 40, 114, 32, 61, // ()).then(r = + 62, 32, 115, 101, 116, 67, 102, 103, 40, 114, 41, 41, // > setCfg(r)) + 59, 10, 10, 32, 32, 99, 111, 110, 115, 116, 32, 103, // ;.. const g + 101, 116, 112, 111, 114, 116, 32, 61, 32, 40, 117, 114, // etport = (ur + 108, 44, 32, 118, 41, 32, 61, 62, 32, 40, 40, 117, // l, v) => ((u + 114, 108, 32, 124, 124, 32, 39, 39, 41, 46, 109, 97, // rl || '').ma + 116, 99, 104, 40, 47, 46, 42, 58, 40, 92, 100, 43, // tch(/.*:(.d+ + 41, 47, 41, 32, 124, 124, 32, 91, 39, 39, 44, 32, // )/) || ['', + 118, 93, 41, 91, 49, 93, 59, 10, 10, 32, 32, 99, // v])[1];.. c + 111, 110, 115, 116, 32, 119, 97, 116, 99, 104, 87, 101, // onst watchWe + 98, 115, 111, 99, 107, 101, 116, 32, 61, 32, 102, 117, // bsocket = fu + 110, 99, 116, 105, 111, 110, 40, 41, 32, 123, 10, 32, // nction() {. + 32, 32, 32, 47, 47, 32, 67, 111, 110, 110, 101, 99, // // Connec + 116, 32, 116, 111, 32, 119, 101, 98, 115, 111, 99, 107, // t to websock + 101, 114, 32, 112, 111, 114, 116, 44, 32, 116, 111, 32, // er port, to + 105, 109, 112, 108, 101, 109, 101, 110, 116, 32, 87, 83, // implement WS + 32, 99, 111, 110, 115, 111, 108, 101, 10, 32, 32, 32, // console. + 32, 118, 97, 114, 32, 114, 101, 99, 111, 110, 110, 101, // var reconne + 99, 116, 32, 61, 32, 102, 117, 110, 99, 116, 105, 111, // ct = functio + 110, 40, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, // n() {. + 118, 97, 114, 32, 112, 111, 114, 116, 32, 61, 32, 103, // var port = g + 101, 116, 112, 111, 114, 116, 40, 99, 102, 103, 46, 119, // etport(cfg.w + 115, 46, 117, 114, 108, 44, 32, 52, 48, 48, 50, 41, // s.url, 4002) + 59, 10, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, // ;. var + 108, 32, 61, 32, 119, 105, 110, 100, 111, 119, 46, 108, // l = window.l + 111, 99, 97, 116, 105, 111, 110, 44, 32, 112, 114, 111, // ocation, pro + 116, 111, 32, 61, 32, 108, 46, 112, 114, 111, 116, 111, // to = l.proto + 99, 111, 108, 46, 114, 101, 112, 108, 97, 99, 101, 40, // col.replace( + 39, 104, 116, 116, 112, 39, 44, 32, 39, 119, 115, 39, // 'http', 'ws' + 41, 59, 10, 32, 32, 32, 32, 32, 32, 118, 97, 114, // );. var + 32, 116, 105, 100, 44, 32, 117, 114, 108, 32, 61, 32, // tid, url = + 96, 36, 123, 112, 114, 111, 116, 111, 125, 47, 47, 36, // `${proto}//$ + 123, 108, 46, 104, 111, 115, 116, 110, 97, 109, 101, 125, // {l.hostname} + 58, 36, 123, 112, 111, 114, 116, 125, 47, 119, 115, 96, // :${port}/ws` + 59, 10, 32, 32, 32, 32, 32, 32, 47, 47, 32, 99, // ;. // c + 111, 110, 115, 111, 108, 101, 46, 108, 111, 103, 40, 117, // onsole.log(u + 114, 108, 41, 59, 10, 32, 32, 32, 32, 32, 32, 118, // rl);. v + 97, 114, 32, 119, 115, 32, 61, 32, 110, 101, 119, 32, // ar ws = new + 87, 101, 98, 83, 111, 99, 107, 101, 116, 40, 117, 114, // WebSocket(ur + 108, 41, 59, 10, 32, 32, 32, 32, 32, 32, 119, 115, // l);. ws + 46, 111, 110, 111, 112, 101, 110, 32, 61, 32, 40, 41, // .onopen = () + 32, 61, 62, 32, 123, 10, 32, 32, 32, 32, 32, 32, // => {. + 32, 32, 115, 101, 116, 67, 111, 110, 110, 101, 99, 116, // setConnect + 101, 100, 40, 116, 114, 117, 101, 41, 59, 10, 32, 32, // ed(true);. + 32, 32, 32, 32, 32, 32, 115, 101, 116, 87, 115, 40, // setWs( + 119, 115, 41, 59, 10, 32, 32, 32, 32, 32, 32, 125, // ws);. } + 59, 10, 32, 32, 32, 32, 32, 32, 119, 115, 46, 111, // ;. ws.o + 110, 109, 101, 115, 115, 97, 103, 101, 32, 61, 32, 101, // nmessage = e + 118, 32, 61, 62, 32, 123, 10, 32, 32, 32, 32, 32, // v => {. + 32, 32, 32, 47, 47, 32, 99, 111, 110, 115, 111, 108, // // consol + 101, 46, 108, 111, 103, 40, 101, 118, 44, 32, 101, 118, // e.log(ev, ev + 46, 100, 97, 116, 97, 41, 59, 10, 32, 32, 32, 32, // .data);. + 32, 32, 32, 32, 115, 101, 116, 77, 101, 115, 115, 97, // setMessa + 103, 101, 115, 40, 120, 32, 61, 62, 32, 120, 46, 99, // ges(x => x.c + 111, 110, 99, 97, 116, 40, 91, 123, 100, 97, 116, 97, // oncat([{data + 58, 32, 101, 118, 46, 100, 97, 116, 97, 44, 32, 117, // : ev.data, u + 97, 114, 116, 58, 32, 116, 114, 117, 101, 125, 93, 41, // art: true}]) + 41, 59, 10, 32, 32, 32, 32, 32, 32, 125, 59, 10, // );. };. + 32, 32, 32, 32, 32, 32, 119, 115, 46, 111, 110, 99, // ws.onc + 108, 111, 115, 101, 32, 61, 32, 102, 117, 110, 99, 116, // lose = funct + 105, 111, 110, 40, 41, 32, 123, 10, 32, 32, 32, 32, // ion() {. + 32, 32, 32, 32, 99, 108, 101, 97, 114, 84, 105, 109, // clearTim + 101, 111, 117, 116, 40, 116, 105, 100, 41, 59, 10, 32, // eout(tid);. + 32, 32, 32, 32, 32, 32, 32, 116, 105, 100, 32, 61, // tid = + 32, 115, 101, 116, 84, 105, 109, 101, 111, 117, 116, 40, // setTimeout( + 114, 101, 99, 111, 110, 110, 101, 99, 116, 44, 32, 49, // reconnect, 1 + 48, 48, 48, 41, 59, 10, 32, 32, 32, 32, 32, 32, // 000);. + 32, 32, 115, 101, 116, 67, 111, 110, 110, 101, 99, 116, // setConnect + 101, 100, 40, 102, 97, 108, 115, 101, 41, 59, 10, 32, // ed(false);. + 32, 32, 32, 32, 32, 32, 32, 115, 101, 116, 87, 115, // setWs + 40, 110, 117, 108, 108, 41, 59, 10, 32, 32, 32, 32, // (null);. + 32, 32, 125, 59, 10, 32, 32, 32, 32, 125, 59, 10, // };. };. + 32, 32, 32, 32, 114, 101, 99, 111, 110, 110, 101, 99, // reconnec + 116, 40, 41, 59, 10, 32, 32, 125, 59, 10, 10, 32, // t();. };.. + 32, 117, 115, 101, 69, 102, 102, 101, 99, 116, 40, 40, // useEffect(( + 41, 32, 61, 62, 32, 123, 10, 32, 32, 32, 32, 114, // ) => {. r + 101, 102, 114, 101, 115, 104, 40, 41, 59, 10, 32, 32, // efresh();. + 32, 32, 119, 97, 116, 99, 104, 87, 101, 98, 115, 111, // watchWebso + 99, 107, 101, 116, 40, 41, 59, 10, 32, 32, 125, 44, // cket();. }, + 32, 91, 93, 41, 59, 10, 10, 10, 32, 32, 99, 111, // []);... co + 110, 115, 116, 32, 115, 101, 110, 100, 109, 101, 115, 115, // nst sendmess + 97, 103, 101, 32, 61, 32, 101, 118, 32, 61, 62, 32, // age = ev => + 123, 10, 32, 32, 32, 32, 115, 101, 116, 77, 101, 115, // {. setMes + 115, 97, 103, 101, 115, 40, 120, 32, 61, 62, 32, 120, // sages(x => x + 46, 99, 111, 110, 99, 97, 116, 40, 91, 123, 100, 97, // .concat([{da + 116, 97, 58, 32, 116, 120, 116, 32, 43, 32, 39, 92, // ta: txt + '. + 110, 39, 44, 32, 117, 97, 114, 116, 58, 32, 102, 97, // n', uart: fa + 108, 115, 101, 125, 93, 41, 41, 59, 10, 32, 32, 32, // lse}]));. + 32, 105, 102, 32, 40, 119, 115, 41, 32, 119, 115, 46, // if (ws) ws. + 115, 101, 110, 100, 40, 116, 120, 116, 32, 43, 32, 39, // send(txt + ' + 92, 110, 39, 41, 59, 10, 32, 32, 32, 32, 115, 101, // .n');. se + 116, 84, 120, 116, 40, 39, 39, 41, 59, 10, 32, 32, // tTxt('');. + 125, 59, 10, 10, 32, 32, 99, 111, 110, 115, 116, 32, // };.. const + 111, 110, 99, 104, 97, 110, 103, 101, 32, 61, 32, 101, // onchange = e + 118, 32, 61, 62, 32, 102, 101, 116, 99, 104, 40, 39, // v => fetch(' + 47, 97, 112, 105, 47, 99, 111, 110, 102, 105, 103, 47, // /api/config/ + 115, 101, 116, 39, 44, 32, 123, 10, 32, 32, 32, 32, // set', {. + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 109, // m + 101, 116, 104, 111, 100, 58, 32, 39, 80, 79, 83, 84, // ethod: 'POST + 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, // ',. + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // + 32, 32, 32, 32, 32, 32, 104, 101, 97, 100, 101, 114, // header + 115, 58, 32, 123, 39, 67, 111, 110, 116, 101, 110, 116, // s: {'Content + 45, 84, 121, 112, 101, 39, 58, 32, 39, 97, 112, 112, // -Type': 'app + 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, // lication/jso + 110, 39, 125, 44, 10, 32, 32, 32, 32, 32, 32, 32, // n'},. + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // + 32, 32, 32, 32, 32, 32, 32, 32, 98, 111, 100, 121, // body + 58, 32, 74, 83, 79, 78, 46, 115, 116, 114, 105, 110, // : JSON.strin + 103, 105, 102, 121, 40, 99, 102, 103, 41, 44, 10, 32, // gify(cfg),. + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // + 125, 41, 46, 116, 104, 101, 110, 40, 114, 32, 61, 62, // }).then(r => + 32, 119, 115, 32, 38, 38, 32, 119, 115, 46, 99, 108, // ws && ws.cl + 111, 115, 101, 40, 41, 41, 59, 10, 10, 32, 32, 99, // ose());.. c + 111, 110, 115, 116, 32, 115, 101, 116, 32, 61, 32, 111, // onst set = o + 98, 106, 32, 61, 62, 32, 115, 101, 116, 67, 102, 103, // bj => setCfg + 40, 120, 32, 61, 62, 32, 79, 98, 106, 101, 99, 116, // (x => Object + 46, 97, 115, 115, 105, 103, 110, 40, 120, 44, 32, 111, // .assign(x, o + 98, 106, 41, 41, 59, 10, 32, 32, 99, 111, 110, 115, // bj));. cons + 116, 32, 110, 115, 101, 116, 32, 61, 32, 40, 110, 44, // t nset = (n, + 111, 98, 106, 41, 32, 61, 62, 32, 115, 101, 116, 67, // obj) => setC + 102, 103, 40, 120, 32, 61, 62, 32, 79, 98, 106, 101, // fg(x => Obje + 99, 116, 46, 97, 115, 115, 105, 103, 110, 40, 120, 44, // ct.assign(x, + 32, 123, 91, 110, 93, 58, 32, 79, 98, 106, 101, 99, // {[n]: Objec + 116, 46, 97, 115, 115, 105, 103, 110, 40, 120, 91, 110, // t.assign(x[n + 93, 44, 111, 98, 106, 41, 125, 41, 41, 59, 10, 32, // ],obj)}));. + 32, 99, 111, 110, 115, 116, 32, 115, 101, 116, 84, 120, // const setTx + 32, 61, 32, 101, 118, 32, 61, 62, 32, 115, 101, 116, // = ev => set + 40, 123, 116, 120, 58, 32, 112, 97, 114, 115, 101, 73, // ({tx: parseI + 110, 116, 40, 101, 118, 46, 116, 97, 114, 103, 101, 116, // nt(ev.target + 46, 118, 97, 108, 117, 101, 41, 125, 41, 59, 10, 32, // .value)});. + 32, 99, 111, 110, 115, 116, 32, 115, 101, 116, 82, 120, // const setRx + 32, 61, 32, 101, 118, 32, 61, 62, 32, 115, 101, 116, // = ev => set + 40, 123, 114, 120, 58, 32, 112, 97, 114, 115, 101, 73, // ({rx: parseI + 110, 116, 40, 101, 118, 46, 116, 97, 114, 103, 101, 116, // nt(ev.target + 46, 118, 97, 108, 117, 101, 41, 125, 41, 59, 10, 32, // .value)});. + 32, 99, 111, 110, 115, 116, 32, 115, 101, 116, 66, 97, // const setBa + 117, 100, 32, 61, 32, 101, 118, 32, 61, 62, 32, 115, // ud = ev => s + 101, 116, 40, 123, 98, 97, 117, 100, 58, 32, 112, 97, // et({baud: pa + 114, 115, 101, 73, 110, 116, 40, 101, 118, 46, 116, 97, // rseInt(ev.ta + 114, 103, 101, 116, 46, 118, 97, 108, 117, 101, 41, 125, // rget.value)} + 41, 59, 10, 32, 32, 99, 111, 110, 115, 116, 32, 115, // );. const s + 101, 116, 84, 99, 112, 85, 114, 108, 32, 61, 32, 101, // etTcpUrl = e + 118, 32, 61, 62, 32, 110, 115, 101, 116, 40, 39, 116, // v => nset('t + 99, 112, 39, 44, 32, 123, 117, 114, 108, 58, 32, 96, // cp', {url: ` + 116, 99, 112, 58, 47, 47, 48, 46, 48, 46, 48, 46, // tcp://0.0.0. + 48, 58, 36, 123, 101, 118, 46, 116, 97, 114, 103, 101, // 0:${ev.targe + 116, 46, 118, 97, 108, 117, 101, 125, 96, 125, 41, 59, // t.value}`}); + 10, 32, 32, 99, 111, 110, 115, 116, 32, 115, 101, 116, // . const set + 87, 115, 85, 114, 108, 32, 61, 32, 101, 118, 32, 61, // WsUrl = ev = + 62, 32, 110, 115, 101, 116, 40, 39, 119, 115, 39, 44, // > nset('ws', + 123, 117, 114, 108, 58, 32, 96, 119, 115, 58, 47, 47, // {url: `ws:// + 48, 46, 48, 46, 48, 46, 48, 58, 36, 123, 101, 118, // 0.0.0.0:${ev + 46, 116, 97, 114, 103, 101, 116, 46, 118, 97, 108, 117, // .target.valu + 101, 125, 96, 125, 41, 59, 10, 32, 32, 99, 111, 110, // e}`});. con + 115, 116, 32, 115, 101, 116, 77, 113, 116, 116, 85, 114, // st setMqttUr + 108, 32, 61, 32, 101, 118, 32, 61, 62, 32, 110, 115, // l = ev => ns + 101, 116, 40, 39, 109, 113, 116, 116, 39, 44, 123, 117, // et('mqtt',{u + 114, 108, 58, 32, 101, 118, 46, 116, 97, 114, 103, 101, // rl: ev.targe + 116, 46, 118, 97, 108, 117, 101, 125, 41, 59, 10, 32, // t.value});. + 32, 99, 111, 110, 115, 116, 32, 115, 101, 116, 84, 99, // const setTc + 112, 69, 110, 97, 32, 61, 32, 101, 118, 32, 61, 62, // pEna = ev => + 32, 40, 110, 115, 101, 116, 40, 39, 116, 99, 112, 39, // (nset('tcp' + 44, 123, 101, 110, 97, 98, 108, 101, 58, 32, 101, 118, // ,{enable: ev + 46, 116, 97, 114, 103, 101, 116, 46, 99, 104, 101, 99, // .target.chec + 107, 101, 100, 125, 41, 44, 32, 111, 110, 99, 104, 97, // ked}), oncha + 110, 103, 101, 40, 41, 41, 59, 10, 32, 32, 99, 111, // nge());. co + 110, 115, 116, 32, 115, 101, 116, 87, 115, 69, 110, 97, // nst setWsEna + 32, 61, 32, 101, 118, 32, 61, 62, 32, 40, 110, 115, // = ev => (ns + 101, 116, 40, 39, 119, 115, 39, 44, 123, 101, 110, 97, // et('ws',{ena + 98, 108, 101, 58, 32, 101, 118, 46, 116, 97, 114, 103, // ble: ev.targ + 101, 116, 46, 99, 104, 101, 99, 107, 101, 100, 125, 41, // et.checked}) + 44, 32, 111, 110, 99, 104, 97, 110, 103, 101, 40, 41, // , onchange() + 41, 59, 10, 32, 32, 99, 111, 110, 115, 116, 32, 115, // );. const s + 101, 116, 77, 113, 116, 116, 69, 110, 97, 32, 61, 32, // etMqttEna = + 101, 118, 32, 61, 62, 40, 110, 115, 101, 116, 40, 39, // ev =>(nset(' + 109, 113, 116, 116, 39, 44, 32, 123, 101, 110, 97, 98, // mqtt', {enab + 108, 101, 58, 32, 101, 118, 46, 116, 97, 114, 103, 101, // le: ev.targe + 116, 46, 99, 104, 101, 99, 107, 101, 100, 125, 41, 44, // t.checked}), + 32, 111, 110, 99, 104, 97, 110, 103, 101, 40, 41, 41, // onchange()) + 59, 10, 10, 32, 32, 114, 101, 116, 117, 114, 110, 32, // ;.. return + 104, 116, 109, 108, 96, 10, 60, 100, 105, 118, 32, 99, // html`.

.

UART .u27F + 55, 32, 110, 101, 116, 119, 111, 114, 107, 32, 98, 114, // 7 network br + 105, 100, 103, 101, 32, 60, 47, 104, 49, 62, 10, 32, // idge

. + 32, 60, 112, 114, 101, 32, 99, 108, 97, 115, 115, 61, //
${J
+  83,  79,  78,  46, 115, 116, 114, 105, 110, 103, 105, 102, // SON.stringif
+ 121,  40,  99, 102, 103,  44,  32, 110, 117, 108, 108,  44, // y(cfg, null,
+  32,  50,  41, 125,  60,  47, 112, 114, 101,  62,  10,  32, //  2)}
. + 32, 60, 100, 105, 118, 32, 99, 108, 97, 115, 115, 61, //
. < + 100, 105, 118, 32, 99, 108, 97, 115, 115, 61, 34, 99, // div class="c + 111, 108, 32, 99, 111, 108, 45, 52, 34, 62, 10, 32, // ol col-4">. + 32, 32, 32, 32, 32, 60, 104, 51, 62, 85, 65, 82, //

UAR + 84, 32, 99, 111, 110, 102, 105, 103, 117, 114, 97, 116, // T configurat + 105, 111, 110, 60, 47, 104, 51, 62, 10, 32, 32, 32, // ion

. + 32, 32, 32, 60, 100, 105, 118, 32, 99, 108, 97, 115, //
. + 32, 32, 32, 32, 32, 32, 60, 108, 97, 98, 101, 108, // . + 32, 32, 32, 32, 32, 32, 32, 60, 105, 110, 112, 117, // . < + 47, 100, 105, 118, 62, 60, 100, 105, 118, 32, 99, 108, // /div>
. + 32, 32, 32, 32, 32, 32, 32, 32, 60, 108, 97, 98, // UART RX + 32, 112, 105, 110, 60, 47, 108, 97, 98, 101, 108, 62, // pin + 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 105, 110, // . . + 32, 60, 47, 100, 105, 118, 62, 60, 100, 105, 118, 32, //
. UART + 66, 97, 117, 100, 60, 47, 108, 97, 98, 101, 108, 62, // Baud + 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 105, 110, // . . + 32, 32, 32, 32, 32, 60, 47, 100, 105, 118, 62, 10, //
. + 32, 32, 32, 32, 60, 47, 100, 105, 118, 62, 10, 32, //
. + 32, 32, 32, 60, 100, 105, 118, 32, 99, 108, 97, 115, //
.

Network con + 102, 105, 103, 117, 114, 97, 116, 105, 111, 110, 60, 47, // figuration. . + 32, 32, 32, 32, 32, 32, 32, 32, 60, 108, 97, 98, // Local T + 67, 80, 32, 112, 111, 114, 116, 60, 47, 108, 97, 98, // CP port. + 60, 105, 110, 112, 117, 116, 32, 115, 116, 121, 108, 101, // . enabl + 101, 60, 47, 108, 97, 98, 101, 108, 62, 10, 32, 32, // e. + 32, 32, 32, 32, 60, 47, 100, 105, 118, 62, 60, 100, //

. + 32, 32, 32, 32, 32, 32, 32, 32, 60, 108, 97, 98, // Local W + 83, 32, 112, 111, 114, 116, 60, 47, 108, 97, 98, 101, // S port. < + 105, 110, 112, 117, 116, 32, 115, 116, 121, 108, 101, 61, // input style= + 34, 102, 108, 101, 120, 58, 32, 49, 32, 49, 48, 48, // "flex: 1 100 + 37, 59, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32, // %;". + 32, 32, 118, 97, 108, 117, 101, 61, 36, 123, 103, 101, // value=${ge + 116, 112, 111, 114, 116, 40, 99, 102, 103, 46, 119, 115, // tport(cfg.ws + 46, 117, 114, 108, 44, 32, 52, 48, 48, 50, 41, 125, // .url, 4002)} + 32, 111, 110, 99, 104, 97, 110, 103, 101, 61, 36, 123, // onchange=${ + 111, 110, 99, 104, 97, 110, 103, 101, 125, 10, 32, 32, // onchange}. + 32, 32, 32, 32, 32, 32, 32, 32, 111, 110, 105, 110, // onin + 112, 117, 116, 61, 36, 123, 115, 101, 116, 87, 115, 85, // put=${setWsU + 114, 108, 125, 32, 47, 62, 10, 32, 32, 32, 32, 32, // rl} />. + 32, 32, 32, 60, 108, 97, 98, 101, 108, 32, 99, 108, // + 10, 32, 32, 32, 32, 32, 32, 60, 47, 100, 105, 118, // .
. < + 108, 97, 98, 101, 108, 32, 99, 108, 97, 115, 115, 61, // label class= + 34, 97, 100, 100, 111, 110, 34, 62, 82, 101, 109, 111, // "addon">Remo + 116, 101, 32, 77, 81, 84, 84, 60, 47, 108, 97, 98, // te MQTT. + 60, 105, 110, 112, 117, 116, 32, 115, 116, 121, 108, 101, // . + 32, 32, 32, 32, 32, 60, 108, 97, 98, 101, 108, 32, //
. + 60, 47, 100, 105, 118, 62, 10, 32, 32, 60, 47, 100, //
. ..
+ 10, 32, 32, 32, 32, 78, 111, 116, 101, 58, 32, 116, // . Note: t + 111, 32, 99, 111, 110, 110, 101, 99, 116, 32, 111, 118, // o connect ov + 101, 114, 32, 77, 81, 84, 84, 44, 32, 10, 32, 32, // er MQTT, . + 32, 32, 32, 32, 111, 112, 101, 110, 32, 60, 97, 32, // open . + 32, 32, 99, 111, 110, 115, 111, 108, 101, 60, 47, 97, // console, subscribe + 32, 116, 111, 32, 98, 47, 116, 120, 32, 97, 110, 100, // to b/tx and + 32, 112, 117, 98, 108, 105, 115, 104, 32, 116, 111, 32, // publish to + 98, 47, 114, 120, 60, 98, 114, 47, 62, 10, 32, 32, // b/rx
. + 32, 32, 78, 111, 116, 101, 58, 32, 116, 111, 32, 99, // Note: to c + 111, 110, 110, 101, 99, 116, 32, 111, 118, 101, 114, 32, // onnect over + 84, 67, 80, 44, 32, 117, 115, 101, 32, 110, 101, 116, // TCP, use net + 99, 97, 116, 32, 117, 116, 105, 108, 105, 116, 121, 58, // cat utility: + 60, 98, 114, 47, 62, 10, 32, 32, 32, 32, 36, 32, //
. $ + 110, 99, 32, 36, 123, 108, 111, 99, 97, 116, 105, 111, // nc ${locatio + 110, 46, 104, 111, 115, 116, 110, 97, 109, 101, 125, 32, // n.hostname} + 36, 123, 103, 101, 116, 112, 111, 114, 116, 40, 99, 102, // ${getport(cf + 103, 46, 116, 99, 112, 46, 117, 114, 108, 44, 32, 52, // g.tcp.url, 4 + 48, 48, 49, 41, 125, 10, 32, 32, 60, 47, 100, 105, // 001)}. ..
+ 10, 32, 32, 32, 32, 60, 98, 62, 85, 65, 82, 84, // . UART + 32, 99, 111, 110, 115, 111, 108, 101, 60, 47, 98, 62, // console + 60, 115, 112, 97, 110, 32, 115, 116, 121, 108, 101, 61, // wor + 107, 115, 32, 10, 32, 32, 32, 32, 111, 118, 101, 114, // ks . over + 32, 116, 104, 101, 32, 108, 111, 99, 97, 108, 32, 87, // the local W + 83, 32, 112, 111, 114, 116, 46, 32, 87, 101, 98, 83, // S port. WebS + 111, 99, 107, 101, 116, 32, 115, 116, 97, 116, 117, 115, // ocket status + 58, 32, 60, 47, 115, 112, 97, 110, 62, 60, 115, 112, // : . + 32, 32, 92, 117, 50, 53, 99, 102, 32, 36, 123, 99, // .u25cf ${c + 111, 110, 110, 101, 99, 116, 101, 100, 32, 63, 32, 39, // onnected ? ' + 99, 111, 110, 110, 101, 99, 116, 101, 100, 39, 32, 58, // connected' : + 32, 39, 100, 105, 115, 99, 111, 110, 110, 101, 99, 116, // 'disconnect + 101, 100, 39, 125, 32, 60, 47, 115, 112, 97, 110, 62, // ed'} + 10, 32, 32, 60, 47, 100, 105, 118, 62, 10, 32, 32, // .
. + 60, 100, 105, 118, 32, 115, 116, 121, 108, 101, 61, 34, //
. + 32, 60, 105, 110, 112, 117, 116, 32, 112, 108, 97, 99, // setTxt(ev + 46, 116, 97, 114, 103, 101, 116, 46, 118, 97, 108, 117, // .target.valu + 101, 41, 125, 32, 47, 62, 10, 32, 32, 32, 32, 60, // e)} />. < + 98, 117, 116, 116, 111, 110, 32, 115, 116, 121, 108, 101, // button style + 61, 34, 109, 97, 114, 103, 105, 110, 45, 108, 101, 102, // ="margin-lef + 116, 58, 32, 49, 101, 109, 59, 34, 10, 32, 32, 32, // t: 1em;". + 32, 32, 32, 111, 110, 99, 108, 105, 99, 107, 61, 36, // onclick=$ + 123, 101, 118, 32, 61, 62, 32, 115, 101, 116, 77, 101, // {ev => setMe + 115, 115, 97, 103, 101, 115, 40, 91, 93, 41, 125, 62, // ssages([])}> + 99, 108, 101, 97, 114, 60, 47, 98, 117, 116, 116, 111, // clear.
. + 32, 32, 60, 112, 114, 101, 32, 115, 116, 121, 108, 101, //
.  
+  32,  32,  36, 123, 109, 101, 115, 115,  97, 103, 101, 115, //   ${messages
+  46, 109,  97, 112,  40, 109, 101, 115, 115,  97, 103, 101, // .map(message
+  32,  61,  62,  32, 104,  40,  77, 101, 115, 115,  97, 103, //  => h(Messag
+ 101,  44,  32, 123, 109, 101, 115, 115,  97, 103, 101, 125, // e, {message}
+  41,  41, 125,  10,  32,  32,  60,  47, 112, 114, 101,  62, // ))}.  
+ 10, 10, 60, 47, 100, 105, 118, 62, 96, 59, 10, 125, // ..
`;.} + 59, 10, 10, 119, 105, 110, 100, 111, 119, 46, 111, 110, // ;..window.on + 108, 111, 97, 100, 32, 61, 32, 40, 41, 32, 61, 62, // load = () => + 32, 114, 101, 110, 100, 101, 114, 40, 104, 40, 65, 112, // render(h(Ap + 112, 41, 44, 32, 100, 111, 99, 117, 109, 101, 110, 116, // p), document + 46, 98, 111, 100, 121, 41, 59, 10, 0 // .body);. +}; static const struct packed_file { const char *name; @@ -1807,13 +1812,17 @@ static const struct packed_file { size_t size; time_t mtime; } packed_files[] = { - {"/web_root/index.html", v1, sizeof(v1), 1654623573}, - {"/web_root/main.js", v2, sizeof(v2), 1655545304}, - {"/web_root/preact.min.js", v3, sizeof(v3), 1654623573}, - {"/web_root/style.css", v4, sizeof(v4), 1655548336}, + {"/web_root/index.html", v1, sizeof(v1), 1655487950}, + {"/web_root/preact.min.js", v2, sizeof(v2), 1655487950}, + {"/web_root/style.css", v3, sizeof(v3), 1655749961}, + {"/web_root/main.js", v4, sizeof(v4), 1658950918}, {NULL, NULL, 0, 0} }; +static int scmp(const char *a, const char *b) { + while (*a && (*a == *b)) a++, b++; + return *(const unsigned char *) a - *(const unsigned char *) b; +} const char *mg_unlist(size_t no); const char *mg_unlist(size_t no) { return packed_files[no].name; @@ -1822,7 +1831,7 @@ const char *mg_unpack(const char *path, size_t *size, time_t *mtime); const char *mg_unpack(const char *name, size_t *size, time_t *mtime) { const struct packed_file *p; for (p = packed_files; p->name != NULL; p++) { - if (strcmp(p->name, name) != 0) continue; + if (scmp(p->name, name) != 0) continue; if (size != NULL) *size = p->size - 1; if (mtime != NULL) *mtime = p->mtime; return (const char *) p->data; diff --git a/examples/uart-bridge/web_root/main.js b/examples/uart-bridge/web_root/main.js index 445cb65d..640d8d15 100644 --- a/examples/uart-bridge/web_root/main.js +++ b/examples/uart-bridge/web_root/main.js @@ -63,16 +63,16 @@ const App = function(props) { }).then(r => ws && ws.close()); const set = obj => setCfg(x => Object.assign(x, obj)); + const nset = (n,obj) => setCfg(x => Object.assign(x, {[n]: Object.assign(x[n],obj)})); const setTx = ev => set({tx: parseInt(ev.target.value)}); const setRx = ev => set({rx: parseInt(ev.target.value)}); const setBaud = ev => set({baud: parseInt(ev.target.value)}); - const setTcpUrl = ev => set({tcp: {url: `tcp://0.0.0.0:${ev.target.value}`}}); - const setWsUrl = ev => set({ws: {url: `ws://0.0.0.0:${ev.target.value}`}}); - const setMqttUrl = ev => set({mqtt: {url: ev.target.value}}); - const setTcpEna = ev => (set({tcp: {enable: ev.target.checked}}), onchange()); - const setWsEna = ev => (set({ws: {enable: ev.target.checked}}), onchange()); - const setMqttEna = ev => - (set({mqtt: {enable: ev.target.checked}}), onchange()); + const setTcpUrl = ev => nset('tcp', {url: `tcp://0.0.0.0:${ev.target.value}`}); + const setWsUrl = ev => nset('ws',{url: `ws://0.0.0.0:${ev.target.value}`}); + const setMqttUrl = ev => nset('mqtt',{url: ev.target.value}); + const setTcpEna = ev => (nset('tcp',{enable: ev.target.checked}), onchange()); + const setWsEna = ev => (nset('ws',{enable: ev.target.checked}), onchange()); + const setMqttEna = ev =>(nset('mqtt', {enable: ev.target.checked}), onchange()); return html`
@@ -115,7 +115,7 @@ const App = function(props) { setMqtt(ev.target.value)} /> + oninput=${setMqttUrl} />