Skip to content

Commit 674909a

Browse files
author
Milan Pssler
committed
2 parents 70d9d81 + 08aa452 commit 674909a

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

modules/receiver/announced.js

+15-11
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,21 @@ module.exports = function(receiverId, configData, api) {
5555
if (err) {
5656
console.log('ERR: ' + err)
5757
} else {
58-
var obj = JSON.parse(res)
59-
var id
60-
if (obj.nodeinfo) {
61-
id = obj.nodeinfo.node_id
62-
} else if (obj.statistics) {
63-
id = obj.statistics.node_id
64-
} else if (obj.neighbours) {
65-
id = obj.neighbours.node_id
66-
} else return
67-
68-
api.receiverCallback(id, obj, receiverId)
58+
try {
59+
var obj = JSON.parse(res)
60+
var id
61+
if (obj.nodeinfo) {
62+
id = obj.nodeinfo.node_id
63+
} else if (obj.statistics) {
64+
id = obj.statistics.node_id
65+
} else if (obj.neighbours) {
66+
id = obj.neighbours.node_id
67+
} else return
68+
api.receiverCallback(id, obj, receiverId)
69+
}
70+
catch (err) {
71+
console.log('JSON.parse ERROR! ' + err)
72+
}
6973
}
7074
})
7175
})

scripts/bootstrap.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ function prereq {
7474

7575
if curl -f "https://deb.nodesource.com/node_6.x/dists/$DISTRO/Release" >/dev/null
7676
then
77-
apt-get remove nodejs nodejs-legacy npm -y
7877
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
7978
echo "deb https://deb.nodesource.com/node_6.x $DISTRO main" > /etc/apt/sources.list.d/nodesource.list
8079
echo "deb-src https://deb.nodesource.com/node_6.x $DISTRO main" >> /etc/apt/sources.list.d/nodesource.list
8180
apt-get update
81+
# comment out the following line, if you installed nodejs 6 already (check with `apt-cache policy nodejs`)
82+
apt-get remove nodejs nodejs-legacy npm
8283
apt-get install nodejs git -y
8384
else
8485
END_NOTICE="$END_NOTICE\nYour distribution is not supported by NodeJS. \nYou have to install a recent NodeJS version (>=4) manually. "
@@ -105,13 +106,12 @@ function prereq {
105106

106107
function install {
107108
#Clone and install NodeJS libs
108-
su - hopglass --shell /bin/bash <<'EOF'
109-
git clone https://github.com/hopglass/hopglass-server -b v0.1.1 server
110-
cd server
111-
npm install
112-
exit
113-
EOF
114-
#EOF can't be indented
109+
su - hopglass --shell /bin/bash <<-EOF
110+
git clone https://github.com/hopglass/hopglass-server -b v0.1.1 server
111+
cd server
112+
npm install
113+
exit
114+
EOF
115115
116116
#Symlink systemd service and copy config file:
117117
#only for systemd-systems

0 commit comments

Comments
 (0)