Merge pull request #15515 from s-hadinger/upload_with_factory

Firmware upload using factory partition
This commit is contained in:
s-hadinger 2022-05-02 21:34:57 +02:00 committed by GitHub
commit ec981e0efd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 169 additions and 6 deletions

View File

@ -2,7 +2,7 @@
// compressed by tools/unishox/compress-html-uncompressed.py
/////////////////////////////////////////////////////////////////////
const size_t HTTP_HEAD_LAST_SCRIPT_SIZE = 355;
const size_t HTTP_HEAD_LAST_SCRIPT_SIZE = 346;
const char HTTP_HEAD_LAST_SCRIPT_COMPRESSED[] PROGMEM = "\x30\x2F\x83\xAD\xCE\x46\xB1\x0E\xE9\xDE\x3D\xA6\x77\xF5\x47\xC3\x8C\xEA\x2D\x3E"
"\x09\x81\x8B\x1A\xFA\x8E\x86\xA1\x6F\xE6\x45\xE6\x13\x0E\xB3\xE5\x61\x04\x77\x4F"
"\xBD\xE1\x82\xE8\xEA\x1C\x2E\xAB\x38\xEA\xA6\x6C\xAB\xFB\xB3\xAB\xCC\x26\x1D\x1F"
@ -13,7 +13,6 @@ const char HTTP_HEAD_LAST_SCRIPT_COMPRESSED[] PROGMEM = "\x30\x2F\x83\xAD\xCE\x4
"\x04\x1C\x87\x44\x3E\xCF\x7C\xF3\x04\x7C\xB0\xF0\x7B\xA8\xED\x9D\xB3\xC1\xEE\x3D"
"\xC0\x89\xC1\x77\x8C\x1D\xDF\x03\x02\xE0\xBC\xE8\x28\xC0\x2F\x70\x2C\x74\xF5\x19"
"\x04\xCE\x82\x6F\x86\x05\x66\x47\xCF\x1D\xA3\xEC\x70\x58\x19\xA1\xF6\x79\x9F\x7D"
"\x9C\xCF\xB0\x43\xD7\x47\xC2\x3B\xA6\xB1\x0E\xF1\xE0\xF4\x3B\x3C\x1F\xF4\x65\x1F"
"\x86";
"\x9C\xCF\xB0\x43\xD7\x47\xC2\x3B\xA6\xB1\x0E\xF1\xE0";
#define HTTP_HEAD_LAST_SCRIPT Decompress(HTTP_HEAD_LAST_SCRIPT_COMPRESSED,HTTP_HEAD_LAST_SCRIPT_SIZE).c_str()

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////
// compressed by tools/unishox/compress-html-uncompressed.py
/////////////////////////////////////////////////////////////////////
const size_t HTTP_HEAD_LAST_SCRIPT32_SIZE = 989;
const char HTTP_HEAD_LAST_SCRIPT32_COMPRESSED[] PROGMEM = "\x30\x2F\x83\xAD\xCE\x46\xB1\x0E\xE9\xDE\x3D\xA6\x77\xF5\x47\xC3\x8C\xEA\x2D\x3E"
"\x09\x81\x8B\x1A\xFA\x8E\x86\xA1\x6F\xE6\x45\xE6\x13\x0E\xB3\xE5\x61\x04\x77\x4F"
"\xBD\xE1\x82\xE8\xEA\x1C\x2E\xAB\x38\xEA\xA6\x6C\xAB\xFB\xB3\xAB\xCC\x26\x1D\x1F"
"\x67\x78\xF0\x3E\x2B\x42\x67\x77\x4E\x81\x3E\x1E\xA1\x47\xE1\xF2\x8E\xF1\xED\xD3"
"\x07\x77\x4F\x7A\x8F\x7C\xEF\x1E\xDD\x3D\xEA\x3D\xF3\xDE\x3E\xFA\xC6\xB3\xEC\xF7"
"\xCF\x87\x77\x4F\x7A\x8F\x7C\xE8\x2A\x2B\xFC\x57\x55\xFD\x1C\x2E\x99\xDD\x3E\xF4"
"\x43\xEC\xEF\x1F\xA3\xF4\x77\x4F\xE0\x27\x57\xEB\x1A\xCF\xB3\xBC\x77\x8E\xF1\xDA"
"\x04\x1C\x87\x44\x3E\xCF\x7C\xF3\x04\x7C\xB0\xF0\x7B\xA8\xED\x9D\xB3\xC1\xEE\x3D"
"\xC0\x89\xC1\x77\x8C\x1D\xDF\x03\x02\xE0\xBC\xE8\x28\xC0\x2F\x70\x2C\x74\xF5\x19"
"\x04\xCE\x82\x6F\x86\x05\x66\x47\xCF\x1D\xA3\xEC\x70\x58\x19\xA1\xF6\x79\x9F\x7D"
"\x9C\xCF\xB0\x43\xD7\x47\xC2\x3B\xA6\xB1\x0E\xF1\xE0\x11\x76\x41\x67\x76\x8E\xF1"
"\xED\x63\x8E\xE9\xF6\x60\xE5\x9F\x67\x78\x81\x2B\x21\x04\x2C\x5D\x8E\x3B\xA7\xD9"
"\x83\x94\x40\x9B\x68\x10\x73\xD3\xC5\x1D\x0C\x67\xC6\x9D\x3C\x2C\x70\xDD\xA3\xBA"
"\x77\x8F\x2A\x01\x8B\xC2\x08\xB1\x81\x1D\xDA\x04\x1E\x10\xBC\x11\xF0\x10\x70\x43"
"\xDE\x3E\xC5\x9C\xA3\xEC\xF7\xCE\x84\x63\x42\x7E\x3D\xE3\x8C\xF7\xCE\x85\xE0\xB4"
"\x36\x77\x4E\x33\xAA\x1D\xE3\xC1\x19\xDF\xD7\xC4\x3E\x73\x1F\x44\x63\x42\x65\xF7"
"\x62\x3F\x9D\xD3\xBC\x78\xF8\x87\x4C\xE0\xB2\xC4\x3E\x1D\xD3\xBC\x7C\x3F\x0F\x69"
"\x9D\xFD\x0E\x1C\x7C\xE6\x3E\x88\x5E\xF5\x1C\xF9\x15\xFF\xF6\x64\x77\x7E\x21\xD3"
"\xEF\xC2\xC2\xA3\xBC\x78\xD3\x07\x74\x70\xE0\x42\xE2\x14\xF8\x7C\x39\x0F\xD1\xFA"
"\x21\xC3\x8F\x78\xE3\x3D\xF3\xE1\xF1\x91\xB0\x99\xC4\x77\x8F\x69\x18\x0E\x8E\xED"
"\x1D\xE3\xC1\xEE\x61\x79\x9E\xD0\x4C\xE0\x60\xF0\x7B\x8F\x1F\x10\xE9\xF7\x62\x15"
"\xF8\xAF\xFF\xB3\x22\x1C\x2C\xC1\x87\xF3\xBB\xE0\x8E\xF1\xE3\xEE\x85\xFF\x91\x8B"
"\x0B\xCC\xF0\x7B\x81\x17\x8A\x2A\x01\x41\xCB\x8F\x69\x9D\xFD\x1B\x0F\x9C\xC7\xD1"
"\x1B\x08\x69\x04\x42\xAA\x86\x17\xD9\xA8\x5B\xF5\x1D\xD3\xBC\x78\x36\x1D\x30\x63"
"\xE3\xBA\x7D\x90\xF1\x32\xA3\xEC\xEA\x3E\xCE\xC1\x67\x30\xED\x10\xB3\x98\x7C\x23"
"\x01\xD1\xFA\xB1\x9A\x7C\x3E\xCE\xAA\xF8\xB6\x77\x8F\x06\xC3\xA6\x77\xDD\x88\x65"
"\xEA\xBA\x61\x8A\xBE\x1E\x60\x83\xC2\x76\x98\x3B\xA6\xC3\xA7\xDD\x88\x64\x5E\xAB"
"\xA6\x7C\x3E\x1C\xC3\xF4\x7E\x88\xD8\x74\xF5\x5D\x0B\xF1\xF0\xF8\x72\x9B\x20\x42"
"\xE3\x2A\x01\xF8\x6C\x3A\x7D\xF8\x66\x77\x99\x53\x36\x51\xE3\x4C\x1D\xDF\x1F\x0F"
"\x87\xD9\x8B\x0B\xCC\xFB\x3B\xDE\x74\x55\xA3\x5E\x0B\xA3\xBA\x77\x4E\xF1\xF0\xFC"
"\x04\x4E\x19\x4E\xA3\x9C\xDB\x3B\xC4\x08\x78\x4D\x7C\x5B\x3E\xCE\xF7\x85\x82\x27"
"\x10\x08\x16\x75\xA3\x8C\xEF\x1E\xD2\x05\x4C\xD4\xE5\x36\xC8\x10\x78\xB0\x36\x1D"
"\x3C\xF8\x43\xBA\x77\x8F\x07\xB8\xF4\x3B\x3C\x1F\xF4\x65\x1F\x86";
#define HTTP_HEAD_LAST_SCRIPT32 Decompress(HTTP_HEAD_LAST_SCRIPT32_COMPRESSED,HTTP_HEAD_LAST_SCRIPT32_SIZE).c_str()

