IPNS MEDIAKEY refresh

This commit is contained in:
qo-op 2021-03-31 01:19:41 +02:00
parent e33ede08b7
commit d78bde1319
1 changed files with 32 additions and 25 deletions

View File

@ -41,17 +41,22 @@ echo "
( I | P | N | S )
\_/ \_/ \_/ \_/
ZENTAG KEY REFRESH
ZENTAG MEDIAKEY REFRESH
MyCODE = $MyCODE
"
echo "I am /ipns/$IPFSNODEID controling and refreshing my KEY ZenTag"
echo "I am /ipns/$IPFSNODEID controling and refreshing my MEDIAKEY IPNS"
########################################################################
# REFRESH IPNS SELF PUBLISH
########################################################################
~/.zen/astrXbian/zen/ipns_self_publish.sh
########################################################################
count=0
[[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/KEY/ ]] && exit 0
for id in $(ls ~/.zen/ipfs/.${IPFSNODEID}/KEY/); # Alternative search
do
count=$((count+1))
count=$((count+1)) && echo "$count) "
IPNSLINK=$(ipfs key list -l | grep ${id} | cut -d ' ' -f 1)
FILE_NAME=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.ipfs.filename)
TITLE=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.title)
@ -71,51 +76,53 @@ Installez <a href='https://copylaradio.com'>astrXbian</a> pour rejoindre notre v
# ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/index.html
########################################################################
# FRANCE COPIE PRIVEE - clear ipfs link no tracking
echo "<meta http-equiv=\"Refresh\" content=\"0;URL=http://localhost:8181/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/index.html
if [[ "$source" == "YOUTUBE" ]]
then
# mutiTUBE - activate .views.counter
echo "<meta http-equiv=\"Refresh\" content=\"0;URL=https://tube.copylaradio.com/ipns/$IPNSLINK/${G1PUB}/go/\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/index.html
# go/index.php from nginx proxy acting act as gateway (= Easy Round robin DNS tube.copylaradio.com is dynamic IP swap swarm nodes from node performance...)
fi
# ln -s /$HOME/.zen/astrXbian/www /var/www/astrxbian
# Testez vos application à même la blockchain en la copiant dans ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/go/
# Proposez de l'ajouter au dépot des applications web2.0 dans ../www/
## Write KEY id (provide verification)
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.id ]] && echo ${id} > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.id
## CRYPTO EXAMPLE, use natools to decrypt (could also verify signature)
[[ -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.ipfs.filelink.natools.encrypt ]] && $MY_PATH/tools/natools.py decrypt -f pubsec -k "$HOME/.zen/secret.dunikey" -i "$HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.ipfs.filelink.natools.encrypt" -o "/tmp/filelink.txt" && cat /tmp/filelink.txt && rm /tmp/filelink.txt
[[ -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.ipfs.filelink.natools.encrypt ]] && $MY_PATH/tools/natools.py decrypt -f pubsec -k "$HOME/.zen/secret.dunikey" -i "$HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.ipfs.filelink.natools.encrypt" -o "/tmp/${id}_filelink.txt"
cat /tmp/${id}_filelink.txt
echo "<meta http-equiv=\"Refresh\" content=\"0;URL=http://localhost:8181$(cat /tmp/${id}_filelink.txt)\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/index.html
# ipfs nanochain progression
I=$(ipfs add -qrH ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/ | tail -n 1)
OLDCHAIN=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/.chain)
if [[ "$OLDCHAIN" != "$I" ]] # MODIFY CHAIN only if something was changed
if [[ "$source" == "YOUTUBE" ]]
then
echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/.timestamp
echo $I > ~/.zen/ipfs/.${IPFSNODEID}/KEY/.chain
# mutiTUBE - activate .views.counter
echo "<meta http-equiv=\"Refresh\" content=\"0;URL=https://tube.copylaradio.com/ipns/$IPNSLINK/${G1PUB}/go/\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/index.html
# go/index.php from nginx proxy acting act as gateway (= Easy Round robin DNS tube.copylaradio.com is dynamic IP swap swarm nodes from node performance...)
fi
# ln -s /$HOME/.zen/astrXbian/www /var/www/astrxbian
# Testez vos application à même la blockchain en la copiant dans ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/go/
# Proposez de l'ajouter au dépot des applications web2.0 dans ../www/
echo "~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter"
if [[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter.sign ]]; then
echo "0" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter
$MY_PATH/tools/natools.py sign -f pubsec -k "$HOME/.zen/secret.dunikey" -i ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter -o ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter.sign
fi
# ACTIVATE SECURITY : FORCE SIGNATURE VERIFICATION for each sensible file
$MY_PATH/tools/natools.py verify -p "${G1PUB}" -i "$HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter.sign" -o "/tmp/verified_msg" && echo "c'est bon" || echo "c'est pas bon"
# Each time a station modify .views.counter it signs, log and timestamp then publish new IPNS to swarm.
# If a "faulty" blockchain appears (fork)...
# Message are sent to warn friends they have to manualy validate data conflict and merge back their mutual chain.
# ipfs nanochain progression
I=$(ipfs add -qrH ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/ | tail -n 1)
OLDCHAIN=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/.chain)
if [[ "$OLDCHAIN" != "$I" ]] # MODIFY CHAIN only if something was changed
then
echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/.timestamp
echo $I > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/.chain
fi
# KEY ZenTag IPNS name publish
J=$(ipfs name publish -k ${id} --quieter /ipfs/${I})
echo "$count) $id REFRESHED https://aries.copylaradio.com/ipns/$J"
echo "$id REFRESHED https://aries.copylaradio.com/ipns/$J"
done
# ACTIVATION MONNAIES LIBRES EQUIBIBREES
# echo "Ajouter une ML en relatif DU :
# DU(t+1)=(DU+c²)/r