Browse Source

for merge

zhangbo 5 years ago
parent
commit
18e6c9217a

+ 1 - 1
app/UpdateFirmware/main.c

@@ -61,7 +61,7 @@ int main()
 			printf("Create UpdateProgress.log file fail!\n");
 			return -1;
 		}
-		sprintf(progressStr, "%d%%", rate);
+		sprintf(progressStr, "%d", rate);
 		fputs(progressStr, fprogress);
 		fclose(fprogress);
 

+ 2 - 94
app/goahead-3.6.5/src/goahead.c

@@ -53,7 +53,6 @@ static LRESULT CALLBACK websWindProc(HWND hwnd, UINT msg, UINT wp, LPARAM lp);
 #if ME_UNIX_LIKE
 static void sigHandler(int signo);
 #endif
-static void uploadTest(Webs *wp);
 /*********************************** Code *************************************/
 
 MAIN(goahead, int argc, char **argv, char **envp)
@@ -202,7 +201,7 @@ websDefineAction("addUser", addUser);
 websDefineAction("delUser", delUser);
 
 //update firmware
-websDefineAction("uploadTest", uploadTest);
+// websDefineAction("uploadTest", uploadTest);
 websDefineAction("prepareDevice", prepareDevice);
 websDefineAction("uploadFirmware", uploadFirmware);
 websDefineAction("updateFlash", updateFlash);
@@ -210,15 +209,11 @@ websDefineAction("getUpdateProgress", getUpdateProgress);
 websDefineAction("getVerifyStatus", getVerifyStatus);
 websDefineAction("resetBmc", resetBmc);
 
+
 //server_health
 websDefineAction("setThreshold", setThreshold);
 
 
-
-
-
-
-
 /**************** user code after goahead end************************/
 
 #if ME_UNIX_LIKE && !MACOSX
@@ -244,93 +239,6 @@ websDefineAction("setThreshold", setThreshold);
     return 0;
 }
 