View File

@ -18,4 +18,4 @@ const char HTTP_HEAD_LAST_SCRIPT[] PROGMEM =
"}"
"}"
"wl(jd);" // Add name='' to any id='' in input,button,textarea,select
"</script>";
;

View File

@ -0,0 +1,65 @@
const char HTTP_HEAD_LAST_SCRIPT32[] PROGMEM =
"function jd(){" // Add label name='' based on provided id=''
"var t=0,i=document.querySelectorAll('input,button,textarea,select');"
"while(i.length>=t){"
"if(i[t]){"
"i[t]['name']=(i[t].hasAttribute('id')&&(!i[t].hasAttribute('name')))?i[t]['id']:i[t]['name'];"
"}"
"t++;"
"}"
"}"
"function sf(s){"
"var t=0,i=document.querySelectorAll('.hf');"
"while(i.length>=t){"
"if(i[t]){"
"i[t].style.display=s?'block':'none';"
"}"
"t++;"
"}"
"}"
"wl(jd);" // Add name='' to any id='' in input,button,textarea,select
// experimental
"function su(t){"
// "console.log('su()');"
"eb('f3').style.display='none';"
"eb('f2').style.display='block';"
"t.form.submit();"
"}"
"function upl(t){" // check file's first byte to decide next step
"var sl=t.form['u2'].files[0].slice(0,1);" // load only first byte of file
// "console.log(sl);"
// "console.log(sl.length);"
"var rd=new FileReader();"
"rd.onload=()=>{"
// "console.log(\"rd.onload\");"
"var bb=new Uint8Array(rd.result);"
// "console.log(bb[0]);"
// "console.log(bb.length);"
"if(bb.length==1&&bb[0]==0xE9){"
"fct(t);" // upload via factory
"}else{"
"t.form.submit();" // normal upload
"};"
"};"
"rd.readAsArrayBuffer(sl);"
"return false;"
"};"
"function fct(t){"
"var x=new XMLHttpRequest();"
"x.open('GET','/u4?u4=fct&api=',true);"
"x.onreadystatechange=()=>{"
// "console.log('x.readyState=%%i x.status=%%i',x.readyState,x.status);"
"if(x.readyState==4&&x.status==200){"
"var s=x.responseText;"
// "console.log('responseText:'+s);"
"if(s=='false')setTimeout(()=>{fct(t);},6000);"
"if(s=='true')su(t);"
"}else if(x.readyState==4&&x.status==0){"
"setTimeout(()=>{fct(t);},2000);" // retry in 2 seconds
"};"
"};"
"x.send();"
// "console.log('after send');"
"}"
"</script>";

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA Url"
#define D_START_UPGRADE "Begin opgradering"
#define D_UPGRADE_BY_FILE_UPLOAD "Gradeer op volgens lêeroplaai"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Oplaai begin"
#define D_UPGRADE_STARTED "Opgradering is begin"
#define D_UPLOAD_DONE "Oplaai gedoen"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "Адрес на сървър за OTA"
#define D_START_UPGRADE "Начало на обновяване"
#define D_UPGRADE_BY_FILE_UPLOAD "Обновяване от файл"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Качване"
#define D_UPGRADE_STARTED "Обновяване"
#define D_UPLOAD_DONE "Качването завърши"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "URL OTA"
#define D_START_UPGRADE "Start aktualizace"
#define D_UPGRADE_BY_FILE_UPLOAD "Aktualizace nahráním souboru"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Nahrávání zahájeno"
#define D_UPGRADE_STARTED "Zahájení aktualizace"
#define D_UPLOAD_DONE "Nahrávání ukončeno"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA-URL"
#define D_START_UPGRADE "Update starten"
#define D_UPGRADE_BY_FILE_UPLOAD "Update Datei hochladen"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Upload gestartet"
#define D_UPGRADE_STARTED "Update gestartet"
#define D_UPLOAD_DONE "Upload abgeschlossen"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA URL"
#define D_START_UPGRADE "Εκκίνηση αναβάθμισης"
#define D_UPGRADE_BY_FILE_UPLOAD "Αναβάθμιση με μεταφόρτωση αρχείου"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Η μεταφόρτωση ξεκίνησε"
#define D_UPGRADE_STARTED "Η αναβάθμιση ξεκίνησε"
#define D_UPLOAD_DONE "Η μεταφόρτωση ολοκληρώθηκε"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA Url"
#define D_START_UPGRADE "Start upgrade"
#define D_UPGRADE_BY_FILE_UPLOAD "Upgrade by file upload"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Upload started"
#define D_UPGRADE_STARTED "Upgrade started"
#define D_UPLOAD_DONE "Upload done"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA Url"
#define D_START_UPGRADE "Comenzar actualización"
#define D_UPGRADE_BY_FILE_UPLOAD "Actualizar cargando archivo bin"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Cargando archivo"
#define D_UPGRADE_STARTED "Actualización iniciada"
#define D_UPLOAD_DONE "Carga finalizada"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "URL OTA"
#define D_START_UPGRADE "Lancer la mise à jour"
#define D_UPGRADE_BY_FILE_UPLOAD "Mise à jour par téléchargement fichier"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Téléchargement lancé"
#define D_UPGRADE_STARTED "Mise à jour lancée"
#define D_UPLOAD_DONE "Téléchargement terminé"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA Url"
#define D_START_UPGRADE "Begjin upgrade"
#define D_UPGRADE_BY_FILE_UPLOAD "Upgrade op bestân upload"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Upload begon"
#define D_UPGRADE_STARTED "Upgrade begon"
#define D_UPLOAD_DONE "Upload dien"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA כתובת"
#define D_START_UPGRADE "התחל בשדרוג"
#define D_UPGRADE_BY_FILE_UPLOAD "שדרוג דרך קובץ נכשל"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "העלאה מתחילה"
#define D_UPGRADE_STARTED "שדרוג מתחיל"
#define D_UPLOAD_DONE "העלאה הסתיימה"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA URL"
#define D_START_UPGRADE "Frissítés"
#define D_UPGRADE_BY_FILE_UPLOAD "Frissítés helyi fájllal"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Feltöltés elindítva"
#define D_UPGRADE_STARTED "Frissítés elindítva"
#define D_UPLOAD_DONE "Feltöltés kész"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "URL OTA"
#define D_START_UPGRADE "Esegui aggiornamento"
#define D_UPGRADE_BY_FILE_UPLOAD "Aggiornamento tramite file locale"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Caricamento..."
#define D_UPGRADE_STARTED "Aggiornamento..."
#define D_UPLOAD_DONE "Caricamento completato"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA Url"
#define D_START_UPGRADE "업그레이드 시작"
#define D_UPGRADE_BY_FILE_UPLOAD "파일에서 업로드해 업그레이드"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "업로드 시작됨"
#define D_UPGRADE_STARTED "업그레이드 시작됨"
#define D_UPLOAD_DONE "업그레이드 완료"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA Url"
#define D_START_UPGRADE "Start opwaarderen"
#define D_UPGRADE_BY_FILE_UPLOAD "Opwaarderen dmv verzenden bestand"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Verzending gestart"
#define D_UPGRADE_STARTED "Opwaarderen gestart"
#define D_UPLOAD_DONE "Opwaarderen klaar"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "Adres serwera"
#define D_START_UPGRADE "Aktualizuj"
#define D_UPGRADE_BY_FILE_UPLOAD "Aktualizacja z pliku"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Wgrywanie rozpoczęte"
#define D_UPGRADE_STARTED "Aktualizacja rozpoczęta"
#define D_UPLOAD_DONE "Wgrywanie zakończone"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA URL"
#define D_START_UPGRADE "Iniciar atualização"
#define D_UPGRADE_BY_FILE_UPLOAD "Atualização por arquivo local"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Início do envio"
#define D_UPGRADE_STARTED "Atualização iniciada"
#define D_UPLOAD_DONE "Atualização finalizada"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "Url OTA"
#define D_START_UPGRADE "Iniciar atualização"
#define D_UPGRADE_BY_FILE_UPLOAD "Atualizar por envio de ficheiro"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Envio Iniciado"
#define D_UPGRADE_STARTED "Atualização Iniciada"
#define D_UPLOAD_DONE "Atualização Finalizada"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA Url"
#define D_START_UPGRADE "Porneste actualizare"
#define D_UPGRADE_BY_FILE_UPLOAD "Actualizare prin încărcare fișier"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Încărcare începută"
#define D_UPGRADE_STARTED "Actualizare începută"
#define D_UPLOAD_DONE "Încărcare terminată"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA Url"
#define D_START_UPGRADE "Начать обновление"
#define D_UPGRADE_BY_FILE_UPLOAD "Обновление путем загрузки файлов"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Загрузка началась"
#define D_UPGRADE_STARTED "Обновление началось"
#define D_UPLOAD_DONE "Загрузка завершена"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "URL OTA"
#define D_START_UPGRADE "Spustiť aktualizáciu"
#define D_UPGRADE_BY_FILE_UPLOAD "Aktualizácia nahraním súboru"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Nahrávanie spustené"
#define D_UPGRADE_STARTED "Aktualizácia spustená"
#define D_UPLOAD_DONE "Nahrávanie ukončené"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA Url"
#define D_START_UPGRADE "Starta uppdatering"
#define D_UPGRADE_BY_FILE_UPLOAD "Uppgradering via filuppladdning"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Uppladdning startad"
#define D_UPGRADE_STARTED "Uppgradeing startad"
#define D_UPLOAD_DONE "Uppladdning klar"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA Url"
#define D_START_UPGRADE "Yükseltmeyi başlat"
#define D_UPGRADE_BY_FILE_UPLOAD "Dosya kullanrak yükset"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Yükleme başlatıldı"
#define D_UPGRADE_STARTED "YÜkestlme başlatıldı"
#define D_UPLOAD_DONE "Yükleme Tamamlandı"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA URL"
#define D_START_UPGRADE "Почати оновлення"
#define D_UPGRADE_BY_FILE_UPLOAD "Оновлення шляхом завантаження файлів"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Завантаження почалось"
#define D_UPGRADE_STARTED "Оновлення почалось"
#define D_UPLOAD_DONE "Завантаження завершено"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "Đường dẫn OTA"
#define D_START_UPGRADE "Bắt đầu nâng cấp"
#define D_UPGRADE_BY_FILE_UPLOAD "Nâng cấp thông qua tải lên tệp"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "Bắt đầu tải lên"
#define D_UPGRADE_STARTED "Bắt đầu nâng cấp"
#define D_UPLOAD_DONE "Hoàn thành tải tệp"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA 地址"
#define D_START_UPGRADE "开始升级"
#define D_UPGRADE_BY_FILE_UPLOAD "通过文件升级"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "开始上传"
#define D_UPGRADE_STARTED "开始升级"
#define D_UPLOAD_DONE "上传完成"

