hostname -f

This commit is contained in:
Yann Autissier 2022-12-29 13:51:05 +00:00
parent b1ee55d196
commit 7160c835fb
25 changed files with 316 additions and 271 deletions

View File

@ -95,7 +95,7 @@ while true; do
############### ############### ############### ############### templates/index.http ############### ############### ############### ############### templates/index.http
# REPLACE myHOST in http response template (fixing next API meeting point) # REPLACE myHOST in http response template (fixing next API meeting point)
echo "$HTTPCORS" > ~/.zen/tmp/coucou/${MOATS}.myHOST.http echo "$HTTPCORS" > ~/.zen/tmp/coucou/${MOATS}.myHOST.http
myTmpl >> ~/.zen/tmp/coucou/${MOATS}.myHOST.http myHtml >> ~/.zen/tmp/coucou/${MOATS}.myHOST.http
sed -i -e "s~\"${myIPFS}/\"~\"$(myIpfs)\"~g" \ sed -i -e "s~\"${myIPFS}/\"~\"$(myIpfs)\"~g" \
-e "s~http://${myHOST}:12345~http://${myHOST}:${PORT}~g" \ -e "s~http://${myHOST}:12345~http://${myHOST}:${PORT}~g" \
~/.zen/tmp/coucou/${MOATS}.myHOST.http ~/.zen/tmp/coucou/${MOATS}.myHOST.http
@ -196,7 +196,7 @@ while true; do
( ## SUB PROCESS ( ## SUB PROCESS
COINS=$($MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key balance) COINS=$($MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key balance)
echo "+++ WALLET BALANCE _ $COINS (G1) _" echo "+++ WALLET BALANCE _ $COINS (G1) _"
[[ $COINS == "" || $COINS == "null" ]] && $MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key -n "https://data.gchange.fr" send -d "${G1PUB}" -t "BRO." -m "TAPA DE JUNE ? VA AVEC >>> https://cesium.app >>> (ᵔ◡◡ᵔ) FLASHER TON G1VISA " [[ $COINS == "" || $COINS == "null" ]] && $MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key -n "$myDATA" send -d "${G1PUB}" -t "BRO." -m "TAPA DE JUNE ? VA AVEC >>> https://cesium.app >>> (ᵔ◡◡ᵔ) FLASHER TON G1VISA "
end=`date +%s` end=`date +%s`
echo "G1WALLET (☓‿‿☓) Execution time was "`expr $end - $start` seconds. echo "G1WALLET (☓‿‿☓) Execution time was "`expr $end - $start` seconds.
) & ) &
@ -276,7 +276,7 @@ while true; do
if [[ "$APPNAME" == "g1pub" && "$OBJ" != "email" ]]; then if [[ "$APPNAME" == "g1pub" && "$OBJ" != "email" ]]; then
[[ ${WHAT} == "astro" ]] && REPLACE="$LIBRA/ipns/$ASTRONAUTENS" \ [[ ${WHAT} == "astro" ]] && REPLACE="$LIBRA/ipns/$ASTRONAUTENS" \
|| REPLACE="https://www.gchange.fr/#/app/user/${G1PUB}" || REPLACE="$myGCHANGE/#/app/user/${G1PUB}"
echo ${REPLACE} echo ${REPLACE}
## REDIRECT TO TW OR GCHANGE PROFILE ## REDIRECT TO TW OR GCHANGE PROFILE
@ -284,7 +284,7 @@ while true; do
## USED BY https://git.p2p.legal/La_Bureautique/zeg1jeux/src/branch/main/lib/Fred.class.php#L81 ## USED BY https://git.p2p.legal/La_Bureautique/zeg1jeux/src/branch/main/lib/Fred.class.php#L81
echo "url='"${REPLACE}"'" >> ~/.zen/tmp/coucou/${MOATS}.index.redirect echo "url='"${REPLACE}"'" >> ~/.zen/tmp/coucou/${MOATS}.index.redirect
### REPONSE=$(echo https://www.gchange.fr/#/app/user/${G1PUB}/ | ipfs add -q) ### REPONSE=$(echo $myGCHANGE/#/app/user/${G1PUB}/ | ipfs add -q)
### ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE ### ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE
### echo "SESSION ${myIPFS}/ipns/$SESSIONNS " ### echo "SESSION ${myIPFS}/ipns/$SESSIONNS "
( (
@ -330,7 +330,7 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
if [[ ! -s ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ]]; then if [[ ! -s ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ]]; then
echo "IPFS TIMEOUT >>> (°▃▃°) $DATAID STILL MISSING GATEWAY BANGING FOR IT (°▃▃°)" echo "IPFS TIMEOUT >>> (°▃▃°) $DATAID STILL MISSING GATEWAY BANGING FOR IT (°▃▃°)"
array=(https://ipfs.copylaradio.com/ipfs/:hash https://ipns.co/:hash https://dweb.link/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=(${myIPFSGW}/ipfs/:hash https://ipns.co/:hash https://dweb.link/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 # size=${#array[@]}; index=$(($RANDOM % $size)); echo ${array[$index]} ## TODO CHOOSE RANDOM
# official ipfs best gateway from https://luke.lol/ipfs.php # official ipfs best gateway from https://luke.lol/ipfs.php
@ -527,9 +527,9 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
# PAY : /?player=PLAYER&pay=1&dest=G1PUB # PAY : /?player=PLAYER&pay=1&dest=G1PUB
############################################## ##############################################
if [[ $APPNAME == "pay" ]]; then if [[ $APPNAME == "pay" ]]; then
echo "${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey pay -a ${WHAT} -p ${VAL} -c 'Bro' -m" echo "${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n $myDATA pay -a ${WHAT} -p ${VAL} -c 'Bro' -m"
echo "$HTTPCORS" > ~/.zen/tmp/pay.log echo "$HTTPCORS" > ~/.zen/tmp/pay.log
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey pay -a ${WHAT} -p ${VAL} -c 'Bro' -m 2>&1 >> ~/.zen/tmp/pay.log ${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "$myDATA" pay -a ${WHAT} -p ${VAL} -c 'Bro' -m 2>&1 >> ~/.zen/tmp/pay.log
cat ~/.zen/tmp/pay.log | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 & cat ~/.zen/tmp/pay.log | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
end=`date +%s` end=`date +%s`
echo "(G_G ) PAYING Execution time was "`expr $end - $start` seconds. echo "(G_G ) PAYING Execution time was "`expr $end - $start` seconds.

View File

@ -5,16 +5,11 @@
######################################################################## ########################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" . "$MY_PATH/tools/my.sh"
start=`date +%s` start=`date +%s`
echo "20H12 (♥‿‿♥) $(hostname) $(date)" echo "20H12 (♥‿‿♥) $(hostname -f) $(date)"
espeak "Ding" > /dev/null 2>&1 espeak "Ding" > /dev/null 2>&1
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
## CLEANING ~/.zen/tmp ## CLEANING ~/.zen/tmp
rm -Rf ~/.zen/tmp/* rm -Rf ~/.zen/tmp/*
@ -29,7 +24,7 @@ cd ~/.zen/Astroport.ONE/
git pull git pull
## SOON /ipns/ Address !!! ## SOON /ipns/ Address !!!
espeak "Updating yt-dlp" > /dev/null 2>&1 espeak "Updating downloads" > /dev/null 2>&1
## Updating yt-dlp ## Updating yt-dlp
$MY_PATH/youtube-dl.sh $MY_PATH/youtube-dl.sh
sudo youtube-dl -U sudo youtube-dl -U
@ -63,10 +58,10 @@ $MY_PATH/tools/mailjet.sh "support@qo-op.com" "/tmp/20h12.log"
espeak "20 12 duration was $dur seconds" > /dev/null 2>&1 espeak "20 12 duration was $dur seconds" > /dev/null 2>&1
espeak "Restarting API" > /dev/null 2>&1
## CLOSING API PORT ## CLOSING API PORT
[[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid) [[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid)
## OPEN API ENGINE ## OPEN API ENGINE
espeak "Restarting API" > /dev/null 2>&1
~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log & ~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log &
PID=$! PID=$!
echo $PID > ~/.zen/.pid echo $PID > ~/.zen/.pid

View File

@ -6,7 +6,7 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" . "$MY_PATH/../tools/my.sh"
################################################################################ ################################################################################
# Create G1VOEU TW for PLAYER # Create G1VOEU TW for PLAYER
# Mon Titre => G1MonTitre => PEPPER # Mon Titre => G1MonTitre => PEPPER
@ -63,10 +63,6 @@ echo
[[ -s ~/.zen/tmp/$VOEUNS.html ]] && echo "HEY !!! UN TW EXISTE POUR CE VOEU ! ~/.zen/tmp/$VOEUNS.html - EXIT -" && exit 1 [[ -s ~/.zen/tmp/$VOEUNS.html ]] && echo "HEY !!! UN TW EXISTE POUR CE VOEU ! ~/.zen/tmp/$VOEUNS.html - EXIT -" && exit 1
# CRYPTO BUG. TODO use natools to protect and share key with Ŋ1 only ;) # CRYPTO BUG. TODO use natools to protect and share key with Ŋ1 only ;)
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
echo " Passerelle : $myIP" echo " Passerelle : $myIP"
echo "# UPGRADING WORLD WHISHKEY DATABASE" echo "# UPGRADING WORLD WHISHKEY DATABASE"
@ -98,7 +94,7 @@ isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.1
sed -i "s~k2k4r8kxfnknsdf7tpyc46ks2jb3s9uvd3lqtcv9xlq9rsoem7jajd75~${VOEUNS}~g" ~/.zen/game/world/$WISHKEY/index.html sed -i "s~k2k4r8kxfnknsdf7tpyc46ks2jb3s9uvd3lqtcv9xlq9rsoem7jajd75~${VOEUNS}~g" ~/.zen/game/world/$WISHKEY/index.html
# ASTROPORT LOCAL IP RELAY == Smartphone doesn't resolve LAN DNS. So using Astroport Station IP # ASTROPORT LOCAL IP RELAY == Smartphone doesn't resolve LAN DNS. So using Astroport Station IP
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/world/$WISHKEY/index.html sed -i "s~ipfs.infura.io~$myTUBE~g" ~/.zen/game/world/$WISHKEY/index.html
sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/world/$WISHKEY/index.html sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/world/$WISHKEY/index.html
# ADD API GW TIDDLERS for IPFS SAVE # ADD API GW TIDDLERS for IPFS SAVE
@ -227,7 +223,7 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPE
# COPY QR CODE TO PLAYER ZONE # COPY QR CODE TO PLAYER ZONE
cp ~/.zen/tmp/player.png ~/.zen/tmp/voeu.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/ cp ~/.zen/tmp/player.png ~/.zen/tmp/voeu.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
echo "$PEPPER" > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.title echo "$PEPPER" > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.title
echo "http://$myIP:8080/ipns/$VOEUNS" > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.link echo "$myIPFS/ipns/$VOEUNS" > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.link
cp ~/.zen/game/world/$WISHKEY/QR.WISHLINK.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/ cp ~/.zen/game/world/$WISHKEY/QR.WISHLINK.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
# PUBLISHING # PUBLISHING
@ -241,20 +237,20 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPE
echo $MOATS > ~/.zen/game/world/$WISHKEY/.moats echo $MOATS > ~/.zen/game/world/$WISHKEY/.moats
echo echo
echo "Astronaute TW : http://$myIP:8080/ipns/$ASTRONAUTENS" echo "Astronaute TW : $myIPFS/ipns/$ASTRONAUTENS"
echo "Nouveau G1Voeu : $PEPPER (document de contrôle de copie Ŋ1)" echo "Nouveau G1Voeu : $PEPPER (document de contrôle de copie Ŋ1)"
echo "TW $PEPPER : http://$myIP:8080/ipns/$VOEUNS" echo "TW $PEPPER : $myIPFS/ipns/$VOEUNS"
echo "## TO RECEIVE G1RONDS Creating Cesium+ Profil #### timeout long ... patience ...." 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+ $MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/tmp/qrtw.dunikey -n "$myDATA" set --name "G1Voeu $PEPPER" --avatar "/home/$USER/.zen/Astroport.ONE/images/logojune.jpg" --site "$myIPFSGW/ipns/$VOEUNS" #CESIUM+
[[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED !!!!" [[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED !!!!"
echo "************************************************************" echo "************************************************************"
echo "Hop, UNE JUNE pour le Voeu $PEPPER" echo "Hop, UNE JUNE pour le Voeu $PEPPER"
echo $MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey pay -a 1 -p $WISHKEY -c \'"$VOEUNS G1Voeu $PEPPER"\' -m echo $MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "$myDATA" pay -a 1 -p $WISHKEY -c \'"$VOEUNS G1Voeu $PEPPER"\' -m
echo "************************************************************" echo "************************************************************"
$MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey pay -a 1 -p $WISHKEY -c "$VOEUXNS G1Voeu $PEPPER" -m $MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "$myDATA" pay -a 1 -p $WISHKEY -c "$VOEUXNS G1Voeu $PEPPER" -m
echo "************************************************************" echo "************************************************************"
exit 0 exit 0

View File

@ -18,6 +18,7 @@ read
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
. "$MY_PATH/../tools/my.sh"
# Get Player Name # Get Player Name
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
@ -28,9 +29,7 @@ mkdir -p ~/.zen/tmp/gchange
[[ ! -f ~/.zen/game/players/$PLAYER/secret.dunikey ]] && echo "Astronaute inconnu. Connectez-vous" [[ ! -f ~/.zen/game/players/$PLAYER/secret.dunikey ]] && echo "Astronaute inconnu. Connectez-vous"
g1pub=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) g1pub=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
CESIUM="https://g1.data.presles.fr" # /user/profile/2L8vaYixCf97DMT8SistvQFeBj7vb6RQL7tvwyiv1XVH?&_source_exclude=avatar._content
GCHANGE="https://data.gchange.fr" # /user/profile/2L8vaYixCf97DMT8SistvQFeBj7vb6RQL7tvwyiv1XVH?&_source_exclude=avatar._content
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/gchange --render '.' 'carte.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Carte' tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/gchange --render '.' 'carte.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Carte'
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/gchange --render '.' 'gchange.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Gchange' tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/gchange --render '.' 'gchange.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Gchange'
@ -57,7 +56,7 @@ echo $LON
RAD="$DIST" RAD="$DIST"
[[ ! $RAD ]] && RAD="50km" [[ ! $RAD ]] && RAD="50km"
echo curl -sk -XPOST 'https://data.gchange.fr/market/record/_search?pretty&_source=title' -d ' echo curl -sk -XPOST "$myDATA/market/record/_search?pretty&_source=title" -d '
{ {
"size": 200, "size": 200,
"query": { "query": {
@ -77,7 +76,7 @@ echo curl -sk -XPOST 'https://data.gchange.fr/market/record/_search?pretty&_sour
if [[ "$LON" != "null" ]]; then if [[ "$LON" != "null" ]]; then
curl -sk -XPOST 'https://data.gchange.fr/market/record/_search?pretty&_source=title' -d ' curl -sk -XPOST "$myDATA/market/record/_search?pretty&_source=title" -d '
{ {
"size": 200, "size": 200,
"query": { "query": {
@ -116,7 +115,7 @@ for gID in $(cat /tmp/gchange.json | jq -r .hits.hits[]._id); do
[[ ! -f ~/.zen/tmp/gchange/$gID.json ]] && [[ ! -f ~/.zen/tmp/gchange/$gID.json ]] &&
NEW="true" \ NEW="true" \
&& curl -s --create-dirs -o ~/.zen/tmp/gchange/$gID.json -s https://data.gchange.fr/market/record/$gID?_source=category,title,description,issuer,time,creationTime,location,address,city,price,unit,currency,thumbnail._content_type,thumbnail._content,picturesCount,type,stock,fees,feesCurrency,geoPoint \ && curl -s --create-dirs -o ~/.zen/tmp/gchange/$gID.json -s "$myDATA/market/record/$gID?_source=category,title,description,issuer,time,creationTime,location,address,city,price,unit,currency,thumbnail._content_type,thumbnail._content,picturesCount,type,stock,fees,feesCurrency,geoPoint" \
&& sleep $((1 + RANDOM % 3)) && sleep $((1 + RANDOM % 3))
type=$(cat ~/.zen/tmp/gchange/$gID.json | jq -r ._source.type) type=$(cat ~/.zen/tmp/gchange/$gID.json | jq -r ._source.type)
@ -135,8 +134,8 @@ for gID in $(cat /tmp/gchange.json | jq -r .hits.hits[]._id); do
[[ $price == null ]] && price="0" [[ $price == null ]] && price="0"
love="$price $currency" love="$price $currency"
[[ $type == "offer" ]] && LINE="___OFFRE___[$title](https://data.gchange.fr/market/record/$gID/_share)_$love" [[ $type == "offer" ]] && LINE="___OFFRE___[$title]($myDATA/market/record/$gID/_share)_$love"
[[ $type == "need" ]] && LINE="__DEMANDE__[$title](https://data.gchange.fr/market/record/$gID/_share)_$love" [[ $type == "need" ]] && LINE="__DEMANDE__[$title]($myDATA/market/record/$gID/_share)_$love"
[[ $NEW == "true" ]] && echo "$LINE" >> ~/.zen/tmp/gchange.txt && chunk=$((chunk+1)) && echo $chunk [[ $NEW == "true" ]] && echo "$LINE" >> ~/.zen/tmp/gchange.txt && chunk=$((chunk+1)) && echo $chunk

View File

@ -6,14 +6,12 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" . "$MY_PATH/../tools/my.sh"
################################################################################ ################################################################################
## Publish All PLAYER TW, ## Publish All PLAYER TW,
# Run TAG subprocess: tube, voeu # Run TAG subprocess: tube, voeu
############################################ ############################################
echo "## RUNNING PLAYER.refresh" echo "## RUNNING PLAYER.refresh"
# IPFSNODEID=$(ipfs id -f='<id>\n')
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
PLAYERONE="$1" PLAYERONE="$1"
[[ ! $PLAYERONE ]] && PLAYERONE=($(ls -t ~/.zen/game/players/)) [[ ! $PLAYERONE ]] && PLAYERONE=($(ls -t ~/.zen/game/players/))
@ -57,10 +55,6 @@ for PLAYER in ${PLAYERONE[@]}; do
rm -Rf ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/ rm -Rf ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/
mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/ mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
echo "Getting latest online TW..." echo "Getting latest online TW..."
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
echo "/ipns/$ASTRONAUTENS ON $LIBRA" echo "/ipns/$ASTRONAUTENS ON $LIBRA"
@ -77,7 +71,7 @@ isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.1
echo "------------------------------------------------" echo "------------------------------------------------"
echo "MANUAL PROCEDURE NEEDED" echo "MANUAL PROCEDURE NEEDED"
echo "------------------------------------------------" echo "------------------------------------------------"
echo "http://$myIP:8080/ipfs/" echo "$myIPFS/ipfs/"
echo "/ipfs/"$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.* | tail -n 1) echo "/ipfs/"$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.* | tail -n 1)
echo "ipfs name publish -t 24h --key=$PLAYER ..." echo "ipfs name publish -t 24h --key=$PLAYER ..."
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
@ -130,10 +124,8 @@ isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.1
########################### ###########################
# Modification Tiddlers de contrôle de GW & API # Modification Tiddlers de contrôle de GW & API
[[ $isLAN ]] && APIGW="http://ipfs.localhost:5001" && IPFSGW="https://ipfs.copylaradio.com" \ echo '[{"title":"$:/ipfs/saver/api/http/localhost/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"'$(myPlayerApiGw)'"}]' > ~/.zen/tmp/${MOATS}/5001.json
|| ( APIGW="https://$(hostname)/api" && IPFSGW="https://ipfs.copylaradio.com" ) echo '[{"title":"$:/ipfs/saver/gateway/http/localhost","tags":"$:/ipfs/core $:/ipfs/saver/gateway","text":"'$myIPFS'"}]' > ~/.zen/tmp/${MOATS}/8080.json
echo '[{"title":"$:/ipfs/saver/api/http/localhost/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"'$APIGW'"}]' > ~/.zen/tmp/${MOATS}/5001.json
echo '[{"title":"$:/ipfs/saver/gateway/http/localhost","tags":"$:/ipfs/core $:/ipfs/saver/gateway","text":"'$IPFSGW'"}]' > ~/.zen/tmp/${MOATS}/8080.json
FRIENDSFEEDS=$(cat ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/FRIENDSFEEDS 2>/dev/null) FRIENDSFEEDS=$(cat ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/FRIENDSFEEDS 2>/dev/null)
echo "FRIENDS FEEDS : "${FRIENDSFEEDS} echo "FRIENDS FEEDS : "${FRIENDSFEEDS}
@ -179,7 +171,7 @@ isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.1
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
echo "================================================" echo "================================================"
echo "$PLAYER : http://$myIP:8080/ipns/$ASTRONAUTENS" echo "$PLAYER : $myIPFS/ipns/$ASTRONAUTENS"
echo " = /ipfs/$TW" echo " = /ipfs/$TW"
echo "================================================" echo "================================================"
@ -190,7 +182,7 @@ isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.1
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )" echo "(☉_☉ ) (☉_☉ ) (☉_☉ )"
# cp -f ~/.zen/game/players/${PLAYER}/ipfs/${FPLAYER}.rss.json ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/${FPLAYER}.rss.json # cp -f ~/.zen/game/players/${PLAYER}/ipfs/${FPLAYER}.rss.json ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/${FPLAYER}.rss.json
[[ -d ~/.zen/game/players/$PLAYER/FRIENDS ]] \ [[ -d ~/.zen/game/players/$PLAYER/FRIENDS ]] \
&& cat ${MY_PATH}/../www/iframe.html | sed "s~_ME_~${IPFSGW}/ipns/${ASTRONAUTENS}~g" | sed "s~_IFRIENDHEAD_~${IFRIENDHEAD}~g" > ~/.zen/game/players/$PLAYER/FRIENDS/index.html && cat ${MY_PATH}/../www/iframe.html | sed "s~_ME_~${myIPFS}/ipns/${ASTRONAUTENS}~g" | sed "s~_IFRIENDHEAD_~${IFRIENDHEAD}~g" > ~/.zen/game/players/$PLAYER/FRIENDS/index.html
[[ -s ~/.zen/game/players/$PLAYER/FRIENDS/index.html ]] \ [[ -s ~/.zen/game/players/$PLAYER/FRIENDS/index.html ]] \
&& FRAME=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/FRIENDS/index.html | tail -n 1) \ && FRAME=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/FRIENDS/index.html | tail -n 1) \

View File

@ -6,7 +6,7 @@
######################################################################## ########################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" . "$MY_PATH/../tools/my.sh"
# Need TW index.html path + IPNS publication Key (available in IPFS keystore) # Need TW index.html path + IPNS publication Key (available in IPFS keystore)
# Search for "voeu" tagged tiddlers to get URL # Search for "voeu" tagged tiddlers to get URL
@ -22,10 +22,6 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1)
[[ ! $ASTRONAUTENS ]] && echo "$PLAYER IPNS INTROUVABLE" && exit 1 [[ ! $ASTRONAUTENS ]] && echo "$PLAYER IPNS INTROUVABLE" && exit 1
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
## EXPORT [tag[voeu]] ## EXPORT [tag[voeu]]
echo "## EXTRACTION DE NOUVEAUX VOEUX pour $PLAYER TW" echo "## EXTRACTION DE NOUVEAUX VOEUX pour $PLAYER TW"
echo "$INDEX [tag[voeu]] ?" echo "$INDEX [tag[voeu]] ?"

View File

@ -6,7 +6,8 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" . "$MY_PATH/../tools/my.sh"
################################################################################ ################################################################################
# Inspect game wishes, refresh latest IPNS version # Inspect game wishes, refresh latest IPNS version
# SubProcess Backup and chain # SubProcess Backup and chain
@ -26,14 +27,6 @@ PLAYER="$2" ## IPNS KEY NAME - G1PUB - PLAYER ...
[[ ! $ASTRONAUTENS ]] && echo "WARNING No $PLAYER in keystore --" && ASTRONAUTENS=$ASTRONS [[ ! $ASTRONAUTENS ]] && echo "WARNING No $PLAYER in keystore --" && ASTRONAUTENS=$ASTRONS
[[ ! $ASTRONAUTENS ]] && echo "Missing $PLAYER IPNS KEY - CONTINUE --" && exit 1 [[ ! $ASTRONAUTENS ]] && echo "Missing $PLAYER IPNS KEY - CONTINUE --" && exit 1
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
# IPFSNODEID=$(ipfs id -f='<id>\n')
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

View File

@ -10,16 +10,11 @@ mkdir -p ~/.zen/bunkerbox # BunkerBOX temp directory
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" . "$MY_PATH/../tools/my.sh"
TS=$(date -u +%s%N | cut -b1-13) TS=$(date -u +%s%N | cut -b1-13)
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || echo " warning ipfs daemon not running" IPFSGWESC="${myIPFS/\//\\/\\}"
isLAN=$(hostname -I | awk '{print $1}' | head -n 1 | cut -f3 -d '/' | grep -E "(^127\.)|(^192\.168\.)|(^fd42\:)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") IPFSNGW="$myIPFS"
IPFSGWESC="https:\/\/tube.copylaradio.com" && IPFSNGW="https://tube.copylaradio.com"
IPFSGWESC="http:\/\/127.0.0.1:8080" && IPFSNGW="http://127.0.0.1:8080"
[[ ! $isLAN ]] && IPFSGWESC="https:\/\/$(hostname)" && IPFSNGW="https://$(hostname)"
echo "IPFS GATEWAY $IPFSNGW" echo "IPFS GATEWAY $IPFSNGW"
## GET LATEST VIDEOS ## GET LATEST VIDEOS

View File

@ -64,10 +64,10 @@ G1PUB=$(myPlayerG1Pub)
PLAYERNS=$(myPlayerNs) || ( echo "noplayerns" && exit 1 ) PLAYERNS=$(myPlayerNs) || ( echo "noplayerns" && exit 1 )
ASTRONAUTENS=$(myAstronauteKey) ASTRONAUTENS=$(myAstroKey)
[[ $ASTRONAUTENS == "" ]] && echo "ASTRONAUTE manquant" && espeak "Astronaut Key Missing" && exit 1 [[ $ASTRONAUTENS == "" ]] && echo "ASTRONAUTE manquant" && espeak "Astronaut Key Missing" && exit 1
BROWSER=$(myPlayerBrowser) ## GET cookies-from-browser BROWSER=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1) ## GET cookies-from-browser
if [ $URL ]; then if [ $URL ]; then
echo "URL: $URL" echo "URL: $URL"
@ -886,7 +886,7 @@ if [[ -s ~/Astroport/${CAT}/${MEDIAID}/${MEDIAKEY}.dragdrop.json ]]; then
|| espeak "USING LOCAL COPY" || espeak "USING LOCAL COPY"
############################### ###############################
echo "Nouveau MEDIAKEY dans TW $PSEUDO / ${PLAYER} : http://$myIP:8080/ipns/$ASTRONAUTENS" echo "Nouveau MEDIAKEY dans TW $PSEUDO / ${PLAYER} : $myIPFS/ipns/$ASTRONAUTENS"
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \ tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
--import ~/Astroport/${CAT}/${MEDIAID}/${MEDIAKEY}.dragdrop.json "application/json" \ --import ~/Astroport/${CAT}/${MEDIAID}/${MEDIAKEY}.dragdrop.json "application/json" \
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain" --output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
@ -906,11 +906,11 @@ if [[ -s ~/Astroport/${CAT}/${MEDIAID}/${MEDIAKEY}.dragdrop.json ]]; then
echo ${MOATS} > ~/.zen/game/players/${PLAYER}/ipfs/moa/.moats echo ${MOATS} > ~/.zen/game/players/${PLAYER}/ipfs/moa/.moats
echo "================================================" echo "================================================"
echo "${PLAYER} : http://$myIP:8080/ipns/$ASTRONAUTENS" echo "${PLAYER} : $myIPFS/ipns/$ASTRONAUTENS"
echo "================================================" echo "================================================"
echo echo
[[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open "http://$myIP:8080/ipns/$ASTRONAUTENS" [[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open "$myIPFS/ipns/$ASTRONAUTENS"
else else

View File

@ -6,13 +6,9 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
myIP=$(hostname -I | awk '{print $1}' | head -n 1) . "${MY_PATH}/tools/my.sh"
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
ME="${0##*/}"
TS=$(date -u +%s%N | cut -b1-13) TS=$(date -u +%s%N | cut -b1-13)
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
echo ' echo '
_ ____ _____ ____ ___ ____ ___ ____ _____ ___ _ _ _____ _ ____ _____ ____ ___ ____ ___ ____ _____ ___ _ _ _____
@ -31,9 +27,8 @@ echo
## VERIFY SOFTWARE DEPENDENCIES ## VERIFY SOFTWARE DEPENDENCIES
[[ ! $(which ipfs) ]] && echo "EXIT. Vous devez avoir installé ipfs CLI sur votre ordinateur" && echo "https://dist.ipfs.io/#go-ipfs" && exit 1 [[ ! $(which ipfs) ]] && echo "EXIT. Vous devez avoir installé ipfs CLI sur votre ordinateur" && echo "https://dist.ipfs.io/#go-ipfs" && exit 1
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); YOU=$(myIpfsApi);
[[ ! $YOU ]] && echo "Lancez 'ipfs daemon' SVP sudo systemctl start ipfs" && exit 1 [[ ! $YOU ]] && echo "Lancez 'ipfs daemon' SVP sudo systemctl start ipfs" && exit 1
export IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
echo 'PRESS ENTER... '; read echo 'PRESS ENTER... '; read
@ -100,7 +95,7 @@ echo
export ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1) export ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
echo "$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null) TW/Moa" echo "$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null) TW/Moa"
echo "http://$myIP:8080/ipns/$ASTRONAUTENS" echo "$myIPFS/ipns/$ASTRONAUTENS"
echo "Activation Réseau P2P Astroport !" echo "Activation Réseau P2P Astroport !"
echo echo
@ -138,7 +133,7 @@ select fav in "${choices[@]}"; do
[[ $voeu != "" ]] && rm -Rf ~/.zen/game/world/$voeu [[ $voeu != "" ]] && rm -Rf ~/.zen/game/world/$voeu
done done
echo "REMOVING GCHANGE+ PROFILE" echo "REMOVING GCHANGE+ PROFILE"
$MY_PATH/tools/jaklis/jaklis.py -k $HOME/.zen/game/players/$PLAYER/secret.dunikey -n https://data.gchange.fr erase $MY_PATH/tools/jaklis/jaklis.py -k $HOME/.zen/game/players/$PLAYER/secret.dunikey -n "$myDATA" erase
#~ echo "REMOVE CESIUM+" #~ echo "REMOVE CESIUM+"
#~ $MY_PATH/tools/jaklis/jaklis.py -k $HOME/.zen/game/players/$PLAYER/secret.dunikey -n https://g1.data.e-is.pro erase #~ $MY_PATH/tools/jaklis/jaklis.py -k $HOME/.zen/game/players/$PLAYER/secret.dunikey -n https://g1.data.e-is.pro erase
echo "rm -Rf ~/.zen/game/players/$PLAYER" echo "rm -Rf ~/.zen/game/players/$PLAYER"
@ -169,7 +164,7 @@ select fav in "${choices[@]}"; do
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
fi fi
echo "================================================" echo "================================================"
echo "$PLAYER : http://$myIP:8080/ipns/$ASTRONAUTENS" echo "$PLAYER : $myIPFS/ipns/$ASTRONAUTENS"
echo "================================================" echo "================================================"
;; ;;

View File

@ -8,7 +8,8 @@ services:
- GID=${HOST_GID} - GID=${HOST_GID}
- UID=${HOST_UID} - UID=${HOST_UID}
container_name: ${COMPOSE_PROJECT_NAME}-astroport container_name: ${COMPOSE_PROJECT_NAME}-astroport
hostname: ${HOSTNAME:-astroport}.${DOMAINNAME:-localhost} domainname: ${DOMAINNAME:-localhost}
hostname: ${HOSTNAME:-astroport}
image: ${DOCKER_REPOSITORY}/astroport:${DOCKER_IMAGE_TAG} image: ${DOCKER_REPOSITORY}/astroport:${DOCKER_IMAGE_TAG}
labels: labels:
- SERVICE_1234_CHECK_HTTP=/test - SERVICE_1234_CHECK_HTTP=/test

View File

@ -6,13 +6,8 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
myIP=$(hostname -I | awk '{print $1}' | head -n 1) . "$MY_PATH/tools/my.sh"
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
ME="${0##*/}"
TS=$(date -u +%s%N | cut -b1-13) TS=$(date -u +%s%N | cut -b1-13)
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
echo "cron_VRFY.sh ON" echo "cron_VRFY.sh ON"
################################################### ###################################################

View File

@ -16,8 +16,8 @@ Describe 'Astroport'
Include ./tools/my.sh Include ./tools/my.sh
It 'does my env variables' It 'does my env variables'
myhost() { myhost() {
echo $myHOST echo $myHOST
echo $myIPFS echo $myIPFS
} }
When call myhost When call myhost
The output should include astroport. The output should include astroport.
@ -26,7 +26,7 @@ Describe 'Astroport'
The stderr should equal "" The stderr should equal ""
End End
It 'does host html register page' It 'does host html register page'
When call myTmpl When call myHtml
The stdout should include $(hostname) The stdout should include $(hostname)
The stdout should include $IPFSNODEID The stdout should include $IPFSNODEID
The stdout should include $myASTROPORT The stdout should include $myASTROPORT
@ -36,7 +36,7 @@ Describe 'Astroport'
End End
It 'does localhost html register page' It 'does localhost html register page'
isLAN=true isLAN=true
When call myTmpl When call myHtml
The stdout should include "input name='salt' value=''" The stdout should include "input name='salt' value=''"
The stdout should include "input name='pepper' value=''" The stdout should include "input name='pepper' value=''"
The status should be success The status should be success

View File

@ -6,13 +6,9 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
myIP=$(hostname -I | awk '{print $1}' | head -n 1) . "$MY_PATH/tools/my.sh"
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
ME="${0##*/}"
TS=$(date -u +%s%N | cut -b1-13) TS=$(date -u +%s%N | cut -b1-13)
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
echo "cron_VRFY.sh ON" echo "cron_VRFY.sh ON"
################################################### ###################################################

View File

@ -3,14 +3,10 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
myIP=$(hostname -I | awk '{print $1}' | head -n 1) . "$MY_PATH/my.sh"
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
IPFSNODEID=$(ipfs id -f='<id>\n')
export PLAYERFEEDS="" export PLAYERFEEDS=""
ME="${0##*/}"
######################################################################### CONNECT PLAYER WITH GCHANGE ######################################################################### CONNECT PLAYER WITH GCHANGE
# Check who is .current PLAYER # Check who is .current PLAYER
PLAYER="$1" PLAYER="$1"
@ -35,7 +31,7 @@ mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/
## VERIFY IT HAS ALREADY RUN ## VERIFY IT HAS ALREADY RUN
if [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/cesium.json ]]; then if [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/cesium.json ]]; then
## GET GCHANGE PROFIL ## GET GCHANGE PROFIL
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" get > ~/.zen/game/players/${PLAYER}/ipfs/gchange.json $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "$myDATA" get > ~/.zen/game/players/${PLAYER}/ipfs/gchange.json
## KEEPING ALREADY EXISTING PROFILE DATA ## KEEPING ALREADY EXISTING PROFILE DATA
NAME=$(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '.title' 2>/dev/null) NAME=$(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '.title' 2>/dev/null)
@ -57,7 +53,7 @@ if [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/cesium.json ]]; then
echo "GCHANGE+ PROFILE https://gchange.fr" echo "GCHANGE+ PROFILE https://gchange.fr"
# echo "set -n "${NAME}" -d "${DESCR}" -v "${VILLE}" -a "${ADRESSE}"" # echo "set -n "${NAME}" -d "${DESCR}" -v "${VILLE}" -a "${ADRESSE}""
######################################################################## ########################################################################
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" set -n "${NAME}" -d "${DESCR}" -v "${VILLE}" -a "${ADRESSE}" -s "https://ipfs.copylaradio.com/ipns/$ASTRONAUTENS" #GCHANGE+ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "$myDATA" set -n "${NAME}" -d "${DESCR}" -v "${VILLE}" -a "${ADRESSE}" -s "$LIBRA/ipns/$ASTRONAUTENS" #GCHANGE+
[[ ! $? == 0 ]] && echo "GCHANGE PROFILE CREATION FAILED" [[ ! $? == 0 ]] && echo "GCHANGE PROFILE CREATION FAILED"
echo echo
@ -73,7 +69,7 @@ echo
fi fi
## GET PROFILE BACK ## GET PROFILE BACK
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" get > ~/.zen/game/players/${PLAYER}/ipfs/gchange.json $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "$myDATA" get > ~/.zen/game/players/${PLAYER}/ipfs/gchange.json
#~ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://g1.data.e-is.pro" get > ~/.zen/game/players/${PLAYER}/ipfs/cesium.json #~ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://g1.data.e-is.pro" get > ~/.zen/game/players/${PLAYER}/ipfs/cesium.json
######################################################################## ########################################################################
@ -91,7 +87,7 @@ echo "Checking received stars"
~/.zen/Astroport.ONE/tools/timeout.sh -t 20 \ ~/.zen/Astroport.ONE/tools/timeout.sh -t 20 \
~/.zen/Astroport.ONE/tools/jaklis/jaklis.py \ ~/.zen/Astroport.ONE/tools/jaklis/jaklis.py \
-k ~/.zen/game/players/${PLAYER}/secret.dunikey \ -k ~/.zen/game/players/${PLAYER}/secret.dunikey \
-n "https://data.gchange.fr" stars > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json -n "$myDATA" stars > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json
[[ ! $(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json | jq -r '.likes[].issuer') ]] && echo "Activez votre Toile de Confiance Ŋ1 sur GChange" && exit 0 [[ ! $(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json | jq -r '.likes[].issuer') ]] && echo "Activez votre Toile de Confiance Ŋ1 sur GChange" && exit 0
@ -105,7 +101,7 @@ do
FRIENDNS=$(~/.zen/Astroport.ONE/tools/g1_to_ipfs.py ${liking_me}) FRIENDNS=$(~/.zen/Astroport.ONE/tools/g1_to_ipfs.py ${liking_me})
echo "===========================" echo "==========================="
echo "${liking_me} IS LIKING ME" echo "${liking_me} IS LIKING ME"
echo "TW ? https://ipfs.copylaradio.com/ipns/$FRIENDNS " echo "TW ? $LIBRA/ipns/$FRIENDNS "
##### CHECKING IF WE LIKE EACH OTHER Ŋ1 LEVEL ##### CHECKING IF WE LIKE EACH OTHER Ŋ1 LEVEL
echo "Receiving Stars : cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json | jq -r" echo "Receiving Stars : cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json | jq -r"
@ -113,7 +109,7 @@ do
~/.zen/Astroport.ONE/tools/timeout.sh -t 20 \ ~/.zen/Astroport.ONE/tools/timeout.sh -t 20 \
~/.zen/Astroport.ONE/tools/jaklis/jaklis.py \ ~/.zen/Astroport.ONE/tools/jaklis/jaklis.py \
-k ~/.zen/game/players/${PLAYER}/secret.dunikey \ -k ~/.zen/game/players/${PLAYER}/secret.dunikey \
-n "https://data.gchange.fr" \ -n "$myDATA" \
stars -p ${liking_me} > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json stars -p ${liking_me} > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json
## ZOMBIE PROTECTION - PURGE AFTER 60 DAYS ## ZOMBIE PROTECTION - PURGE AFTER 60 DAYS
@ -144,6 +140,7 @@ do
## GET FRIEND GCHANGE PROFILE ## GET FRIEND GCHANGE PROFILE
${MY_PATH}/timeout.sh -t 20 \ ${MY_PATH}/timeout.sh -t 20 \
${MY_PATH}/jaklis/jaklis.py get \ ${MY_PATH}/jaklis/jaklis.py get \
-n "$myDATA" \
-p ${liking_me} > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/gchange.json -p ${liking_me} > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/gchange.json
FRIENDTITLE=$(cat ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/gchange.json | jq -r '.title') FRIENDTITLE=$(cat ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/gchange.json | jq -r '.title')
@ -153,7 +150,7 @@ do
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
echo "$LIBRA/ipns/$FRIENDNS" echo "$LIBRA/ipns/$FRIENDNS"
echo "http://$myIP:8080/ipns/$FRIENDNS ($FRIENDTITLE)" echo "$myIPFS/ipns/$FRIENDNS ($FRIENDTITLE)"
# DISPLAY TIMER # DISPLAY TIMER
${MY_PATH}/displaytimer.sh 60 & ${MY_PATH}/displaytimer.sh 60 &
@ -166,7 +163,7 @@ do
## AUCUN VISA ASTRONAUTE ENVOYER UN MESSAGE PAR GCHANGE ## AUCUN VISA ASTRONAUTE ENVOYER UN MESSAGE PAR GCHANGE
echo "AUCUN TW ACTIF. PREVENONS LE" echo "AUCUN TW ACTIF. PREVENONS LE"
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" send -d "${liking_me}" -t "HEY BRO !" -m "G1 TW BunkerBOX >>> (⌐■_■) <<< https://ipfs.copylaradio.com/ipns/$ASTRONAUTENS >>> (ᵔ◡◡ᵔ) <<< " $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "$myDATA" send -d "${liking_me}" -t "HEY BRO !" -m "G1 TW BunkerBOX >>> (⌐■_■) <<< https://ipfs.copylaradio.com/ipns/$ASTRONAUTENS >>> (ᵔ◡◡ᵔ) <<< "
## I TRY ## I TRY
try=$((try+1)) && echo $try > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}.try try=$((try+1)) && echo $try > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}.try
@ -237,7 +234,7 @@ do
## COOL FEATURE FOR GCHANGE ACCOUNT CONFIDENCE ## COOL FEATURE FOR GCHANGE ACCOUNT CONFIDENCE
## IS IT REALLY A FRIEND I LIKE ? ## IS IT REALLY A FRIEND I LIKE ?
echo "BRO?" echo "BRO?"
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" send -d "${G1PUB}" -t "Bro ?" -m "https://www.gchange.fr/#/app/user/${liking_me}/" $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "$myDATA" send -d "${G1PUB}" -t "Bro ?" -m "$myGCHANGE/#/app/user/${liking_me}/"
try=$((try+1)) && echo $try > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}.try try=$((try+1)) && echo $try > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}.try
fi fi

