Merge pull request #371 from colkito/feature/chrome-extension

Feature/chrome extension
This commit is contained in:
Matias Alejo Garcia 2014-05-14 21:17:53 -03:00
commit 4ddfc65a2b
10 changed files with 147 additions and 56 deletions

2
.gitignore vendored
View File

@ -42,4 +42,4 @@ lib/*
js/copayBundle.js
config.js
webapp
chrome-extension

View File

@ -17,6 +17,7 @@
"crypto-js": "http://crypto-js.googlecode.com/files/CryptoJS%20v3.1.2.zip",
"sjcl": "1.0.0",
"file-saver": "*",
"qrcode-decoder-js": "*"
"qrcode-decoder-js": "*",
"bitcore": "~0.1.19"
}
}

View File

@ -1,51 +0,0 @@
#! /bin/bash
#Description: A simple script to compile and copy only the needed files for the web app.
# Configs
APPDIR="webapp"
LIBDIR="$APPDIR/lib"
DOWNLOADDIR="$APPDIR/download"
ZIPFILE="copay_webapp_.zip"
OpenColor="\033["
Red="1;31m"
Yellow="1;33m"
Green="1;32m"
CloseColor="\033[0m"
# Create/Clean temp dir
echo -e "${OpenColor}${Green}* Checking temp dir...${CloseColor}"
if [ -d $APPDIR ]; then
rm -rf $APPDIR
fi
mkdir -p $APPDIR
# Generate and copy bitcore bundle
if [ ! -d node_modules/bitcore ]; then
echo -e "${OpenColor}${Red}X The node_modules/bitcore dir does not exist. \nRun npm install and try again.${CloseColor}"
exit 1
else
echo -e "${OpenColor}${Green}* Generating bitcore bundle...${CloseColor}"
cd node_modules/bitcore
grunt --target=dev shell
cd ../..
fi
# Re-compile copayBundle.js
echo -e "${OpenColor}${Green}* Generating copay bundle...${CloseColor}"
grunt --target=dev shell
# Copy all app files
echo -e "${OpenColor}${Green}* Copying all app files...${CloseColor}"
cp -af {css,font,img,js,lib,config.js,index.html} $APPDIR
cp -af node_modules/bitcore/browser/bundle.js $LIBDIR/
mv $LIBDIR/bundle.js $LIBDIR/bitcore.js
echo -e "${OpenColor}${Green}* Zipping all app files...${CloseColor}"
zip -r $ZIPFILE $APPDIR
mkdir -p $DOWNLOADDIR
mv $ZIPFILE $DOWNLOADDIR
echo -e "${OpenColor}${Yellow}\nAwesome! You just need to copy and paste the ./webapp content to your local repository and push it.${CloseColor}"

BIN
img/icons/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -0,0 +1,22 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Copay Chrome Extension - Install</title>
<link rel="stylesheet" href="../../css/foundation.min.css">
</head>
<body>
<div class="row">
<h1>Copay Installation:</h1>
<ul>
<li>Download <a href="copay-chrome-extension.zip">ZIP</a></li>
<li>Unpack the ZIP file</li>
<li>Navigate to "chrome://extensions" in your browser</li>
<li>Enable Developer Mode</li>
<li>Click "Load unpacked extension" and select the unzipped folder</li>
<li>Copay is installed!</li>
</ul>
</div>
</body>
</html>

View File

@ -1,5 +1,5 @@
<!doctype html>
<html lang="en">
<html lang="en" ng-csp>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@ -7,6 +7,7 @@
<title>Copay - Multisignature Wallet</title>
<link rel="stylesheet" href="css/foundation.min.css">
<link rel="stylesheet" href="css/foundation-icons.css">
<link rel="stylesheet" href="lib/angular/angular-csp.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body ng-cloak class="ng-cloak">
@ -590,7 +591,7 @@
<h3>{{title}}</h3>
<div class="small-12 medium-6 medium-centered large-6 large-centered columns">
<fieldset>
<legend>Network Name</legend>
<legend>Bitcoin Network</legend>
<input id="network-name" type="checkbox" ng-model="networkName" ng-true-value="livenet" ng-false-value="testnet">
<label for="network-name">Livenet</label>
</fieldset>
@ -660,7 +661,7 @@ on supported browsers please check <a href="http://www.webrtc.org/">http://www.w
<script src="lib/angular-foundation/mm-foundation.min.js"></script>
<script src="lib/angular-foundation/mm-foundation-tpls.min.js"></script>
<script src="lib/peerjs/peer.js"></script>
<script src="lib/bitcore.js"></script>
<script src="lib/bitcore/browser/bundle.js"></script>
<script src="lib/crypto-js/rollups/sha256.js"></script>
<script src="lib/crypto-js/rollups/pbkdf2.js"></script>
<script src="lib/crypto-js/rollups/aes.js"></script>

View File

@ -74,4 +74,7 @@ angular
}
}
});
})
.config(function($compileProvider) {
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel|chrome-extension):/);
});

19
manifest.json Normal file
View File

@ -0,0 +1,19 @@
{
"manifest_version": 2,
"name": "Copay",
"description": "A multisignature bitcoin wallet",
"version": "0.0.1",
"homepage_url": "http://bitpay.github.io/copay",
"browser_action": {
"default_title": "Copay",
"default_icon": "img/icons/icon.png",
"default_popup": "popup.html"
},
"permissions": [
"tabs", "storage"
],
"options_page": "index.html#/settings",
"icons": {
"128": "img/icons/icon.png"
}
}

31
popup.html Normal file
View File

@ -0,0 +1,31 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Copay</title>
<style>
body { background-color: #2C3E50; }
a {
-webkit-border-radius: 5px;
border-radius: 5px;
background-color: #008cba;
color: #fff;
display: block;
font-family: "Helvetica Neue","Helvetica",Helvetica,Arial,sans-serif;
margin: 20px 0;
opacity: .8;
outline: none;
padding: 10px;
text-decoration: none;
text-align: center;
width: 200px;
}
a:hover { opacity: 1; }
</style>
</head>
<body>
<a href="index.html#signin" target="_blank">Open wallet</a>
<a href="index.html#settings" target="_blank">Settings</a>
</body>
</html>

65
util/generate-app-extension.sh Executable file
View File

@ -0,0 +1,65 @@
#! /bin/bash
#Description: A simple script to compile and copy only the needed files for the web app.
# Moving to root path
cd ../
# Configs
APPDIR="./webapp"
CHROMEDIR="./chrome-extension"
LIBDIR="$APPDIR/lib"
DOWNLOADDIR="$APPDIR/download"
CHROMEDOWNLOADDIR="$DOWNLOADDIR/chrome"
ZIPFILE="copay.zip"
CHROMEZIPFILE="copay-chrome-extension.zip"
OpenColor="\033["
Red="1;31m"
Yellow="1;33m"
Green="1;32m"
CloseColor="\033[0m"
# Create/Clean temp dir
echo -e "${OpenColor}${Green}* Checking temp dir...${CloseColor}"
if [ -d $APPDIR ]; then
rm -rf $APPDIR
fi
mkdir -p $APPDIR
# Create/Clean chrome-extension dir
if [ -d $CHROMEDIR ]; then
rm -rf $CHROMEDIR
fi
mkdir -p $CHROMEDIR
# Re-compile copayBundle.js
echo -e "${OpenColor}${Green}* Generating copay bundle...${CloseColor}"
grunt --target=dev shell
# Copy all app files
echo -e "${OpenColor}${Green}* Copying all app files...${CloseColor}"
cp -af {css,font,img,js,lib,sound,config.js,index.html} $APPDIR
# Copy all chrome-extension files
echo -e "${OpenColor}${Green}* Copying all chrome-extension files...${CloseColor}"
cp -af {css,font,img,js,lib,sound,config.js,index.html,popup.html,manifest.json} $CHROMEDIR
# Zipping apps
echo -e "${OpenColor}${Green}* Zipping all app files...${CloseColor}"
zip -r $ZIPFILE $APPDIR
# Zipping chrome-extension
echo -e "${OpenColor}${Green}* Zipping all chrome-extension files...${CloseColor}"
zip -r $CHROMEZIPFILE $CHROMEDIR
mkdir -p $CHROMEDOWNLOADDIR
mv $ZIPFILE $DOWNLOADDIR
mv $CHROMEZIPFILE $CHROMEDOWNLOADDIR
cp index-download-chrome.html $CHROMEDOWNLOADDIR/index.html
echo -e "${OpenColor}${Yellow}\nAwesome! Now you have the webapp in ./webapp and the chrome extension files in ./webapp/download/.${CloseColor}"