diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-02-07 23:48:11 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-02-13 10:49:32 +0000 |
| commit | ae3e7c7abe4825bfe842a1dbe486fcaefda5901c (patch) | |
| tree | ba2cc9868418a4d4eae8ebb7700e72e73c5e413e | |
| parent | 4ca331577bd4379ae915b37fa0d6f009b29fb9ac (diff) | |
| download | mullvadvpn-ae3e7c7abe4825bfe842a1dbe486fcaefda5901c.tar.xz mullvadvpn-ae3e7c7abe4825bfe842a1dbe486fcaefda5901c.zip | |
Refactor to create `update-relays.sh` script
| -rwxr-xr-x | build.sh | 22 | ||||
| -rwxr-xr-x | update-relays.sh | 23 |
2 files changed, 24 insertions, 21 deletions
@@ -190,27 +190,7 @@ if [[ "$BUILD_MODE" == "release" && "$(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 - -JSONRPC_RESPONSE="$(curl -X POST \ - --fail \ - -H "Content-Type: application/json" \ - -d '{"jsonrpc": "2.0", "id": "0", "method": "relay_list_v3"}' \ - https://api.mullvad.net/rpc/)" -echo $JSONRPC_RESPONSE | node -e "$JSONRPC_CODE" > dist-assets/relays.json +./update-relays.sh pushd "$SCRIPT_DIR/gui" diff --git a/update-relays.sh b/update-relays.sh new file mode 100755 index 0000000000..711afe342a --- /dev/null +++ b/update-relays.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +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 + +JSONRPC_RESPONSE="$(curl -X POST \ + --fail \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": "0", "method": "relay_list_v3"}' \ + https://api.mullvad.net/rpc/)" +echo $JSONRPC_RESPONSE | node -e "$JSONRPC_CODE" > dist-assets/relays.json |
