use image type field if available
authorMoritz Warning <moritzwarning@web.de>
Fri, 21 Feb 2020 20:50:08 +0000 (21:50 +0100)
committerMoritz Warning <moritzwarning@web.de>
Sun, 23 Feb 2020 18:19:07 +0000 (19:19 +0100)
index.js

index 7286f3c8291683b620d082a0e7f382366b0f778f..0c2fdea1b95842825d84770f2349727b88c377bb 100644 (file)
--- a/index.js
+++ b/index.js
@@ -349,22 +349,22 @@ function updateImages(version, commit, model, url, mobj, is_custom) {
     images.sort();
 
     for (var i in images) {
-      var image = images[i].name;
-      var lc = image.toLowerCase()
+      var type = images[i].type || images[i].name;
+      var lc = type.toLowerCase()
       if (lc.includes('factory')) {
-        entries['FACTORY'].push(image);
+        entries['FACTORY'].push(type);
       } else if (lc.includes('sysupgrade')) {
-        entries['SYSUPGRADE'].push(image);
+        entries['SYSUPGRADE'].push(type);
       } else if (lc.includes('kernel') || lc.includes('zimage') || lc.includes('uimage')) {
-        entries['KERNEL'].push(image);
+        entries['KERNEL'].push(type);
       } else if (lc.includes('rootfs')) {
-        entries['ROOTFS'].push(image);
+        entries['ROOTFS'].push(type);
       } else if (lc.includes('sdcard')) {
-        entries['SDCARD'].push(image);
+        entries['SDCARD'].push(type);
       } else if (lc.includes('tftp')) {
-        entries['TFTP'].push(image);
+        entries['TFTP'].push(type);
       } else {
-        entries['OTHER'].push(image);
+        entries['OTHER'].push(type);
       }
     }