diff --git a/browser-extensions/chrome/README.md b/browser-extensions/chrome/README.md new file mode 100644 index 000000000..0eec88a19 --- /dev/null +++ b/browser-extensions/chrome/README.md @@ -0,0 +1,9 @@ +Development + +* Just run: + +``` +$ sh chrome/build.sh +``` + +* The ZIP file is *chrome/copay-chrome-extension.zip* diff --git a/browser-extensions/chrome/build.sh b/browser-extensions/chrome/build.sh new file mode 100755 index 000000000..034b910ec --- /dev/null +++ b/browser-extensions/chrome/build.sh @@ -0,0 +1,65 @@ +#! /bin/bash + +# Description: This script compiles and copy the needed files to later package the application for Chrome + +OpenColor="\033[" +Red="1;31m" +Yellow="1;33m" +Green="1;32m" +CloseColor="\033[0m" + +# Check function OK +checkOK() { + if [ $? != 0 ]; then + echo "${OpenColor}${Red}* ERROR. Exiting...${CloseColor}" + exit 1 + fi +} + +# Configs +BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +APPDIR="$BUILDDIR/copay-chrome-extension" +ZIPFILE="copay-chrome-extension.zip" +VERSION=`cut -d '"' -f2 $BUILDDIR/../../src/js/version.js|head -n 1` + +# Move to the build directory +cd $BUILDDIR + +# Create/Clean temp dir +echo "${OpenColor}${Green}* Checking temp dir...${CloseColor}" +if [ -d $APPDIR ]; then + rm -rf $APPDIR +fi + +mkdir -p $APPDIR + +# Re-compile copayBundle.js +echo "${OpenColor}${Green}* Generating copay bundle...${CloseColor}" +grunt +checkOK + +# Copy all chrome-extension files +echo "${OpenColor}${Green}* Copying all chrome-extension files...${CloseColor}" +sed "s/APP_VERSION/$VERSION/g" manifest.json > $APPDIR/manifest.json +checkOK + + +INCLUDE=`cat ../include` +INITIAL=$BUILDDIR/initial.js +echo "INITIAL: $INITIAL" +cp -vf $INITIAL $APPDIR + +cd $BUILDDIR/../../public +CMD="rsync -rLRv --exclude-from $BUILDDIR/../exclude $INCLUDE $APPDIR" +echo $CMD +$CMD +checkOK + +# Zipping chrome-extension +echo "${OpenColor}${Green}* Zipping all chrome-extension files...${CloseColor}" +cd $BUILDDIR +rm $ZIPFILE +zip -qr $ZIPFILE "`basename $APPDIR`" +checkOK + +echo "${OpenColor}${Yellow}\nThe Chrome Extension is ready at $BUILDDIR/copay-chrome-extension.zip${CloseColor}" diff --git a/browser-extensions/chrome/initial.js b/browser-extensions/chrome/initial.js new file mode 100644 index 000000000..0ff1298cf --- /dev/null +++ b/browser-extensions/chrome/initial.js @@ -0,0 +1,8 @@ +chrome.app.runtime.onLaunched.addListener(function() { + chrome.app.window.create('index.html', { + 'bounds': { + 'width': 400, + 'height': 600 + } + }); +}); diff --git a/browser-extensions/chrome/manifest.json b/browser-extensions/chrome/manifest.json new file mode 100644 index 000000000..d5361b40e --- /dev/null +++ b/browser-extensions/chrome/manifest.json @@ -0,0 +1,19 @@ +{ + "manifest_version": 2, + "name": "Copay", + "description": "A secure Bitcoin wallet for friends and companies", + "version": "APP_VERSION", + "permissions": [ + "storage", + "notifications", + "videoCapture" + ], + "app": { + "background": { + "scripts": ["initial.js"] + } + }, + "icons": { + "128": "img/icons/icon.png" + } +} diff --git a/browser-extensions/chrome/tile.png b/browser-extensions/chrome/tile.png new file mode 100644 index 000000000..d457fa2bf Binary files /dev/null and b/browser-extensions/chrome/tile.png differ diff --git a/browser-extensions/exclude b/browser-extensions/exclude new file mode 100644 index 000000000..2d4d75de3 --- /dev/null +++ b/browser-extensions/exclude @@ -0,0 +1,11 @@ +../cordova +../covergae +../bower_components +../browser_extensions +../node_modules +../po +../src +../util +../.git +../test +../.* diff --git a/browser-extensions/include b/browser-extensions/include new file mode 100644 index 000000000..bc2e9ea13 --- /dev/null +++ b/browser-extensions/include @@ -0,0 +1,2 @@ +./**/* +./index.html