aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-02-01 06:51:02 +0200
committerkaotisk <kaotisk@arching-kaos.org>2023-02-01 06:51:02 +0200
commit36339e1f2839305e22748b9d3cf347847592565a (patch)
tree786aeafc003fd0c132420fdd59728f00490af3f0 /bin
parent45f47e430c1fe28fefd14ecb1c24af508dea2399 (diff)
downloadarching-kaos-tools-36339e1f2839305e22748b9d3cf347847592565a.tar.gz
arching-kaos-tools-36339e1f2839305e22748b9d3cf347847592565a.tar.bz2
arching-kaos-tools-36339e1f2839305e22748b9d3cf347847592565a.zip
Removed -z flag and functionality, add regex check for IPFS CIDv0
Diffstat (limited to 'bin')
-rwxr-xr-xbin/enter62
-rwxr-xr-x[-rw-r--r--]bin/profile0
2 files changed, 5 insertions, 57 deletions
diff --git a/bin/enter b/bin/enter
index a4aa2ef..584d0e0 100755
--- a/bin/enter
+++ b/bin/enter
@@ -28,7 +28,6 @@ usage(){
echo "Usage:"
echo " --help, -h Print this help and exit"
echo " --chain <ipns-link>, -n <ipns-link> Crawl specified chain"
- echo " --show-zblocks-only, -z Show only zblocks"
echo " --no-verify, -nV Don't verify signatures"
echo " <ipfs-link> Specify IPFS CID for entrance"
echo ""
@@ -52,65 +51,14 @@ then
elif [ ! -z "$1" ] && [ "$1" == "-n" ]
then
entrance="$(ipns-resolve $2)"
-elif [ ! -z "$1" ] && [ "$1" == "--show-zblocks-only" ] || [ "$1" == "-z" ]
+elif [ ! -z "$1" ]
then
- # Enter temp folder
- TEMPASSIN="/tmp/aktmp_$(date -u +%s)"
- mkdir $TEMPASSIN
- cd $TEMPASSIN
- ccounter=0
- entrance="$(cat $ZLATEST)"
- seed="$(cat $ZGENESIS)"
- echo -n '['
- zblock=$entrance
- while true
- do
- if [ "$counter" == 0 ]
- then
- echo -n "["
- fi
- counter=$(expr $counter + 1)
- if [ ! -v $zblock ]
- then
- if [ "$zblock" != "$seed" ]
- then
- timestamp=''
- echo -n '{"zblock":"'$zblock'",'
- ipfs --timeout=10s cat $zblock | json2bash > $TEMPASSIN/tmp-zblock
- source $TEMPASSIN/tmp-zblock
- ipfs --timeout=10s cat $block | json2bash > $TEMPASSIN/tmp-block
- source $TEMPASSIN/tmp-block
- logit "[INFO]" "BLOCK REFERENCED"
- if [ ! -v $timestamp ]
- then
- echo -n '"timestamp":"'$timestamp'",'
- fi
- echo -n '"block_signature":"'$block_signature'",'
- echo -n '"gpg":"'$gpg'",'
-
- if [ -v $previous ]
- then
- logit "[ERROR]" "Block $block has no previous zblock $previous. Appending default genesis to close cleanly."
- echo -n '"previous":"genesis"},{"genesis":"genesis"}]'
- exit 0
- else
- echo -n '"previous":"'$previous'"},'
- zblock=$previous
- fi
- elif [ "$zblock" == "$seed" ]
- then
- echo -n '{"genesis":"genesis"}]'
- logit "[INFO]" "Counter $counter"
- exit 0
- fi
- else
- echo "Check not passed... No previous IPFS CID"
+ echo $1 | grep -e 'Qm.\{44\}' >/dev/null
+ if [ "$?" -ne 0 ]
+ then
+ logit "[ERROR]" "Argument provided was not an IPFS CIDv0 string"
exit 1
fi
-done
-
-elif [ ! -z "$1" ]
-then
entrance="$1"
else
# By default we enter from the latest block
diff --git a/bin/profile b/bin/profile
index ed83d29..ed83d29 100644..100755
--- a/bin/profile
+++ b/bin/profile