diff options
-rw-r--r-- | api/routes/getNodeInfo/index.js | 9 | ||||
-rw-r--r-- | api/routes/getZblock/index.js | 2 | ||||
-rwxr-xr-x | api/tests/node_local_chain.sh | 2 | ||||
-rwxr-xr-x | bin/ak | 2 | ||||
-rwxr-xr-x | bin/ak-config | 5 | ||||
-rwxr-xr-x | bin/ak-profile | 31 | ||||
-rwxr-xr-x | bin/ak-repositories | 2 | ||||
-rwxr-xr-x | bin/ak-zblock | 50 |
8 files changed, 76 insertions, 27 deletions
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 }')" @@ -7,6 +7,7 @@ fullprogrampath="$(realpath $0)" PROGRAM="$(basename $0)" descriptionString="Arching Kaos CLI" + source $AK_LIBDIR/_ak_log source $AK_LIBDIR/_ak_script @@ -36,6 +37,7 @@ then _ak_title_description _ak_help exit 1 + ;; esac fi diff --git a/bin/ak-config b/bin/ak-config index cc2c8c5..7d604ed 100755 --- a/bin/ak-config +++ b/bin/ak-config @@ -15,12 +15,13 @@ PROGRAM="$(basename $0)" descriptionString="Arching Kaos Configuration Tool" source $AK_LIBDIR/_ak_script +source $AK_LIBDIR/_ak_gpg source $AK_LIBDIR/_ak_ipfs _ak_config_show(){ # We will be using our public key also to put it in the block later KEY="tmp-gpg.pub" - gpg2 --homedir $AK_GPGHOME --armour --output $KEY --export $AK_FINGERPRINT + _ak_gpg_key_self_export $KEY GPG_PUB_KEY=$(_ak_ipfs_add $KEY) rm $KEY @@ -52,7 +53,7 @@ _ak_config_publish(){ } _ak_config_published(){ - _ak_ipfs_cat $(ak-node-info ipfs) | jq -c + _ak_ipfs_cat $(ak-node-info --ipfs) | jq -c } if [ ! -z $1 ]; then diff --git a/bin/ak-profile b/bin/ak-profile index 74491ef..d513c9a 100755 --- a/bin/ak-profile +++ b/bin/ak-profile @@ -5,22 +5,25 @@ ## ## Usage: ## -## -h, --help Prints this help message +## -h, --help Prints this help message ## -## index Show current status +## -i, --index Show current status ## -## show <data> Show profile entry from specified DATA IPFS CIDv0 +## --show <data IPFS CIDv0> Show profile entry from specified DATA +## IPFS CIDv0 ## -## set <property> <value> Sets a profile value +## -s, --set <property> <value> Sets a profile value ## -## get <property> Gets a profile value from the on-disk file. +## -g, --get <property> Gets a profile value from the on-disk +## file. ## ## Advanced (use with caution may produce duplicate entries): ## -## add <file> Creates a data file from the profile file you point -## to (file should already be in ZPROFILEDIR. +## -a, --add <file> Creates a data file from the profile file +## you point (file should already be in +## ZPROFILEDIR). ## -## import <folder> Import a folder to zchain #TODO +## -i, --import <folder> Import a folder to zchain #TODO ## fullprogrampath="$(realpath $0)" PROGRAM=$(basename $0) @@ -211,12 +214,12 @@ EOF if [ ! -z $1 ]; then case $1 in -h | --help) _ak_usage; exit;; - index) _ak_modules_profile_index; exit;; - show) _ak_modules_profile_show $2; exit;; - import) _ak_modules_profile_import $2; exit;; - add) _ak_modules_profile_add $2; exit;; - set) _ak_modules_profile_propset $2 "$3"; exit;; - get) _ak_modules_profile_propget $2; exit;; + -i | --index) _ak_modules_profile_index; exit;; + --show) _ak_modules_profile_show $2; exit;; + -i | --import) _ak_modules_profile_import $2; exit;; + -a | --add) _ak_modules_profile_add $2; exit;; + -s | --set) _ak_modules_profile_propset $2 "$3"; exit;; + -g | --get) _ak_modules_profile_propget $2; exit;; * ) _ak_usage;; esac else _ak_usage diff --git a/bin/ak-repositories b/bin/ak-repositories index 5086eb2..ffda701 100755 --- a/bin/ak-repositories +++ b/bin/ak-repositories @@ -107,7 +107,7 @@ add(){ then _ak_ipfs_name_publish --key="$PROJECT.git" /ipfs/$IPFS printf '{"project":"%s.git","ipns":"%s"}' $PROJECT $try > data - _ak_zblock_pack "repos/add" $PWD/data + _ak_zblock_pack "repos/add" $PWD/data echo "Done" fi fi diff --git a/bin/ak-zblock b/bin/ak-zblock new file mode 100755 index 0000000..d657ba5 --- /dev/null +++ b/bin/ak-zblock @@ -0,0 +1,50 @@ +#!/bin/bash +## +## Brief description +## +## Usage: +## +## -h, --help Prints this help message +## +fullprogrampath="$(realpath $0)" +PROGRAM=$(basename $0) +descriptionString="Quick description" + +# At least these +source $AK_LIBDIR/_ak_log +source $AK_LIBDIR/_ak_script +source $AK_LIBDIR/_ak_zblock + +# Your stuff here... +example(){ + echo "Example" +} + +# Flags to run +if [ ! -z $1 ]; then + case $1 in + -h | --help) _ak_usage; exit;; + -s | --show) + _ak_zblock_show $2 + exit + ;; + -x | --gen-html) + _ak_zblock_gen_html $2 + exit + ;; + -c | --cache) + _ak_zblock_gen_html $2 + exit + ;; + -p | --pack) + _ak_zblock_pack $2 + exit + ;; + -a | --announce) + _ak_zblock_announce $2 + exit + ;; + * ) _ak_usage;; + esac +else _ak_usage +fi |