empty url protection
This commit is contained in:
parent
8823cd08ba
commit
676d4be808
|
@ -46,12 +46,21 @@ randh=$((1 + RANDOM % 24))
|
||||||
|
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# MIDNIGHT:01
|
# MIDNIGHT:01 : ZENBOT CLEANING & UPDATE
|
||||||
if [[ "$timebar" == "00:01" ]]; then
|
if [[ "$timebar" == "00:01" ]]; then
|
||||||
|
# UPGRADE youtube-dl
|
||||||
youtube-dl --rm-cache-dir
|
youtube-dl --rm-cache-dir
|
||||||
youtube-dl -U
|
youtube-dl -U
|
||||||
|
|
||||||
|
# LOG ROTATE EVERY SUNDAY
|
||||||
[[ $jourdelasemaine == 0 ]] && mv -f /tmp/astroport.log ~/.zen/astroport.$numerosemaine.log # LOG BACKUP FOR 1 YEAR !!
|
[[ $jourdelasemaine == 0 ]] && mv -f /tmp/astroport.log ~/.zen/astroport.$numerosemaine.log # LOG BACKUP FOR 1 YEAR !!
|
||||||
|
|
||||||
|
# GIT PULL
|
||||||
cd $MY_PATH/../ && git pull && cd $MY_PATH # UPDATE CODE git pull
|
cd $MY_PATH/../ && git pull && cd $MY_PATH # UPDATE CODE git pull
|
||||||
|
|
||||||
|
# Clear 24h ssb_GET markers
|
||||||
|
rm ~/.zen/zenytv.last.ts
|
||||||
|
rm ~/.zen/zenyta.last.ts
|
||||||
fi
|
fi
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
|
|
|
@ -41,23 +41,23 @@ IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||||
[[ $DELAY == "" ]] && DELAY="60 days" && echo "*** HELP ***" && echo "./$ME \"duration\" (default $DELAY)" && echo "************" && echo
|
[[ $DELAY == "" ]] && DELAY="60 days" && echo "*** HELP ***" && echo "./$ME \"duration\" (default $DELAY)" && echo "************" && echo
|
||||||
DELAYUNIT=$(echo $DELAY | cut -d ' ' -f 2)
|
DELAYUNIT=$(echo $DELAY | cut -d ' ' -f 2)
|
||||||
|
|
||||||
# NODE_G1PUBKEY=$2 # DEBUG
|
# g1pub=$2 # DEBUG
|
||||||
if [[ $NODE_G1PUBKEY == "" ]]; then
|
if [[ $g1pub == "" ]]; then
|
||||||
if [[ -f ~/.ssb/secret ]]; then
|
if [[ -f ~/.ssb/secret ]]; then
|
||||||
ssbpub=$(cat ~/.ssb/secret | grep public\" | cut -d ' ' -f 4 | cut -d '.' -f 1 | sed s/\"//g)
|
ssbpub=$(cat ~/.ssb/secret | grep public\" | cut -d ' ' -f 4 | cut -d '.' -f 1 | sed s/\"//g)
|
||||||
ssbpriv=$(cat ~/.ssb/secret | grep private\" | cut -d ' ' -f 4 | cut -d '.' -f 1 | sed s/\"//g)
|
ssbpriv=$(cat ~/.ssb/secret | grep private\" | cut -d ' ' -f 4 | cut -d '.' -f 1 | sed s/\"//g)
|
||||||
NODE_G1PUBKEY=$(echo $ssbpub | base64 -d | base58)
|
g1pub=$(echo $ssbpub | base64 -d | base58)
|
||||||
NODE_G1PRIVKEY=$(echo $ssbpriv | base64 -d | base58)
|
g1priv=$(echo $ssbpriv | base64 -d | base58)
|
||||||
if [[ ! -f ~/.ssb/secret.dunikey ]]; then
|
if [[ ! -f ~/.ssb/secret.dunikey ]]; then
|
||||||
echo "pub: $NODE_G1PUBKEY" > ~/.ssb/secret.dunikey
|
echo "pub: $g1pub" > ~/.ssb/secret.dunikey
|
||||||
echo "sec: $NODE_G1PRIVKEY" >> ~/.ssb/secret.dunikey
|
echo "sec: $g1priv" >> ~/.ssb/secret.dunikey
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
NODE_G1PUBKEY=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||||
NODE_G1PRIVKEY=$(cat ~/.ssb/secret.dunikey | grep 'sec:' | cut -d ' ' -f 2)
|
g1priv=$(cat ~/.ssb/secret.dunikey | grep 'sec:' | cut -d ' ' -f 2)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
[[ "$NODE_G1PUBKEY" == "" ]] && echo "$USER Missing ~/.ssb/secret : Please Install Scuttlebutt server !" && exit 1;
|
[[ "$g1pub" == "" ]] && echo "$USER Missing ~/.ssb/secret : Please Install Scuttlebutt server !" && exit 1;
|
||||||
|
|
||||||
#########################################################################################################
|
#########################################################################################################
|
||||||
echo "======================================="
|
echo "======================================="
|
||||||
|
@ -67,7 +67,7 @@ echo "IPFS Node ID = $IPFSNODEID
|
||||||
(_| |(/_(_|< | \|(_)(_|(/_ \_| | \/\/(_|||(/_|_
|
(_| |(/_(_|< | \|(_)(_|(/_ \_| | \/\/(_|||(/_|_
|
||||||
last $DELAY
|
last $DELAY
|
||||||
|
|
||||||
G1 PUBKEY = $NODE_G1PUBKEY
|
G1 PUBKEY = $g1pub
|
||||||
SSB ID = %$ssbpub.ed25519
|
SSB ID = %$ssbpub.ed25519
|
||||||
|
|
||||||
"
|
"
|
||||||
|
@ -79,11 +79,11 @@ TIMESTAMP=$(date -u +"%s")
|
||||||
DUNITERNODE=$($MY_PATH/tools/duniter_getnode.sh)
|
DUNITERNODE=$($MY_PATH/tools/duniter_getnode.sh)
|
||||||
DUNITERURL="https://$DUNITERNODE"
|
DUNITERURL="https://$DUNITERNODE"
|
||||||
# GET BLOCKCHAIN TX FOR TIME WINDOW
|
# GET BLOCKCHAIN TX FOR TIME WINDOW
|
||||||
curl -s $DUNITERURL/tx/history/$NODE_G1PUBKEY/times/$TIMEBEFORE/$TIMESTAMP > /tmp/g1_TX.scan.txt
|
curl -s $DUNITERURL/tx/history/$g1pub/times/$TIMEBEFORE/$TIMESTAMP > /tmp/g1_TX.scan.txt
|
||||||
TXNB=$(cat /tmp/g1_TX.scan.txt | wc -l)
|
TXNB=$(cat /tmp/g1_TX.scan.txt | wc -l)
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
$DUNITERURL/tx/history/$NODE_G1PUBKEY/times/$TIMEBEFORE/$TIMESTAMP
|
$DUNITERURL/tx/history/$g1pub/times/$TIMEBEFORE/$TIMESTAMP
|
||||||
___
|
___
|
||||||
|\/ ._ ._ _ |_ _ ._
|
|\/ ._ ._ _ |_ _ ._
|
||||||
G1 |/\ | ||_|| | ||_)(/_|
|
G1 |/\ | ||_|| | ||_)(/_|
|
||||||
|
@ -106,13 +106,13 @@ if [[ $DELAYUNIT != "minutes" && $DELAYUNIT != "minute" ]]; then
|
||||||
if [[ ! -f ~/.zen/cache/g1_TX_inputs/zen.$TXhash ]]; then
|
if [[ ! -f ~/.zen/cache/g1_TX_inputs/zen.$TXhash ]]; then
|
||||||
# GET LAST TX ISSUER
|
# GET LAST TX ISSUER
|
||||||
ISSUER=$(cat /tmp/g1_TX.scan.txt | jq -r '.history.received[].issuers[0]' | head -n $line | tail -n 1)
|
ISSUER=$(cat /tmp/g1_TX.scan.txt | jq -r '.history.received[].issuers[0]' | head -n $line | tail -n 1)
|
||||||
[[ $ISSUER == $NODE_G1PUBKEY ]] && ((line++)) && continue ## TX/OUT CONTINUE
|
[[ $ISSUER == $g1pub ]] && ((line++)) && continue ## TX/OUT CONTINUE
|
||||||
echo $ISSUER > ~/.zen/cache/g1_TX_inputs/zen.$TXhash
|
echo $ISSUER > ~/.zen/cache/g1_TX_inputs/zen.$TXhash
|
||||||
# GET OUTPUTS AND MAKE ZEN=G1*100 SUM
|
# GET OUTPUTS AND MAKE ZEN=G1*100 SUM
|
||||||
ZEN=$(cat /tmp/g1_TX.scan.txt | jq -r '.history.received[].outputs[]' | grep $NODE_G1PUBKEY | head -n $line | tail -n 1 | cut -d ':' -f 1)
|
ZEN=$(cat /tmp/g1_TX.scan.txt | jq -r '.history.received[].outputs[]' | grep $g1pub | head -n $line | tail -n 1 | cut -d ':' -f 1)
|
||||||
# GET COMMENT
|
# GET COMMENT
|
||||||
COMMENT=$(cat /tmp/g1_TX.scan.txt | jq '.history.received' | jq -r '.[].comment' | head -n $line | tail -n 1)
|
COMMENT=$(cat /tmp/g1_TX.scan.txt | jq '.history.received' | jq -r '.[].comment' | head -n $line | tail -n 1)
|
||||||
# echo "TX-IN $ISSUER => $NODE_G1PUBKEY"
|
# echo "TX-IN $ISSUER => $g1pub"
|
||||||
echo "Received $ZEN Zen From $ISSUER :: $COMMENT :: ($TXhash)"
|
echo "Received $ZEN Zen From $ISSUER :: $COMMENT :: ($TXhash)"
|
||||||
CMD=$(echo "$COMMENT" | awk '{print toupper($1)}')
|
CMD=$(echo "$COMMENT" | awk '{print toupper($1)}')
|
||||||
|
|
||||||
|
@ -148,13 +148,13 @@ else
|
||||||
if [[ ! -f ~/.zen/cache/g1_TX_inputs/zen.$TXhash ]]; then
|
if [[ ! -f ~/.zen/cache/g1_TX_inputs/zen.$TXhash ]]; then
|
||||||
# GET LAST RX ISSUER
|
# GET LAST RX ISSUER
|
||||||
ISSUER=$(cat /tmp/g1_TX.scan.txt | jq -r '.history.pending[].issuers[0]' | head -n $line | tail -n 1)
|
ISSUER=$(cat /tmp/g1_TX.scan.txt | jq -r '.history.pending[].issuers[0]' | head -n $line | tail -n 1)
|
||||||
[[ $ISSUER == $NODE_G1PUBKEY ]] && ((line++)) && continue ## TX/OUT CONTINUE
|
[[ $ISSUER == $g1pub ]] && ((line++)) && continue ## TX/OUT CONTINUE
|
||||||
echo $ISSUER > ~/.zen/cache/g1_TX_inputs/zen.$TXhash
|
echo $ISSUER > ~/.zen/cache/g1_TX_inputs/zen.$TXhash
|
||||||
# GET OUTPUTS AND MAKE ZEN SUM
|
# GET OUTPUTS AND MAKE ZEN SUM
|
||||||
ZEN=$(cat /tmp/g1_TX.scan.txt | jq -r '.history.pending[].outputs[]' | grep $NODE_G1PUBKEY | head -n $line | tail -n 1 | cut -d ':' -f 1)
|
ZEN=$(cat /tmp/g1_TX.scan.txt | jq -r '.history.pending[].outputs[]' | grep $g1pub | head -n $line | tail -n 1 | cut -d ':' -f 1)
|
||||||
# GET COMMENT
|
# GET COMMENT
|
||||||
COMMENT=$(cat /tmp/g1_TX.scan.txt | jq '.history.pending' | jq -r '.[].comment' | head -n $line | tail -n 1)
|
COMMENT=$(cat /tmp/g1_TX.scan.txt | jq '.history.pending' | jq -r '.[].comment' | head -n $line | tail -n 1)
|
||||||
# echo "TX-IN $ISSUER => $NODE_G1PUBKEY"
|
# echo "TX-IN $ISSUER => $g1pub"
|
||||||
echo "Pending $ZEN Zen From $ISSUER :: $COMMENT :: ($TXhash)"
|
echo "Pending $ZEN Zen From $ISSUER :: $COMMENT :: ($TXhash)"
|
||||||
CMD=$(echo "$COMMENT" | awk '{print toupper($1)}')
|
CMD=$(echo "$COMMENT" | awk '{print toupper($1)}')
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ echo "FINISH !
|
||||||
|\ | _ _| _ /__/| \ /_.|| __|_ |_ _.| _.._ _ _
|
|\ | _ _| _ /__/| \ /_.|| __|_ |_ _.| _.._ _ _
|
||||||
| \|(_)(_|(/_ \_| | \/\/(_|||(/_|_ |_)(_||(_|| |(_(/_
|
| \|(_)(_|(/_ \_| | \/\/(_|||(/_|_ |_)(_||(_|| |(_(/_
|
||||||
|
|
||||||
silkaj -p $DUNITERNODE balance $NODE_G1PUBKEY
|
silkaj -p $DUNITERNODE balance $g1pub
|
||||||
|
|
||||||
"
|
"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -76,16 +76,14 @@ do
|
||||||
|
|
||||||
# YOUTUBE-DL AUDIO
|
# YOUTUBE-DL AUDIO
|
||||||
|
|
||||||
mkdir -p ~/.zen/miam/$timestamp
|
[[ $timestamp ]] && mkdir -p ~/.zen/miam/$timestamp
|
||||||
|
|
||||||
/usr/local/bin/youtube-dl -x --audio-format mp3 \
|
[[ $msg_ytdlurl ]] && /usr/local/bin/youtube-dl -x --audio-format mp3 \
|
||||||
--write-thumbnail --write-info-json --add-metadata --embed-thumbnail \
|
--write-thumbnail --write-info-json --add-metadata --embed-thumbnail \
|
||||||
--no-mtime -o "~/.zen/miam/$timestamp/%(id)s.%(ext)s" $msg_ytdlurl
|
--no-mtime -o "~/.zen/miam/$timestamp/%(id)s.%(ext)s" $msg_ytdlurl
|
||||||
|
|
||||||
# REFERENCE msg_key AND timestamp
|
# REFERENCE msg_key AND timestamp
|
||||||
echo "$timestamp" > ~/.zen/zenyta.last.ts
|
[[ $timestamp ]] && echo "$timestamp" > ~/.zen/zenyta.last.ts
|
||||||
echo "$msg_key" > ~/.zen/miam/$timestamp/msg_key
|
[[ $msg_key ]] && echo "$msg_key" > ~/.zen/miam/$timestamp/msg_key
|
||||||
|
|
||||||
# rm ~/.zen/zenyta.last.ts
|
|
||||||
|
|
||||||
done < <(printf '%s\n' "$messages")
|
done < <(printf '%s\n' "$messages")
|
||||||
|
|
|
@ -76,16 +76,14 @@ do
|
||||||
|
|
||||||
# YOUTUBE-DL VIDEO
|
# YOUTUBE-DL VIDEO
|
||||||
|
|
||||||
mkdir -p ~/.zen/miam/$timestamp
|
[[ $timestamp ]] && mkdir -p ~/.zen/miam/$timestamp
|
||||||
|
|
||||||
/usr/local/bin/youtube-dl -f '[height=720]/best' \
|
[[ $msg_ytdlurl ]] && /usr/local/bin/youtube-dl -f '[height=720]/best' \
|
||||||
--write-thumbnail --all-subs --write-info-json --write-annotations \
|
--write-thumbnail --all-subs --write-info-json --write-annotations \
|
||||||
--no-mtime -o "~/.zen/miam/$timestamp/%(id)s.%(ext)s" $msg_ytdlurl
|
--no-mtime -o "~/.zen/miam/$timestamp/%(id)s.%(ext)s" $msg_ytdlurl
|
||||||
|
|
||||||
# REFERENCE msg_key AND timestamp
|
# REFERENCE msg_key AND timestamp
|
||||||
echo "$timestamp" > ~/.zen/zenytv.last.ts
|
[[ $timestamp ]] && echo "$timestamp" > ~/.zen/zenytv.last.ts
|
||||||
echo "$msg_key" > ~/.zen/miam/$timestamp/msg_key
|
[[ $msg_key ]] && echo "$msg_key" > ~/.zen/miam/$timestamp/msg_key
|
||||||
|
|
||||||
# rm ~/.zen/zenytv.last.ts # DEBUG
|
|
||||||
|
|
||||||
done < <(printf '%s\n' "$messages")
|
done < <(printf '%s\n' "$messages")
|
||||||
|
|
|
@ -204,10 +204,10 @@ echo "
|
||||||
# SEARCH FOR SAME SOURCE in IPFS... Not to make it twice...
|
# SEARCH FOR SAME SOURCE in IPFS... Not to make it twice...
|
||||||
CHECKSWARM=$(grep -Rwl "$ZENSOURCE" ~/.zen/ipfs_swarm/.Qm*/TAG/*/_tag.zensource | tail -n 1 | cut -f 6 -d '/')
|
CHECKSWARM=$(grep -Rwl "$ZENSOURCE" ~/.zen/ipfs_swarm/.Qm*/TAG/*/_tag.zensource | tail -n 1 | cut -f 6 -d '/')
|
||||||
[[ $CHECKSWARM == "" ]] && CHECKSWARM=$(grep -Rwl "$ZENSOURCE" ~/.zen/ipfs/.$ipfsnodeid/TAG/*/_tag.zensource | tail -n 1 | cut -f 6 -d '/')
|
[[ $CHECKSWARM == "" ]] && CHECKSWARM=$(grep -Rwl "$ZENSOURCE" ~/.zen/ipfs/.$ipfsnodeid/TAG/*/_tag.zensource | tail -n 1 | cut -f 6 -d '/')
|
||||||
[[ -f ~/.zen/ipfs/.$ipfsnodeid/TAG/$ZENSOURCE/_tag.issuer ]] && ISSUERSWARM=$(cat ~/.zen/ipfs/.$ipfsnodeid/TAG/$ZENSOURCE/_tag.issuer)
|
[[ -s ~/.zen/ipfs/.$ipfsnodeid/TAG/$ZENSOURCE/_tag.issuer ]] && ISSUERSWARM=$(cat ~/.zen/ipfs/.$ipfsnodeid/TAG/$ZENSOURCE/_tag.issuer)
|
||||||
[[ "$CHECKSWARM" != "" && "$ISSUERSWARM" == "$ISSUER" ]] && rm ~/.ipfs/keystore/${AA}.key && rm -Rf ~/.zen/tag/${AAH} \
|
[[ "$CHECKSWARM" != "" && "$ISSUERSWARM" == "$ISSUER" ]] && rm ~/.ipfs/keystore/${AA}.key && rm -Rf ~/.zen/tag/${AAH} \
|
||||||
&& echo "$ZENSOURCE ALREADY COPIED IN IPFS SWARM. CANCEL" && exit 1
|
&& echo "$ZENSOURCE ALREADY COPIED IN IPFS SWARM. CANCEL" && exit 1
|
||||||
# NO DUPLICATE : OK
|
# NO DUPLICATE
|
||||||
|
|
||||||
# ADD PASSENGER TO IPFS
|
# ADD PASSENGER TO IPFS
|
||||||
IPASSENGER=$(ipfs add -q "$PASSENGER" -w | tail -n 1)
|
IPASSENGER=$(ipfs add -q "$PASSENGER" -w | tail -n 1)
|
||||||
|
@ -391,7 +391,7 @@ if [[ "${PASSENGERNAME}" != "" ]]; then
|
||||||
[![ssb_thumb.jpg](${id})](http://127.0.0.1:8080/ipfs/$IPASSENGER/$PASSENGERNAME)
|
[![ssb_thumb.jpg](${id})](http://127.0.0.1:8080/ipfs/$IPASSENGER/$PASSENGERNAME)
|
||||||
|
|
||||||
[:pig_nose:_IPFS_:pig_nose:](http://127.0.0.1:8080/ipfs/$IPASSENGER/$PASSENGERNAME)
|
[:pig_nose:_IPFS_:pig_nose:](http://127.0.0.1:8080/ipfs/$IPASSENGER/$PASSENGERNAME)
|
||||||
[${extractor}](https://youtu.be/${youtubeid}) ${duration} s by ${uploader_id}
|
miam:[${extractor}](https://youtu.be/${youtubeid}):${duration}:${uploader_id}
|
||||||
|
|
||||||
**ZEN=$ZEN($READ/$PARK)**
|
**ZEN=$ZEN($READ/$PARK)**
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue