#!/bin/bash source $AK_LIBDIR/_ak_log _ak_generate_html_header(){ printf '\n\n\n' printf 'Arching Kaos Chain Data\n' printf ' \n' printf ' \n' printf ' \n' printf '\n' printf '\n' } _ak_generate_html_zblock(){ if [ ! -z $1 ] && [ -n "$1" ] then arg="$1" else _ak_log_error "No argument given" exit 1 fi # Iterate through each argument and parse data if [ -f "$arg" ] then # Extract data from argument zblock=$(cat $arg | jq -r '.zblock') if [ ! -n "$zblock" ] then _ak_log_error "Empty zblock value" exit 1 fi block=$(cat $arg | jq -r '.block') if [ ! -n "$block" ] then _ak_log_error "Empty block value" exit 1 fi timestamp=$(cat $arg | jq -r '.timestamp') if [ ! -n "$timestamp" ] then _ak_log_error "Empty timestamp value" exit 1 fi block_signature=$(cat $arg | jq -r '.block_signature') if [ ! -n "$block_signature" ] then _ak_log_error "Empty block_signature value" exit 1 fi detach=$(cat $arg | jq -r '.detach') if [ ! -n "$detach" ] then _ak_log_error "Empty detach value" exit 1 fi data=$(cat $arg | jq -r '.data') if [ ! -n "$data" ] then _ak_log_error "Empty data value" exit 1 fi module=$(cat $arg | jq -r '.module') if [ ! -n "$module" ] then _ak_log_error "Empty module value" exit 1 fi action=$(cat $arg | jq -r '.action') if [ ! -n "$action" ] then _ak_log_error "Empty action value" exit 1 fi gpg=$(cat $arg | jq -r '.gpg') if [ ! -n "$gpg" ] then _ak_log_error "Empty gpg value" exit 1 fi previous=$(cat $arg | jq -r '.previous') if [ ! -n "$previous" ] then _ak_log_error "Empty previous value" exit 1 fi datablock=$(cat $arg | jq -r ".$data") if [ ! -n "$datablock" ] then _ak_log_error "Empty datablock value" exit 1 fi # Output data in HTML format printf '

%s

\n' "$PROGRAM" printf '

🔎 %szblock

\n' "$zblock" if [ -f $AK_MODULESDIR/$module/main.sh ] && [ "$action" == "add" ] then ak -m $module -x $zblock > /dev/null 2>&1 if [ $? -eq 0 ] then ak -m $module -x $zblock fi fi printf '

ℹī¸ %s

\n' "$zblock" printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf '
\n' printf '
đŸ“Ļ ZBLOCK
\n' printf '
\n' printf '
\n' printf ' %s\n' "$zblock" printf '
%s
' "$(_ak_ipfs_cat $zblock | jq)" printf '
\n' printf '
\n' printf '
đŸ“Ļ BLOCK
\n' printf '
\n' printf '
\n' printf ' %s\n' "$block" printf '
%s
\n' "$(_ak_ipfs_cat $block | jq)" printf '
\n' printf '
\n' printf '
🔏 BLOCK SIGNATURE
\n' printf '
\n' printf '
\n' printf ' %s\n' "$block_signature" printf '
%s
\n' "$(_ak_ipfs_cat $block_signature)" printf '
\n' printf '
\n' printf '
⌚ TIMESTAMP
\n' printf '
\n' printf '

%s

\n' "$timestamp" printf '
\n' printf '
🔌 MODULE
\n' printf '
\n' printf '

%s

\n' "$module" printf '
\n' printf '
đŸĒ§ ACTION
\n' printf '
\n' printf '

%s

\n' "$action" printf '
\n' printf '
🔑 GPG
\n' printf '
\n' printf '
\n' printf ' %s\n' "$gpg" printf '
%s
\n' "$(_ak_ipfs_cat $gpg)" printf '
\n' printf '
\n' printf '
đŸ“Ļ PREVIOUS
\n' printf '
\n' printf ' 🔗 %s\n' "$previous" "$previous" printf '
\n' printf '
đŸ“Ļ DATA
\n' printf '
\n' printf '
\n' printf ' %s\n' "$data" printf '
%s
\n' "$datablock" printf '
\n' printf '
\n' printf '
🔏 DATA_SIGNATURE
\n' printf '
\n' printf '
\n' printf ' %s\n' "$detach" printf '
%s
\n' "$(_ak_ipfs_cat $detach)" printf '
\n' printf '
\n' printf '
📄 ipfs
\n' printf '
\n' printf ' 🔗 %s\n' "$(echo $datablock | jq -r '.ipfs')" "$(echo $datablock | jq -r '.ipfs')" printf '
\n' printf '
🔏 detach
\n' printf '
\n' printf '
\n' printf ' %s\n' "$(echo $datablock | jq -r '.detach')" printf '
%s
\n' "$(_ak_ipfs_cat $(echo $datablock | jq -r '.detach'))" printf '
\n' printf '
\n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf ' \n' printf '
\n' printf '
📃 Rendered ZBLOCK
\n' printf '
\n' printf '
%s
\n' "$(cat $arg | jq)" printf '
\n' fi }