From 892f215a934a5e7cae7c0af36187eadb66f157c6 Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 5 Nov 2022 13:55:02 +0100 Subject: [PATCH] myIP=$(hostname -I | awk '{print $1}' | head -n 1) isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") [[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" --- ASTROBOT/G1Voeu.sh | 5 ++++- ASTROBOT/PLAYER.refresh.sh | 4 +++- ASTROBOT/VOEUX.create.sh | 2 ++ ASTROBOT/VOEUX.refresh.sh | 2 ++ _12345.sh | 10 +++++++--- adventure/rooms/gameroom.sh | 3 ++- ajouter_media.sh | 2 ++ start.sh | 2 ++ tools/Connect_PLAYER_To_Gchange.sh | 2 ++ tools/VISA.new.sh | 2 ++ tools/VOEUX.print.sh | 5 ++++- tools/new_file_in_astroport.sh | 3 ++- tools/vlc_webcam.sh | 2 ++ 13 files changed, 36 insertions(+), 8 deletions(-) diff --git a/ASTROBOT/G1Voeu.sh b/ASTROBOT/G1Voeu.sh index b18be5f5..05e5c805 100755 --- a/ASTROBOT/G1Voeu.sh +++ b/ASTROBOT/G1Voeu.sh @@ -63,7 +63,10 @@ echo [[ -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 ;) - myIP=$(hostname -I | awk '{print $1}' | head -n 1) +myIP=$(hostname -I | awk '{print $1}' | head -n 1) +isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" + echo " Passerelle : $myIP" echo "# UPGRADING WORLD WHISHKEY DATABASE" diff --git a/ASTROBOT/PLAYER.refresh.sh b/ASTROBOT/PLAYER.refresh.sh index a815dfa3..b15e5824 100755 --- a/ASTROBOT/PLAYER.refresh.sh +++ b/ASTROBOT/PLAYER.refresh.sh @@ -40,7 +40,9 @@ for PLAYER in $(ls -t ~/.zen/game/players/); do rm -Rf ~/.zen/tmp/${PLAYER} mkdir -p ~/.zen/tmp/${PLAYER} - myIP=$(hostname -I | awk '{print $1}' | head -n 1) +myIP=$(hostname -I | awk '{print $1}' | head -n 1) +isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" echo "Getting latest online TW..." YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); diff --git a/ASTROBOT/VOEUX.create.sh b/ASTROBOT/VOEUX.create.sh index 6f89f39a..cb20fbcb 100755 --- a/ASTROBOT/VOEUX.create.sh +++ b/ASTROBOT/VOEUX.create.sh @@ -23,6 +23,8 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1) [[ ! $ASTRONAUTENS ]] && echo "$PLAYER IPNS INTROUVABLE" && exit 1 myIP=$(hostname -I | awk '{print $1}' | head -n 1) +isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" ## EXPORT [tag[voeu]] echo "## EXTRACTION DE NOUVEAUX VOEUX pour $PLAYER TW" diff --git a/ASTROBOT/VOEUX.refresh.sh b/ASTROBOT/VOEUX.refresh.sh index 09a99021..9dd0426d 100755 --- a/ASTROBOT/VOEUX.refresh.sh +++ b/ASTROBOT/VOEUX.refresh.sh @@ -23,6 +23,8 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1) 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=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" mkdir -p ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS} diff --git a/_12345.sh b/_12345.sh index fc8f1bd6..be285f7a 100755 --- a/_12345.sh +++ b/_12345.sh @@ -9,10 +9,10 @@ # Then publish map of json DApp data # MOATS=$(date -u +"%Y%m%d%H%M%S%4N") -echo "${MOATS}" > ~/.zen/tmp/swarm/${IPFSNODEID}/.moats -IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) +PFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) myIP=$(hostname -I | awk '{print $1}' | head -n 1) -[[ ! $myIP ]] && myIP="127.0.1.1" +isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" PORT=12345 @@ -24,8 +24,12 @@ ncrunning=$(ps auxf --sort=+utime | grep -w 'nc -l -p 12345' | grep -v -E 'color ## RESET MEMORY rm -Rf ~/.zen/tmp/swarm/* +## NAME PUBLISH EMPTY !!! ipfs name publish --allow-offline /ipfs/Qmc5m94Gu7z62RC8waSKkZUrCCBJPyHbkpmGzEePxy2oXJ +mkdir -p ~/.zen/tmp/swarm/${IPFSNODEID} +echo "${MOATS}" > ~/.zen/tmp/swarm/${IPFSNODEID}/.moats + # REFRESH FROM BOOTSTRAP (COULD, SHOULD BE MY FRIENDS !) while true; do diff --git a/adventure/rooms/gameroom.sh b/adventure/rooms/gameroom.sh index 826855c6..2281039a 100755 --- a/adventure/rooms/gameroom.sh +++ b/adventure/rooms/gameroom.sh @@ -17,7 +17,8 @@ echo "y est raccordé... D'autres fils sortent de l'appareil. Une webcam. Une i echo echo "Que voulez vous faire?" myIP=$(hostname -I | awk '{print $1}' | head -n 1) -[[ ! $myIP ]] && myIP="127.0.1.1" +isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" while true; do read -p "> " nsewuh diff --git a/ajouter_media.sh b/ajouter_media.sh index bdabdb36..56482390 100755 --- a/ajouter_media.sh +++ b/ajouter_media.sh @@ -43,6 +43,8 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 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=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" URL="$1" if [ $URL ]; then diff --git a/start.sh b/start.sh index 57d81f31..7333aac9 100755 --- a/start.sh +++ b/start.sh @@ -7,6 +7,8 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized myIP=$(hostname -I | awk '{print $1}' | head -n 1) +isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" ME="${0##*/}" TS=$(date -u +%s%N | cut -b1-13) diff --git a/tools/Connect_PLAYER_To_Gchange.sh b/tools/Connect_PLAYER_To_Gchange.sh index 3ee9782c..15e95ed0 100755 --- a/tools/Connect_PLAYER_To_Gchange.sh +++ b/tools/Connect_PLAYER_To_Gchange.sh @@ -4,6 +4,8 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized myIP=$(hostname -I | awk '{print $1}' | head -n 1) +isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" ME="${0##*/}" ######################################################################### CONNECT PLAYER WITH GCHANGE diff --git a/tools/VISA.new.sh b/tools/VISA.new.sh index f1ab23cb..c5bb103f 100755 --- a/tools/VISA.new.sh +++ b/tools/VISA.new.sh @@ -22,6 +22,8 @@ LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d 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=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" ## LOCAL [[ ${PLAYER} ]] && ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1) diff --git a/tools/VOEUX.print.sh b/tools/VOEUX.print.sh index 235dac73..ac9a6c75 100755 --- a/tools/VOEUX.print.sh +++ b/tools/VOEUX.print.sh @@ -38,7 +38,10 @@ select voeu in "${vlist[@]}"; do voeu=$(echo $voeu | cut -d ':' -f2) ## Get G1PUB part TITLE=$(cat ~/.zen/game/world/$voeu/.pepper) ## Get Voeu title (pepper) = simple GUI form + Name collision => Voeu fusion - myIP=$(hostname -I | awk '{print $1}' | head -n 1) +myIP=$(hostname -I | awk '{print $1}' | head -n 1) +isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" + VOEUXNS=$(ipfs key list -l | grep $voeu | cut -d ' ' -f1) choices=("TW" "G1") diff --git a/tools/new_file_in_astroport.sh b/tools/new_file_in_astroport.sh index d2a1d8a9..abb7e801 100755 --- a/tools/new_file_in_astroport.sh +++ b/tools/new_file_in_astroport.sh @@ -21,7 +21,8 @@ IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) 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=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" # ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN # Astropot/Kodi/Vstream source reads ${PREFIX}ASTRXBIAN from http://${myIP}:8080/.$IPFNODEID/ diff --git a/tools/vlc_webcam.sh b/tools/vlc_webcam.sh index 5d6eaa7a..f2b34aed 100755 --- a/tools/vlc_webcam.sh +++ b/tools/vlc_webcam.sh @@ -26,6 +26,8 @@ LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d 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=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" mkdir -p ~/.zen/game/players/${PLAYER}/vlog