diff --git a/README.md b/README.md index df3eda10e..b848714d9 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ the *default* of `To RAM` {"name":"+7chname","url":"my-great-app.json"}, {"name":"-7chname","url":"my-great-app.js"}, {"name":"*7chname","url":"my-great-app.js","evaluate":true} - ] + ], }, ``` @@ -74,7 +74,9 @@ the *default* of `To RAM` "evaluate":true // if supplied, data isn't quoted into a String before upload // (eg it's evaluated as JS) }, - + "sortorder" : 0, // optional - choose where in the list this goes. + // this should only really be used to put system + // stuff at the top ] } ``` diff --git a/index.js b/index.js index 322a20b71..90ca156b0 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,12 @@ var appJSON = []; // List of apps and info from apps.json var appsInstalled = []; // list of app IDs httpGet("apps.json").then(apps=>{ - appJSON = JSON.parse(apps); + try { + appJSON = JSON.parse(apps); + } catch(e) { + console.log(e); + showToast("App List Corrupted","error"); + } appJSON.sort(appSorter); refreshLibrary(); }); diff --git a/utils.js b/utils.js index 44a1479ab..51173d9d0 100644 --- a/utils.js +++ b/utils.js @@ -33,5 +33,9 @@ function toJS(txt) { function appSorter(a,b) { if (a.unknown || b.unknown) return (a.unknown)? 1 : -1; + var sa = 0|a.sortorder; + var sb = 0|b.sortorder; + if (sasb) return 1; return (a.name==b.name) ? 0 : ((a.name