diff --git a/adventure/adventure.sh b/adventure/adventure.sh index 704b2eb1..bfb5d050 100755 --- a/adventure/adventure.sh +++ b/adventure/adventure.sh @@ -8,31 +8,37 @@ # - @BenNunney # Thanks and gratitude to all living creatures and the whole creation. # - @Fred - # $AGE×365,25×24×60×60×9,807÷299792458 = RELATIVE LIGHT GRAVITY SPEED +################################################################### # 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. +# and support multipe-users, check you have everything set up correctly. +# Follow the instructions in the original ReadMe file : https://github.com/apetro/BashVenture/blob/master/README.md +################################################################### +# Guide avancé d'écriture des scripts Bash : https://abs.traduc.org/abs-fr/ +################################################################### 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/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 + homefolder=$(pwd) + newplayer=$(uuidgen) + ## Copy Player Game Files + 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/adventure/$newplayer/rooms + cd $HOME/.zen/adventure/$newplayer/rooms else -cd rooms + cd rooms fi ./start.sh if hash uuidgen 2>/dev/null; then diff --git a/adventure/rooms/meteofrance.sh b/adventure/rooms/meteofrance.sh index 4ee66a3e..c1f05984 100755 --- a/adventure/rooms/meteofrance.sh +++ b/adventure/rooms/meteofrance.sh @@ -4,43 +4,54 @@ # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ################################################################################ -ts=$(date -u +%s%N | cut -b1-13) +MOATS=$(date -u +"%Y%m%d%H%M%S%4N") +mkdir -p ~/.zen/tmp/${MOATS} ################################################################################ # Capture la photographie satellite de la France # https://fr.sat24.com/image?type=visual5HDComplete®ion=fr + MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ME="${0##*/}" +## TEST IPFS +[[ ! $(which ipfs) ]] && echo "Missing IPFS. Please install... https://ipfs.tech" && exit 1 + +## PREPARE FILE SYSTEM CACHE mkdir -p ~/.zen/adventure/meteo.anim.eu rm -f ~/.zen/adventure/meteo.anim.eu/meteo.png + +## SCRAPING meteo.png curl -m 20 --output ~/.zen/adventure/meteo.anim.eu/meteo.png https://s.w-x.co/staticmaps/wu/wu/satir1200_cur/europ/animate.png if [[ ! -f ~/.zen/adventure/meteo.anim.eu/meteo.png ]]; then - echo "Impossible de vous connecter au service meteo" + echo "Impossible de se connecter au service meteo" exit 1 else - echo "NEED HTML TEMPLATING" - echo "Mise à jour archive points meteo : $ts" - echo $ts > ~/.zen/adventure/meteo.anim.eu/.ts + echo "Mise à jour archive meteo : ${MOATS}" + echo ${MOATS} > ~/.zen/adventure/meteo.anim.eu/.moats - PSEUDO=$(cat ~/.zen/adventure/players/.current/.pseudo 2>/dev/null) OLDID=$(cat ~/.zen/adventure/.meteo.index 2>/dev/null) - sed s/_OLDID_/$OLDID/g ${MY_PATH}/../templates/meteo_chain.html > /tmp/index.html - sed -i s/_IPFSID_/$IPFSID/g /tmp/index.html - sed -i s/_DATE_/$(date -u "+%Y-%m-%d#%H:%M:%S")/g /tmp/index.html - sed s/_PSEUDO_/$PSEUDO/g /tmp/index.html > ~/.zen/adventure/index.html + # TODO : COMPARE SIMILAR OR NOT + # ipfs get "/ipfs/$OLDID/meteo.anim.eu/meteo.png" + + ## PREPARE NEW index.html + sed "s/_OLDID_/$OLDID/g" ${MY_PATH}/../templates/meteo_chain.html > /tmp/index.html + sed -i "s/_IPFSID_/$IPFSID/g" /tmp/index.html + sed -i "s/_DATE_/$(date -u "+%Y-%m-%d#%H:%M:%S")/g" /tmp/index.html + sed "s/_PSEUDO_/${USER}/g" /tmp/index.html > ~/.zen/adventure/index.html # Copy style css - cp -R ${MY_PATH}/../templates/styles ~/.zen/adventure/players/.current/public/ + cp -r ${MY_PATH}/../templates/styles ~/.zen/adventure/ - INDEXID=$(ipfs add -rHq ~/.zen/adventure/index.html | tail -n 1) + INDEXID=$(ipfs add -rHq ~/.zen/adventure/* | tail -n 1) echo $INDEXID > ~/.zen/adventure/.meteo.index - echo "LAST VIDEO INDEX http://127.0.0.1:8080/ipfs/$INDEXID" - IPFS=$(ipfs add -Rw ~/.zen/adventure/meteo.anim.eu/) + echo "METEO INDEX : http://127.0.0.1:8080/ipfs/$INDEXID" + + IPFS=$(ipfs add -q ~/.zen/adventure/meteo.anim.eu/meteo.png | tail -n 1) echo $IPFS > ~/.zen/adventure/meteo.anim.eu/.chain fi diff --git a/adventure/rooms/start.sh b/adventure/rooms/start.sh index 33f60466..ebb3fb6a 100755 --- a/adventure/rooms/start.sh +++ b/adventure/rooms/start.sh @@ -46,7 +46,7 @@ echo "Tout autour la forêt. Des feuillus. Quelques arbustres épineux." echo "Sous vos pieds. Le sol est rouge parsemé de cailloux blancs." echo echo "Vous pouvez vous diriger selon les points cardinaux." -echo "Au nord un chemin remonte, au sud un passage descend, à l'est, la bergerie, à l'ouest, une trace d'animaux" +echo "Au nord un chemin remonte, au sud un passage descend, à l'est, la bergerie, à l'ouest, des traces d'animaux" echo echo "Que voulez-vous faire? Les commandes sont : n, e, s, w, u et h." @@ -63,7 +63,7 @@ while true; do w ) ./green.sh exit ;; u ) echo "Vous ouvrez votre sac il contient une tente, des vêtements, un termos, une scie pliante et un couteau" ;; # Something to say? You can also just echo. - h ) echo "Comment avez-vous pu arriver ici.? Des souvenirs vous reviennent... https://oasis.astroport.com/a-quel-jeu-voulons-nous-jouer/" ;; + h ) echo "Comment avez-vous pu arriver ici.? Des souvenirs vous reviennent... https://web.archive.org/web/20211129105224/https://oasis.astroport.com/a-quel-jeu-voulons-nous-jouer/" ;; * ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";; esac done diff --git a/adventure/templates/meteo_chain.html b/adventure/templates/meteo_chain.html index 108086f3..8e7653b5 100644 --- a/adventure/templates/meteo_chain.html +++ b/adventure/templates/meteo_chain.html @@ -14,7 +14,7 @@ - _PSEUDO_ ENREGISTREMENT METEO - Astroport One + ENREGISTREMENT METEO - Astroport One @@ -23,14 +23,14 @@
- Astroport "ONE" _PSEUDO_ + Astroport "ONE"
- ANIMATION METEO + ANIMATION METEO