check icons is a bit more resilient

master
Gordon Williams 2022-04-19 10:03:46 +01:00
parent 35b6267a9f
commit 1e09140515
2 changed files with 5 additions and 5 deletions

View File

@ -1,2 +1 @@
// https://icons8.com/icon/19324/no-reminders
require("heatshrink").decompress(atob("mEwxH+AH4A/AH4AElksF1wwtF4YwO0WiGFguBGFovfGB3MAAgwnFooxfGBAuJGEguLGEV/F5owh0YvpGH4vhGCQvd0YwQF7vMGCAveGCAvfGB4vgGBwvhGBouhGFLkIGEouIGEwvKGBguiGEQuNGEHN5owa5ouQ53P5/O5wyOGA3NDAIbBLyAUCAAQzCNBQwF0gVDXiQoBGQgAEEIILE0iSJdiozCFQw1FGBJgSABSVIeg7wQGSDDMFyQ0VCQQwdAAWcAAwPHGD4vPGD+iAAwRJGEgRLGEQRNeTwARF1wA/AH4AX"))

View File

@ -1,4 +1,4 @@
#!/usr/bin/nodejs
#!/usr/bin/node
/* Checks for any obvious problems in apps.json
*/
@ -197,10 +197,11 @@ apps.forEach((app,appIdx) => {
// warn if JS icon is the wrong size
if (file.name == app.id+".img") {
let icon;
let match = fileContents.match(/E\.toArrayBuffer\(atob\(\"([^"]*)\"\)\)/);
let match = fileContents.match(/^\s*E\.toArrayBuffer\(atob\(\"([^"]*)\"\)\)\s*$/);
if (match==null) match = fileContents.match(/^\s*atob\(\"([^"]*)\"\)\s*$/);
if (match) icon = Buffer.from(match[1], 'base64');
else {
match = fileContents.match(/require\(\"heatshrink\"\)\.decompress\(\s*atob\(\s*\"([^"]*)\"\s*\)\s*\)/);
match = fileContents.match(/^\s*require\(\"heatshrink\"\)\.decompress\(\s*atob\(\s*\"([^"]*)\"\s*\)\s*\)\s*$/);
if (match) icon = heatshrink.decompress(Buffer.from(match[1], 'base64'));
else ERROR(`JS icon ${file.name} does not match the pattern 'require("heatshrink").decompress(atob("..."))'`);
}