From fe063f50fec346b57453f541308ad5ffa7454398 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 5 Jan 2021 04:16:42 -0500 Subject: add foundation for WebUSB-based install page --- static/js/web-install.js | 32 ++++++++++++++++++++++++ static/web-install.html | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 static/js/web-install.js create mode 100644 static/web-install.html (limited to 'static') diff --git a/static/js/web-install.js b/static/js/web-install.js new file mode 100644 index 00000000..5899fc9b --- /dev/null +++ b/static/js/web-install.js @@ -0,0 +1,32 @@ +// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT + +async function doConnect() { + const webusb = await Adb.open("WebUSB"); + + console.log("connected"); + + if (webusb.isAdb()) { + console.log("adb"); + const adb = await webusb.connectAdb("host::"); + await adb.reboot("bootloader"); + return; + } + + if (webusb.isFastboot()) { + console.log("fastboot"); + const fastboot = await webusb.connectFastboot(); + await fastboot.send("flashing unlock"); + await fastboot.receive(); + } +} + +if ("usb" in navigator) { + console.log("WebUSB available"); + + const connect = document.getElementById("connect"); + connect.onclick = doConnect; +} else { + console.log("WebUSB unavailable"); +} + +// @license-end diff --git a/static/web-install.html b/static/web-install.html new file mode 100644 index 00000000..b7a70440 --- /dev/null +++ b/static/web-install.html @@ -0,0 +1,65 @@ + + + + + Web install | GrapheneOS + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+

Web install

+ + +
+ + + -- cgit v1.3.1