View File

@ -7,11 +7,10 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" . "${MY_PATH}/my.sh"
! ipfs swarm peers >/dev/null 2>&1 && echo "Lancez 'ipfs daemon' SVP" && exit 1 ! ipfs swarm peers >/dev/null 2>&1 && echo "Lancez 'ipfs daemon' SVP" && exit 1
################################################################################ ################################################################################
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
mkdir -p ~/.zen/tmp/${MOATS} mkdir -p ~/.zen/tmp/${MOATS}
SALT="$1" SALT="$1"
@ -22,23 +21,15 @@ PSEUDO="$4"
## Fill UP TW with VIDEO URL ## Fill UP TW with VIDEO URL
URL="$5" URL="$5"
################################################################################ ################################################################################
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); YOU=$(myIpfsApi);
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
################################################################################ ################################################################################
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
################################################################################
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="localhost"
[[ $isLAN ]] && myIPFSGW="http://ipfs.localhost:8080" && myASTROPORT="http://astroport.localhost:1234" ## LAN STATION
[[ ! $isLAN || $USER == "zen" ]] && myIPFSGW="https://ipfs.copylaradio.com" && myASTROPORT="https://astroport.copylaradio.com" ## WAN STATION
################################################################################ ################################################################################
## CHECK if PLAYER resolve any ASTRONAUTENS ## CHECK if PLAYER resolve any ASTRONAUTENS
[[ ${PLAYER} ]] && ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1) [[ ${PLAYER} ]] && ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
[[ ${ASTRONAUTENS} ]] && echo "WARNING IPNS $PLAYER EXISTANT ${myIPFSGW}/ipns/${ASTRONAUTENS} - EXIT -" && exit 0 [[ ${ASTRONAUTENS} ]] && echo "WARNING IPNS $PLAYER EXISTANT ${myIPFS}/ipns/${ASTRONAUTENS} - EXIT -" && exit 0
## Chargement TW !!! ## Chargement TW !!!
if [[ $SALT != "" && PEPPER != "" ]]; then if [[ $SALT != "" && PEPPER != "" ]]; then
@ -175,13 +166,13 @@ CLYUSER=$(printf '%s\n' "${LYUSER[@]}" | tac | tr '\n' '.' ) # CLYUSER=debrouill
YOMAIN=$(echo $PLAYER | cut -d '@' -f 2) # YOMAIN=super.chez-moi.com YOMAIN=$(echo $PLAYER | cut -d '@' -f 2) # YOMAIN=super.chez-moi.com
echo "NEXT STYLE GW : https://ipfs.$CLYUSER$YOMAIN.$HOSTNAME" echo "NEXT STYLE GW : https://ipfs.$CLYUSER$YOMAIN.$HOSTNAME"
#~ [[ ! $isLAN ]] && NID="https://ipfs.$CLYUSER$YOMAIN.$HOSTNAME" && WID="$NID/api" #~ [[ ! $isLAN ]] && NID="https://ipfs.$CLYUSER$YOMAIN.$HOSTNAME" && WID="$NID/api"
NID="${myIPFSGW}" && WID="$NID/api" echo "MY PLAYER API GW : $(myPlayerApiGw)"
[[ $isLAN ]] && NID="http://ipfs.localhost:8080" && WID="http://ipfs.localhost:5001" NID="${myIPFS}"
WID="$(myPlayerApiGw)"
#### ####
[[ $USER == "zen" || $isLAN == "" ]] \ [[ $USER == "zen" ]] \
&& make player MAIL=$PLAYER PLAYER_API_ONLINE=true \ && make player MAIL=$PLAYER
&& NID="https://ipfs.$HOSTNAME" && WID="https://ipfs.$CLYUSER$YOMAIN.$HOSTNAME/api"
#### ####
@ -202,7 +193,7 @@ NID="${myIPFSGW}" && WID="$NID/api"
cp ~/.zen/game/players/$PLAYER/QR.png ~/.zen/game/players/$PLAYER/ipfs/QR.png cp ~/.zen/game/players/$PLAYER/QR.png ~/.zen/game/players/$PLAYER/ipfs/QR.png
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/ipfs/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible) echo "$G1PUB" > ~/.zen/game/players/$PLAYER/ipfs/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible)
qrencode -s 12 -o ~/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png "https://ipfs.copylaradio.com/ipns/${ASTRONAUTENS}" qrencode -s 12 -o ~/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png "$LIBRA/ipns/${ASTRONAUTENS}"
## SEC PASS PROTECTED QRCODE ## SEC PASS PROTECTED QRCODE
@ -253,8 +244,8 @@ NID="${myIPFSGW}" && WID="$NID/api"
sed -i "s~_MEDIAKEY_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html sed -i "s~_MEDIAKEY_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
sed -i "s~k2k4r8kxfnknsdf7tpyc46ks2jb3s9uvd3lqtcv9xlq9rsoem7jajd75~${ASTRONAUTENS}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html sed -i "s~k2k4r8kxfnknsdf7tpyc46ks2jb3s9uvd3lqtcv9xlq9rsoem7jajd75~${ASTRONAUTENS}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
sed -i "s~tube.copylaradio.com~ipfs.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html sed -i "s~tube.copylaradio.com~$myTUBE~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
sed -i "s~ipfs.copylaradio.com~ipfs.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html sed -i "s~ipfs.copylaradio.com~$myTUBE~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
# #
sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html # 8080 & 5001 BEING THE RECORDING GATEWAY (WAN or ipfs.localhost) sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html # 8080 & 5001 BEING THE RECORDING GATEWAY (WAN or ipfs.localhost)
@ -353,11 +344,11 @@ NID="${myIPFSGW}" && WID="$NID/api"
echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sleep 1 echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sleep 1
echo "--- PLAYER : $PLAYER"; echo "--- PLAYER : $PLAYER";
echo; echo "VISA : ${myIPFSGW}/ipfs/${IASTRO}" echo; echo "VISA : ${myIPFS}/ipfs/${IASTRO}"
echo; echo "+ TW : ${myIPFSGW}/ipns/${ASTRONAUTENS}" echo; echo "+ TW : ${myIPFS}/ipns/${ASTRONAUTENS}"
echo; echo "+ RSS : ${myIPFSGW}/ipns/${FEEDNS}"; sleep 1 echo; echo "+ RSS : ${myIPFS}/ipns/${FEEDNS}"; sleep 1
[[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open "${myIPFSGW}/ipns/${ASTRONAUTENS}" [[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open "${myIPFS}/ipns/${ASTRONAUTENS}"
[[ ! -L ~/.zen/game/players/.current ]] && ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current [[ ! -L ~/.zen/game/players/.current ]] && ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current

View File

@ -9,12 +9,10 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" . "$MY_PATH/my.sh"
PLAYER="$1" PLAYER="$1"
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
[[ ! -f ~/.zen/game/players/${PLAYER}/QR.png ]] &&\ [[ ! -f ~/.zen/game/players/${PLAYER}/QR.png ]] &&\
echo "ERREUR. Aucun PLAYER Astronaute connecté .ERREUR ~/.zen/game/players/${PLAYER}/" && exit 1 echo "ERREUR. Aucun PLAYER Astronaute connecté .ERREUR ~/.zen/game/players/${PLAYER}/" && exit 1
@ -49,14 +47,9 @@ sudo brother_ql_print /tmp/toprint.bin $LP
################################################################ ################################################################
### PRINT PLAYER TW myIP link ### PRINT PLAYER TW myIP link
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
TUBE=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 3)
playerns=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1) playerns=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1)
qrencode -s 12 -o "$HOME/.zen/tmp/QR.ASTRO.png" "http://$TUBE:8080/ipns/$playerns" qrencode -s 12 -o "$HOME/.zen/tmp/QR.ASTRO.png" "$myIPFSGW/ipns/$playerns"
convert $HOME/.zen/tmp/QR.ASTRO.png -resize 600 /tmp/playerns.png convert $HOME/.zen/tmp/QR.ASTRO.png -resize 600 /tmp/playerns.png
brother_ql_create --model QL-700 --label-size 62 /tmp/playerns.png > /tmp/toprint.bin 2>/dev/null brother_ql_create --model QL-700 --label-size 62 /tmp/playerns.png > /tmp/toprint.bin 2>/dev/null

View File

@ -5,7 +5,7 @@
######################################################################## ########################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" . "$MY_PATH/my.sh"
PLAYER=$1 PLAYER=$1
@ -17,12 +17,6 @@ PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null)
ASTRONAUTENS=$(ipfs key list -l | grep -w "${G1PUB}" | cut -d ' ' -f 1) ASTRONAUTENS=$(ipfs key list -l | grep -w "${G1PUB}" | cut -d ' ' -f 1)
[[ $ASTRONAUTENS == "" ]] && echo "ASTRONAUTE manquant" && exit 1 [[ $ASTRONAUTENS == "" ]] && echo "ASTRONAUTE manquant" && exit 1
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
############################### ###############################
## EXTRACT G1Voeu from PLAYER TW ## EXTRACT G1Voeu from PLAYER TW
@ -68,11 +62,11 @@ select voeu in "${vlist[@]}"; do
case $typ in case $typ in
"TW") "TW")
echo "Changer de Gateway http://$myIP:8080 ?" echo "Changer de Gateway $myIPFS ?"
read GW && [[ ! $GW ]] && GW="http://$myIP:8080" read GW && [[ ! $GW ]] && GW="$myIPFS"
qrencode -s 12 -o "$HOME/.zen/game/world/$voeu/QR.WISHLINK.png" "http://$myIP:8080/ipns/$VOEUXNS" qrencode -s 12 -o "$HOME/.zen/game/world/$voeu/QR.WISHLINK.png" "$GW/ipns/$VOEUXNS"
convert $HOME/.zen/game/world/$voeu/QR.WISHLINK.png -resize 600 ~/.zen/tmp/START.png convert $HOME/.zen/game/world/$voeu/QR.WISHLINK.png -resize 600 ~/.zen/tmp/START.png
echo " QR code $TITLE : http://$myIP:8080/ipns/$VOEUXNS" echo " QR code $TITLE : $GW/ipns/$VOEUXNS"
break break
;; ;;
"G1") "G1")

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
. "$MY_PATH/my.sh"
# Controle par Scanner de QRCode # Controle par Scanner de QRCode
# Scan G1PUB # Scan G1PUB
# Scan QRSec + PASS # Scan QRSec + PASS
@ -24,7 +24,7 @@ sudo cat /dev/ttyACM0 | while read line; do
echo "__SUB:tag_READ.sh: SCAN /dev/ttyACM0 ($lon) :: $line" echo "__SUB:tag_READ.sh: SCAN /dev/ttyACM0 ($lon) :: $line"
if [[ $inet == 'ipns' ]]; then if [[ $inet == 'ipns' ]]; then
xdg-open "http://127.0.0.1:8080/ipns/$hash" & xdg-open "$myIPFS/ipns/$hash" &
fi fi
if [[ $lon != 43 && $lon != 44 ]]; then if [[ $lon != 43 && $lon != 44 ]]; then
@ -39,7 +39,7 @@ sudo cat /dev/ttyACM0 | while read line; do
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 ) PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
echo "ASTRONAUTE $PLAYER : Ŋ1 exploration" echo "ASTRONAUTE $PLAYER : Ŋ1 exploration"
PLAYERNS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1) PLAYERNS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
echo "MOA : http://127.0.0.1:8080/ipns/$PLAYERNS" echo "MOA : $myIPFS/ipns/$PLAYERNS"
## Lancer vlc_webcam ## Lancer vlc_webcam
## Ajouter vlog au TW ## Ajouter vlog au TW
@ -96,7 +96,7 @@ sudo cat /dev/ttyACM0 | while read line; do
# La Clef IPNS porte comme nom G1PUB. # La Clef IPNS porte comme nom G1PUB.
sed -i "s~_MOAKEY_~${G1PUB}~g" ~/.zen/game/world/$G1PUB/index.html sed -i "s~_MOAKEY_~${G1PUB}~g" ~/.zen/game/world/$G1PUB/index.html
sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${IPNSK}~g" ~/.zen/game/world/$G1PUB/index.html sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${IPNSK}~g" ~/.zen/game/world/$G1PUB/index.html
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/world/$G1PUB/index.html sed -i "s~ipfs.infura.io~${myTUBE}~g" ~/.zen/game/world/$G1PUB/index.html
IPUSH=$(ipfs add -Hq ~/.zen/game/world/$G1PUB/index.html | tail -n 1) IPUSH=$(ipfs add -Hq ~/.zen/game/world/$G1PUB/index.html | tail -n 1)
ipfs name publish --key=${G1PUB} /ipfs/$IPUSH 2>/dev/null ipfs name publish --key=${G1PUB} /ipfs/$IPUSH 2>/dev/null
@ -111,13 +111,13 @@ sudo cat /dev/ttyACM0 | while read line; do
if [[ ! -f ~/.zen/game/world/.gchange.$G1PUB ]] if [[ ! -f ~/.zen/game/world/.gchange.$G1PUB ]]
then then
echo "CREATION ANNONCE CROWDFUNDING" echo "CREATION ANNONCE CROWDFUNDING"
echo $MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/tmp/secret.dunikey -n "https://data.gchange.fr" setoffer -t "${TITLE} #ASTROMIZ" -d "http://127.0.0.1:8080/ipns/$RESSOURCENS - Gratitude Astronaute $PLAYER" -p $HOME/.zen/Astroport.ONE/images/moa_net.png echo $MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/tmp/secret.dunikey -n "$myDATA" setoffer -t "${TITLE} #ASTROMIZ" -d "$myIPFS/ipns/$RESSOURCENS - Gratitude Astronaute $PLAYER" -p $HOME/.zen/Astroport.ONE/images/moa_net.png
# echo $GOFFER > ~/.zen/game/world/.gchange.$G1PUB # echo $GOFFER > ~/.zen/game/world/.gchange.$G1PUB
fi fi
## OPEN ## OPEN
echo "OUVERTURE TW" echo "OUVERTURE TW"
xdg-open "http://127.0.0.1:8080/ipns/$IPNSK" & xdg-open "$myIPFS/ipns/$IPNSK" &
done done

