[PATCH webflash 1/6] Print exception to console when "Flasher failed"
Export this patch
Otherwise errors such as trying to use a non-sparse image for flashing
fails without printing the error.
---
flasher.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/flasher.js b/flasher.js
index 5b0bec9..b3d9c42 100644
--- a/flasher.js
+++ b/flasher.js
@@ -238,6 +238,7 @@ async function runScript(device, di, image, script) {
ss_flash.style.color = '#F00';
flasherError("Fastboot failure: <br>" + err.message);
}
+ console.log(err);
throw new Error("Flasher failed");
}
}
--
2.41.0
Applied the series and updated the production installation :)
[PATCH webflash 2/6] Update device names to name from wiki
Export this patch
Make sure they're consistent and correctly capitalized.
---
flasher.js | 4 ++ --
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/flasher.js b/flasher.js
index b3d9c42..847353e 100644
--- a/flasher.js
+++ b/flasher.js
@@ -27,7 +27,7 @@ const deviceinfo = [
},
{
'name': 'oneplus-fajita',
- 'nicename': 'OnePlus 6t',
+ 'nicename': 'OnePlus 6T',
'filter': {
'product': 'sdm845'
},
@@ -40,7 +40,7 @@ const deviceinfo = [
},
{
'name': 'shift-axolotl',
- 'nicename': 'SHIFT 6MQ',
+ 'nicename': 'SHIFT SHIFT6mq',
'filter': {
'product': 'sdm845'
},
--
2.41.0
[PATCH webflash 3/6] Replace hardcoded pretty name list for UI to pretty_name from json
Export this patch
Now that bpo provides a pretty_name attribute, use that.
---
flasher.js | 15 ++++ -----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/flasher.js b/flasher.js
index 847353e..47ca840 100644
--- a/flasher.js
+++ b/flasher.js
@@ -3,14 +3,6 @@ let handles = {};
let bpo = null;
let allImages = {};
- const IfName = {
- 'plasma-mobile': 'Plasma Mobile',
- 'phosh': 'Phosh',
- 'gnome-mobile': 'Gnome Mobile',
- 'sxmo-de-sway': 'SXMO Sway',
- 'sxmo-de-dwm': 'SXMO Dwm',
- }
-
const deviceinfo = [
{
'name': 'oneplus-enchilada',
@@ -298,6 +290,7 @@ function selectDevice(event) {
for (let k = 0; k < releases.length; k++) {
for (let i = 0; i < releases[k]['interfaces'].length; i++) {
const IntfName = releases[k]['interfaces'][i]['name'];
+ const IntfPrettyName = releases[k]['interfaces'][i].pretty_name;
let realImages = {};
for (let j = 0; j < releases[k]['interfaces'][i]['images'].length; j++) {
@@ -320,7 +313,7 @@ function selectDevice(event) {
const edge_row = document.createElement('TR');
const td_ui = document.createElement('TD');
const td_act = document.createElement('TD');
- td_ui.innerHTML = IfName[IntfName];
+ td_ui.innerHTML = IntfPrettyName;
edge_row.appendChild(td_ui);
edge_row.appendChild(td_act);
const act_btn = document.createElement('BUTTON');
@@ -341,7 +334,7 @@ function selectDevice(event) {
const stable_row = document.createElement('TR');
const td_ui = document.createElement('TD');
const td_act = document.createElement('TD');
- td_ui.innerHTML = IfName[IntfName];
+ td_ui.innerHTML = IntfPrettyName;
stable_row.appendChild(td_ui);
stable_row.appendChild(td_act);
const act_btn = document.createElement('BUTTON');
@@ -369,7 +362,7 @@ function selectDevice(event) {
row.appendChild(td_date);
row.appendChild(td_action);
- td_name.innerHTML = IfName[IntfName];
+ td_name.innerHTML = IntfPrettyName;
td_release.innerHTML = releases[k]['name'];
td_date.innerHTML = image['timestamp'];
--
2.41.0
[PATCH webflash 4/6] Some UI improvements
Export this patch
Image selection:
* Use pretty_name from bpo
* Show latest stable version
* Show more device info
Flashing:
* Show image name
---
flasher.js | 33 ++++++++++++++++++++++++++++++ ---
index.html | 12 +++++++++ ---
2 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/flasher.js b/flasher.js
index 47ca840..5ac0985 100644
--- a/flasher.js
+++ b/flasher.js
@@ -98,11 +98,14 @@ function filterReleases(codename) {
for (let i = 0; i < releases.length; i++) {
const devices = releases[i].devices;
const releaseName = releases[i].name;
+ const releasePrettyName = releases[i].name;
for (let j = 0; j < devices.length; j++) {
if (devices[j].name === codename) {
result.push({
- name: releaseName, interfaces: devices[j].interfaces,
+ name: releaseName,
+ pretty_name: releasePrettyName,
+ interfaces: devices[j].interfaces,
});
}
}
@@ -110,6 +113,21 @@ function filterReleases(codename) {
return result;
}
+ function getDevicePrettyName(codename) {
+ const releases = bpo.releases;
+ for (let i = 0; i < releases.length; i++) {
+ const devices = releases[i].devices;
+ const releaseName = releases[i].name;
+
+ for (let j = 0; j < devices.length; j++) {
+ if (devices[j].name === codename) {
+ return devices[j].pretty_name;
+ }
+ }
+ }
+ return undefined;
+ }
+
function flasherError(message) {
const div = document.getElementById('flasher-error');
div.classList.add('error');
@@ -128,6 +146,9 @@ async function runScript(device, di, image, script) {
stepElem[i] = elem;
}
+ const imageName = document.getElementById('image-name');
+ imageName.innerHTML = image[".img.xz"].name;
+
startButton.addEventListener('click', async function () {
startButton.setAttribute('disabled', 'disabled');
for (let i = 0; i < script.length; i++) {
@@ -265,7 +286,10 @@ function selectDevice(event) {
const serial = this.dataset.serial;
const sdn = document.getElementById('select-device-name');
- sdn.innerHTML = codename;
+ sdn.innerHTML = getDevicePrettyName(codename);
+
+ const sdpn = document.getElementById('select-device-codename');
+ sdpn.innerHTML = codename;
console.log('Using device', activeDevice);
const oldScreen = document.getElementById('supported');
@@ -345,6 +369,9 @@ function selectDevice(event) {
act_btn.addEventListener('click', selectImage);
td_act.appendChild(act_btn);
+ const stableVersionPretty = document.getElementById('stable-version');
+ stableVersionPretty.innerHTML = releases[k].pretty_name;
+
latestStableTable.appendChild(stable_row);
}
}
@@ -363,7 +390,7 @@ function selectDevice(event) {
row.appendChild(td_action);
td_name.innerHTML = IntfPrettyName;
- td_release.innerHTML = releases[k]['name'];
+ td_release.innerHTML = releases[k].pretty_name;
td_date.innerHTML = image['timestamp'];
const btn = document.createElement('BUTTON');
diff --git a/index.html b/index.html
index e0118e1..6c34ae1 100644
--- a/index.html
+++ b/index.html
@@ -172,16 +172,21 @@
<h2>Image selection</h2>
<div class="boxes">
<div class="deviceinfo box">
- <h3 id="select-device-name"></h3>
+ <h3>Device info</h3>
+ <p><b>Name:</b></p>
+ <p><span id="select-device-name"></span></p>
+ <p><b>Codename:</b></p>
+ <p><span id="select-device-codename"></span></p>
</div>
<div class="stable box">
<h3>Latest stable</h3>
- <p>Recommended builds for trying out postmarketOS</p>
+ <p><i>Recommended builds for trying out postmarketOS</i></p>
+ <p><b>Version:</b> <span id="stable-version"></span></p>
<table id="stable-images"></table>
</div>
<div class="edge box">
<h3>Latest edge</h3>
- <p>Untested experimental builds</p>
+ <p><i>Untested experimental builds</i></p>
<table id="edge-images"></table>
</div>
</div>
@@ -194,6 +199,7 @@
</div>
<div id="flasher" style="display: none;">
<h2>Flashing</h2>
+ <p><b>Image:</b> <span id="image-name"></span></p>
<button id="start">Start flashing</button>
<ol id="steps"></ol>
<div id="flasher-error"></div>
--
2.41.0
[PATCH webflash 5/6] Make cursor a pointer when hovering over "All images"
Export this patch
---
index.html | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/index.html b/index.html
index 6c34ae1..47a10a4 100644
--- a/index.html
+++ b/index.html
@@ -58,6 +58,10 @@
}
+ details summary {
+ cursor: pointer;
+ }
+
table.fancy {
width: 100%;
border-collapse: separate;
--
2.41.0
[PATCH webflash 6/6] Give the buttons a pointer cursor
Export this patch
---
index.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/index.html b/index.html
index 47a10a4..c1b1e6e 100644
--- a/index.html
+++ b/index.html
@@ -15,6 +15,7 @@
border-radius: 7px;
margin-bottom: 4px;
padding: 4px 8px;
+ cursor: pointer;
}
button:disabled {
--
2.41.0