-// typedef struct{
-//     char buf[1024*1000];
-//     char filename[32];
-//     int fileSize;
-// } filestruct;
-
-// //这个函数是把16进制字符串转换成16进制
-
-// int StringToHex(char *str, unsigned char *out, unsigned int *outlen)
-// {
-//     char *p = str;
-//     char high = 0, low = 0;
-//     int tmplen = strlen(p), cnt = 0;
-//     tmplen = strlen(p);
-//     while(cnt < (tmplen / 2))
-//     {
-//         high = ((*p > '9') && ((*p <= 'F') || (*p <= 'f'))) ? *p - 48 - 7 : *p - 48;
-//         low = (*(++ p) > '9' && ((*p <= 'F') || (*p <= 'f'))) ? *(p) - 48 - 7 : *(p) - 48;
-//         out[cnt] = ((high & 0x0f) << 4 | (low & 0x0f));
-//         p ++;
-//         cnt ++;
-//     }
-//     if(tmplen % 2 != 0) out[cnt] = ((*p > '9') && ((*p <= 'F') || (*p <= 'f'))) ? *p - 48 - 7 : *p - 48;
-    
-//     if(outlen != NULL) *outlen = tmplen / 2 + tmplen % 2;
-//     return tmplen / 2 + tmplen % 2;
-// }
-
-
-
-static void uploadTest(Webs *wp)
-{
-    WebsKey         *s;
-    WebsUpload      *up;
-    char            *upfile;
-    websSetStatus(wp, 200);
-    websWriteHeaders(wp, -1, 0);
-    websWriteHeader(wp, "Content-Type", "text/plain");
-    websWriteEndHeaders(wp);
-    if (scaselessmatch(wp->method, "POST")) {
-        for (s = hashFirst(wp->files); s; s = hashNext(wp->files, s)) {
-            up = s->content.value.symbol;
-            websWrite(wp, "FILE: %s\r\n", s->name.value.string);
-            websWrite(wp, "FILENAME=%s\r\n", up->filename);
-            websWrite(wp, "CLIENT=%s\r\n", up->clientFilename);
-            websWrite(wp, "TYPE=%s\r\n", up->contentType);
-            websWrite(wp, "SIZE=%d\r\n", up->size);
-            upfile = sfmt("%s/tmp/%s", websGetDocuments(), up->clientFilename);
-            printf("<<<<<<<<<<<%s>>>>>>>>>>\n", upfile);
-            if (rename(up->filename, upfile) < 0) {
-                error("Cannot rename uploaded file: %s to %s, errno %d", up->filename, upfile, errno);
-            }
-            wfree(upfile);
-        }
-        websWrite(wp, "\r\nVARS:\r\n");
-        for (s = hashFirst(wp->vars); s; s = hashNext(wp->vars, s)) {
-            websWrite(wp, "%s=%s\r\n", s->name.value.string, s->content.value.string);
-        }
-    }
-
-
-
-    //  char *pStr;
-    // cJSON * root =  cJSON_CreateObject();
-    // cJSON * data =  cJSON_CreateObject();
-    // cJSON_AddItemToObject(root, "data", data);//根节点下添加
-    // cJSON_AddStringToObject(root, "msg", "");
-    // cJSON_AddNumberToObject(root, "code", 200);
-    
-   
-    // pStr = cJSON_PrintUnformatted(root);
-
-    // printf("---> cJSON Str:\n%s\n", pStr);
-    // websSetStatus(wp, 200);
-    // websWriteHeaders(wp, -1, 0);
-    // websWriteEndHeaders(wp); 
-    // websWrite(wp,"%s", pStr);
-    // websFlush(wp, 0);
-    // // websDone(wp);
-
-    // if(pStr)
-    //     wfree(pStr);
-    // if(root)
-    //     cJSON_Delete(root);
-    
-    websDone(wp);
-}
 
 static void logHeader()
 {

+ 63 - 1
app/goahead-3.6.5/src/web/index.html

@@ -1 +1,63 @@
-<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>bmcui</title><link href=/static/css/RemotPwrCtrl.css rel=prefetch><link href=/static/css/dashbord.css rel=prefetch><link href=/static/css/fan.css rel=prefetch><link href=/static/css/index.css rel=prefetch><link href=/static/css/login.css rel=prefetch><link href=/static/css/sensor_history.css rel=prefetch><link href=/static/css/set_proctrol.css rel=prefetch><link href=/static/css/system_logs.css rel=prefetch><link href=/static/js/BSODScreen.js rel=prefetch><link href=/static/js/RemotPwrCtrl.js rel=prefetch><link href=/static/js/RemotPwrCtrl~dashbord~fan~index~login~sensor_history.js rel=prefetch><link href=/static/js/dashbord.js rel=prefetch><link href=/static/js/event_logs.js rel=prefetch><link href=/static/js/fan.js rel=prefetch><link href=/static/js/index.js rel=prefetch><link href=/static/js/login.js rel=prefetch><link href=/static/js/sensor_history.js rel=prefetch><link href=/static/js/set_proctrol.js rel=prefetch><link href=/static/js/system_logs.js rel=prefetch><link href=/static/css/app.css rel=preload as=style><link href=/static/css/chunk-vendors.css rel=preload as=style><link href=/static/js/app.js rel=preload as=script><link href=/static/js/chunk-vendors.js rel=preload as=script><link href=/static/css/chunk-vendors.css rel=stylesheet><link href=/static/css/app.css rel=stylesheet></head><body><div id=app></div><script src=/static/js/chunk-vendors.js></script><script src=/static/js/app.js></script></body></html>
+<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>bmcui</title><link href=/static/css/RemotPwrCtrl.css rel=prefetch><link href=/static/css/UploadProgre.css rel=prefetch><link href=/static/css/UserManage.css rel=prefetch><link href=/static/css/dashbord.css rel=prefetch><link href=/static/css/fan.css rel=prefetch><link href=/static/css/index.css rel=prefetch><link href=/static/css/login.css rel=prefetch><link href=/static/css/sensor_history.css rel=prefetch><link href=/static/css/set_proctrol.css rel=prefetch><link href=/static/css/system_logs.css rel=prefetch><link href=/static/js/BSODScreen.js rel=prefetch><link href=/static/js/RemotPwrCtrl.js rel=prefetch><link href=/static/js/RemotPwrCtrl~UploadProgre~UserManage~dashbord~event_logs~fan~index~login~sensor_history.js rel=prefetch><link href=/static/js/SelList.js rel=prefetch><link href=/static/js/UploadProgre.js rel=prefetch><link href=/static/js/UserManage.js rel=prefetch><link href=/static/js/dashbord.js rel=prefetch><link href=/static/js/event_logs.js rel=prefetch><link href=/static/js/fan.js rel=prefetch><link href=/static/js/index.js rel=prefetch><link href=/static/js/login.js rel=prefetch><link href=/static/js/sensor_history.js rel=prefetch><link href=/static/js/set_proctrol.js rel=prefetch><link href=/static/js/system_logs.js rel=prefetch><link href=/static/css/app.css rel=preload as=style><link href=/static/css/chunk-vendors.css rel=preload as=style><link href=/static/js/app.js rel=preload as=script><link href=/static/js/chunk-vendors.js rel=preload as=script><link href=/static/css/chunk-vendors.css rel=stylesheet><link href=/static/css/app.css rel=stylesheet></head><script>var eLang = {};         // declare empty object
+
+//----------------------------------------------------------------//
+// getString
+// optBit - added by chandrasekarr@amiindia.co.in
+// purpose - For multidimensional declaration of strings.
+eLang.getString = function(widget, token, offset)
+{
+  var optBit = arguments[2];
+
+  if (token=="")
+    return " ";
+  else if (widget=="")
+    return "DEVERROR: String class not specified";
+  // Cascade to try and find the string, which could be included either in the
+  // frame/page that has loaded this copy of eLang, or it may be in the topmost
+  // frameset.
+  // [BrandonB] 7/2/2007
+
+  // First look for string group
+  if (eLang[widget+"_strings"]!=undefined)
+    {
+    //Optional bit check
+    if(optBit!=undefined && eLang[widget+"_strings"][token][optBit]!=undefined)
+    {
+    return eLang[widget+"_strings"][token][optBit];
+    }
+
+  if (eLang[widget+"_strings"][token]!=undefined)
+    {
+    return eLang[widget+"_strings"][token];
+    }
+    }
+  else
+    {
+    if (top.eLang[widget+"_strings"]!=undefined)
+      {
+      //Optional bit check
+      if(optBit!=undefined && top.eLang[widget+"_strings"][token][optBit]!=undefined)
+      return top.eLang[widget+"_strings"][token][optBit];
+
+      if (top.eLang[widget+"_strings"][token]!=undefined)
+        return top.eLang[widget+"_strings"][token];
+      }
+    else
+      {
+      if (eLang.global_strings!=undefined)
+        {
+        //Optional bit check
+        if(optBit!=undefined && eLang.global_strings[token][optBit]!=undefined)
+        return eLang.global_strings[token][optBit];
+
+        if (eLang.global_strings[token]!=undefined)
+          return eLang.global_strings[token];
+        }
+      }
+    }
+  return "DEVERROR: Cannot locate string eLang."+widget+"_strings["+token+"]"+(optBit!=undefined)?"["+optBit+"]":"";
+
+}
+
+
+eLang.loaded = true;</script><body><div id=app></div><script src=/static/js/chunk-vendors.js></script><script src=/static/js/app.js></script></body></html>

+ 1 - 0
app/goahead-3.6.5/src/web/static/css/UploadProgre.css

@@ -0,0 +1 @@
+input[data-v-4417c52b]{margin:0}.subSection[data-v-4417c52b]{padding:20px;width:450px}.subSection p[data-v-4417c52b]{margin-bottom:20px;text-align:right}.demo-spin-icon-load[data-v-4417c52b]{-webkit-animation:ani-demo-spin-data-v-4417c52b 1s linear infinite;animation:ani-demo-spin-data-v-4417c52b 1s linear infinite}@-webkit-keyframes ani-demo-spin-data-v-4417c52b{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}50%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes ani-demo-spin-data-v-4417c52b{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}50%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.demo-spin-col[data-v-4417c52b]{height:100px;position:relative;border:1px solid #eee}

+ 1 - 0
app/goahead-3.6.5/src/web/static/css/UserManage.css

@@ -0,0 +1 @@
+input[data-v-0dc5fd96]{margin:0}.subSection[data-v-0dc5fd96]{padding:20px;width:450px}.subSection p[data-v-0dc5fd96]{margin-bottom:20px;text-align:right}

File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/css/dashbord.css


+ 1 - 1
app/goahead-3.6.5/src/web/static/css/index.css

@@ -1 +1 @@
-.head-contener[data-v-78ddf56d]{width:1180px;height:125px;margin:0 auto}.logo-box[data-v-78ddf56d]{float:left;width:184px;height:23px}.logo-line[data-v-78ddf56d]{float:left;height:54px;width:1px;background:#77adff;margin-left:12px}.logo-text[data-v-78ddf56d]{float:left;margin-left:12px;font-size:14px}.logo-title[data-v-78ddf56d]{font-size:28px;color:#fff;font-weight:700;line-height:41px}.logo-subtitle[data-v-78ddf56d]{color:#77adff;font-size:12px}.logo-table[data-v-78ddf56d]{position:relative;padding-top:37px}.userDetails[data-v-78ddf56d]{font-size:12px;color:#fff;height:48px;line-height:48px;padding-left:20px;padding-right:20px;background:rgba(24,116,255,.1);border-bottom-left-radius:3px;border-bottom-right-radius:3px;position:absolute;right:0;top:0;color:#77adff}.userDetails img[data-v-78ddf56d]{width:12px;position:relative;margin-right:3px;margin-left:3px;height:12px}.userDetails a[data-v-78ddf56d]{padding-left:15px;text-decoration:none;color:#77adff}.menu-contente[data-v-40382e7c]{width:1180px;margin-left:auto;margin-right:auto}.dashbord-contanier[data-v-5d223bde]{margin:10 auto}.content[data-v-5d223bde]{width:1200px;margin:10px auto;height:800px;overflow-y:scroll;overflow-x:hidden}
+.head-contener[data-v-547198ba]{width:1180px;height:125px;margin:0 auto}.logo-box[data-v-547198ba]{float:left;width:184px;height:23px}.logo-line[data-v-547198ba]{float:left;height:54px;width:1px;background:#77adff;margin-left:12px}.logo-text[data-v-547198ba]{float:left;margin-left:12px;font-size:14px}.logo-title[data-v-547198ba]{font-size:28px;color:#fff;font-weight:700;line-height:41px;margin-top:9px}.logo-subtitle[data-v-547198ba]{color:#77adff;font-size:12px}.logo-table[data-v-547198ba]{position:relative;padding-top:37px}.userDetails[data-v-547198ba]{font-size:12px;color:#fff;height:48px;line-height:48px;padding-left:20px;padding-right:20px;background:rgba(24,116,255,.1);border-bottom-left-radius:3px;border-bottom-right-radius:3px;position:absolute;right:0;top:0;color:#77adff}.userDetails img[data-v-547198ba]{width:12px;position:relative;margin-right:3px;margin-left:3px;height:12px}.userDetails a[data-v-547198ba]{padding-left:15px;text-decoration:none;color:#77adff}.menu-contente[data-v-686b837e]{width:1180px;margin-left:auto;margin-right:auto}.dashbord-contanier[data-v-5d223bde]{margin:10 auto}.content[data-v-5d223bde]{width:1200px;margin:10px auto;height:800px;overflow-y:scroll;overflow-x:hidden}

+ 1 - 1
app/goahead-3.6.5/src/web/static/css/login.css

@@ -1 +1 @@
-.head-contener[data-v-78ddf56d]{width:1180px;height:125px;margin:0 auto}.logo-box[data-v-78ddf56d]{float:left;width:184px;height:23px}.logo-line[data-v-78ddf56d]{float:left;height:54px;width:1px;background:#77adff;margin-left:12px}.logo-text[data-v-78ddf56d]{float:left;margin-left:12px;font-size:14px}.logo-title[data-v-78ddf56d]{font-size:28px;color:#fff;font-weight:700;line-height:41px}.logo-subtitle[data-v-78ddf56d]{color:#77adff;font-size:12px}.logo-table[data-v-78ddf56d]{position:relative;padding-top:37px}.userDetails[data-v-78ddf56d]{font-size:12px;color:#fff;height:48px;line-height:48px;padding-left:20px;padding-right:20px;background:rgba(24,116,255,.1);border-bottom-left-radius:3px;border-bottom-right-radius:3px;position:absolute;right:0;top:0;color:#77adff}.userDetails img[data-v-78ddf56d]{width:12px;position:relative;margin-right:3px;margin-left:3px;height:12px}.userDetails a[data-v-78ddf56d]{padding-left:15px;text-decoration:none;color:#77adff}.login-context[data-v-e932024c]{height:250px;width:450px;margin:0 auto;margin-top:180px;padding:30px;border-radius:7px}.tips-attion[data-v-e932024c]{margin-top:30px;color:#fff}.tips-attion h3[data-v-e932024c]{font-size:14px}.tips-attion h2[data-v-e932024c]{font-size:15px}.tips-attion ul li[data-v-e932024c]{height:28px;font-size:13px}.tips-attion ul li img[data-v-e932024c]{padding-left:4px;position:relative;width:20px}.login-context[data-v-e932024c] .ivu-form-item-label{color:#fff}
+.head-contener[data-v-547198ba]{width:1180px;height:125px;margin:0 auto}.logo-box[data-v-547198ba]{float:left;width:184px;height:23px}.logo-line[data-v-547198ba]{float:left;height:54px;width:1px;background:#77adff;margin-left:12px}.logo-text[data-v-547198ba]{float:left;margin-left:12px;font-size:14px}.logo-title[data-v-547198ba]{font-size:28px;color:#fff;font-weight:700;line-height:41px;margin-top:9px}.logo-subtitle[data-v-547198ba]{color:#77adff;font-size:12px}.logo-table[data-v-547198ba]{position:relative;padding-top:37px}.userDetails[data-v-547198ba]{font-size:12px;color:#fff;height:48px;line-height:48px;padding-left:20px;padding-right:20px;background:rgba(24,116,255,.1);border-bottom-left-radius:3px;border-bottom-right-radius:3px;position:absolute;right:0;top:0;color:#77adff}.userDetails img[data-v-547198ba]{width:12px;position:relative;margin-right:3px;margin-left:3px;height:12px}.userDetails a[data-v-547198ba]{padding-left:15px;text-decoration:none;color:#77adff}.login-context[data-v-e932024c]{height:250px;width:450px;margin:0 auto;margin-top:180px;padding:30px;border-radius:7px}.tips-attion[data-v-e932024c]{margin-top:30px;color:#fff}.tips-attion h3[data-v-e932024c]{font-size:14px}.tips-attion h2[data-v-e932024c]{font-size:15px}.tips-attion ul li[data-v-e932024c]{height:28px;font-size:13px}.tips-attion ul li img[data-v-e932024c]{padding-left:4px;position:relative;width:20px}.login-context[data-v-e932024c] .ivu-form-item-label{color:#fff}

File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/js/RemotPwrCtrl~UploadProgre~UserManage~dashbord~event_logs~fan~index~login~sensor_history.js


File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/js/RemotPwrCtrl~dashbord~fan~index~login~sensor_history.js


+ 1 - 0
app/goahead-3.6.5/src/web/static/js/SelList.js

@@ -0,0 +1 @@
+(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["SelList"],{"2d81":function(t,e,s){"use strict";s.r(e);var n=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"dashboard_box set-pro",staticStyle:{width:"1180px",margin:"auto"}},[s("Title",{attrs:{title:"Blue Screen of Death",desc:"This page displays the snapshot of the blue screen captured if the host system crashed since last reboot."}})],1)},a=[],i=s("6968"),l={name:"BSODScreen",components:{Title:i["a"]},data:function(){return{}}},r=l,c=s("2877"),o=Object(c["a"])(r,n,a,!1,null,"604fbe05",null);e["default"]=o.exports},6968:function(t,e,s){"use strict";var n=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"title-info-content"},[s("h3",[t._v(" "+t._s(t.title)+" ")]),s("p",{staticClass:"title-info"},[t._v(t._s(t.desc))])])},a=[],i={name:"ititle",data:function(){return{}},props:{title:{type:String,default:""},desc:{type:String,default:""}}},l=i,r=s("2877"),c=Object(r["a"])(l,n,a,!1,null,null,null);e["a"]=c.exports}}]);

