From 0fd522a6e324de08a99bdd42ead193acff6f3d15 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Fri, 5 Apr 2024 14:23:22 +0300 Subject: various fixes, surely still broken in places --- api/routes/getNodeInfo/index.js | 9 +-------- api/routes/getZblock/index.js | 2 +- api/tests/node_local_chain.sh | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) (limited to 'api') diff --git a/api/routes/getNodeInfo/index.js b/api/routes/getNodeInfo/index.js index bd2c733..d87a3e7 100644 --- a/api/routes/getNodeInfo/index.js +++ b/api/routes/getNodeInfo/index.js @@ -1,13 +1,6 @@ const { spawn } = require('child_process'); const akLogMessage = require('../../lib/akLogMessage'); -/* - * Gets the local latest zblock - * - * Returns: - * - JSON object - * { zlatest: "Qm..." } - * - */ + module.exports = (req, res) => { akLogMessage('INFO', `Incoming from [${req.socket._peername.address}]:${req.socket._peername.port} @ ${req.get('host')}${req._parsedOriginalUrl.pathname}`); const command = spawn("ak-config", ["get-published"]); diff --git a/api/routes/getZblock/index.js b/api/routes/getZblock/index.js index a9ec02c..723df48 100644 --- a/api/routes/getZblock/index.js +++ b/api/routes/getZblock/index.js @@ -13,7 +13,7 @@ const config = require("../../config"); function fetchZblock(zblock, res){ regex= /Qm[A-Za-z0-9]{44}/; if (regex.test(zblock)){ - const command = spawn("ak-zblock-cache",[zblock]); + const command = spawn("ak-zblock",["--cache",zblock]); command.stdout.on("data", data => { }); diff --git a/api/tests/node_local_chain.sh b/api/tests/node_local_chain.sh index 8bf8b7c..4ad4c33 100755 --- a/api/tests/node_local_chain.sh +++ b/api/tests/node_local_chain.sh @@ -1,7 +1,7 @@ #!/bin/bash PROGRAM="$(basename $0)" printf '[%s]\n' "$PROGRAM" -printf "TEST /zchain\n" +printf "TEST /zchain\n" printf "\t01:\tComparing API with CLI response..." API_RESPONSE="$(curl http://127.0.0.1:8610/v0/zchain 2>/dev/null | jq -c -M | sha512sum - | awk '{print $1 }')" CMD_RESPONSE="$(ak-enter | jq -c -M | sha512sum - | awk '{ print $1 }')" -- cgit v1.2.3