diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2025-07-22 02:29:12 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2025-07-22 02:29:12 +0300 |
commit | de3fab3c70befe6920d5436ce0bef62f3e70ba29 (patch) | |
tree | 63af5d628c62c846a436d006674ddc66f80137ea /api/routes | |
parent | fd12421d9e9589cc8d68a8a64bc2630266e3288f (diff) | |
download | arching-kaos-tools-de3fab3c70befe6920d5436ce0bef62f3e70ba29.tar.gz arching-kaos-tools-de3fab3c70befe6920d5436ce0bef62f3e70ba29.tar.bz2 arching-kaos-tools-de3fab3c70befe6920d5436ce0bef62f3e70ba29.zip |
[api+ns] ns tool outputs JSON format and it's used for the API
Diffstat (limited to 'api/routes')
-rw-r--r-- | api/routes/getAKNSKey/index.js | 7 | ||||
-rw-r--r-- | api/routes/getAKNSKeyFromBase/index.js | 7 |
2 files changed, 4 insertions, 10 deletions
diff --git a/api/routes/getAKNSKey/index.js b/api/routes/getAKNSKey/index.js index c5adff0..5e78f81 100644 --- a/api/routes/getAKNSKey/index.js +++ b/api/routes/getAKNSKey/index.js @@ -13,7 +13,7 @@ const config = require("../../config.js"); function replyIfOkay(key, res) { const program = "ak-ns"; - const command = spawn(program, ["-rk", key]); + const command = spawn(program, ["-rj", key]); var buffer = ""; command.stdout.on("data", data => { buffer += data; @@ -29,10 +29,7 @@ function replyIfOkay(key, res) if (code === 0){ buffer = buffer.trim() res.writeHead(200, {'Content-Type': 'application/json'}); - res.end(JSON.stringify({ - key:`${key}`, - resolved:`${buffer}` - })); + res.end(`${buffer}`); } else { res.writeHead(404, {'Content-Type': 'application/json'}); res.end({"error":"unreachable"}); diff --git a/api/routes/getAKNSKeyFromBase/index.js b/api/routes/getAKNSKeyFromBase/index.js index 587314a..7da3d9b 100644 --- a/api/routes/getAKNSKeyFromBase/index.js +++ b/api/routes/getAKNSKeyFromBase/index.js @@ -35,7 +35,7 @@ function replyIfOkay(key, res) const base64String = key; const decodedHexString = decodeBase64ToHex(base64String); formatted_key = decodedHexString.toUpperCase(); - const command = spawn(program, ["-rk", `${formatted_key}`]); + const command = spawn(program, ["-rj", `${formatted_key}`]); var buffer = ""; command.stdout.on("data", data => { @@ -52,10 +52,7 @@ function replyIfOkay(key, res) if (code === 0){ buffer = buffer.trim() res.writeHead(200, {'Content-Type': 'application/json'}); - res.end(JSON.stringify({ - key:`${formatted_key}`, - resolved:`${buffer}` - })); + res.end(`${buffer}`); } else { res.writeHead(404, {'Content-Type': 'application/json'}); res.end(JSON.stringify({error:"unreachable"})); |