Prettify apps.json + validate-icons.js

main
Ward Oosterlijnck 8 years ago
parent b30e94991b
commit 851ba0fadb

@ -12,43 +12,43 @@ var
for (app in json.apps) { for (app in json.apps) {
(function(app) { (function(app) {
var basePath = process.env.WAPPALYZER_ROOT + '/src/icons/'; var basePath = process.env.WAPPALYZER_ROOT + '/src/icons/';
var iconPath = json.apps[app].icon || 'default.svg'; var iconPath = json.apps[app].icon || 'default.svg';
var path = basePath + iconPath; var path = basePath + iconPath;
var type; var type;
if (path.substr(path.length - 4) === '.png') { if (path.substr(path.length - 4) === '.png') {
type = "PNG"; type = "PNG";
} }
else if (path.substr(path.length - 4) === '.svg') { else if (path.substr(path.length - 4) === '.svg') {
type = "SVG"; type = "SVG";
} }
else { else {
var err = new Error('Icon file extension specified for app "' + app + '" is not ".png" or ".svg": src/icons/' + iconPath); var err = new Error('Icon file extension specified for app "' + app + '" is not ".png" or ".svg": src/icons/' + iconPath);
throw err; throw err;
} }
fs.exists(path, function(exists) { fs.exists(path, function(exists) {
if (exists) { if (exists) {
if (type === "PNG") { if (type === "PNG") {
var buffer = fileType(readChunk.sync(path, 0, 262)); var buffer = fileType(readChunk.sync(path, 0, 262));
if (buffer === null) { if (buffer === null) {
var err = new Error('Unknown mimetype or bad file for "' + app + '": src/icons/' + iconPath); var err = new Error('Unknown mimetype or bad file for "' + app + '": src/icons/' + iconPath);
throw err; throw err;
} }
else if (buffer.mime !== 'image/png') { else if (buffer.mime !== 'image/png') {
var err = new Error('Incorrect mimetype "' + buffer.mime + '" when expected PNG for app "' + app + '": src/icons/' + iconPath); var err = new Error('Incorrect mimetype "' + buffer.mime + '" when expected PNG for app "' + app + '": src/icons/' + iconPath);
throw err; throw err;
} }
} }
else if (type === "SVG") { else if (type === "SVG") {
if (!isSvg(fs.readFileSync(path))) { if (!isSvg(fs.readFileSync(path))) {
var err = new Error('Incorrect mimetype when expected SVG for app "' + app + '": src/icons/' + iconPath); var err = new Error('Incorrect mimetype when expected SVG for app "' + app + '": src/icons/' + iconPath);
throw err; throw err;
} }
} }
} else { } else {
var err = new Error('Missing file for app "' + app + '": src/icons/' + iconPath); var err = new Error('Missing file for app "' + app + '": src/icons/' + iconPath);
throw err; throw err;
} }
}); });
}(app)); }(app));

@ -3178,18 +3178,6 @@
}, },
"website": "http://www.greenvalley.nl/Public/Producten/Content_Management/CMS" "website": "http://www.greenvalley.nl/Public/Producten/Content_Management/CMS"
}, },
"Homeland": {
"cats": [
"1",
"2"
],
"headers": {
"Set-Cookie:": "_homeland_"
},
"icon": "Homeland.png",
"implies": "Ruby on Rails",
"website": "https://gethomeland.com"
},
"HERE": { "HERE": {
"cats": [ "cats": [
"35" "35"
@ -3416,6 +3404,18 @@
], ],
"website": "http://twitter.github.com/hogan.js" "website": "http://twitter.github.com/hogan.js"
}, },
"Homeland": {
"cats": [
"1",
"2"
],
"headers": {
"Set-Cookie:": "_homeland_"
},
"icon": "Homeland.png",
"implies": "Ruby on Rails",
"website": "https://gethomeland.com"
},
"Hotaru CMS": { "Hotaru CMS": {
"cats": [ "cats": [
"1" "1"
@ -6226,6 +6226,10 @@
"^priceDisplayMethod$\\;confidence:25", "^priceDisplayMethod$\\;confidence:25",
"^priceDisplayPrecision$\\;confidence:25" "^priceDisplayPrecision$\\;confidence:25"
], ],
"headers": {
"Powered-By": "^Prestashop$",
"Set-Cookie": "^PrestaShop"
},
"html": [ "html": [
"Powered by <a\\s+[^>]+>PrestaShop", "Powered by <a\\s+[^>]+>PrestaShop",
"<!-- /Block [a-z ]+ module (?:HEADER|TOP)?\\s?-->", "<!-- /Block [a-z ]+ module (?:HEADER|TOP)?\\s?-->",
@ -6236,10 +6240,6 @@
"meta": { "meta": {
"generator": "PrestaShop" "generator": "PrestaShop"
}, },
"headers": {
"Set-Cookie": "^PrestaShop",
"Powered-By": "^Prestashop$"
},
"website": "http://www.prestashop.com" "website": "http://www.prestashop.com"
}, },
"Project Wonderful": { "Project Wonderful": {
@ -7753,15 +7753,6 @@
"url": "/typo3/", "url": "/typo3/",
"website": "http://www.typo3.org" "website": "http://www.typo3.org"
}, },
"Typecho": {
"cats": [
"11"
],
"icon": "typecho.svg",
"implies": "PHP",
"url": "/admin/login\\.php?referer=http%3A%2F%2F",
"website": "http://typecho.org/"
},
"Taiga": { "Taiga": {
"cats": [ "cats": [
"13" "13"
@ -8105,6 +8096,15 @@
"url": "typepad\\.com", "url": "typepad\\.com",
"website": "http://www.typepad.com" "website": "http://www.typepad.com"
}, },
"Typecho": {
"cats": [
"11"
],
"icon": "typecho.svg",
"implies": "PHP",
"url": "/admin/login\\.php?referer=http%3A%2F%2F",
"website": "http://typecho.org/"
},
"Typekit": { "Typekit": {
"cats": [ "cats": [
"17" "17"

Loading…
Cancel
Save