Merge remote-tracking branch 'origin/main' into mods

This commit is contained in:
btsimonh
2022-02-16 18:54:33 +00:00
8 changed files with 49 additions and 8 deletions

View File

@ -2,15 +2,16 @@
#include "../new_common.h"
#include "ctype.h"
#include "lwip/sockets.h"
#if WINDOWS
//#include <windows.h>
#include <winsock2.h>
//#include <ws2tcpip.h>
#elif PLATFORM_XR809
#include "lwip/sockets.h"
#include <stdarg.h>
#include <image/flash.h>
#else
#include "lwip/sockets.h"
#include "str_pub.h"
#endif
#include "new_http.h"
@ -1199,7 +1200,26 @@ int HTTP_ProcessPacket(http_request_t *request) {
}
}
// strcat(outbuf,"<button type=\"button\">Click Me!</button>");
if(http_getArg(urlStr,"restart",tmpA,sizeof(tmpA))) {
poststr(request,"<h5> Module will restart soon</h5>");
#if WINDOWS
#elif PLATFORM_XR809
#else
RESET_ScheduleModuleReset(3);
#endif
}
poststr(request,"<form action=\"cfg\"><input type=\"submit\" value=\"Config\"/></form>");
poststr(request,"<form action=\"/index\">\
<input type=\"hidden\" id=\"restart\" name=\"restart\" value=\"1\">\
<input type=\"submit\" value=\"Restart\" onclick=\"return confirm('Are you sure to restart module?')\">\
</form> ");
poststr(request,"<form action=\"about\"><input type=\"submit\" value=\"About\"/></form>");

View File

@ -15,9 +15,6 @@
#include "../flash_config/flash_config.h"
#include "../new_cfg.h"
extern int g_reset;
extern UINT32 flash_read(char *user_buf, UINT32 count, UINT32 address);
@ -701,7 +698,7 @@ static int http_rest_post_reboot(http_request_t *request){
http_setup(request, httpMimeTypeJson);
hprintf128(request, "{\"reboot\":%d}", 3);
ADDLOG_DEBUG(LOG_FEATURE_API, "Rebooting in 3 seconds...");
g_reset = 3;
RESET_ScheduleModuleReset(3);
poststr(request,NULL);
return 0;
}