View File

@ -7,14 +7,15 @@
# Activate SUPPORT MODE: open ssh over IPFS # Activate SUPPORT MODE: open ssh over IPFS
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
. "$MY_PATH/my.sh"
######################################################################## ########################################################################
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || er+=" ipfs daemon not running" YOU=$(myIpfsApi) || er+=" ipfs daemon not running"
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) || er+=" ipfs id problem" IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) || er+=" ipfs id problem"
[[ "$YOU" == "" || "$IPFSNODEID" == "" ]] && echo "ERROR : $er " && exit 1 [[ "$YOU" == "" || "$IPFSNODEID" == "" ]] && echo "ERROR : $er " && exit 1
######################################################################## ########################################################################
# Make Station publish SSH port on "/x/ssh-$(hostname)" # Make Station publish SSH port on "/x/ssh-$(hostname)"
zuid="$(hostname)" zuid="$(hostname -f)"
if [[ $zuid ]] if [[ $zuid ]]
then then
if [[ ! $(cat ~/.ssh/authorized_keys | grep "fred@ONELOVE") ]] if [[ ! $(cat ~/.ssh/authorized_keys | grep "fred@ONELOVE") ]]

View File

@ -6,9 +6,8 @@
######################################################################## ########################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
. "$MY_PATH/my.sh"
ME="${0##*/}" ME="${0##*/}"
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
echo ' echo '
######################################################################## ########################################################################
@ -23,7 +22,7 @@ mail="$1" # EMAIL DESTINATAIRE
messfile="$2" # FICHIER A AJOUTER AU CORPS MESSAGE messfile="$2" # FICHIER A AJOUTER AU CORPS MESSAGE
SUBJECT="[(♥‿‿♥)] Station Astroport : $(hostname)" SUBJECT="[(♥‿‿♥)] Station Astroport : $(hostname -f)"
MESSAGE="( ◕‿◕)\n\n Bonjour $PLAYER\n\n UN MESSAGE POUR VOUS.\n\nAstroport\n/ipns/$IPFSNODEID" MESSAGE="( ◕‿◕)\n\n Bonjour $PLAYER\n\n UN MESSAGE POUR VOUS.\n\nAstroport\n/ipns/$IPFSNODEID"
echo " echo "

