blob: e7c39d8752f97a9f3578d67e7cdfe7c836f14e1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/bin/bash
# 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
ak-enter -l 1 "$1" | jq '.[]' > tempz
arg="tempz"
( \
# Create HTML document
echo "<!DOCTYPE html>"
echo "<html>"
echo "<head>"
echo " <title>Arching Kaos Chain Data</title>"
echo "</head>"
echo "<body>"
# Iterate through each argument and parse data
# for arg in "$@"
if [ -f "$arg" ]
then
#do
# 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 " <h1>ZBLOCK: $zblock</h1>"
echo " <p>BLOCK SIGNATURE: $block_signature</p>"
echo " <pre>$(ak-ipfs-cat $zblock | jq)</pre>"
echo " <h2>BLOCK: $block</h2>"
echo " <pre>$(ak-ipfs-cat $block | jq)</pre>"
echo " <p>TIMESTAMP: $timestamp</p>"
echo " <p>DETACH: $detach</p>"
echo " <pre>$(ak-ipfs-cat $detach)</pre>"
echo " <p>MODULE: $module</p>"
echo " <p>ACTION: $action</p>"
echo " <p>GPG: $gpg</p>"
echo " <pre>$(ak-ipfs-cat $gpg)</pre>"
echo " <p>PREVIOUS: $previous</p>"
echo " <h3>DATA: $data</h3>"
echo " <pre>$datablock</pre>"
echo " <p>ipfs: $(echo $datablock | jq -r '.ipfs')</p>"
echo " <p>detach: $(echo $datablock | jq -r '.detach')</p>"
echo " <pre>$(ak-ipfs-cat $(echo $datablock | jq -r '.detach'))</pre>"
echo " <h2>Rendered ZBLOCK</h2>"
echo " <pre>$(cat $arg | jq)</pre>"
fi
#done
echo "</body>"
echo "</html>" ) > zblock-$1.html
rm tempz
|