1
0
mirror of https://github.com/Ylianst/MeshCommander synced 2025-12-06 06:03:20 +00:00

OCR user interface improvements and fixes.

This commit is contained in:
Ylian Saint-Hilaire
2020-08-12 16:17:39 -07:00
parent 6cc32cb483
commit 2dda2ee3cd

View File

@@ -1594,7 +1594,8 @@
<option id="ForceDiagBootOption" value=4>Force Diagnostic Boot</option> <option id="ForceDiagBootOption" value=4>Force Diagnostic Boot</option>
<!-- ###BEGIN###{PowerControl-OneClick} --> <!-- ###BEGIN###{PowerControl-OneClick} -->
<option id="ForceUEFIBootOption" value=5>Force OCR UEFI Boot Option</option> <option id="ForceUEFIBootOption" value=5>Force OCR UEFI Boot Option</option>
<option id="ForceHttpBootOption" value=6>Force OCR UEFI HTTPS Boot</option> <option id="ForceHttpBootOption" value=6>Force OCR UEFI HTTPS Boot (.iso)</option>
<option id="ForceHttpUrlBootOption" value=7>Force OCR UEFI HTTPS Boot (url)</option>
<!-- ###END###{PowerControl-OneClick} --> <!-- ###END###{PowerControl-OneClick} -->
</select> </select>
<div>Boot Source</div> <div>Boot Source</div>
@@ -1614,11 +1615,13 @@
<select id="idx_d24customBootMediaIndex" onchange=showAdvPowerDlgChange() style="float:right;width:200px"></select> <select id="idx_d24customBootMediaIndex" onchange=showAdvPowerDlgChange() style="float:right;width:200px"></select>
<div>Boot Media</div> <div>Boot Media</div>
</div> </div>
<div id="idx_d24diskImage" style=height:54px> <div id="idx_d24diskImage" style=height:26px>
<input id=idx_d24ocrBootFile type=file onchange=showAdvPowerDlgChange() style="float:right;width:200px" accept=".iso"> <input id=idx_d24ocrBootFile type=file onchange=showAdvPowerDlgChange() style="float:right;width:200px" accept=".iso">
<div>Boot Image</div><br/> <div>Boot Image</div>
<input id=idx_d24ocrBootUrl type=text onchange=showAdvPowerDlgChange() style="float:right;width:200px"> </div>
<div>or HTTPS URL</div> <div id="idx_d24diskImageUrl" style=height:26px>
<input id=idx_d24ocrBootUrl type=text onchange=showAdvPowerDlgChange() onkeyup=showAdvPowerDlgChange() placeholder="https://" style="float:right;width:200px">
<div>Boot URL</div>
</div> </div>
<!-- ###END###{PowerControl-OneClick} --> <!-- ###END###{PowerControl-OneClick} -->
<div style=height:26px id=idd_d24IDERBootDevice> <div style=height:26px id=idd_d24IDERBootDevice>
@@ -10217,6 +10220,7 @@
QH('idx_d24customBootMediaIndex', x); QH('idx_d24customBootMediaIndex', x);
} }
QV('ForceHttpBootOption', amtPowerBootCapabilities['ForceUEFIHTTPSBoot'] == true); QV('ForceHttpBootOption', amtPowerBootCapabilities['ForceUEFIHTTPSBoot'] == true);
QV('ForceHttpUrlBootOption', amtPowerBootCapabilities['ForceUEFIHTTPSBoot'] == true);
// ###END###{PowerControl-OneClick} // ###END###{PowerControl-OneClick}
QV('d24dForceProgressEvents', amtPowerBootCapabilities['ForcedProgressEvents'] == true); QV('d24dForceProgressEvents', amtPowerBootCapabilities['ForcedProgressEvents'] == true);
QV('d24dUseIDER', amtPowerBootCapabilities['IDER'] == true); QV('d24dUseIDER', amtPowerBootCapabilities['IDER'] == true);
@@ -10263,10 +10267,9 @@
QV('idx_d24bootSource', bootSourceIndex < 5); QV('idx_d24bootSource', bootSourceIndex < 5);
QV('idx_d24customBootSource', bootSourceIndex == 5) QV('idx_d24customBootSource', bootSourceIndex == 5)
QV('idx_d24diskImage', bootSourceIndex == 6); QV('idx_d24diskImage', bootSourceIndex == 6);
QV('idx_d24diskImageUrl', bootSourceIndex == 7);
if ((bootSourceIndex == 6) && (Q('idx_d24ocrBootFile').files.length != 1)) { ok = false; } if ((bootSourceIndex == 6) && (Q('idx_d24ocrBootFile').files.length != 1)) { ok = false; }
// Allow HTTPS url to be passed as argument if ((bootSourceIndex == 7) && (Q('idx_d24ocrBootUrl').value.trim().toLowerCase().startsWith('https://') == false)) { ok = false;}
if ((bootSourceIndex == 6) && (Q('idx_d24ocrBootUrl').value.trim()!='') && Q('idx_d24ocrBootUrl').value.trim().toLowerCase().startsWith("https")) { ok = true;}
// console.log(AmtOcrPbaLength, AmtOcrPba);
// ###END###{PowerControl-OneClick} // ###END###{PowerControl-OneClick}
QE('idx_dlgOkButton', ok); QE('idx_dlgOkButton', ok);
@@ -10276,18 +10279,15 @@
// ###BEGIN###{PowerControl-OneClick} // ###BEGIN###{PowerControl-OneClick}
var forceBootSelection = Q('idx_d24ForceBootDevice').value; var forceBootSelection = Q('idx_d24ForceBootDevice').value;
// ###BEGIN###{Mode-NodeWebkit} // ###BEGIN###{Mode-NodeWebkit}
if (((forceBootSelection == 5) || (forceBootSelection == 6)) && (wsstack.comm.xtlsCertificate == null)) { if (((forceBootSelection == 5) || (forceBootSelection == 6) || (forceBootSelection == 7)) && (wsstack.comm.xtlsCertificate == null)) {
messagebox("Power Action", "This feature requires a TLS connection to Intel AMT"); return; messagebox("Power Action", "This feature requires a TLS connection to Intel AMT"); return;
} }
// ###END###{Mode-NodeWebkit} // ###END###{Mode-NodeWebkit}
if (forceBootSelection == 6) { if (forceBootSelection == 6) {
var files = Q('idx_d24ocrBootFile').files; var files = Q('idx_d24ocrBootFile').files;
//if (files.length != 1) return;
if (files.length == 1) { if (files.length == 1) {
setupWebServer(urlvars['webcn'] ? urlvars['webcn'] : wsstack.comm.localAddress); setupWebServer(urlvars['webcn'] ? urlvars['webcn'] : wsstack.comm.localAddress);
webserver.setupBootImage(files[0].path, (urlvars['webcn'] ? urlvars['webcn'] : wsstack.comm.localAddress)); webserver.setupBootImage(files[0].path, (urlvars['webcn'] ? urlvars['webcn'] : wsstack.comm.localAddress));
} else if ((Q('idx_d24ocrBootUrl').value.trim()=='') || !Q('idx_d24ocrBootUrl').value.trim().toLowerCase().startsWith("https")) {
return; //invalid HTTPS URL supplied
} }
} }
// ###END###{PowerControl-OneClick} // ###END###{PowerControl-OneClick}
@@ -10486,19 +10486,14 @@
// ###BEGIN###{PowerControl-OneClick} // ###BEGIN###{PowerControl-OneClick}
// Add OCR TLV parameters if firmware supports OCR and Force HTTPS Boot is requested // Add OCR TLV parameters if firmware supports OCR and Force HTTPS Boot is requested
if ((action == 600) || (action == 601) || ((action == 999) && (Q('idx_d24ForceBootDevice').value == 6))) { // Force UEFI HTTPS Boot if ((action == 999) && (Q('idx_d24ForceBootDevice').value == 7)) { // Force UEFI HTTPS Boot using URL
// check if using built-in webserver or external webserver
if (Q('idx_d24ocrBootFile').files.length==1) {
r['UefiBootParametersArray'] = webserver.lastBootImageArgs.args;
r['UefiBootNumberOfParams'] = webserver.lastBootImageArgs.argscount;
} else if ((Q('idx_d24ocrBootUrl').value.trim()!='') && Q('idx_d24ocrBootUrl').value.trim().toLowerCase().startsWith("https")){
r['UefiBootParametersArray'] = btoa(makeUefiBootParam(1, Q('idx_d24ocrBootUrl').value.trim()) + makeUefiBootParam(20, 1, 1) + makeUefiBootParam(30, 0, 2)); r['UefiBootParametersArray'] = btoa(makeUefiBootParam(1, Q('idx_d24ocrBootUrl').value.trim()) + makeUefiBootParam(20, 1, 1) + makeUefiBootParam(30, 0, 2));
r['UefiBootNumberOfParams'] = 3; r['UefiBootNumberOfParams'] = 3;
} else { r['BootMediaIndex'] = 0; // Do not use boot media index for One Click Recovery (OCR)
// it should not be here } else if ((action == 600) || (action == 601) || ((action == 999) && (Q('idx_d24ForceBootDevice').value == 6))) { // Force UEFI HTTPS Boot
messagebox("UEFI HTTPS Boot", "HTTPS Boot configuration is invalid!"); // Check if using built-in webserver or external webserver
return; r['UefiBootParametersArray'] = webserver.lastBootImageArgs.args;
} r['UefiBootNumberOfParams'] = webserver.lastBootImageArgs.argscount;
r['BootMediaIndex'] = 0; // Do not use boot media index for One Click Recovery (OCR) r['BootMediaIndex'] = 0; // Do not use boot media index for One Click Recovery (OCR)
} else if ((action == 999) && (Q('idx_d24ForceBootDevice').value == 5)) { } else if ((action == 999) && (Q('idx_d24ForceBootDevice').value == 5)) {
var bootstr = AmtOcrPba[Q('idx_d24customBootMediaIndex').value].bootstr; var bootstr = AmtOcrPba[Q('idx_d24customBootMediaIndex').value].bootstr;