From d9b12f47af22fb22cfb60a5ff57bd660983fc889 Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 12 Nov 2022 15:19:42 +0100 Subject: [PATCH] IPFS & adventure correct --- adventure/adventure.sh | 18 ++++++++++-------- install.sh | 40 ---------------------------------------- tools/ipfs_setup.sh | 5 +++++ 3 files changed, 15 insertions(+), 48 deletions(-) diff --git a/adventure/adventure.sh b/adventure/adventure.sh index 8049ea9d..b3980f68 100755 --- a/adventure/adventure.sh +++ b/adventure/adventure.sh @@ -11,30 +11,32 @@ # Here we check to see if uuidgen is installed - if not it will default to single-user mode. To run this on a server # and support multipe-users, check you have everthing set up correctly. Follow the instructions in the ReadMe file on GitHub. - +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +ME="${0##*/}" if hash uuidgen 2>/dev/null; then homefolder=$(pwd) newplayer=$(uuidgen) -mkdir -p $HOME/.zen/tmp/adventure/$newplayer -cp -r rooms $HOME/.zen/tmp/adventure/$newplayer/rooms -cp -r art $HOME/.zen/tmp/adventure/$newplayer/art -cp -r script $HOME/.zen/tmp/adventure/$newplayer/script -cp -r logic $HOME/.zen/tmp/adventure/$newplayer/logic +mkdir -p $HOME/.zen/adventure/$newplayer +cp -r $MY_PATH/rooms $HOME/.zen/adventure/$newplayer/rooms +cp -r $MY_PATH/art $HOME/.zen/adventure/$newplayer/art +cp -r $MY_PATH/script $HOME/.zen/adventure/$newplayer/script +cp -r $MY_PATH/logic $HOME/.zen/adventure/$newplayer/logic fi echo "Loading..." echo sleep 4 if hash uuidgen 2>/dev/null; then -cd $HOME/.zen/tmp/adventure/$newplayer/rooms +cd $HOME/.zen/adventure/$newplayer/rooms else cd rooms fi ./start.sh if hash uuidgen 2>/dev/null; then cd "$homefolder" -rm -r $HOME/.zen/tmp/adventure/$newplayer +rm -r $HOME/.zen/adventure/$newplayer fi echo exit diff --git a/install.sh b/install.sh index b59f450a..c7340aa2 100755 --- a/install.sh +++ b/install.sh @@ -192,45 +192,6 @@ echo ">>> INFO : Ajoutez l'extension 'OpenWith' à votre navigateur !! # https://addons.mozilla.org/firefox/addon/open-with/ # https://chrome.google.com/webstore/detail/open-with/cogjlncmljjnjpbgppagklanlcbchlno" -########################################### -# ACTIVATE IPFS OPTIONS: #swarm0 INIT -########################################### -### IMPORTANT !!!!!!! IMPORTANT !!!!!! -########################################### -# DHT PUBSUB mode -ipfs config Pubsub.Router gossipsub -# MAXSTORAGE = 1/2 available -availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}') -diskSize="$((availableDiskSize / 2))" -ipfs config Datastore.StorageMax $diskSize -## Activate Rapid "ipfs p2p" -ipfs config --json Experimental.Libp2pStreamMounting true -ipfs config --json Experimental.P2pHttpProxy true -ipfs config --json Swarm.ConnMgr.LowWater 0 -ipfs config --json Swarm.ConnMgr.HighWater 0 - -## For ipfs.js = https://github.com/ipfs/js-ipfs/blob/master/docs/DELEGATE_ROUTERS.md -ipfs config --json Addresses.Swarm | jq '. += ["/ip4/0.0.0.0/tcp/30215/ws"]' > /tmp/30215.ws -ipfs config --json Addresses.Swarm "$(cat /tmp/30215.ws)" - -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])/") -[[ ! $isLAN ]] && ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://127.0.0.1:8080", "http://127.0.1.1:8080" ]' \ - || ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://127.0.0.1:8080", "http://127.0.1.1:8080" ]' -ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]' -ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]' - -## TODO ADPAT PERMISSIONS -ipfs config Addresses.API "/ip4/0.0.0.0/tcp/5001" -ipfs config Addresses.Gateway "/ip4/0.0.0.0/tcp/8080" - -######### CLEAN DEFAULT BOOTSTRAP TO STAY INVISIBLE ########### -ipfs bootstrap rm --all -########################################### -# BOOTSTRAP NODES ARE ADDED LATER -########################################### -[[ "$USER" != "xbian" ]] && sudo systemctl restart ipfs - ### ADD 20h12.sh CRON ############### $MY_PATH/tools/cron_VRFY.sh ON @@ -288,7 +249,6 @@ $(cat ~/.zen/game/players/.current/secret.june) http://astroport.com " - # MAIN # fi } diff --git a/tools/ipfs_setup.sh b/tools/ipfs_setup.sh index df280b33..82d8686b 100755 --- a/tools/ipfs_setup.sh +++ b/tools/ipfs_setup.sh @@ -92,6 +92,11 @@ ipfs config --json Swarm.ConnMgr.HighWater 0 ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]' +## For ipfs.js = https://github.com/ipfs/js-ipfs/blob/master/docs/DELEGATE_ROUTERS.md +ipfs config --json Addresses.Swarm | jq '. += ["/ip4/0.0.0.0/tcp/30215/ws"]' > /tmp/30215.ws +ipfs config --json Addresses.Swarm "$(cat /tmp/30215.ws)" + + ipfs config Addresses.API "/ip4/0.0.0.0/tcp/5001" ipfs config Addresses.Gateway "/ip4/0.0.0.0/tcp/8080"