File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/js/UploadProgre.js


File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/js/UserManage.js


File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/js/app.js


File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/js/chunk-vendors.js


File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/js/dashbord.js


File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/js/event_logs.js


File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/js/index.js


File diff suppressed because it is too large
+ 0 - 0
app/goahead-3.6.5/src/web/static/js/login.js


+ 64 - 29
app/goahead-3.6.5/src/web_interface/src/fw_update.c

@@ -20,17 +20,30 @@ void prepareDevice(Webs *wp)
     printf("Update Firmware: Prepare Device...\n");
     uint8_t cmd[50] = {0};
     progress = 0;
-
     //kill bmc_app
     sprintf(cmd, "killall -9 bmc_app"); 
     system(cmd);
-
+    char *pStr;
+    cJSON * root =  cJSON_CreateObject();
+    cJSON * data =  cJSON_CreateObject();
+    cJSON_AddItemToObject(root, "data", data);//根节点下添加
+    cJSON_AddStringToObject(root, "msg", "");
+    cJSON_AddNumberToObject(root, "code", 200);
+    pStr = cJSON_PrintUnformatted(root);
+    printf("---> cJSON Str:\n%s\n", pStr);
+   
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
-    //websWriteHeader(wp, "","prepareDevice");
-    websWriteEndHeaders(wp);
-    //websWrite(wp, "%s", pStr);
-    //websFlush(wp, 0);
+    websWriteEndHeaders(wp); 
+    websWrite(wp,"%s", pStr);
+    websFlush(wp, 0);
+    // websDone(wp);
+
+    if(pStr)
+        wfree(pStr);
+    if(root)
+        cJSON_Delete(root);
+    
     websDone(wp);
     printf("Update Firmware: Prepare Device Ok.\n");
 }
