@@ -307,19 +307,21 @@ const char HTTP_FORM_LOGIN[] PROGMEM =
307307const char HTTP_FIELDSET_LEGEND[] PROGMEM =
308308 " <fieldset><legend><b> %s </b></legend>" ;
309309
310- const char HTTP_FORM_TEMPLATE[] PROGMEM =
311- " <form method='get' action='tp'>" ;
310+ const char HTTP_FORM_GET_ACTION[] PROGMEM =
311+ " <form method='get' action='%s'>" ;
312+
313+ const char HTTP_FORM_BUTTON[] PROGMEM =
314+ " <p></p><form method='get' action='%s'><button>%s</button></form>" ;
315+
312316const char HTTP_FORM_TEMPLATE_FLAG[] PROGMEM =
313317// "<label><input id='c0' name='c0' type='checkbox'><b>" D_OPTION_TEXT "</b></label><br>"
314318 " </p></fieldset>" ;
315319
316320const char HTTP_FORM_MODULE[] PROGMEM =
317- " <form method='get' action='md'>"
318321 " <p></p><b>" D_MODULE_TYPE " </b> (%s)<br><select id='g99'></select><br>"
319322 " <br><table>" ;
320323
321324const char HTTP_FORM_WIFI_PART1[] PROGMEM =
322- " <form method='get' action='wi'>"
323325 " <p><b>" D_AP1_SSID " </b>%s<br><input id='s1' placeholder=\" " D_AP1_SSID_HELP " \" value=\" %s\" ></p>" // Need \" instead of ' to be able to use ' in text (#8489)
324326 " <p><label><b>" D_AP_PASSWORD " </b><input type='checkbox' onclick='sp(\" p1\" )'></label><br><input id='p1' type='password' placeholder=\" " D_AP_PASSWORD_HELP " \" " ;
325327
@@ -333,18 +335,12 @@ const char HTTP_FORM_WIFI_PART2[] PROGMEM =
333335#endif
334336 ;
335337
336- const char HTTP_FORM_LOG1[] PROGMEM =
337- " <form method='get' action='lg'>" ;
338- const char HTTP_FORM_LOG2[] PROGMEM =
338+ const char HTTP_FORM_LOG[] PROGMEM =
339339 " <p><b>" D_SYSLOG_HOST " </b> (" SYS_LOG_HOST " )<br><input id='lh' placeholder=\" " SYS_LOG_HOST " \" value=\" %s\" ></p>"
340340 " <p><b>" D_SYSLOG_PORT " </b> (" STR(SYS_LOG_PORT) " )<br><input id='lp' placeholder='" STR(SYS_LOG_PORT) " ' value='%d'></p>"
341341 " <p><b>" D_TELEMETRY_PERIOD " </b> (" STR(TELE_PERIOD) " )<br><input id='lt' placeholder='" STR(TELE_PERIOD) " ' value='%d'></p>" ;
342342
343- const char HTTP_FORM_OTHER1[] PROGMEM =
344- " <form method='get' action='co'>"
345- " <p></p>" ;
346-
347- const char HTTP_FORM_OTHER2[] PROGMEM =
343+ const char HTTP_FORM_OTHER[] PROGMEM =
348344 " <p><input id='t1' placeholder=\" " D_TEMPLATE " \" value='%s'></p>" // We need ' apostrophe here as the template contains " quotation mark
349345 " <p><label><input id='t2' type='checkbox'%s><b>" D_ACTIVATE " </b></label></p>"
350346 " </fieldset>"
@@ -362,11 +358,10 @@ const char HTTP_FORM_END[] PROGMEM =
362358 " <button name='save' type='submit' class='button bgrn'>" D_SAVE " </button>"
363359 " </form></fieldset>" ;
364360
365- const char HTTP_DIV_BLOCK [] PROGMEM =
361+ const char HTTP_DIV_F1_BLOCK [] PROGMEM =
366362 " <div id='f1' name='f1' style='display:block;'>" ;
367363
368364const char HTTP_FORM_UPG[] PROGMEM =
369- " <form method='get' action='u1'>"
370365 " <br><b>" D_OTA_URL " </b><br><input id='o' placeholder=\" OTA_URL\" value=\" %s\" ><br>"
371366 " <br><button type='submit'>" D_START_UPGRADE " </button></form>"
372367 " </fieldset><br><br>" ;
@@ -2275,7 +2270,7 @@ void HandleTemplateConfiguration(void) {
22752270
22762271 WSContentSendStyle ();
22772272 WSContentSend_P (HTTP_FIELDSET_LEGEND, PSTR (D_TEMPLATE_PARAMETERS));
2278- WSContentSend_P (HTTP_FORM_TEMPLATE );
2273+ WSContentSend_P (HTTP_FORM_GET_ACTION, PSTR ( " tp " ) );
22792274 WSContentSend_P (HTTP_TABLE100); // "<table style='width:100%%'>"
22802275 WSContentSend_P (PSTR (" <tr><td><b>" D_TEMPLATE_NAME " </b></td><td style='width:200px'><input id='s1' placeholder='" D_TEMPLATE_NAME " '></td></tr>"
22812276 " <tr><td><b>" D_BASE_TYPE " </b></td><td><select id='g99' onchange='st(this.value)'></select></td></tr>"
@@ -2449,6 +2444,7 @@ void HandleModuleConfiguration(void) {
24492444
24502445 WSContentSendStyle ();
24512446 WSContentSend_P (HTTP_FIELDSET_LEGEND, PSTR (D_MODULE_PARAMETERS));
2447+ WSContentSend_P (HTTP_FORM_GET_ACTION, PSTR (" md" ));
24522448 WSContentSend_P (HTTP_FORM_MODULE, AnyModuleName (MODULE).c_str ());
24532449 for (uint32_t i = 0 ; i < nitems (template_gp.io ); i++) {
24542450 if (ValidGPIO (i, template_gp.io [i])) {
@@ -2729,6 +2725,7 @@ void HandleWifiConfiguration(void) {
27292725 WSContentSend_P (PSTR (" <div><a href='/wi?scan='>%s</a></div><br>" ),
27302726 (limitScannedNetworks) ? PSTR (D_SHOW_MORE_WIFI_NETWORKS) : PSTR (D_SCAN_FOR_WIFI_NETWORKS));
27312727 WSContentSend_P (HTTP_FIELDSET_LEGEND, PSTR (D_WIFI_PARAMETERS));
2728+ WSContentSend_P (HTTP_FORM_GET_ACTION, PSTR (" wi" ));
27322729 WSContentSend_P (HTTP_FORM_WIFI_PART1,
27332730 (WifiIsInManagerMode ()) ? " " : PSTR (" (" STA_SSID1 " )" ),
27342731 SettingsTextEscaped (SET_STASSID1).c_str ());
@@ -2813,7 +2810,7 @@ void HandleLoggingConfiguration(void) {
28132810 WSContentStart_P (PSTR (D_CONFIGURE_LOGGING));
28142811 WSContentSendStyle ();
28152812 WSContentSend_P (HTTP_FIELDSET_LEGEND, PSTR (D_LOGGING_PARAMETERS));
2816- WSContentSend_P (HTTP_FORM_LOG1 );
2813+ WSContentSend_P (HTTP_FORM_GET_ACTION, PSTR ( " lg " ) );
28172814 char stemp1[45 ];
28182815 char stemp2[32 ];
28192816 uint8_t dlevel[4 ] = { LOG_LEVEL_INFO, LOG_LEVEL_INFO, LOG_LEVEL_NONE, LOG_LEVEL_NONE };
@@ -2831,7 +2828,7 @@ void HandleLoggingConfiguration(void) {
28312828 }
28322829 WSContentSend_P (PSTR (" </select></p>" ));
28332830 }
2834- WSContentSend_P (HTTP_FORM_LOG2 ,
2831+ WSContentSend_P (HTTP_FORM_LOG ,
28352832 SettingsTextEscaped (SET_SYSLOG_HOST).c_str (),
28362833 Settings->syslog_port ,
28372834 Settings->tele_period );
@@ -2875,9 +2872,10 @@ void HandleOtherConfiguration(void) {
28752872 TemplateJson ();
28762873
28772874 WSContentSend_P (HTTP_FIELDSET_LEGEND, PSTR (D_OTHER_PARAMETERS));
2878- WSContentSend_P (HTTP_FORM_OTHER1);
2875+ WSContentSend_P (HTTP_FORM_GET_ACTION, PSTR (" co" ));
2876+ WSContentSend_P (PSTR (" <p></p>" ));
28792877 WSContentSend_P (HTTP_FIELDSET_LEGEND, PSTR (D_TEMPLATE));
2880- WSContentSend_P (HTTP_FORM_OTHER2 ,
2878+ WSContentSend_P (HTTP_FORM_OTHER ,
28812879 HtmlEscape (ResponseData ()).c_str (),
28822880 (USER_MODULE == Settings->module ) ? PSTR (" checked disabled" ) : " " ,
28832881 (Settings->flag5 .disable_referer_chk ) ? PSTR (" checked" ) : " " , // SetOption128 - Enable HTTP API
@@ -3018,7 +3016,7 @@ void HandleRestoreConfiguration(void) {
30183016
30193017 WSContentStart_P (PSTR (D_RESTORE_CONFIGURATION));
30203018 WSContentSendStyle ();
3021- WSContentSend_P (HTTP_DIV_BLOCK );
3019+ WSContentSend_P (HTTP_DIV_F1_BLOCK );
30223020 WSContentSend_P (HTTP_FIELDSET_LEGEND, PSTR (D_RESTORE_CONFIGURATION));
30233021 WSContentSend_P (HTTP_FORM_RST_UPG, PSTR (D_START_RESTORE));
30243022 if (WifiIsInManagerMode ()) {
@@ -3390,8 +3388,9 @@ void HandleUpgradeFirmware(void) {
33903388 WSContentStart_P (PSTR (D_FIRMWARE_UPGRADE));
33913389 WSContentSendStyle ();
33923390 WSContentSend_P (HTTP_MENU_HEAD, D_FIRMWARE_UPGRADE);
3393- WSContentSend_P (HTTP_DIV_BLOCK );
3391+ WSContentSend_P (HTTP_DIV_F1_BLOCK );
33943392 WSContentSend_P (HTTP_FIELDSET_LEGEND, PSTR (D_UPGRADE_BY_WEBSERVER));
3393+ WSContentSend_P (HTTP_FORM_GET_ACTION, PSTR (" u1" ));
33953394 WSContentSend_P (HTTP_FORM_UPG, SettingsTextEscaped (SET_OTAURL).c_str ());
33963395 WSContentSend_P (HTTP_FIELDSET_LEGEND, PSTR (D_UPGRADE_BY_FILE_UPLOAD));
33973396#ifdef ESP32
0 commit comments