"
echo " "
echo " "
echo " ⌚ Date/Time "
echo " | "
echo " "
echo " $zdatetime "
echo " | "
echo "
"
echo " "
echo " "
echo " ✍️ Title "
echo " | "
echo " "
echo " $ztitle "
echo " | "
echo "
"
echo " "
echo " "
echo " 📄 Filename "
echo " | "
echo " "
echo " $zfilename "
echo " | "
echo "
"
echo " "
echo " "
echo " 📄 Content "
echo " | "
echo " "
echo " "
_ak_ipfs_cat $linkToText | txt2tags -t html -H --infile=- --outfile=-
echo " | "
echo "
"
echo '
'
else
_ak_log_error "Not a news block."
exit 1
fi
rm temp
}
_ak_modules_news_specs(){
datetime_mask=$(printf '^[0-9]\{8\}_[0-9]\{6\}$' | xxd -p)
ipfs_mask=$(printf '^Qm[a-zA-Z0-9]\{44\}$' | xxd -p)
text_mask=$(printf '^[a-zA-Z0-9_\-]\{1,128\}$' | xxd -p)
echo '
{
"datetime":"'$datetime_mask'",
"title": "'$text_mask'",
"filename": "'$text_mask'",
"ipfs": "'$ipfs_mask'",
"detach": "'$ipfs_mask'"
}' | jq
}
_ak_modules_news_read_latest_local_news(){
TEMP="$(_ak_make_temp_directory)"
cd $TEMP
if [ -z "$1" ]
then
_ak_zchain_crawl -l 1 | jq > aktempzblock
else
_ak_zchain_crawl -l 1 $1 | jq > aktempzblock
fi
curzblock="`cat aktempzblock | jq -r '.[].zblock'`"
curaction="`cat aktempzblock | jq -r '.[].action'`"
curmodule="`cat aktempzblock | jq -r '.[].module'`"
curdata="`cat aktempzblock | jq -r '.[].data'`"
curipfs="$(cat aktempzblock | jq -r ".[].$curdata" | jq -r ".ipfs")"
curprevious="`cat aktempzblock | jq -r '.[].previous'`"
if [ "$curmodule" == "news" ] && [ "$curaction" == "add" ]
then
gpgkey="$(cat aktempzblock | jq -r ".[].gpg")"
title="$(cat aktempzblock | jq -r ".[].$curdata" | jq -r ".title")"
echo "Found zblock: $curzblock"
echo "$title by $gpgkey"
_ak_ipfs_get $curipfs
$PAGER $curipfs
exit 0
else
_ak_modules_news_read_latest_local_news $curprevious
fi
rm -rf $TEMP
}