From e4f18be94261b39544ef3bc50321f6aedeb45bd6 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 31 Mar 2024 12:00:59 +0300 Subject: huge refactor, might breaking things --- bin/ak-zblock-gen-html | 239 ------------------------------------------------- 1 file changed, 239 deletions(-) delete mode 100755 bin/ak-zblock-gen-html (limited to 'bin/ak-zblock-gen-html') diff --git a/bin/ak-zblock-gen-html b/bin/ak-zblock-gen-html deleted file mode 100755 index d125d82..0000000 --- a/bin/ak-zblock-gen-html +++ /dev/null @@ -1,239 +0,0 @@ -#!/bin/bash -PROGRAM="$(basename $0)" -source $AK_LIBDIR/_ak_ipfs - -time_started=$(date -u +%s.%N) -ss=$(echo $time_started | cut -d '.' -f 1) -nss=$(echo $time_started | cut -d '.' -f 2) -# Check if there are enough arguments -if [ $# -lt 1 ] -then - echo "Error: Not enough arguments provided" - echo "Give a zblock's IPFS CID v0 as an argument" - exit 1 -fi - -if [ -n "$1" ] -then - TEST="$(echo -n "$1" | grep -v '^Qm[A-Za-z0-9]\{44\}$')" - if [ -n "$TEST" ] - then - echo not ok - exit 1 - fi -fi - -arg="$(mktemp)" -ak-enter -l 1 "$1" | jq '.[]' > $arg - -( \ -# Create HTML document -echo "" -echo "" -echo "" -echo " Arching Kaos Chain Data" -echo ' ' -echo ' ' -echo ' ' -echo "" -echo "" - -# Iterate through each argument and parse data -if [ -f "$arg" ] -then - # Extract data from argument - zblock=$(cat $arg | jq -r '.zblock') - block=$(cat $arg | jq -r '.block') - timestamp=$(cat $arg | jq -r '.timestamp') - block_signature=$(cat $arg | jq -r '.block_signature') - detach=$(cat $arg | jq -r '.detach') - data=$(cat $arg | jq -r '.data') - module=$(cat $arg | jq -r '.module') - action=$(cat $arg | jq -r '.action') - gpg=$(cat $arg | jq -r '.gpg') - previous=$(cat $arg | jq -r '.previous') - datablock=$(cat $arg | jq -r ".$data") - - # Output data in HTML format - echo "

$PROGRAM

" - echo "

🔎 $zblock

" - if [ "$module" == "news" ] && [ "$action" == "add" ] - then - ak-news -x $zblock - fi - echo "

ℹī¸ $zblock

" - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo " " - echo "
" - echo "
đŸ“Ļ ZBLOCK
" - echo "
" - echo "
" - echo " $zblock" - echo "
$(_ak_ipfs_cat $zblock | jq)
" - echo "
" - echo "
" - echo "
đŸ“Ļ BLOCK
" - echo "
" - echo "
" - echo " $block" - echo "
$(_ak_ipfs_cat $block | jq)
" - echo "
" - echo "
" - echo "
🔏 BLOCK SIGNATURE
" - echo "
" - echo "
" - echo " $block_signature" - echo "
$(_ak_ipfs_cat $block_signature)
" - echo "
" - echo "
" - echo "
⌚ TIMESTAMP
" - echo "
" - echo "

$timestamp

" - echo "
" - echo "
🔌 MODULE
" - echo "
" - echo "

$module

" - echo "
" - echo "
đŸĒ§ ACTION
" - echo "
" - echo "

$action

" - echo "
" - echo "
🔑 GPG
" - echo "
" - echo "
" - echo " $gpg" - echo "
$(_ak_ipfs_cat $gpg)
" - echo "
" - echo "
" - echo "
đŸ“Ļ PREVIOUS
" - echo "
" - echo ' 🔗 '$previous'' - echo "
" - echo "
đŸ“Ļ DATA
" - echo "
" - echo "
" - echo " $data" - echo "
$datablock
" - echo "
" - echo "
" - echo "
🔏 DATA_SIGNATURE
" - echo "
" - echo "
" - echo " $detach" - echo "
$(_ak_ipfs_cat $detach)
" - echo "
" - echo "
" - echo "
📄 ipfs
" - echo "
" - echo ' '🔗 $(echo $datablock | jq -r '.ipfs')'' - echo "
" - echo "
🔏 detach
" - echo "
" - echo "
" - echo " $(echo $datablock | jq -r '.detach')" - echo "
$(_ak_ipfs_cat $(echo $datablock | jq -r '.detach'))
" - echo "
" - echo "
" - echo "
📃 Rendered ZBLOCK
" - echo "
$(cat $arg | jq)
" -fi -time_ended=$(date -u +%s.%N) -se=$(echo $time_ended | cut -d '.' -f 1) -nse=$(echo $time_ended | cut -d '.' -f 2) -echo "
" -echo -n " " -else - echo "$(( $nse - $(echo -n $nss|sed 's/^0*//') )) seconds" -fi - -echo "" -echo "" ) > zblock-$1.html - -rm $arg -- cgit v1.2.3