forked from STI/Astroport.ONE
G1${CAT} & mime-type
This commit is contained in:
parent
0009297bf7
commit
fa529b89a3
2
12345.sh
2
12345.sh
|
@ -282,7 +282,7 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
|
|||
if [[ ! -s ~/.zen/tmp/${IPFSNODEID}/${ASTRONAUTENS}/${APPNAME}/${MOATS}.data.${WHAT} ]]; then
|
||||
|
||||
echo "IPFS TIMEOUT >>> (°▃▃°) $DATAID STILL MISSING GATEWAY BANGING FOR IT (°▃▃°)"
|
||||
array=(https://ipns.co/:hash https://dweb.link/ipfs/:hash https://ipfs.yt/ipfs/:hash https://ipfs.io/ipfs/:hash https://ipfs.fleek.co/ipfs/:hash https://ipfs.best-practice.se/ipfs/:hash https://gateway.pinata.cloud/ipfs/:hash https://gateway.ipfs.io/ipfs/:hash https://cf-ipfs.com/ipfs/:hash https://cloudflare-ipfs.com/ipfs/:hash)
|
||||
array=(https://tube.copylaradio.com/ipfs/:hash https://ipns.co/:hash https://dweb.link/ipfs/:hash https://ipfs.yt/ipfs/:hash https://ipfs.io/ipfs/:hash https://ipfs.fleek.co/ipfs/:hash https://ipfs.best-practice.se/ipfs/:hash https://gateway.pinata.cloud/ipfs/:hash https://gateway.ipfs.io/ipfs/:hash https://cf-ipfs.com/ipfs/:hash https://cloudflare-ipfs.com/ipfs/:hash)
|
||||
# size=${#array[@]}; index=$(($RANDOM % $size)); echo ${array[$index]} ## TODO CHOOSE RANDOM
|
||||
|
||||
# official ipfs best gateway from https://luke.lol/ipfs.php
|
||||
|
|
|
@ -185,6 +185,7 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPE
|
|||
echo "## Creation json tiddler : Qr${PEPPER} /ipfs/${IVOEU}"
|
||||
echo '[
|
||||
{
|
||||
"created": "'${MOATS}'",
|
||||
"title": "'${PEPPER}'",
|
||||
"type": "'text/vnd.tiddlywiki'",
|
||||
"astronautens": "'/ipns/$ASTRONAUTENS'",
|
||||
|
@ -244,9 +245,9 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPE
|
|||
echo $MOATS > ~/.zen/game/world/$WISHKEY/.moats
|
||||
|
||||
echo
|
||||
echo "Astronaute TW : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||
echo "Astronaute TW : http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||
echo "Nouveau G1Voeu : $PEPPER (document de contrôle de copie Ŋ1)"
|
||||
echo "TW $PEPPER : http://127.0.0.1:8080/ipns/$VOEUNS"
|
||||
echo "TW $PEPPER : http://$myIP:8080/ipns/$VOEUNS"
|
||||
|
||||
echo "## TO RECEIVE G1RONDS Creating Cesium+ Profil #### timeout long ... patience ...."
|
||||
$MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/tmp/qrtw.dunikey -n "https://g1.data.presles.fr" set --name "G1Voeu $PEPPER" --avatar "/home/$USER/.zen/Astroport.ONE/images/logojune.jpg" --site "https://astroport.com/ipns/$VOEUNS" #CESIUM+
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
for bootnode in $(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#");
|
||||
do
|
||||
ipfsnodeid=${bootnode##*/}
|
||||
|
@ -6,3 +8,10 @@ for bootnode in $(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#");
|
|||
|| echo "BAD NODE $bootnode"
|
||||
done
|
||||
|
||||
|
||||
for friendnode in $(cat ~/.zen/game/players/.current/FRIENDS/*/.astronautens);
|
||||
do
|
||||
ipfs ping -n 3 $friendnode
|
||||
[ $? = 0 ] && ipfs swarm connect $friendnode \
|
||||
|| echo "UNCONNECTED $friendnode"
|
||||
done
|
||||
|
|
|
@ -45,8 +45,8 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
|||
|
||||
## GLOBAL
|
||||
## GETTING LAST TW via IPFS or HTTP GW
|
||||
[[ $YOU ]] && echo "http://$myIP:8080/ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 6s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/TW/index.html
|
||||
[[ ! -s ~/.zen/tmp/TW/index.html ]] && echo "$LIBRA/ipns/${ASTRONAUTENS}" && curl -m 6 -so ~/.zen/tmp/TW/index.html "$LIBRA/ipns/${ASTRONAUTENS}"
|
||||
[[ $YOU ]] && echo "http://$myIP:8080/ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 12s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/TW/index.html
|
||||
[[ ! -s ~/.zen/tmp/TW/index.html ]] && echo "$LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/tmp/TW/index.html "$LIBRA/ipns/${ASTRONAUTENS}"
|
||||
|
||||
if [ ! -s ~/.zen/tmp/TW/index.html ]; then
|
||||
rm -f ~/.zen/tmp/TW/index.html
|
||||
|
@ -61,6 +61,7 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
|||
echo "TW OFFICIAL GATEWAY : http://$OLDIP:8080//ipns/${ASTRONAUTENS}"
|
||||
if [[ ! -d ~/.zen/game/players/$PLAYER/ipfs/moa ]]; then
|
||||
echo "UPDATE $PLAYER LOCAL COPY ~/.zen/game/players/$PLAYER/ipfs/moa"
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/moa
|
||||
[[ "$myIP" == "$OLDIP" ]] && cp ~/.zen/tmp/TW/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/
|
||||
fi
|
||||
# DO NOT CONTINUE
|
||||
|
|
|
@ -55,6 +55,7 @@ TITLE="${file%.*}"
|
|||
|
||||
# .part file false flag correcting (inotify mode)
|
||||
[[ ! -f "${path}${file}" ]] && file="${TITLE%.*}" && extension="${TITLE##*.}" && [[ ! -f "${path}${file}" ]] && er="NO FILE" && echo "$er" && exit 1
|
||||
MIME=$(file --mime-type -b "${path}${file}")
|
||||
|
||||
# GET PLAYER
|
||||
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null);
|
||||
|
@ -67,9 +68,8 @@ mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}
|
|||
TYPE=$(echo "$path" | cut -d '/' -f 5 ) # ex: /home/$YOU/astroport/... TYPE(film, youtube, mp3, video, page)/ REFERENCE /
|
||||
CAT=$(echo "$TYPE" | awk '{ print tolower($0) }')
|
||||
|
||||
echo $CAT
|
||||
PREFIX=$(echo "$TYPE" | head -c 1 | awk '{ print toupper($0) }' ) # ex: F, Y, M ou Y (all the alaphabet can address a data type
|
||||
|
||||
PREFIX=$(echo "$TYPE" | head -c 1 | awk '{ print toupper($0) }' ) # ex: F, Y, M ou Y
|
||||
# File is placed in ROOT ~/astroport ?
|
||||
if [[ $PREFIX == "" ]]
|
||||
then
|
||||
|
@ -125,17 +125,21 @@ case ${CAT} in
|
|||
esac
|
||||
|
||||
MEDIAKEY="${INDEXPREFIX}${REFERENCE}"
|
||||
echo ">>>>>>>>>> $MEDIAKEY ($MIME) <<<<<<<<<<<<<<<"
|
||||
|
||||
########################################################################
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/
|
||||
echo "ADDING ${path}${file} to IPFS and create ${PREFIX}ASTRXBIAN INDEX"
|
||||
echo "ADDING ${path}${file} to IPFS "
|
||||
echo "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN"
|
||||
echo "-----------------------------------------------------------------"
|
||||
|
||||
### IPFS ADD
|
||||
###########################################################
|
||||
IPFS=$(ipfs add -wq "${path}${file}")
|
||||
IPFSREPFILEID=$(echo $IPFS | cut -d ' ' -f 2)
|
||||
IPFSID=$(echo $IPFS | cut -d ' ' -f 1)
|
||||
[[ $IPFSREPFILEID == "" ]] && echo "ipfs add ERROR" && exit 1
|
||||
###########################################################
|
||||
|
||||
echo "FOUND : ${path}${file}"
|
||||
FILE_BSIZE=$(du -b "${path}${file}" | awk '{print $1}')
|
||||
|
@ -149,224 +153,223 @@ echo "New $TYPE INDEX ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/astroport/
|
|||
|
||||
URLENCODE_FILE_NAME=$(echo ${file} | jq -Rr @uri)
|
||||
|
||||
### MEDIAKEY FORGE
|
||||
########################################################################
|
||||
## CREATE NEW ipns KEY : ${MEDIAKEY}
|
||||
########################################################################
|
||||
## IPFS SELF IPNS DATA STORAGE
|
||||
## ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
|
||||
########################################################################
|
||||
if [[ ! $(ipfs key list | grep -w "${MEDIAKEY}") ]]; then
|
||||
echo "CREATING NEW IPNS $MEDIAKEY"
|
||||
## IPNS KEY CREATION ?
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}
|
||||
KEY=$(ipfs key gen "${MEDIAKEY}")
|
||||
# KEYFILE=$(ls -t ~/.ipfs/keystore/ | head -n 1) # get name of last created key (could be fooled during stargate exchange)
|
||||
KEYFILE=$(~/.zen/Astroport.ONE/tools/give_me_keystore_filename.py "${MEDIAKEY}") # better method applied
|
||||
fi
|
||||
#~ ### MEDIAKEY FORGE
|
||||
#~ ########################################################################
|
||||
#~ ## CREATE NEW ipns KEY : ${MEDIAKEY}
|
||||
#~ ########################################################################
|
||||
#~ ## IPFS SELF IPNS DATA STORAGE
|
||||
#~ ## ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
|
||||
#~ ########################################################################
|
||||
#~ if [[ ! $(ipfs key list | grep -w "${MEDIAKEY}") ]]; then
|
||||
#~ echo "CREATING NEW IPNS $MEDIAKEY"
|
||||
#~ ## IPNS KEY CREATION ?
|
||||
#~ mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}
|
||||
#~ KEY=$(ipfs key gen "${MEDIAKEY}")
|
||||
#~ # KEYFILE=$(ls -t ~/.ipfs/keystore/ | head -n 1) # get name of last created key (could be fooled during stargate exchange)
|
||||
#~ KEYFILE=$(~/.zen/Astroport.ONE/tools/give_me_keystore_filename.py "${MEDIAKEY}") # better method applied
|
||||
#~ fi
|
||||
|
||||
## IS IT NEW IPNS KEY?
|
||||
if [[ $KEY ]]; then
|
||||
# memorize IPNS key filename for easiest exchange
|
||||
echo "$KEYFILE" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.key.keystore_filename
|
||||
# Publishing IPNS key
|
||||
echo "$KEY" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.link
|
||||
# CREATE .zen = ZEN economic value counter
|
||||
touch ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.zen
|
||||
# CREATE other encrypted copies for friends depending DEFCON & stars
|
||||
# > STARGATE 1 - 2 - 3 - 4 - 5 !!
|
||||
################ ENCRYPT keystore/$KEYFILE
|
||||
else
|
||||
KEY=$(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.link)
|
||||
KEYFILE=$(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.key.keystore_filename)
|
||||
echo "## ALREADY EXISTING IPNS KEY $KEYFILE ($KEY)"
|
||||
fi
|
||||
#~ ## IS IT NEW IPNS KEY?
|
||||
#~ if [[ $KEY ]]; then
|
||||
#~ # memorize IPNS key filename for easiest exchange
|
||||
#~ echo "$KEYFILE" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.key.keystore_filename
|
||||
#~ # Publishing IPNS key
|
||||
#~ echo "$KEY" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.link
|
||||
#~ # CREATE .zen = ZEN economic value counter
|
||||
#~ touch ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.zen
|
||||
#~ # CREATE other encrypted copies for friends depending DEFCON & stars
|
||||
#~ # > STARGATE 1 - 2 - 3 - 4 - 5 !!
|
||||
#~ ################ ENCRYPT keystore/$KEYFILE
|
||||
#~ else
|
||||
#~ KEY=$(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.link)
|
||||
#~ KEYFILE=$(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.key.keystore_filename)
|
||||
#~ echo "## ALREADY EXISTING IPNS KEY $KEYFILE ($KEY)"
|
||||
#~ fi
|
||||
|
||||
[[ ! $KEY ]] && echo "FATAL ERROR" && exit 1
|
||||
########################################################################
|
||||
## add default metadata (TODO = use json file?)
|
||||
########################################################################
|
||||
FILE_BSIZE=$(du -b "${path}${file}" | awk '{print $1}')
|
||||
echo "${FILE_BSIZE}" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.filesize
|
||||
echo "${file}" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipfs.filename
|
||||
echo "${TITLE}" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.title
|
||||
echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.timestamp
|
||||
## INIT MEDIAKEY .views.counter
|
||||
echo "0" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.views.counter
|
||||
########################################################################
|
||||
#~ [[ ! $KEY ]] && echo "FATAL ERROR" && exit 1
|
||||
#~ ########################################################################
|
||||
#~ ## add default metadata (TODO = use json file?)
|
||||
#~ ########################################################################
|
||||
#~ echo "${FILE_BSIZE}" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.filesize
|
||||
#~ echo "${file}" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipfs.filename
|
||||
#~ echo "${TITLE}" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.title
|
||||
#~ echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.timestamp
|
||||
#~ ## INIT MEDIAKEY .views.counter
|
||||
#~ echo "0" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.views.counter
|
||||
#~ ########################################################################
|
||||
|
||||
########################################################################
|
||||
# Prepare IPFS links (then cyphered to manage exchange regulation)
|
||||
########################################################################
|
||||
echo "/ipfs/$IPFSREPFILEID/${file}" > ~/.zen/tmp/.ipfs.filelink
|
||||
echo "$IPFSID" > ~/.zen/tmp/.ipfsid
|
||||
########################################################################
|
||||
#~ ########################################################################
|
||||
#~ # Prepare IPFS links (then cyphered to manage exchange regulation)
|
||||
#~ ########################################################################
|
||||
#~ echo "/ipfs/$IPFSREPFILEID/${file}" > ~/.zen/tmp/.ipfs.filelink
|
||||
#~ echo "$IPFSID" > ~/.zen/tmp/.ipfsid
|
||||
#~ ########################################################################
|
||||
|
||||
########################################################################
|
||||
################ ask autoPIN to one shuffle A_boostrap_nodes
|
||||
########################################################################
|
||||
PINIPFSnode=$(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#" | shuf | tail -n 1)
|
||||
nodeid=${PINIPFSnode##*/}
|
||||
PINnode=$(~/.zen/Astroport.ONE/tools/ipfs_to_g1.py $nodeid)
|
||||
#~ ########################################################################
|
||||
#~ ################ ask autoPIN to one shuffle A_boostrap_nodes
|
||||
#~ ########################################################################
|
||||
#~ PINIPFSnode=$(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#" | shuf | tail -n 1)
|
||||
#~ nodeid=${PINIPFSnode##*/}
|
||||
#~ PINnode=$(~/.zen/Astroport.ONE/tools/ipfs_to_g1.py $nodeid)
|
||||
|
||||
echo "ASK AUTOPIN to $PINnode"
|
||||
## CREATE $PINnode IPFS communication directory
|
||||
if [[ ! -d ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode} && "$PINnode" != "$G1PUB" ]]; then
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}
|
||||
## ENCRYPT .ipfsid & .ipfs.filelink (THESE FILES ARE
|
||||
$MY_PATH/natools.py encrypt -p $PINnode -i ~/.zen/tmp/.ipfs.filelink -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfs.filelink.encrypt"
|
||||
$MY_PATH/natools.py encrypt -p $PINnode -i ~/.zen/tmp/.ipfsid -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfsid.encrypt"
|
||||
# .ipfsid.encrypt is searched by each Station running ./zen/tools/autoPINfriends.sh
|
||||
fi
|
||||
#~ echo "ASK AUTOPIN to $PINnode"
|
||||
#~ ## CREATE $PINnode IPFS communication directory
|
||||
#~ if [[ ! -d ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode} && "$PINnode" != "$G1PUB" ]]; then
|
||||
#~ mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}
|
||||
#~ ## ENCRYPT .ipfsid & .ipfs.filelink (THESE FILES ARE
|
||||
#~ $MY_PATH/natools.py encrypt -p $PINnode -i ~/.zen/tmp/.ipfs.filelink -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfs.filelink.encrypt"
|
||||
#~ $MY_PATH/natools.py encrypt -p $PINnode -i ~/.zen/tmp/.ipfsid -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfsid.encrypt"
|
||||
#~ # .ipfsid.encrypt is searched by each Station running ./zen/tools/autoPINfriends.sh
|
||||
#~ fi
|
||||
|
||||
## Ask PIN to myself
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}
|
||||
$MY_PATH/natools.py encrypt -p $G1PUB -i ~/.zen/tmp/.ipfs.filelink -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}/.ipfs.filelink.encrypt"
|
||||
$MY_PATH/natools.py encrypt -p $G1PUB -i ~/.zen/tmp/.ipfsid -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}/.ipfsid.encrypt"
|
||||
#~ ## Ask PIN to myself
|
||||
#~ mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}
|
||||
#~ $MY_PATH/natools.py encrypt -p $G1PUB -i ~/.zen/tmp/.ipfs.filelink -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}/.ipfs.filelink.encrypt"
|
||||
#~ $MY_PATH/natools.py encrypt -p $G1PUB -i ~/.zen/tmp/.ipfsid -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}/.ipfsid.encrypt"
|
||||
|
||||
|
||||
########################################################################
|
||||
## GREAT natools can convert IPNS MEDIAKEY into .dunikey file
|
||||
########################################################################
|
||||
# CREATING QRCODE
|
||||
$MY_PATH/natools.py privkey -f ipfs-keystore -k $HOME/.ipfs/keystore/$KEYFILE -F pubsec -o ~/.zen/tmp/${MEDIAKEY}.dunikey
|
||||
# PubFromDunikey=$(cat ~/.zen/tmp/${MEDIAKEY}.dunikey | grep "sec" | cut -d ' ' -f2 | base58 -d | tail -c+33 | base58) ## HOWTO EXTRACT PUBKEY FROM SECKEY
|
||||
PubFromDunikey=$(cat ~/.zen/tmp/${MEDIAKEY}.dunikey | grep "pub" | cut -d ' ' -f2)
|
||||
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/QR.png" "$PubFromDunikey"
|
||||
echo "$PubFromDunikey" > $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/MEDIAPUBKEY
|
||||
#~ ########################################################################
|
||||
#~ ## GREAT natools can convert IPNS MEDIAKEY into .dunikey file
|
||||
#~ ########################################################################
|
||||
#~ # CREATING QRCODE
|
||||
#~ $MY_PATH/natools.py privkey -f ipfs-keystore -k $HOME/.ipfs/keystore/$KEYFILE -F pubsec -o ~/.zen/tmp/${MEDIAKEY}.dunikey
|
||||
#~ # PubFromDunikey=$(cat ~/.zen/tmp/${MEDIAKEY}.dunikey | grep "sec" | cut -d ' ' -f2 | base58 -d | tail -c+33 | base58) ## HOWTO EXTRACT PUBKEY FROM SECKEY
|
||||
#~ PubFromDunikey=$(cat ~/.zen/tmp/${MEDIAKEY}.dunikey | grep "pub" | cut -d ' ' -f2)
|
||||
#~ qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/QR.png" "$PubFromDunikey"
|
||||
#~ echo "$PubFromDunikey" > $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/MEDIAPUBKEY
|
||||
|
||||
########################################################################
|
||||
## MEDIAKEY => DUNIKEY + PASS 6 DIGITS openssl protection
|
||||
########################################################################
|
||||
PASS=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-7) && echo "$PASS" > ~/.zen/tmp/${MEDIAKEY}.pass
|
||||
openssl enc -aes-256-cbc -salt -in ~/.zen/tmp/${MEDIAKEY}.dunikey -out "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/dunikey.enc" -k $PASS
|
||||
#~ ########################################################################
|
||||
#~ ## MEDIAKEY => DUNIKEY + PASS 6 DIGITS openssl protection
|
||||
#~ ########################################################################
|
||||
#~ PASS=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-7) && echo "$PASS" > ~/.zen/tmp/${MEDIAKEY}.pass
|
||||
#~ openssl enc -aes-256-cbc -salt -in ~/.zen/tmp/${MEDIAKEY}.dunikey -out "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/dunikey.enc" -k $PASS
|
||||
|
||||
## STATION & BOOTSTRAP ACCESS TO PASS
|
||||
$MY_PATH/natools.py encrypt -p $G1PUB -i ~/.zen/tmp/${MEDIAKEY}.pass -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.pass.encrypt
|
||||
$MY_PATH/natools.py encrypt -p $PINnode -i ~/.zen/tmp/${MEDIAKEY}.pass -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.pass.encrypt
|
||||
#~ ## STATION & BOOTSTRAP ACCESS TO PASS
|
||||
#~ $MY_PATH/natools.py encrypt -p $G1PUB -i ~/.zen/tmp/${MEDIAKEY}.pass -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.pass.encrypt
|
||||
#~ $MY_PATH/natools.py encrypt -p $PINnode -i ~/.zen/tmp/${MEDIAKEY}.pass -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.pass.encrypt
|
||||
|
||||
## DECODE MEDIAKEY.dunikey ##
|
||||
# ~/.zen/Astroport.ONE/tools/natools.py decrypt -f pubsec -k "$HOME/.zen/secret.dunikey" -i "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.pass.encrypt" -o "~/.zen/tmp/${MEDIAKEY}.pass"
|
||||
# openssl enc -aes-256-cbc -d -in "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/dunikey.enc" -out "~/.zen/tmp/${MEDIAKEY}.dunikey" -k $(cat "~/.zen/tmp/${MEDIAKEY}.pass")
|
||||
rm ~/.zen/tmp/${MEDIAKEY}.dunikey
|
||||
#~ ## DECODE MEDIAKEY.dunikey ##
|
||||
#~ # ~/.zen/Astroport.ONE/tools/natools.py decrypt -f pubsec -k "$HOME/.zen/secret.dunikey" -i "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.pass.encrypt" -o "~/.zen/tmp/${MEDIAKEY}.pass"
|
||||
#~ # openssl enc -aes-256-cbc -d -in "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/dunikey.enc" -out "~/.zen/tmp/${MEDIAKEY}.dunikey" -k $(cat "~/.zen/tmp/${MEDIAKEY}.pass")
|
||||
#~ rm ~/.zen/tmp/${MEDIAKEY}.dunikey
|
||||
|
||||
########################################################################
|
||||
## GET .ipfs/keystore file MAHE .ipns.mediakey.encrypt
|
||||
# used in ipns_TAG_refresh.sh & autoPINfriends.sh
|
||||
########################################################################
|
||||
$MY_PATH/natools.py encrypt -p $G1PUB -i $HOME/.ipfs/keystore/$KEYFILE -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.mediakey.encrypt
|
||||
$MY_PATH/natools.py encrypt -p $PINnode -i $HOME/.ipfs/keystore/$KEYFILE -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipns.mediakey.encrypt
|
||||
#~ ########################################################################
|
||||
#~ ## GET .ipfs/keystore file MAHE .ipns.mediakey.encrypt
|
||||
#~ # used in ipns_TAG_refresh.sh & autoPINfriends.sh (TODO RUN AGAIN?)
|
||||
#~ ########################################################################
|
||||
#~ $MY_PATH/natools.py encrypt -p $G1PUB -i $HOME/.ipfs/keystore/$KEYFILE -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.mediakey.encrypt
|
||||
#~ $MY_PATH/natools.py encrypt -p $PINnode -i $HOME/.ipfs/keystore/$KEYFILE -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipns.mediakey.encrypt
|
||||
|
||||
## Init zen, views counters & visitor
|
||||
echo "0" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.zen
|
||||
echo "0" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.views.counter
|
||||
echo "anonymous" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.visitor
|
||||
########################################################################
|
||||
# MEMORIZE my PIN
|
||||
mkdir -p ~/.zen/PIN/${IPFSREPFILEID}/
|
||||
touch ~/.zen/PIN/${IPFSREPFILEID}/${G1PUB}
|
||||
# echo "$(ipfs key list -l | grep ${MEDIAKEY} | cut -d ' ' -f 1)" > ~/.zen/PIN/${ipfsrepidfile}/IPNSLINK # NO!! CHOOSE TODO Would let PINing nodes change index.html///
|
||||
#~ ## Init zen, views counters & visitor
|
||||
#~ echo "0" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.zen
|
||||
#~ echo "0" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.views.counter
|
||||
#~ echo "anonymous" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.visitor
|
||||
#~ ########################################################################
|
||||
#~ # MEMORIZE my PIN
|
||||
#~ mkdir -p ~/.zen/PIN/${IPFSREPFILEID}/
|
||||
#~ touch ~/.zen/PIN/${IPFSREPFILEID}/${G1PUB}
|
||||
#~ # echo "$(ipfs key list -l | grep ${MEDIAKEY} | cut -d ' ' -f 1)" > ~/.zen/PIN/${ipfsrepidfile}/IPNSLINK # NO!! CHOOSE TODO Would let PINing nodes change index.html///
|
||||
|
||||
########################################################################
|
||||
## encrypt links for myself
|
||||
########################################################################
|
||||
$MY_PATH/natools.py encrypt -p ${G1PUB} -i ~/.zen/tmp/.ipfs.filelink -o ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipfs.filelink.natools.encrypt
|
||||
$MY_PATH/natools.py encrypt -p ${G1PUB} -i ~/.zen/tmp/.ipfsid -o ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipfsid.encrypt
|
||||
rm ~/.zen/tmp/.ipfs.filelink
|
||||
rm ~/.zen/tmp/.ipfsid
|
||||
########################################################################
|
||||
#~ ########################################################################
|
||||
#~ ## encrypt links for myself
|
||||
#~ ########################################################################
|
||||
#~ $MY_PATH/natools.py encrypt -p ${G1PUB} -i ~/.zen/tmp/.ipfs.filelink -o ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipfs.filelink.natools.encrypt
|
||||
#~ $MY_PATH/natools.py encrypt -p ${G1PUB} -i ~/.zen/tmp/.ipfsid -o ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipfsid.encrypt
|
||||
#~ rm ~/.zen/tmp/.ipfs.filelink
|
||||
#~ rm ~/.zen/tmp/.ipfsid
|
||||
#~ ########################################################################
|
||||
|
||||
########################################################################
|
||||
## ADD "ajouter_video.txt" and "video.json" will be SELF IPNS publish data
|
||||
## ENCRYPT TO STOP CLEAR DATA LEAKING
|
||||
[[ -f ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
|
||||
[[ -f ~/astroport/${TYPE}/${REFERENCE}/screen.png ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/screen.png ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
|
||||
[[ -f ~/astroport/${TYPE}/${REFERENCE}/youtube.png ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/youtube.png ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/screen.png
|
||||
[[ -f ~/astroport/${TYPE}/${REFERENCE}/video.json ]] &&\
|
||||
cp -f ~/astroport/${TYPE}/${REFERENCE}/video.json ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/ &&\
|
||||
cp -f ~/astroport/${TYPE}/${REFERENCE}/video.json ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/
|
||||
########################################################################
|
||||
#~ ########################################################################
|
||||
#~ ## ADD "ajouter_video.txt" and "video.json" will be SELF IPNS publish data
|
||||
#~ ## ENCRYPT TO STOP CLEAR DATA LEAKING
|
||||
#~ [[ -f ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
|
||||
#~ [[ -f ~/astroport/${TYPE}/${REFERENCE}/screen.png ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/screen.png ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
|
||||
#~ [[ -f ~/astroport/${TYPE}/${REFERENCE}/youtube.png ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/youtube.png ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/screen.png
|
||||
#~ [[ -f ~/astroport/${TYPE}/${REFERENCE}/video.json ]] &&\
|
||||
#~ cp -f ~/astroport/${TYPE}/${REFERENCE}/video.json ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/ &&\
|
||||
#~ cp -f ~/astroport/${TYPE}/${REFERENCE}/video.json ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/
|
||||
#~ ########################################################################
|
||||
|
||||
########################################################################
|
||||
## EXPLANATIONS
|
||||
########################################################################
|
||||
# What is being in ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/
|
||||
# is published on http://${myIP}:8080/ipns/$KEY/ AND ipfs ls /ipns/$KEY/
|
||||
########################################################################
|
||||
########################################################################
|
||||
# CONTRACTS, are small App (fulljs or jquery + nginx backend app server)
|
||||
# They must decrypt IPFS after succeeding a chalenge (, +/- n zen, ...)
|
||||
########################################################################
|
||||
# Contract App Examples (ipns_TAG_refresh.sh makes MEDIAKEY evolution)
|
||||
# Counting video views = +1 .views.counter => decrypt key
|
||||
# Balancing Zen wallets = -n form source = +n for destination => decrypt key
|
||||
########################################################################
|
||||
# Astroport/Gchange USE as public/private media copy friend of friends swarm
|
||||
# one star level (no encrypt)
|
||||
# index.html is presenting Astroport/Kodi service then redirect to
|
||||
# $G1PUB/index.html contains redirection to ipfs link
|
||||
## NEW RELEASE
|
||||
## Create TW5 index.html to give easy control access to MEDIAKEY and KEY owner
|
||||
########################################################################
|
||||
#~ ########################################################################
|
||||
#~ ## EXPLANATIONS
|
||||
#~ ########################################################################
|
||||
#~ # What is being in ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/
|
||||
#~ # is published on http://${myIP}:8080/ipns/$KEY/ AND ipfs ls /ipns/$KEY/
|
||||
#~ ########################################################################
|
||||
#~ ########################################################################
|
||||
#~ # CONTRACTS, are small App (fulljs or jquery + nginx backend app server)
|
||||
#~ # They must decrypt IPFS after succeeding a chalenge (, +/- n zen, ...)
|
||||
#~ ########################################################################
|
||||
#~ # Contract App Examples (ipns_TAG_refresh.sh makes MEDIAKEY evolution)
|
||||
#~ # Counting video views = +1 .views.counter => decrypt key
|
||||
#~ # Balancing Zen wallets = -n form source = +n for destination => decrypt key
|
||||
#~ ########################################################################
|
||||
#~ # Astroport/Gchange USE as public/private media copy friend of friends swarm
|
||||
#~ # one star level (no encrypt)
|
||||
#~ # index.html is presenting Astroport/Kodi service then redirect to
|
||||
#~ # $G1PUB/index.html contains redirection to ipfs link
|
||||
#~ ## NEW RELEASE
|
||||
#~ ## Create TW5 index.html to give easy control access to MEDIAKEY and KEY owner
|
||||
#~ ########################################################################
|
||||
|
||||
########################################################################
|
||||
## IPNS access to index.html
|
||||
## Level 1 (not crypted) -> Redirect to ipfs streaming link
|
||||
#~ ########################################################################
|
||||
#~ ## IPNS access to index.html
|
||||
#~ ## Level 1 (not crypted) -> Redirect to ipfs streaming link
|
||||
|
||||
IPNSLINK=$(ipfs key list -l | grep -w ${MEDIAKEY} | cut -d ' ' -f 1)
|
||||
## FIRST REDIRECT PAGE ${MEDIAKEY}/index.html
|
||||
# https://tube.copylaradio.com/ipns/$IPNSLINK
|
||||
#envsubst < ./www/boris/youtube_watch_step2.html > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
|
||||
#~ IPNSLINK=$(ipfs key list -l | grep -w ${MEDIAKEY} | cut -d ' ' -f 1)
|
||||
#~ ## FIRST REDIRECT PAGE ${MEDIAKEY}/index.html
|
||||
#~ # https://tube.copylaradio.com/ipns/$IPNSLINK
|
||||
#~ #envsubst < ./www/boris/youtube_watch_step2.html > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
|
||||
|
||||
echo "=======> Mediakey Welcome index.html "
|
||||
cat ~/.zen/Astroport.ONE/templates/boris/youtube_watch_step2.html \
|
||||
| sed "s/_IPNSLINK_/$IPNSLINK/g" \
|
||||
| sed "s/_IPFSNODEID_/$IPFSNODEID/g" \
|
||||
| sed "s/_PLAYER_/$PLAYER/g" \
|
||||
| sed "s/_G1PUB_/$G1PUB/g" \
|
||||
| sed "s/_TITLE_/$TITLE/g" \
|
||||
> ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
|
||||
#~ echo "=======> Mediakey Welcome index.html "
|
||||
#~ cat ~/.zen/Astroport.ONE/templates/boris/youtube_watch_step2.html \
|
||||
#~ | sed "s/_IPNSLINK_/$IPNSLINK/g" \
|
||||
#~ | sed "s/_IPFSNODEID_/$IPFSNODEID/g" \
|
||||
#~ | sed "s/_PLAYER_/$PLAYER/g" \
|
||||
#~ | sed "s/_G1PUB_/$G1PUB/g" \
|
||||
#~ | sed "s/_TITLE_/$TITLE/g" \
|
||||
#~ > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
|
||||
|
||||
## SECOND REDIRECT PAGE ${MEDIAKEY}/${G1PUB}/index.html
|
||||
# https://tube.copylaradio.com/ipns/$IPNSLINK/${G1PUB}/
|
||||
#~ ## SECOND REDIRECT PAGE ${MEDIAKEY}/${G1PUB}/index.html
|
||||
#~ # https://tube.copylaradio.com/ipns/$IPNSLINK/${G1PUB}/
|
||||
|
||||
# envsubst < ../www/boris/youtube_watch_step3.html > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
|
||||
echo "=======> Mediakey Contract index.html "
|
||||
cat ~/.zen/Astroport.ONE/templates/boris/youtube_watch_step3.html \
|
||||
| sed "s/_TITLE_/$TITLE/g" \
|
||||
| sed "s/_IPFSNODEID_/$IPFSNODEID/g" \
|
||||
| sed "s/_PLAYER_/$PLAYER/g" \
|
||||
| sed "s/_IPFSREPFILEID_/$IPFSREPFILEID/g" \
|
||||
| sed "s/_URLENCODE_FILE_NAME_/$URLENCODE_FILE_NAME/g" \
|
||||
> ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
|
||||
#~ # envsubst < ../www/boris/youtube_watch_step3.html > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
|
||||
#~ echo "=======> Mediakey Contract index.html "
|
||||
#~ cat ~/.zen/Astroport.ONE/templates/boris/youtube_watch_step3.html \
|
||||
#~ | sed "s/_TITLE_/$TITLE/g" \
|
||||
#~ | sed "s/_IPFSNODEID_/$IPFSNODEID/g" \
|
||||
#~ | sed "s/_PLAYER_/$PLAYER/g" \
|
||||
#~ | sed "s/_IPFSREPFILEID_/$IPFSREPFILEID/g" \
|
||||
#~ | sed "s/_URLENCODE_FILE_NAME_/$URLENCODE_FILE_NAME/g" \
|
||||
#~ > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
|
||||
|
||||
|
||||
# echo "<meta http-equiv=\"Refresh\" content=\"0;URL=http://${myIP}:8080/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME\">" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
|
||||
########################################################################
|
||||
## TODO ACTIVATE "./zen/ipns_TAG_refresh.sh" (SACEM & Netflix Buziness is HERE!! Add your crypto/contracts there)
|
||||
########################################################################
|
||||
#~ # echo "<meta http-equiv=\"Refresh\" content=\"0;URL=http://${myIP}:8080/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME\">" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
|
||||
#~ ########################################################################
|
||||
#~ ## TODO ACTIVATE "./zen/ipns_TAG_refresh.sh" (SACEM & Netflix Buziness is HERE!! Add your crypto/contracts there)
|
||||
#~ ########################################################################
|
||||
|
||||
########################################################################
|
||||
########################################################################
|
||||
## PUBLISH new IPNS
|
||||
########################################################################
|
||||
echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/.timestamp
|
||||
#~ ########################################################################
|
||||
#~ ########################################################################
|
||||
#~ ## PUBLISH new IPNS
|
||||
#~ ########################################################################
|
||||
#~ echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/.timestamp
|
||||
|
||||
echo "ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/"
|
||||
NEWIPFS=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ | tail -n 1 )
|
||||
[[ "$NEWIPFS" == "" ]] && echo "~~~ FAILURE ~~~ ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ | tail -n 1" && exit 1
|
||||
#~ echo "ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/"
|
||||
#~ NEWIPFS=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ | tail -n 1 )
|
||||
#~ [[ "$NEWIPFS" == "" ]] && echo "~~~ FAILURE ~~~ ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ | tail -n 1" && exit 1
|
||||
|
||||
## ADD CHAIN BLOCK ZERO (will be updated by ipns_TAG_refresh.sh)
|
||||
echo $NEWIPFS > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/.chain
|
||||
#~ ## ADD CHAIN BLOCK ZERO (will be updated by ipns_TAG_refresh.sh)
|
||||
#~ echo $NEWIPFS > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/.chain
|
||||
|
||||
echo "ipfs name publish --quieter --key=${MEDIAKEY} $NEWIPFS"
|
||||
ipfs name publish -t 720h --quieter --key="${MEDIAKEY}" $NEWIPFS &
|
||||
#~ echo "ipfs name publish --quieter --key=${MEDIAKEY} $NEWIPFS"
|
||||
#~ ipfs name publish -t 720h --quieter --key="${MEDIAKEY}" $NEWIPFS &
|
||||
|
||||
IPNS="$(ipfs key list -l | grep -w ${MEDIAKEY} | cut -f 1 -d ' ')"
|
||||
echo "${MEDIAKEY} : /ipns/$IPNS"
|
||||
#~ IPNS="$(ipfs key list -l | grep -w ${MEDIAKEY} | cut -f 1 -d ' ')"
|
||||
#~ echo "${MEDIAKEY} : /ipns/$IPNS"
|
||||
|
||||
########################################################################
|
||||
########################################################################
|
||||
#~ ########################################################################
|
||||
#~ ########################################################################
|
||||
|
||||
########################################################################
|
||||
# POST TRAITEMENTS
|
||||
|
@ -390,7 +393,6 @@ then
|
|||
# echo "Annonce gchange : $(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.gchange.ad)"
|
||||
#
|
||||
# fi
|
||||
|
||||
########################################################################
|
||||
# CREATION DU FICHIER ${PREFIX}ASTRXBIAN FILE : Add Header (TODO DEBUG Kodi Plugin !! )
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/
|
||||
|
@ -398,9 +400,9 @@ then
|
|||
&& echo "CAT;TMDB;YEAR;TITLE;SAISON;GENRES;GROUPES;RES;URLS=http://${myIP}:8080" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN
|
||||
|
||||
# ADD NEW LINE TO INDEX
|
||||
if [[ -f ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/ajouter_video.txt ]]
|
||||
if [[ -f ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt ]]
|
||||
then
|
||||
line=$(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/ajouter_video.txt | sed "s/_IPFSREPFILEID_/$IPFSREPFILEID/g" | sed "s/_IPNSKEY_/$IPNS/g" )
|
||||
line=$(cat ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt | sed "s/_IPFSREPFILEID_/$IPFSREPFILEID/g" | sed "s/_IPNSKEY_/$IPNS/g" )
|
||||
else
|
||||
FILE_RES=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "${path}${file}" | cut -d "x" -f 2)
|
||||
RES=${FILE_RES%?}0p
|
||||
|
@ -408,30 +410,30 @@ then
|
|||
fi
|
||||
echo "-------------------- UPDATE ${PREFIX}ASTRXBIAN INDEX -----------------------------"
|
||||
echo "$line"
|
||||
echo "$line" >> ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN
|
||||
echo "UPDATE IPNS ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ajouter_video.txt"
|
||||
echo "$line" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/ajouter_video.txt
|
||||
## UPDATE SOURCE ajouter_video.txt FILE
|
||||
cp -f ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/ajouter_video.txt ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt
|
||||
# echo "$line" >> ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN
|
||||
echo "UPDATE ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt"
|
||||
echo "$line" > ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt
|
||||
|
||||
########################################################################
|
||||
## TODO: ACTIVATE SUB DEFCON 4 MODE = encrypt/decrypt file in $G1DEST subdirectory
|
||||
########################################################################
|
||||
echo "----------------- REFRESH LOCAL KODI INDEX ----------------------"
|
||||
cat ~/.zen/game/players/$PLAYER/ipfs*/.*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | sort | uniq > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/${PREFIX}ASTRXBIAN
|
||||
# echo "----------------- REFRESH LOCAL KODI INDEX ----------------------"
|
||||
# cat ~/.zen/game/players/$PLAYER/ipfs*/.*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | sort | uniq > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/${PREFIX}ASTRXBIAN
|
||||
|
||||
|
||||
echo "----------------- PREPARING TIDDLER ----------------------"
|
||||
CAT=$(echo "$CAT" | sed -r 's/\<./\U&/g' | sed 's/ //g') # CapitalGluedWords
|
||||
|
||||
GENRE=$(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/ajouter_video.txt | cut -d ';' -f 6 | sed 's/|/ /g' | jq -r '@csv' | sed 's/ /_/g' | sed 's/,/ /g' | sed 's/\"//g' )
|
||||
GENRE=$(cat ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt | cut -d ';' -f 6 | sed 's/|/ /g' | jq -r '@csv' | sed 's/ /_/g' | sed 's/,/ /g' | sed 's/\"//g' )
|
||||
echo $GENRE
|
||||
|
||||
MIME=$(file --mime-type -b "$HOME/astroport/${TYPE}/${REFERENCE}/${file}")
|
||||
REAL=$MIME
|
||||
|
||||
## ASK FOR EXTRA METADATA
|
||||
OUTPUT=$(zenity --forms --width 480 --title="METADATA" --text="Ajouter des métadonnées" --separator=";" --add-entry="Sous-titre" --add-entry="tag(s)")
|
||||
DESCRIPTION=$(awk -F ';' '{print $1}' <<<$OUTPUT)
|
||||
HASHTAG=$(awk -F ';' '{print $2}' <<<$OUTPUT)
|
||||
OUTPUT=$(zenity --forms --width 480 --title="METADATA" --text="Metadonnées (séparateur espace)" --separator="~" --add-entry="Description" --add-entry="extra tag(s)")
|
||||
DESCRIPTION=$(awk -F '~' '{print $1}' <<<$OUTPUT)
|
||||
HASHTAG=$(awk -F '~' '{print $2}' <<<$OUTPUT)
|
||||
|
||||
## Add screenshot (TODO : Make it better. Check what to put; if used & usefull
|
||||
[[ -f $HOME/astroport/${TYPE}/${REFERENCE}/screen.png ]] && IPSCREEN=$(ipfs add -q "$HOME/astroport/${TYPE}/${REFERENCE}/screen.png" | tail -n 1)
|
||||
|
@ -445,17 +447,19 @@ then
|
|||
</video><h1>"${TITLE}"</h1>
|
||||
<h2>"$DESCRIPTION"</h2>
|
||||
<\$button class='tc-tiddlylink'>
|
||||
<\$list filter='[tag[${CAT}]]'>
|
||||
<\$list filter='[tag[G1${CAT}]]'>
|
||||
<\$action-navigate \$to=<<currentTiddler>> \$scroll=no/>
|
||||
</\$list>
|
||||
Afficher tous les ${CAT}
|
||||
Afficher tous les G1${CAT}
|
||||
</\$button>"
|
||||
MIME="text/vnd.tiddlywiki" ## MAYBE REAL ONCE TW CAN SHOW ATTACHED IPFS VIDEO (TODO: TESTINGS)
|
||||
TAGS="G1Films G1DessinsAnimes G1Series G1CopierYoutube ${CAT} ${PLAYER} $GENRE ipfs ${HASHTAG}"
|
||||
TAGS="G1${CAT} ${PLAYER} $GENRE ipfs ${HASHTAG}"
|
||||
# TYPE=$REAL
|
||||
# CANON="/ipfs/"${IPFSID}
|
||||
CANON=''
|
||||
else
|
||||
TEXT='${MEDIAKEY}'
|
||||
TAGS="'$:/isAttachment $:/isIpfs ${CAT} $GENRE"
|
||||
TAGS="'$:/isAttachment $:/isIpfs G1${CAT} $GENRE"
|
||||
CANON="/ipfs/"${IPFSID}
|
||||
fi
|
||||
|
||||
|
@ -465,6 +469,7 @@ then
|
|||
"text": "'${TEXT}'",
|
||||
"title": "'${TITLE}'",
|
||||
"created": "'${MOATS}'",
|
||||
"resolution": "'${RES}'",
|
||||
"type": "'${MIME}'",
|
||||
"mime": "'${REAL}'",
|
||||
"cat": "'${CAT}'",
|
||||
|
@ -488,7 +493,7 @@ then
|
|||
' >> ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json
|
||||
|
||||
echo "~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json copy into Station Balise"
|
||||
cp ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/tiddler.json
|
||||
# cp ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/tiddler.json
|
||||
|
||||
## TODO : Do we keep that ?
|
||||
# echo "SEND TW LINK to GCHANGE MESSAGE"
|
||||
|
@ -510,21 +515,11 @@ fi
|
|||
echo "$TEXT" | xclip -selection c
|
||||
|
||||
########################################################################
|
||||
# PUBLISH GENERAL video
|
||||
########################################################################
|
||||
if [[ "${CAT}" == "video" ]]
|
||||
then
|
||||
## REPLACE IPFS / IPNS REFERENCE IN video.json (Maybe cyphered later)
|
||||
cat ~/astroport/${CAT}/${MEDIAKEY}/video.json | sed "s/_IPFSREPFILEID_/$IPFSREPFILEID/g" | sed "s/_IPNSKEY_/$IPNS/g" >> ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN
|
||||
fi
|
||||
|
||||
########################################################################
|
||||
|
||||
########################################################################
|
||||
echo "DUNIKEY PASS $PASS"
|
||||
# echo "DUNIKEY PASS $PASS"
|
||||
echo "NEW $TYPE ($file) ADDED. http://${myIP}:8080/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME"
|
||||
echo "INDEX UPDATED : ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN"
|
||||
echo "VIDEO IPNS LINK : http://${myIP}:8080/ipns/$KEY/$G1PUB/ (MUST Activate 'G1VideoClub.sh' to publish & renew)"
|
||||
echo "VIDEO IPNS LINK : http://${myIP}:8080/ipns/$KEY/$G1PUB/ = Create 'G1${CAT}.sh' to adapt 20H12 Ŋ1 process"
|
||||
echo "#### EXCECUTION TIME"
|
||||
end=`date +%s`
|
||||
echo Execution time was `expr $end - $start` seconds.
|
||||
|
|
Loading…
Reference in New Issue