@@ -38,38 +51,45 @@ void prepareDevice(Webs *wp)
 /* 
     接收上传的固件
 */
+
 void uploadFirmware(Webs *wp)
 {
     WebsKey         *s;
     WebsUpload      *up;
     char            *upfile;
-   
-    websSetStatus(wp, 200);
-    websWriteHeaders(wp, -1, 0);
-    websWriteHeader(wp, "Content-Type", "text/plain");
-    websWriteEndHeaders(wp);
     if (scaselessmatch(wp->method, "POST")) {
         for (s = hashFirst(wp->files); s; s = hashNext(wp->files, s)) {
             up = s->content.value.symbol;
-            websWrite(wp, "FILE: %s\r\n", s->name.value.string);
-            websWrite(wp, "FILENAME=%s\r\n", up->filename);
-            websWrite(wp, "CLIENT=%s\r\n", up->clientFilename);
-            websWrite(wp, "TYPE=%s\r\n", up->contentType);
-            websWrite(wp, "SIZE=%d\r\n", up->size);
-            upfile = sfmt("%s/tmp/%s", websGetDocuments(), "tmp.uImage"/*up->clientFilename*/);
-            printf("upfile: %s\n", upfile);
+            upfile = sfmt("%s/tmp/%s", websGetDocuments(), "tmp.uImage");
+            printf("<<<<<<<<<<<%s>>111111>>>>>>>>\n", upfile);
             if (rename(up->filename, upfile) < 0) {
                 error("Cannot rename uploaded file: %s to %s, errno %d", up->filename, upfile, errno);
             }
             wfree(upfile);
         }
-        websWrite(wp, "\r\nVARS:\r\n");
-        for (s = hashFirst(wp->vars); s; s = hashNext(wp->vars, s)) {
-            websWrite(wp, "%s=%s\r\n", s->name.value.string, s->content.value.string);
-        }
+      
     }
+    char *pStr;
+    cJSON * root =  cJSON_CreateObject();
+    cJSON * data =  cJSON_CreateObject();
+    cJSON_AddItemToObject(root, "data", data);//根节点下添加
+    cJSON_AddStringToObject(root, "msg", "");
+    cJSON_AddNumberToObject(root, "code", 200);
+    pStr = cJSON_PrintUnformatted(root);
+    printf("---> cJSON Str:\n%s\n", pStr);
+    websSetStatus(wp, 200);
+    websWriteHeaders(wp, -1, 0);
+    websWriteEndHeaders(wp); 
+    websWrite(wp,"%s", pStr);
+    websFlush(wp, 0);
+    // websDone(wp);
+
+    if(pStr)
+        wfree(pStr);
+    if(root)
+        cJSON_Delete(root);
+    
     websDone(wp);
-    printf("Update Firmware: Upload Firmware oK.\n");
 }
 
 /*
@@ -86,14 +106,29 @@ void updateFlash(Webs *wp)
     //Call updateFW_app
     sprintf(cmd, "/usr/bin/updateFW_app &"); 
     system(cmd);
-
+    char *pStr;
+    cJSON * root =  cJSON_CreateObject();
+    cJSON * data =  cJSON_CreateObject();
+    cJSON_AddItemToObject(root, "data", data);//根节点下添加
+    cJSON_AddStringToObject(root, "msg", "");
+    cJSON_AddNumberToObject(root, "code", 200);
+    pStr = cJSON_PrintUnformatted(root);
+    printf("---> cJSON Str:\n%s\n", pStr);
+   
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
-    //websWriteHeader(wp, "updateFlash");
-    websWriteEndHeaders(wp);
-    //websWrite(wp, "%s", pStr);
-    //websFlush(wp, 0);
+    websWriteEndHeaders(wp); 
+    websWrite(wp,"%s", pStr);
+    websFlush(wp, 0);
+    // websDone(wp);
+
+    if(pStr)
+        wfree(pStr);
+    if(root)
+        cJSON_Delete(root);
+    
     websDone(wp);
+    printf("Update Firmware: Prepare Device Ok.\n");
 }
 
 
@@ -141,7 +176,7 @@ void getUpdateProgress(Webs *wp)
     websWrite(wp, "%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
-
+    
     if(pStr)
         wfree(pStr);
     if(root)

+ 9 - 2
gd32450i-eval.initramfs

@@ -147,8 +147,7 @@ file /var/www/goahead/favicon.ico ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead
 file /var/www/goahead/index.html ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/index.html 755 0 0
 
 
-
-file /var/www/goahead/favicon.ico ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/favicon.ico 755 0 0
+le /var/www/goahead/favicon.ico ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/favicon.ico 755 0 0
 file /var/www/goahead/index.html ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/index.html 755 0 0
 file /var/www/goahead/static/css/app.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/app.css 755 0 0
 file /var/www/goahead/static/css/chunk-vendors.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/chunk-vendors.css 755 0 0
@@ -156,9 +155,12 @@ file /var/www/goahead/static/css/dashbord.css ${INSTALL_ROOT}/projects/${SAMPLE}
 file /var/www/goahead/static/css/fan.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/fan.css 755 0 0
 file /var/www/goahead/static/css/index.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/index.css 755 0 0
 file /var/www/goahead/static/css/login.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/login.css 755 0 0
+file /var/www/goahead/static/css/RemotPwrCtrl.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/RemotPwrCtrl.css 755 0 0
 file /var/www/goahead/static/css/sensor_history.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/sensor_history.css 755 0 0
 file /var/www/goahead/static/css/set_proctrol.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/set_proctrol.css 755 0 0
 file /var/www/goahead/static/css/system_logs.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/system_logs.css 755 0 0
+file /var/www/goahead/static/css/UploadProgre.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/UploadProgre.css 755 0 0
+file /var/www/goahead/static/css/UserManage.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/UserManage.css 755 0 0
 file /var/www/goahead/static/fonts/ionicons.ttf ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/fonts/ionicons.ttf 755 0 0
 file /var/www/goahead/static/fonts/ionicons.woff ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/fonts/ionicons.woff 755 0 0
 file /var/www/goahead/static/fonts/ionicons.woff2 ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/fonts/ionicons.woff2 755 0 0
@@ -183,11 +185,16 @@ file /var/www/goahead/static/img/view.png ${INSTALL_ROOT}/projects/${SAMPLE}/app
 file /var/www/goahead/static/js/app.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/app.js 755 0 0
 file /var/www/goahead/static/js/BSODScreen.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/BSODScreen.js 755 0 0
 file /var/www/goahead/static/js/chunk-vendors.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/chunk-vendors.js 755 0 0
+file /var/www/goahead/static/js/core_bmc_js.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/core_bmc_js.js 755 0 0
 file /var/www/goahead/static/js/dashbord.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/dashbord.js 755 0 0
 file /var/www/goahead/static/js/event_logs.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/event_logs.js 755 0 0
 file /var/www/goahead/static/js/fan.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/fan.js 755 0 0
 file /var/www/goahead/static/js/index.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/index.js 755 0 0
 file /var/www/goahead/static/js/login.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/login.js 755 0 0
+file /var/www/goahead/static/js/RemotPwrCtrl.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/RemotPwrCtrl.js 755 0 0
+file /var/www/goahead/static/js/SelList.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/SelList.js 755 0 0
 file /var/www/goahead/static/js/sensor_history.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/sensor_history.js 755 0 0
 file /var/www/goahead/static/js/set_proctrol.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/set_proctrol.js 755 0 0
 file /var/www/goahead/static/js/system_logs.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/system_logs.js 755 0 0
+file /var/www/goahead/static/js/UploadProgre.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/UploadProgre.js 755 0 0
+file /var/www/goahead/static/js/UserManage.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/UserManage.js 755 0 0

Some files were not shown because too many files changed in this diff