diff --git a/.gitignore b/.gitignore index 19de018bb..7d65964c0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,8 @@ npm-debug.log tags !.gitkeep + +Thumbs.db +Desktop.ini +*.DS_Store +._* diff --git a/bin/wappalyzer-build b/bin/wappalyzer-build index 45de3da42..9c4989728 100755 --- a/bin/wappalyzer-build +++ b/bin/wappalyzer-build @@ -24,7 +24,7 @@ node $WAPPALYZER_NODE_PATH/node_modules/jsonlint/lib/cli.js -ist $'\t' $WAPPALYZ echo "Compressing PNG and SVG icons..." -node $WAPPALYZER_NODE_PATH/node_modules/imagemin-cli/cli.js $WAPPALYZER_ROOT/src/icons/* --out-dir $WAPPALYZER_ROOT/src/icons +node $WAPPALYZER_NODE_PATH/node_modules/imagemin-cli/cli.js $WAPPALYZER_ROOT/src/icons/* --out-dir $WAPPALYZER_ROOT/src/icons 2>&1 > /dev/null echo "Converting SVG icons to PNG..." @@ -37,9 +37,11 @@ do dest="$WAPPALYZER_ROOT/src/icons/converted/$(basename "$svg").png" - if [[ ! -f "$dest" ]]; then - node $WAPPALYZER_NODE_PATH/node_modules/svg2png/bin/svg2png-cli "$svg" --width=32 --height=32 --output "$dest" || true + if [[ -f "$dest" ]]; then + rm "$dest" fi + + #node $WAPPALYZER_NODE_PATH/node_modules/svg2png/bin/svg2png-cli "$svg" --width=32 --height=32 --output "$dest" || true done IFS="$OIFS" @@ -66,17 +68,17 @@ pushd $WAPPALYZER_ROOT/src/drivers/chrome > /dev/null zip -qr $WAPPALYZER_ROOT/build/wappalyzer_chrome.zip . -popd > /dev/null +# WebExtension +echo "Building WebExtension driver..." -# Bookmarklet -echo "Building Bookmarklet driver..." +pushd $WAPPALYZER_ROOT/src/drivers/webextension > /dev/null -echo "var json =" > /tmp/bookmarklet +zip -qr $WAPPALYZER_ROOT/build/wappalyzer_webextension.zip . -x manifest.edge.json -cat $WAPPALYZER_ROOT/src/apps.json >> /tmp/bookmarklet +zip -qr $WAPPALYZER_ROOT/build/wappalyzer_webextension.edge.zip . -x manifest.json -echo -e ";\n\nwappalyzer.apps = json.apps;\nwappalyzer.categories = json.categories;" >> /tmp/bookmarklet +printf "@ manifest.edge.json\n@=manifest.json\n" | zipnote -w $WAPPALYZER_ROOT/build/wappalyzer_webextension.edge.zip -mv /tmp/bookmarklet $WAPPALYZER_ROOT/src/drivers/bookmarklet/js/apps.js +popd > /dev/null echo "Done. Builds have been created in $WAPPALYZER_ROOT/build." diff --git a/bin/wappalyzer-links b/bin/wappalyzer-links index 7e4b1e45d..251cebbf2 100755 --- a/bin/wappalyzer-links +++ b/bin/wappalyzer-links @@ -46,9 +46,14 @@ if [ "$(compgen -G "$path/icons/converted/*.png" | head -n1)" ]; then ln -f $path/icons/converted/*.png $path/drivers/chrome/images/icons/converted fi -ln -f $path/wappalyzer.js $path/drivers/bookmarklet/js -ln -f $path/icons/*.png $path/drivers/bookmarklet/images/icons -ln -f $path/icons/*.svg $path/drivers/bookmarklet/images/icons +ln -f $path/wappalyzer.js $path/drivers/webextension/js +ln -f $path/apps.json $path/drivers/webextension +ln -f $path/icons/*.png $path/drivers/webextension/images/icons +ln -f $path/icons/*.svg $path/drivers/webextension/images/icons + +if [ "$(compgen -G "$path/icons/converted/*.png" | head -n1)" ]; then + ln -f $path/icons/converted/*.png $path/drivers/webextension/images/icons/converted +fi echo "OK" diff --git a/bin/wappalyzer-validate b/bin/wappalyzer-validate index d9d09a617..0106c4d18 100755 --- a/bin/wappalyzer-validate +++ b/bin/wappalyzer-validate @@ -1,23 +1,20 @@ #!/bin/bash -path=$1 +path="$1" -if [ -z $path ] -then - if [ -z $WAPPALYZER_ROOT ] - then +if [ -z "$path" ]; then + if [ -z "$WAPPALYZER_ROOT" ]; then echo "-$(basename $0): No path specified" exit 1 fi - path=$WAPPALYZER_ROOT + path="$WAPPALYZER_ROOT" fi set -eu -if [ ! -d $path/src ] -then +if [ ! -d "$path/src" ]; then echo "-$(basename $0): Incorrect path" exit 1 @@ -27,7 +24,7 @@ path="$path/src" echo "Validating apps.json..." -node $WAPPALYZER_NODE_PATH/node_modules/jsonlint/lib/cli.js --quiet -V $WAPPALYZER_ROOT/schema.json $path/apps.json +node "$WAPPALYZER_NODE_PATH/node_modules/jsonlint/lib/cli.js" --quiet -V "$WAPPALYZER_ROOT/schema.json" "$path/apps.json" echo "Validating regular expressions..." diff --git a/bin/wappalyzer-validate-regex b/bin/wappalyzer-validate-regex index 36012c57a..f7976c116 100755 --- a/bin/wappalyzer-validate-regex +++ b/bin/wappalyzer-validate-regex @@ -80,7 +80,7 @@ for ( app in json.apps ) { } }); - if ( /[a-z]+:\/\//i.test(json.apps[app].website) ) { - throw new Error('Do not include the protocol in the website URL\n' + app + ': ' + json.apps[app].website); + if ( !/^https?:\/\//i.test(json.apps[app].website) ) { + throw new Error('Invalid website URL\n' + app + ': ' + json.apps[app].website); } } diff --git a/schema.json b/schema.json index 8be26af2a..c70605b61 100644 --- a/schema.json +++ b/schema.json @@ -9,7 +9,16 @@ "additionalProperties": false, "patternProperties": { "^[0-9]+$": { - "type": "string" + "type": "object", + "required": true, + "properties": { + "priority": { + "type": "string" + }, + "name": { + "type": "string" + } + } } } }, @@ -22,7 +31,7 @@ "cats": { "type": "array", "items": { - "type": "integer" + "type": "string" }, "required": true }, diff --git a/src/apps.json b/src/apps.json index 363ee4648..04b2f0408 100755 --- a/src/apps.json +++ b/src/apps.json @@ -2,16 +2,16 @@ "apps": { "1&1": { "cats": [ - 6 + "6" ], "icon": "1and1.svg", "implies": "PHP", "url": "/shop/catalog/browse\\?sessid=", - "website": "1and1.com" + "website": "http://1and1.com" }, "1C-Bitrix": { "cats": [ - 1 + "1" ], "headers": { "Set-Cookie": "BITRIX_", @@ -21,31 +21,31 @@ "icon": "1C-Bitrix.png", "implies": "PHP", "script": "1c-bitrix", - "website": "www.1c-bitrix.ru" + "website": "http://www.1c-bitrix.ru" }, "2z Project": { "cats": [ - 1 + "1" ], "icon": "2z Project.png", "meta": { "generator": "2z project ([\\d.]+)\\;version:\\1" }, - "website": "2zproject-cms.ru" + "website": "http://2zproject-cms.ru" }, "3DM": { "cats": [ - 19 + "19" ], "html": "
- Drag this button to your bookmarks toolbar: -
- -- Wappalyzer -
- - - - - -