summaryrefslogtreecommitdiffhomepage
path: root/build.sh
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2018-07-18 11:43:20 +0100
committerEmīls Piņķis <emils@mullvad.net>2018-07-18 11:43:20 +0100
commit7c19aaf642d59d88ea07b2aea8c971347dfbd611 (patch)
tree593b393fe2db1c9e04527771fda4e7c39998871b /build.sh
parentf84238cd2a8d84a3593a47f043859a5bd2ead795 (diff)
parenta5aa5086dc173f060b12eb93faef7b97899ed8ee (diff)
downloadmullvadvpn-7c19aaf642d59d88ea07b2aea8c971347dfbd611.tar.xz
mullvadvpn-7c19aaf642d59d88ea07b2aea8c971347dfbd611.zip
Merge branch 'fix-relay-list-download'
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index 75c83327ea..e88a076798 100755
--- a/build.sh
+++ b/build.sh
@@ -130,11 +130,25 @@ if [[ "$(uname -s)" != "MINGW"* ]]; then
fi
echo "Updating relay list..."
+set +e
+read -d '' JSONRPC_CODE <<-JSONRPC_CODE
+var buff = "";
+process.stdin.on('data', function (chunk) {
+ buff += chunk;
+})
+process.stdin.on('end', function () {
+ var obj = JSON.parse(buff);
+ var output = JSON.stringify(obj.result, null, ' ');
+ process.stdout.write(output);
+})
+JSONRPC_CODE
+set -e
+
curl -X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": "0", "method": "relay_list"}' \
- https://api.mullvad.net/rpc/ \
- -o dist-assets/relays.json
+ https://api.mullvad.net/rpc/ | \
+node -e "$JSONRPC_CODE" > dist-assets/relays.json
echo "Installing JavaScript dependencies..."
yarn install