View File

@ -372,6 +372,7 @@
#define D_OTA_URL "OTA網址"
#define D_START_UPGRADE "開始升級"
#define D_UPGRADE_BY_FILE_UPLOAD "透過檔案升級"
#define D_UPLOAD_FACTORY "Switching to safeboot partition"
#define D_UPLOAD_STARTED "已開始上傳"
#define D_UPGRADE_STARTED "已開始升級"
#define D_UPLOAD_DONE "已上傳完成"

View File

@ -209,10 +209,12 @@ const char HTTP_SCRIPT_INFO_END[] PROGMEM =
#ifdef USE_UNISHOX_COMPRESSION
#include "./html_compressed/HTTP_HEAD_LAST_SCRIPT.h"
#include "./html_compressed/HTTP_HEAD_LAST_SCRIPT32.h"
#include "./html_compressed/HTTP_HEAD_STYLE1.h"
#include "./html_compressed/HTTP_HEAD_STYLE2.h"
#else
#include "./html_uncompressed/HTTP_HEAD_LAST_SCRIPT.h"
#include "./html_uncompressed/HTTP_HEAD_LAST_SCRIPT32.h"
#include "./html_uncompressed/HTTP_HEAD_STYLE1.h"
#include "./html_uncompressed/HTTP_HEAD_STYLE2.h"
#endif
@ -352,7 +354,17 @@ const char HTTP_FORM_RST_UPG[] PROGMEM =
"<br><button type='submit' onclick='eb(\"f1\").style.display=\"none\";eb(\"f2\").style.display=\"block\";this.form.submit();'>" D_START " %s</button></form>"
"</fieldset>"
"</div>"
"<div id='f2' style='display:none;text-align:center;'><b>" D_UPLOAD_STARTED " ...</b></div>";
"<div id='f2' style='display:none;text-align:center;'><b>" D_UPLOAD_STARTED "...</b></div>";
// upload via factory partition
const char HTTP_FORM_RST_UPG_FCT[] PROGMEM =
"<form method='post' action='u2' enctype='multipart/form-data'>"
"<br><input type='file' name='u2'><br>"
"<br><button type='submit' onclick='eb(\"f1\").style.display=\"none\";eb(\"f3\").style.display=\"block\";return upl(this);'>" D_START " %s</button></form>"
"</fieldset>"
"</div>"
"<div id='f3' style='display:none;text-align:center;'><b>" D_UPLOAD_FACTORY "...</b></div>"
"<div id='f2' style='display:none;text-align:center;'><b>" D_UPLOAD_STARTED "...</b></div>";
const char HTTP_FORM_CMND[] PROGMEM =
"<br><textarea readonly id='t1' cols='340' wrap='off'></textarea><br><br>"
@ -844,7 +856,11 @@ void WSContentSendStyle_P(const char* formatP, ...) {
WSContentSend_P(HTTP_SCRIPT_COUNTER);
}
}
#ifdef ESP32
WSContentSend_P(HTTP_HEAD_LAST_SCRIPT32);
#else
WSContentSend_P(HTTP_HEAD_LAST_SCRIPT);
#endif
WSContentSend_P(HTTP_HEAD_STYLE1, WebColor(COL_FORM), WebColor(COL_INPUT), WebColor(COL_INPUT_TEXT), WebColor(COL_INPUT),
WebColor(COL_INPUT_TEXT), WebColor(COL_CONSOLE), WebColor(COL_CONSOLE_TEXT), WebColor(COL_BACKGROUND));
@ -2286,7 +2302,15 @@ void HandleRestoreConfiguration(void)
WSContentStart_P(PSTR(D_RESTORE_CONFIGURATION));
WSContentSendStyle();
WSContentSend_P(HTTP_FORM_RST);
#ifdef ESP32
if (EspSingleOtaPartition() && !EspRunningFactoryPartition()) {
WSContentSend_P(HTTP_FORM_RST_UPG_FCT, PSTR(D_RESTORE));
} else {
WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_RESTORE));
}
#else
WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_RESTORE));
#endif
if (WifiIsInManagerMode()) {
WSContentSpaceButton(BUTTON_MAIN);
} else {
@ -2511,7 +2535,15 @@ void HandleUpgradeFirmware(void) {
WSContentStart_P(PSTR(D_FIRMWARE_UPGRADE));
WSContentSendStyle();
WSContentSend_P(HTTP_FORM_UPG, SettingsText(SET_OTAURL));
#ifdef ESP32
if (EspSingleOtaPartition() && !EspRunningFactoryPartition()) {
WSContentSend_P(HTTP_FORM_RST_UPG_FCT, PSTR(D_UPGRADE));
} else {
WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_UPGRADE));
}
#else
WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_UPGRADE));
#endif
WSContentSpaceButton(BUTTON_MAIN);
WSContentStop();
@ -2955,8 +2987,9 @@ void HandleSwitchFactory(void)
Webserver->send(302, "text/plain", "");
}
}
Web.upload_file_type = UPL_TASMOTA;
}
#endif
#endif // ESP32
/*-------------------------------------------------------------------------------------------*/