View File

@ -1,204 +1,332 @@
#shellcheck shell=sh disable=SC2034 #shellcheck shell=sh disable=SC2034
Normalize() {
awk '{print tolower($1)}' | sed 's/\(_\|+\)/./g;'
}
Revert() {
awk -F. '{for (i=NF; i>1; i--) printf("%s.",$i); print $1;}'
}
isLan() { isLan() {
isLan=$(ip route |awk '$1 == "default" {print $3}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/" \ local isLan=$(ip route |awk '$1 == "default" {print $3}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/" \
|| route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/" \ || route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/" \
|| true) || true)
[ -n "$isLan" ] && echo "$isLan" || true [ -n "$isLan" ] && echo "$isLan" || true
} 2>/dev/null } 2>/dev/null
isPlayerLegal() { isPlayerLegal() {
isPlayerLegal=$(cat "$(myPlayerPath)"/.legal 2>/dev/null || true) local isPlayerLegal=$(cat "$(myPlayerPath)"/.legal 2>/dev/null || true)
[ -n "$isPlayerLegal" ] && echo "$isPlayerLegal" || true [ -n "$isPlayerLegal" ] && echo "$isPlayerLegal" || true
} }
myAstronauteKey() { myAstroKey() {
myAstronauteKey=$(ipfs --api "$(myIpfsApi)" key list -l | awk '$2 == "'"$(myPlayer)"'" {print $1}') local myAstroKey=$(ipfs --api "$(myIpfsApi)" key list -l | awk '$2 == "'"$(myPlayer)"'" {print $1}')
[ -n "$myAstronauteKey" ] && echo "$myAstronauteKey" [ -n "$myAstroKey" ] && echo "$myAstroKey"
}
myAstroPath() {
local myAstroPath=$(cd ~/.zen/Astroport.ONE/ && pwd -P)
[ -n "$myAstroPath" ] && echo "$myAstroPath"
}
myDate() {
local myDate=$(date -u +"%Y%m%d%H%M%S%4N")
[ -n "$myDate" ] && echo "$myDate"
} }
myDomainName() { myDomainName() {
myDomainName=$(hostname -d 2>/dev/null) && [ -z "$myDomainName" ] && myDomainName=$(domainname 2>/dev/null) && [ "$myDomainName" = "(none)" ] && myDomainName="localhost" local myDomainName=$(hostname -d 2>/dev/null) && [ -z "$myDomainName" ] && myDomainName=$(domainname 2>/dev/null) && [ "$myDomainName" = "(none)" ] && myDomainName="localhost"
[ -n "$myDomainName" ] && echo "$myDomainName" [ -n "$myDomainName" ] && echo "$myDomainName"
} }
myIpfsHash() {
[ -f "$(myPath)"/localhost/latest ] \
&& myIpfsHash=$(cat "$(myPath)"/localhost/latest) \
|| myIpfsHash=$(myTmpl |ipfs add -q)
[ ! -f "$(myPath)"/localhost/latest ] \
&& echo "$myIpfsHash" > "$(myPath)"/localhost/latest
[ -n "$myIpfsHash" ] && echo "$myIpfsHash"
}
myHttp() { myHttp() {
[ -n "$(myHttpHeader)" ] \ [ -n "$(myHttpHeader)" ] \
&& myHttp="$(myHttpHeader) && local myHttp="$(myHttpHeader)
" || myHttp="" " || local myHttp=""
[ -n "$(myHttpContent)" ] \ [ -n "$(myHttpContent)" ] && myHttp="${myHttp}$(myHttpContent)"
&& myHttp="${myHttp}$(myHttpContent)" [ -n "$myHttp" ] && echo "$myHttp"
[ -n "$myHttp" ] \
&& echo "$myHttp"
} }
myHttpContent() { myHttpContent() {
[ -n "$(myIpfsHash)" ] \ [ -n "$(myIpfsHash)" ] \
&& myHttpContent="<html><head><title>302 Found</title></head><body><h1>Found</h1> && local myHttpContent="<html><head><title>302 Found</title></head><body><h1>Found</h1>
<p>The document is <a href=\"ipfs/$(myIpfsHash)\">here</a> in IPFS.</p></body></html>" \ <p>The document is <a href=\"ipfs/$(myIpfsHash)\">here</a> in IPFS.</p></body></html>" \
&& echo "$myHttpContent" && echo "$myHttpContent"
} }
myHttpHeader() { myHttpHeader() {
[ -n "$(myIpfsHash)" ] \ [ -n "$(myIpfsHash)" ] \
&& myHttpHeader="HTTP/1.0 302 Found && local myHttpHeader="HTTP/1.0 302 Found
Content-Type: text/html; charset=UTF-8 Content-Type: text/html; charset=UTF-8
Content-Length: $(myHttpContent |wc -c) Content-Length: $(myHttpContent |wc -c)
Date: $(date -R) Date: $(date -R)
Location: ipfs/$(myIpfsHash) Location: ipfs/$(myIpfsHash)
Server: and" Server: and" \
[ -n "$(myIpfsKey)" ] && myHttpHeader="${myHttpHeader} && [ -n "$(myIpfsKey)" ] && myHttpHeader="${myHttpHeader}
set-cookie: AND=$(myIpfsKey); expires=$(date -R -d "+1 month"); path=/; domain=.$(myDomainName); Secure; SameSite=lax" set-cookie: AND=$(myIpfsKey); expires=$(date -R -d "+1 month"); path=/; domain=.$(myDomainName); Secure; SameSite=lax"
[ -n "$myHttpHeader" ] && echo "$myHttpHeader" [ -n "$myHttpHeader" ] && echo "$myHttpHeader"
} }
myHome() { myHome() {
myHome=$(cd ~ && pwd -P) local myHome=$(cd ~ && pwd -P)
[ -n "$myHome" ] && echo "$myHome" [ -n "$myHome" ] && echo "$myHome"
} }
myHostName() { myHostName() {
myHostName=$(hostname |sed 's/\.'"$(myDomainName)"'$//') local myHostName=$(hostname |sed 's/\.'"$(myDomainName)"'$//')
[ -n "$(myDomainName)" ] && myHostName="${myHostName}.$(myDomainName)" || myDomainName=${myHostName#*.} [ -n "$(myDomainName)" ] && myHostName="${myHostName}.$(myDomainName)" || myDomainName=${myHostName#*.}
[ -n "$myHostName" ] && echo "$myHostName" [ -n "$myHostName" ] && echo "$myHostName"
} }
myIp() { myIp() {
myIp=$(hostname -I | awk '{print $1}' | head -n 1) local myIp=$(hostname -I | awk '{print $1}' | head -n 1)
[ -n "$myIp" ] && echo "$myIp" [ -n "$myIp" ] && echo "$myIp" || echo "127.0.0.1"
} }
myIpfs() { myIpfs() {
[ -n "$(myIpfsHash)" ] \ [ -n "$(myIpfsHash)" ] \
&& myIpfs="${myIPFS}/ipfs/$(myIpfsHash)" \ && local myIpfs="${myIPFS}/ipfs/$(myIpfsHash)" \
&& echo "$myIpfs" && echo "$myIpfs"
} }
myIpfsApi() { myIpfsApi() {
ipfs --api "$(cat "$(myHome)"/.ipfs/api)" swarm peers >/dev/null 2>&1 \ ipfs --api "$(cat "$(myHome)"/.ipfs/api)" swarm peers >/dev/null 2>&1 \
&& myIpfsApi=$(cat "$(myHome)"/.ipfs/api) \ && local myIpfsApi=$(cat "$(myHome)"/.ipfs/api)
&& echo "$myIpfsApi" [ -n "$myIpfsApi" ] && echo "$myIpfsApi"
}
myIpfsApiGw() {
[ -n "$isLAN" ] \
&& local myIpfsApiGw="http://ipfs.localhost:5001" \
|| local myIpfsApiGw="https://ipfs.$(myHostName)/api"
[ -n "$myIpfsApiGw" ] && echo "$myIpfsApiGw"
}
myIpfsBootstrapNode() {
[ -n "$(myIpfsBootstrapNodes)" ] \
&& local myIpfsBootstrapNode=$(myIpfsBootstrapNodes | shuf | head -1)
[ -n "$myIpfsBootstrapNode" ] && echo "$myIpfsBootstrapNode"
}
myIpfsBootstrapNodes() {
[ -f "$(myAstroPath)/A_boostrap_nodes.txt" ] \
&& local myIpfsBootstrapNodes=$(awk -F/ '$6 != "" {print}' "$(myAstroPath)/A_boostrap_nodes.txt")
[ -n "$myIpfsBootstrapNodes" ] && echo "$myIpfsBootstrapNodes"
}
myIpfsGw() {
[ -f "$(myAstroPath)/A_boostrap_nodes.txt" ] \
&& local myIpfsGw=$(head -n2 "$(myAstroPath)/A_boostrap_nodes.txt" | tail -n 1 | cut -d ' ' -f 2)
[ -n "$myIpfsGw" ] && echo "$myIpfsGw"
}
myIpfsHash() {
[ -f "$(myPath)"/localhost/latest ] \
&& local myIpfsHash=$(cat "$(myPath)"/localhost/latest) \
|| local myIpfsHash=$(myHtml |ipfs add -q)
[ ! -f "$(myPath)"/localhost/latest ] \
&& echo "$myIpfsHash" > "$(myPath)"/localhost/latest
[ -n "$myIpfsHash" ] && echo "$myIpfsHash"
} }
myIpfsKey() { myIpfsKey() {
myIpfsKey=$(ipfs --api "$(myIpfsApi)" key list -l | awk '$2 == "self" {print $1}') local myIpfsKey=$(ipfs --api "$(myIpfsApi)" key list -l | awk '$2 == "self" {print $1}')
[ -n "$myIpfsKey" ] && echo "$myIpfsKey" [ -n "$myIpfsKey" ] && echo "$myIpfsKey"
} }
myIpfsKeystore() { myIpfsKeystore() {
myIpfsKeystore=$(cd "$(myHome)"/.ipfs/keystore && pwd -P) local myIpfsKeystore=$(cd "$(myHome)"/.ipfs/keystore && pwd -P)
[ -n "$myIpfsKeystore" ] && echo "$myIpfsKeystore" [ -n "$myIpfsKeystore" ] && echo "$myIpfsKeystore"
} }
myIpfsPeerId() { myIpfsPeerId() {
myIpfsPeerId=$(jq -r .Identity.PeerID "$(myHome)"/.ipfs/config) local myIpfsPeerId=$(jq -r .Identity.PeerID "$(myHome)"/.ipfs/config)
[ -n "$myIpfsPeerId" ] && echo "$myIpfsPeerId" [ -n "$myIpfsPeerId" ] && echo "$myIpfsPeerId"
} }
myIpns() { myIpns() {
[ -n "$(myIpfsKey)" ] \ [ -n "$(myIpfsKey)" ] \
&& myIpns="${myIPFS}/ipns/$(myIpfsKey)" \ && local myIpns="${myIPFS}/ipns/$(myIpfsKey)" \
&& echo "$myIpns" && echo "$myIpns"
} }
myPath() { myPath() {
myPath=$(cd ~/.zen/game/players/ && pwd -P) local myPath=$(cd ~/.zen/game/players/ && pwd -P)
[ -n "$myPath" ] && echo "$myPath" [ -n "$myPath" ] && echo "$myPath"
} }
myPlayer() { myPlayer() {
myPlayer=$(cat "$(myPath)"/.current/.player 2>/dev/null) local myPlayer=$(cat "$(myPath)"/.current/.player 2>/dev/null)
[ -n "$myPlayer" ] && echo "$myPlayer" [ -n "$myPlayer" ] && echo "$myPlayer"
} }
myPlayerApi() { myPlayerApi() {
ipfs --api "$(cat "$(myPlayerPath)"/.ipfs/api )" swarm peers >/dev/null 2>&1 \ ipfs --api "$(cat "$(myPlayerPath)"/.ipfs/api )" swarm peers >/dev/null 2>&1 \
&& myPlayerApi=$(cat "$(myPlayerPath)"/.ipfs/api) \ && local myPlayerApi=$(cat "$(myPlayerPath)"/.ipfs/api)
&& echo "$myPlayerApi" [ -n "$myPlayerApi" ] && echo "$myPlayerApi"
} }
myPlayerBrowser() { myPlayerApiGw() {
myPlayerBrowser=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1) [ -n "$(myReyalp)" ] \
[ -n "$myPlayerBrowser" ] && echo "$myPlayerBrowser" && { [ -n "$isLAN" ] \
&& local myPlayerApiGw="http://ipfs.$(myHostName):5001" \
|| local myPlayerApiGw="https://ipfs.$(myReyalp).$(myHostName)/api" \
;}
[ -n "$myPlayerApiGw" ] && echo "$myPlayerApiGw"
}
myPlayerDomain() {
echo "$(myPlayer)" | grep "@" >/dev/null \
&& local myPlayerDomain=$(echo "$(myPlayer)" | awk -F "@" '{print $2}' | Normalize)
[ -n "$myPlayerDomain" ] && echo "$myPlayerDomain"
} }
myPlayerFeedKey() { myPlayerFeedKey() {
myPlayerFeedKey=$(ipfs --api "$(myPlayerApi)" key list -l | awk '$2 == "'"$(myPlayer)"'_feed" {print $1}') local myPlayerFeedKey=$(ipfs --api "$(myPlayerApi)" key list -l | awk '$2 == "'"$(myPlayer)"'_feed" {print $1}')
[ -n "$myPlayerFeedKey" ] && echo "$myPlayerFeedKey" [ -n "$myPlayerFeedKey" ] && echo "$myPlayerFeedKey"
} }
myPlayerG1Pub() { myPlayerG1Pub() {
myPlayerG1Pub=$(cat "$(myPlayerPath)"/.g1pub 2>/dev/null) local myPlayerG1Pub=$(cat "$(myPlayerPath)"/.g1pub 2>/dev/null)
[ -n "$myPlayerG1Pub" ] && echo "$myPlayerG1Pub" [ -n "$myPlayerG1Pub" ] && echo "$myPlayerG1Pub"
} }
myPlayerHome() {
echo "$(myPlayer)" | grep "@" >/dev/null \
&& local myPlayerHome=$(cd "$(dirname "$(myHome)")/$(myPlayer)" && pwd -P)
[ -n "$myPlayerHome" ] && echo "$myPlayerHome"
}
myPlayerKey() { myPlayerKey() {
myPlayerKey=$(ipfs --api "$(myPlayerApi)" key list -l | awk '$2 == "'"$(myPlayer)"'" {print $1}') local myPlayerKey=$(ipfs --api "$(myPlayerApi)" key list -l | awk '$2 == "'"$(myPlayer)"'" {print $1}')
[ -n "$myPlayerKey" ] && echo "$myPlayerKey" [ -n "$myPlayerKey" ] && echo "$myPlayerKey"
} }
myPlayerKeystore() { myPlayerKeystore() {
myPlayerKeystore=$(cd "$(myPlayerPath)"/.ipfs/keystore && pwd -P) local myPlayerKeystore=$(cd "$(myPlayerPath)"/.ipfs/keystore && pwd -P)
[ -n "$myPlayerKeystore" ] && echo "$myPlayerKeystore" [ -n "$myPlayerKeystore" ] && echo "$myPlayerKeystore"
} }
myPlayerNs() { myPlayerNs() {
myPlayerNs=$(cat "$(myPlayerPath)"/.playerns 2>/dev/null) local myPlayerNs=$(cat "$(myPlayerPath)"/.playerns 2>/dev/null)
[ -n "$myPlayerNs" ] && echo "$myPlayerNs" [ -n "$myPlayerNs" ] && echo "$myPlayerNs"
} }
myPlayerPath() { myPlayerPath() {
[ -n "$myPlayer" ] \ [ -n "$(myPlayer)" ] \
&& myPlayerPath=$(cd "$(myPath)"/"$(myPlayer)" && pwd -P) \ && local myPlayerPath=$(cd "$(myPath)"/"$(myPlayer)" && pwd -P)
&& echo "$myPlayerPath" [ -n "$myPlayerPath" ] && echo "$myPlayerPath"
} }
myPlayerPseudo() { myPlayerPseudo() {
myPlayerPseudo=$(cat "$(myPlayerPath)"/.pseudo 2>/dev/null) local myPlayerPseudo=$(cat "$(myPlayerPath)"/.pseudo 2>/dev/null)
[ -n "$myPlayerPseudo" ] && echo "$myPseudo" [ -n "$myPlayerPseudo" ] && echo "$myPseudo"
} }
myTmpl() { myPlayerUser() {
myTmpl=$($RUN sed \ echo "$(myPlayer)" | grep "@" >/dev/null \
&& local myPlayerUser=$(echo "$(myPlayer)" | awk -F "@" '{print $1}' | Normalize)
[ -n "$myPlayerUser" ] && echo "$myPlayerUser"
}
myPlayerUserDomain() {
[ -n "$(myPlayerDomain)" ] \
&& local myPlayerUserDomain="$(myPlayerUser).$(myPlayerDomain)" \
&& echo "$myPlayerUserDomain"
}
myReyalp() {
[ -n "$(myPlayerDomain)" ] \
&& local myReyalp="$(myPlayerUser).$(myPlayerDomain)" \
&& echo "$myReyalp" \
|| echo "$(myPlayer)"
}
myReyalpHome() {
[ -n "$(myReyalpResuPath)" ] \
&& local myReyalpHome=$(cd "$(case ${RESU_HOME:-mail} in \
dns) echo /dns/$(myReyalpResuPath) ;; \
*) echo /home/$(myReyalpMail) ;; \
esac)" && pwd -P)
[ -n "$myReyalpHome" ] && echo "$myReyalpHome"
}
myReyalpMail() {
[ -n "$(myPlayerDomain)" ] \
&& local myReyalpMail=$(echo "$(myPlayer)" | Normalize)
[ -n "$myReyalpMail" ] && echo "$myReyalpMail"
}
myReyalpNiamod() {
[ -n "$(myPlayerDomain)" ] \
&& local myReyalpNiamod=$(echo "$(myPlayerDomain)" | Revert)
[ -n "$myReyalpNiamod" ] && echo "$myReyalpNiamod"
}
myReyalpResu() {
[ -n "$(myPlayerUser)" ] \
&& local myReyalpResu=$(echo "$(myPlayerUser)" | Revert)
[ -n "$myReyalpResu" ] && echo "$myReyalpResu"
}
myReyalpResuNiamod() {
[ -n "$(myReyalpNiamod)" ] \
&& local myReyalpResuNiamod="$(myReyalpNiamod).$(myReyalpResu)" \
&& echo "$myReyalpResuNiamod"
}
myReyalpResuPath() {
[ -n "$(myReyalpResuNiamod)" ] \
&& local myReyalpResuPath=$(echo "$(myReyalpResuNiamod)" | sed 's/\./\//g';)
[ -n "$myReyalpResuPath" ] && echo "$myReyalpResuPath"
}
myHtml() {
local myHtml=$($RUN sed \
-e "s~\"http://127.0.0.1:1234/\"~\"${myIPFS}/\"~g" \ -e "s~\"http://127.0.0.1:1234/\"~\"${myIPFS}/\"~g" \
-e "s~\"http://127.0.0.1:1234\"~\"${myASTROPORT}\"~g" \ -e "s~\"http://127.0.0.1:1234\"~\"${myASTROPORT}\"~g" \
-e "s~http://127.0.0.1:8080~${myIPFS}~g" \ -e "s~http://127.0.0.1:8080~${myIPFS}~g" \
-e "s~http://127.0.0.1:12345~http://${myHOST}:12345~g" \ -e "s~http://127.0.0.1:12345~http://${myHOST}:12345~g" \
-e "s~https://ipfs.copylaradio.com~${myIPFSGW}~g" \
-e "s~_IPFSNODEID_~${IPFSNODEID}~g" \ -e "s~_IPFSNODEID_~${IPFSNODEID}~g" \
-e "s~_HOSTNAME_~$(hostname)~g" \ -e "s~_HOSTNAME_~$(hostname)~g" \
-e "s~.000.~.$(printf '%03d' "$(seq 0 17 |shuf -n 1)").~g" \ -e "s~.000.~.$(printf '%03d' "$(seq 0 17 |shuf -n 1)").~g" \
~/.zen/Astroport.ONE/templates/register.html) ~/.zen/Astroport.ONE/templates/register.html)
[ -n "$isLAN" ] \ [ -z "$isLAN" ] \
&& myTmpl=$($RUN echo "$myTmpl" | sed \ || myHtml=$($RUN echo "$myHtml" | sed \
-e "s~<input type='"'hidden'"' name='"'salt'"' value='"'0'"'>~<input name='"'salt'"' value='"''"'>~g" \ -e "s~<input type='"'hidden'"' name='"'salt'"' value='"'0'"'>~<input name='"'salt'"' value='"''"'>~g" \
-e "s~<input type='"'hidden'"' name='"'pepper'"' value='"'0'"'>~<input name='"'pepper'"' value='"''"'>~g") -e "s~<input type='"'hidden'"' name='"'pepper'"' value='"'0'"'>~<input name='"'pepper'"' value='"''"'>~g")
[ -n "$myTmpl" ] && echo "$myTmpl" [ -n "$myHtml" ] && echo "$myHtml"
} }
myTs() { myTs() {
myTs=$(date -u +"%Y%m%d%H%M%S%4N") local myTs=$(date +%s)
[ -n "$myTs" ] && echo "$myTs" [ -n "$myTs" ] && echo "$myTs"
} }
MOATS="$(myTs)" myTube() {
[ -f "$(myAstroPath)/A_boostrap_nodes.txt" ] \
&& local myTube=$(head -n2 "$(myAstroPath)/A_boostrap_nodes.txt" | tail -n 1 | cut -d ' ' -f 3)
[ -n "$myTube" ] && echo "$myTube"
}
IPFSNODEID="$(myIpfsPeerId)" IPFSNODEID="$(myIpfsPeerId)"
myIP="$(myIp)" MOATS="$(myDate)"
isLAN="$(isLan)" isLAN="$(isLan)"
myHOST="astroport.$(myDomainName)" \
myIPFS="http://ipfs.$(myDomainName):8080" \
myASTROPORT="http://astroport.$(myDomainName):1234" myASTROPORT="http://astroport.$(myDomainName):1234"
myAPI="http://ipfs.$(myDomainName):5001"
myDATA="https://data.gchange.fr"
myGCHANGE="https://www.gchange.fr"
myHOST="astroport.$(myDomainName)"
myIP="$(myIp)"
myIPFS="http://ipfs.$(myDomainName):8080"
myIPFSGW="$(myIpfsGw)"
myTUBE="$(myTube)"
## WAN STATION ## WAN STATION
[ -z "$isLAN" ] \ [ -z "$isLAN" ] \
&& myHOST="astroport.$(myHostName)" \ && myASTROPORT="https://astroport.$(myDomainName)" \
&& myAPI="https://ipfs.$(myHostName)" \
&& myIPFS="https://ipfs.$(myDomainName)" \ && myIPFS="https://ipfs.$(myDomainName)" \
&& myASTROPORT="https://astroport.$(myDomainName)" && myHOST="astroport.$(myHostName)"

View File

@ -11,24 +11,19 @@ start=`date +%s`
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
. "$MY_PATH/my.sh"
ME="${0##*/}" ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l) countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0 [[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); YOU=$(myIpfsApi);
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
[[ ! $IPFSNODEID ]] && echo 'ERROR missing IPFS Node id !! IPFS is not responding !?' && exit 1 [[ ! $IPFSNODEID ]] && echo 'ERROR missing IPFS Node id !! IPFS is not responding !?' && exit 1
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
alias zenity='zenity 2> >(grep -v GtkDialog >&2)' alias zenity='zenity 2> >(grep -v GtkDialog >&2)'
# ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/Astroport/kodi/vstream/${PREFIX}ASTRXBIAN # ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/Astroport/kodi/vstream/${PREFIX}ASTRXBIAN
# Astropot/Kodi/Vstream source reads ${PREFIX}ASTRXBIAN from http://${myIP}:8080/.$IPFNODEID/ # Astropot/Kodi/Vstream source reads ${PREFIX}ASTRXBIAN from $myIPFS/.$IPFNODEID/
# Index File Format (could be enhanced) is using Kodi TMDB enhancement # Index File Format (could be enhanced) is using Kodi TMDB enhancement
# https://github.com/Kodi-vStream/venom-xbmc-addons/wiki/Voir-et-partager-sa-biblioth%C3%A8que-priv%C3%A9e#d%C3%A9clarer-des-films # https://github.com/Kodi-vStream/venom-xbmc-addons/wiki/Voir-et-partager-sa-biblioth%C3%A8que-priv%C3%A9e#d%C3%A9clarer-des-films
######################################################################## ########################################################################
@ -46,7 +41,7 @@ fi
# Add trailing / if needed # Add trailing / if needed
length=${#path} length=${#path}
last_char=${path:length-1:1} last_char=${path:length-1:1}
[[ $last_char != "/" ]] && path="$path/"; : [[ $last_char != "/" ]] && path="$path/" || true
file="$2" file="$2"
@ -358,7 +353,7 @@ cp ~/Astroport/${TyPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json "$HOME/.zen/game/p
## TODO : Do we keep that ? ## TODO : Do we keep that ?
# echo "SEND TW LINK to GCHANGE MESSAGE" # echo "SEND TW LINK to GCHANGE MESSAGE"
[[ $3 ]] && ~/.zen/Astroport.ONE/tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://data.gchange.fr" send -d "$3" -t "${TITLE} ${MEDIAKEY}" -m "MEDIA : https://ipfs.copylaradio.com/ipfs/${IPFSREPFILEID}" [[ $3 ]] && ~/.zen/Astroport.ONE/tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "$myDATA" send -d "$3" -t "${TITLE} ${MEDIAKEY}" -m "MEDIA : $myIPFSGW/ipfs/${IPFSREPFILEID}"
# Couldl be used by caroussel.html template # Couldl be used by caroussel.html template
# CAROUSSEL=$(ipfs add -wq ~/Astroport/${TyPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json | head-n 1) # CAROUSSEL=$(ipfs add -wq ~/Astroport/${TyPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json | head-n 1)
@ -372,13 +367,13 @@ fi
######################################################################## ########################################################################
## COPY LOCALHOST IPFS URL TO CLIPBOARD ## COPY LOCALHOST IPFS URL TO CLIPBOARD
[[ $(which xclip) ]] &&\ [[ $(which xclip) ]] &&\
echo "http://${myIP}:8080/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME" | xclip -selection c echo "$myIPFS/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME" | xclip -selection c
######################################################################## ########################################################################
######################################################################## ########################################################################
# echo "DUNIKEY PASS $PASS" # echo "DUNIKEY PASS $PASS"
echo "NEW $TyPE ($file) ADDED. http://${myIP}:8080/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME" echo "NEW $TyPE ($file) ADDED. $myIPFS/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME"
echo "VIDEO IPNS LINK : http://${myIP}:8080/ipns/$KEY/$G1PUB/ = Create 'G1${CAT}.sh' to adapt 20H12 Ŋ1 process" echo "VIDEO IPNS LINK : $myIPFS/ipns/$KEY/$G1PUB/ = Create 'G1${CAT}.sh' to adapt 20H12 Ŋ1 process"
echo "#### EXCECUTION TIME" echo "#### EXCECUTION TIME"
end=`date +%s` end=`date +%s`
dur=`expr $end - $start` dur=`expr $end - $start`

View File

@ -8,12 +8,12 @@
######## #### ### ## # ######## #### ### ## #
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
. "$MY_PATH/my.sh"
ME="${0##*/}" ME="${0##*/}"
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); YOU=$(myIpfsApi)
IPFSNODEID=$(ipfs id -f='<id>\n')
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
# GET XZUID # GET XZUID
[[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title) || XZUID=$(cat /etc/hostname) [[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title) || XZUID=$(hostname -f)
######################################################################## ########################################################################
path="$1" path="$1"
# Add trailing / if needed # Add trailing / if needed
@ -23,7 +23,7 @@ last_char=${path:length-1:1}
file="$2" file="$2"
echo "~/.zen/astrXbian/zen/new_mp3_in_astroport.sh PATH/ \"$path\" FILE \"$file\"" echo "$0 PATH/ \"$path\" FILE \"$file\""
[[ ! -f "${path}${file}" ]] && echo "Fichier introuvable ... EXIT" && exit 1 [[ ! -f "${path}${file}" ]] && echo "Fichier introuvable ... EXIT" && exit 1
echo '#### NEED REWRITING #####' && exit 0 echo '#### NEED REWRITING #####' && exit 0

View File

@ -6,7 +6,7 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" . "$MY_PATH/my.sh"
PLAYER="$1" PLAYER="$1"
@ -20,14 +20,8 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
[[ ! $ASTRONAUTENS ]] && echo "${PLAYER} CLEF IPNS INTROUVABLE - EXIT -" && exit 1 [[ ! $ASTRONAUTENS ]] && echo "${PLAYER} CLEF IPNS INTROUVABLE - EXIT -" && exit 1
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); YOU=$(myIpfsApi)
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) LIBRA=$(myIpfsGw)
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
mkdir -p ~/.zen/game/players/${PLAYER}/vlog mkdir -p ~/.zen/game/players/${PLAYER}/vlog
@ -51,7 +45,7 @@ espeak "Hello"
if [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.pubkey ]]; then if [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.pubkey ]]; then
espeak "Getting player latest TW. please wait." espeak "Getting player latest TW. please wait."
## GETTING LAST TW via IPFS or HTTP GW ## GETTING LAST TW via IPFS or HTTP GW
[[ $YOU ]] && echo "http://$myIP:8080/ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 12s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/vlc_webcam.html [[ $YOU ]] && echo "$myIPFS/ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 12s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/vlc_webcam.html
[[ ! -s ~/.zen/tmp/vlc_webcam.html ]] && echo "$LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/tmp/vlc_webcam.html "$LIBRA/ipns/${ASTRONAUTENS}" [[ ! -s ~/.zen/tmp/vlc_webcam.html ]] && echo "$LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/tmp/vlc_webcam.html "$LIBRA/ipns/${ASTRONAUTENS}"
[[ ! -s ~/.zen/tmp/vlc_webcam.html ]] && espeak "WARNING. impossible to find your TW online" [[ ! -s ~/.zen/tmp/vlc_webcam.html ]] && espeak "WARNING. impossible to find your TW online"
[[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ]] && espeak "FATAL ERROR. No local copy found !" && exit 1 [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ]] && espeak "FATAL ERROR. No local copy found !" && exit 1
@ -119,7 +113,7 @@ mv ~/.zen/game/players/${PLAYER}/vlog/${MOATS}.index.html ~/.zen/game/players/${
IPFSROOT=$(ipfs add -rHq ~/.zen/game/players/${PLAYER}/vlog | tail -n 1) IPFSROOT=$(ipfs add -rHq ~/.zen/game/players/${PLAYER}/vlog | tail -n 1)
echo $IPFSROOT > ~/.zen/game/players/${PLAYER}/.vlog.index echo $IPFSROOT > ~/.zen/game/players/${PLAYER}/.vlog.index
echo "NEW VIDEO http://$myIP:8080/ipfs/$IPFSROOT" echo "NEW VIDEO $myIPFS/ipfs/$IPFSROOT"
########################### ###########################
## AJOUT VIDEO ASTROPORT TW ## AJOUT VIDEO ASTROPORT TW
@ -165,7 +159,7 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
rm -f ~/.zen/tmp/newindex.html rm -f ~/.zen/tmp/newindex.html
echo "Nouveau TID dans TW ${PSEUDO} : http://$myIP:8080/ipns/$ASTRONAUTENS" echo "Nouveau TID dans TW ${PSEUDO} : $myIPFS/ipns/$ASTRONAUTENS"
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \ tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
--import ~/.zen/game/players/${PLAYER}/vlog/${MEDIAKEY}.dragdrop.json "application/json" \ --import ~/.zen/game/players/${PLAYER}/vlog/${MEDIAKEY}.dragdrop.json "application/json" \
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain" --output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
@ -188,10 +182,10 @@ echo "PLAYER TW Update..."
espeak "Hip Hip Hip Hurray" espeak "Hip Hip Hip Hurray"
xdg-open "http://$myIP:8080/ipns/$ASTRONAUTENS/#:[days:created[-1]tag[G1Vlog]]" xdg-open "$myIPFS/ipns/$ASTRONAUTENS/#:[days:created[-1]tag[G1Vlog]]"
echo "================================================" echo "================================================"
echo "${PLAYER} : http://$myIP:8080/ipns/$ASTRONAUTENS/#:[days:created[-1]tag[G1Vlog]]" echo "${PLAYER} : $myIPFS/ipns/$ASTRONAUTENS/#:[days:created[-1]tag[G1Vlog]]"
echo "================================================" echo "================================================"
echo echo
else else
@ -199,7 +193,7 @@ else
echo "Une erreur est survenue lors de l'ajout du tiddler VLOG à votre TW" echo "Une erreur est survenue lors de l'ajout du tiddler VLOG à votre TW"
fi fi
echo "${PSEUDO} TW VLOG : http://$myIP:8080/ipns/$ASTRONAUTENS/#VLOG_${MEDIAID}" echo "${PSEUDO} TW VLOG : $myIPFS/ipns/$ASTRONAUTENS/#VLOG_${MEDIAID}"
# ~/.zen/astrXbian/zen/new_file_in_astroport.sh "$HOME/Astroport/video/${MEDIAID}/" "output.mp4" "$G1PUB" # ~/.zen/astrXbian/zen/new_file_in_astroport.sh "$HOME/Astroport/video/${MEDIAID}/" "output.mp4" "$G1PUB"