${mediakey}

This commit is contained in:
qo-op 2021-06-17 22:38:04 +02:00
parent ba4734a23e
commit bbf8c3a14b
1 changed files with 28 additions and 28 deletions

View File

@ -63,22 +63,22 @@ count=0
[[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/KEY/ ]] && exit 0
## TAKE CARE OF MY KEY
for id in $(ls ~/.zen/ipfs/.${IPFSNODEID}/KEY/); # Alternative search
for mediakey in $(ls ~/.zen/ipfs/.${IPFSNODEID}/KEY/); # Alternative search
do
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)
IPNSLINK=$(ipfs key list -l | grep ${mediakey} | cut -d ' ' -f 1)
FILE_NAME=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.ipfs.filename)
TITLE=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.title)
source=$(echo $id | cut -d '_' -f 1)
ANNONCE=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.gchange.ad)
ANNONCE=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.gchange.ad)
## 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/${id}_filelink.txt"
# file=$(cat /tmp/${id}_filelink.txt | rev | cut -d '/' -f 1 | rev)
[[ -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.ipfs.filelink.natools.encrypt ]] && $MY_PATH/tools/natools.py decrypt -f pubsec -k "$HOME/.zen/secret.dunikey" -i "$HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.ipfs.filelink.natools.encrypt" -o "/tmp/${mediakey}_filelink.txt"
# file=$(cat /tmp/${mediakey}_filelink.txt | rev | cut -d '/' -f 1 | rev)
TUBELINK="https://tube.copylaradio.com$(cat /tmp/${id}_filelink.txt)"
LOCALTUBELINK="http://127.0.0.1:8181$(cat /tmp/${id}_filelink.txt)"
TUBELINK="https://tube.copylaradio.com$(cat /tmp/${mediakey}_filelink.txt)"
LOCALTUBELINK="http://127.0.0.1:8181$(cat /tmp/${mediakey}_filelink.txt)"
MIMETYPE="video/${LOCALTUBELINK##*.}"
[[ "$MIMETYPE" == "video/avi" ]] && MIMETYPE="video/x-msvideo"
@ -106,10 +106,10 @@ do
</article>
</main>
<center><br>Démonstration du service Video Club du Datacenter P2P Libre et Légal.<br>
<br>Les dons au portefeuille du Media (${id}) rapportent à son Auteur, et payent son hébergement.
<br>Les dons au portefeuille du Media (${mediakey}) rapportent à son Auteur, et payent son hébergement.
<br><a target='tube' href=\"https://www.gchange.fr/#/app/user/${G1PUB}/\"><img width=222 src=\"https://tube.copylaradio.com/ipns/$IPNSLINK/QR.png\"></a></center>
</body>
</html>" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/index.html
</html>" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/index.html
########################################################################
### Scenario are G1PUB subdivized. Thus each friend can establish own contract
@ -117,12 +117,12 @@ do
########################################################################
## Write KEY id (provide verification)
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.id ]] && echo ${id} > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.id
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.id ]] && echo ${mediakey} > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.id
## THIS MAKES FRENCH COPY RIGHT LAW RESPECT
## LOCALHOST REDIRECT FOR INTERNAL KODI DEFCON 3 (swarm.key) ASTROPORT STATION MODE
# echo "<meta charset=\"UTF-8\"><meta http-equiv=\"Refresh\" content=\"0;URL=http://127.0.0.1:8181$(cat /tmp/${id}_filelink.txt)\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/index.html
# echo "<meta charset=\"UTF-8\"><meta http-equiv=\"Refresh\" content=\"0;URL=https://tube.copylaradio.com$(cat /tmp/${id}_filelink.txt)\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/index.html
# echo "<meta charset=\"UTF-8\"><meta http-equiv=\"Refresh\" content=\"0;URL=http://127.0.0.1:8181$(cat /tmp/${mediakey}_filelink.txt)\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/index.html
# echo "<meta charset=\"UTF-8\"><meta http-equiv=\"Refresh\" content=\"0;URL=https://tube.copylaradio.com$(cat /tmp/${mediakey}_filelink.txt)\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/index.html
## DEMO PERIOD
## NICE FINAL STREAMING PAGE
@ -147,33 +147,33 @@ do
</article>
</main>
<center><br>Ce fichier possède un G1 portefeuille qui lui permet de payer son hébergement ( 0.5 G1 /bootstrap / jour ).
<br>Faire un don permet de conserver le fichier (${id}) en ligne mais aussi de récompenser son Auteur!<br>
<br>Faire un don permet de conserver le fichier (${mediakey}) en ligne mais aussi de récompenser son Auteur!<br>
<br>
<br><img width=222 src=\"https://tube.copylaradio.com/ipns/$IPNSLINK/QR.png\"></center>
</body>
</html>" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/index.html
</html>" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/index.html
if [[ "$source" == "YOUTUBE" ]]
then
echo "$source"
# 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
# echo "<meta http-equiv=\"Refresh\" content=\"0;URL=https://tube.copylaradio.com/ipns/$IPNSLINK/${G1PUB}/go\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/index.html
# TODO 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/
# Testez vos application à même la blockchain en la copiant dans ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/go/
# Proposez de l'ajouter au dépot des applications web2.0 dans ../www/
########################################################################
# EXAMPLE TO ACTIVATE SECURITY : FORCE SIGNATURE VERIFICATION for each sensible file
########################################################################
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
echo "~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.views.counter"
if [[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.views.counter.sign ]]; then
echo "0" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.views.counter
$MY_PATH/tools/natools.py sign -f pubsec -k "$HOME/.zen/secret.dunikey" -i ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.views.counter -o ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.views.counter.sign
fi
$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"
$MY_PATH/tools/natools.py verify -p "${G1PUB}" -i "$HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${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 (Mediakey collision)...
# Message are sent to warn friends they have to manualy validate data conflict and merge back their mutual chain.
@ -182,17 +182,17 @@ do
## CHAIN & IPNS REFRESH
########################################################################
# ipfs nanochain progression
I=$(ipfs add -qrH ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/ | tail -n 1)
I=$(ipfs add -qrH ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/ | tail -n 1)
OLDCHAIN=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/.chain)
OLDCHAIN=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/.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
echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/.timestamp
echo $I > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/.chain
fi
# KEY ZenTag IPNS name publish
J=$(ipfs name publish -k ${id} --quieter /ipfs/${I})
J=$(ipfs name publish -k ${mediakey} --quieter /ipfs/${I})
echo "$id REFRESHED https://tube.copylaradio.com/ipns/$J"
########################################################################