diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2021-01-05 08:57:15 -0500 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2021-01-05 08:57:15 -0500 |
| commit | ebfef1f23b96a9eee63be18febc989d3d1eda880 (patch) | |
| tree | 61a3093bfa18f292bb62841c2f5bb0b16309d485 /static/js/web-install.js | |
| parent | b11fbbcf0f522f58c4864eef433d3a44f8f25825 (diff) | |
add locking to web install proof of concept
Diffstat (limited to 'static/js/web-install.js')
| -rw-r--r-- | static/js/web-install.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/static/js/web-install.js b/static/js/web-install.js index aa117b76..1f623fad 100644 --- a/static/js/web-install.js +++ b/static/js/web-install.js @@ -28,6 +28,20 @@ async function unlockBootloader() { await fastboot.receive(); } +async function lockBootloader() { + const webusb = await Adb.open("WebUSB"); + + if (!webusb.isFastboot()) { + console.log("error: not in fastboot mode"); + } + + console.log("connecting with fastboot"); + + const fastboot = await webusb.connectFastboot(); + await fastboot.send("flashing lock"); + await fastboot.receive(); +} + if ("usb" in navigator) { console.log("WebUSB available"); @@ -38,6 +52,10 @@ if ("usb" in navigator) { const unlockBootloaderButton = document.getElementById("unlock-bootloader"); unlockBootloaderButton.disabled = false; unlockBootloaderButton.onclick = unlockBootloader; + + const lockBootloaderButton = document.getElementById("lock-bootloader"); + lockBootloaderButton.disabled = false; + lockBootloaderButton.onclick = lockBootloader; } else { console.log("WebUSB unavailable"); } |
