diff --git a/API/PLAYER.sh b/API/PLAYER.sh index 30e9bd09..7c6c9df8 100755 --- a/API/PLAYER.sh +++ b/API/PLAYER.sh @@ -12,9 +12,21 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized start=`date +%s` -PORT=$1 THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9 -### transfer variables according to script -PORT=$1 PLAYER=$2 APPNAME=$3 WHAT=$4 OBJ=$5 VAL=$6 +PORT=$1 THAT=$2 ANDcyberD0G! +=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9 COOKIE=$10 +echo "PORT=$1 +THAT=$2 +AND=$3 +THIS=$4 +APPNAME=$5 +WHAT=$6 +OBJ=$7 +VAL=$8 +MOATS=$9 +COOKIE=$10" + +### transfer variables according to script (TODO REMOVE THAT) +PORT=$1 PLAYER=$2 APPNAME=$3 OBJ=$5 HTTPCORS="HTTP/1.1 200 OK Access-Control-Allow-Origin: ${myASTROPORT} @@ -24,7 +36,6 @@ Server: Astroport.ONE Content-Type: text/html; charset=UTF-8 " - echo "- ${PLAYER} - ${APPNAME} : ${WHAT} ${OBJ} ${VAL}" [[ ! ${PLAYER} ]] && (echo "${HTTPCORS} BAD PLAYER - EXIT" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1 ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1) [[ ! ${ASTRONAUTENS} ]] && (echo "${HTTPCORS} UNKNOWN PLAYER ${PLAYER} - EXIT" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1 @@ -34,12 +45,12 @@ Content-Type: text/html; charset=UTF-8 ############################################## if [[ ${APPNAME} == "moa" ]]; then - [[ ! ${VAL} ]] && VAL="G1CopierYoutube" - echo "EXPORT MOATUBE ${PLAYER} ${VAL}" + [[ ! ${WHAT} ]] && WHAT="G1CopierYoutube" + echo "EXPORT MOATUBE ${PLAYER} ${WHAT}" - tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html --output ~/.zen/tmp/ --render '.' "${PLAYER}.moatube.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "[tag[${VAL}]]" + tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html --output ~/.zen/tmp/ --render '.' "${PLAYER}.moatube.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "[tag[${WHAT}]]" - if [[ ! ${WHAT} || ${WHAT} == "json" ]]; then + if [[ ! ${THIS} || ${THIS} == "json" ]]; then echo "${HTTPCORS}" > ~/.zen/tmp/${MOATS}.${PLAYER}.http sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}.${PLAYER}.http @@ -53,6 +64,18 @@ Content-Type: text/html; charset=UTF-8 exit 0 fi +############################################## +# ATPASS : /?player=PLAYER&atpass=G1PUB&$VoeuName=ONELINE +############################################## + if [[ ${APPNAME} == "atpass" ]]; then + + echo "CREATING @PASS" + + end=`date +%s` + echo "(@PASS) creation time was "`expr $end - $start` seconds. + exit 0 + fi + ############################################## # YOUTUBE : /?player=PLAYER&(youtube | pdf | image) =_URL_ ############################################## @@ -60,9 +83,9 @@ Content-Type: text/html; charset=UTF-8 APPNAME=$(echo ${APPNAME} | sed -r 's/\<./\U&/g' | sed 's/ //g') ## First letter Capital - [[ ! ${WHAT} ]] && WHAT="https://www.youtube.com/watch?v=BCl2-0HBJ2c" + [[ ! ${THIS} ]] && THIS="https://www.youtube.com/watch?v=BCl2-0HBJ2c" - echo ">>> COPY ${APPNAME} for ${PLAYER} from ${WHAT}" + echo ">>> COPY ${APPNAME} for ${PLAYER} from ${THIS}" G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub) [[ ! ${G1PUB} ]] && espeak "NOT MY PLAYER " && echo "${PLAYER} IS NOT MY PLAYER" && exit 1 @@ -72,11 +95,14 @@ Content-Type: text/html; charset=UTF-8 echo " = /ipfs/${TW}" echo "================================================" - ${MY_PATH}/../ajouter_media.sh "${WHAT}" "${PLAYER}" "${APPNAME}" & + ${MY_PATH}/../ajouter_media.sh "${THIS}" "${PLAYER}" "${APPNAME}" & echo "${HTTPCORS}" > ~/.zen/tmp/${MOATS}.${PLAYER}.http echo "${myIPFS}/ipns/${ASTRONAUTENS}" >> ~/.zen/tmp/${MOATS}.${PLAYER}.http - cat ~/.zen/tmp/${MOATS}.${PLAYER}.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 & + ( + cat ~/.zen/tmp/${MOATS}.${PLAYER}.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 + rm ~/.zen/tmp/${MOATS}.${PLAYER}.http + ) & # ### REFRESH CHANNEL COPY diff --git a/g1billet.desktop b/g1billet.desktop index 895c9833..ef100918 100755 --- a/g1billet.desktop +++ b/g1billet.desktop @@ -2,6 +2,6 @@ [Desktop Entry] Name=G1BILLET Exec=xdg-open http://localhost:33101 -Icon=/home/_USER_/.zen/Astroport.ONE/rec.png +Icon=/home/_USER_/.zen/Astroport.ONE/g1logo.png Type=Application Categories=Utility diff --git a/g1logo.png b/g1logo.png new file mode 100644 index 00000000..dd1fe747 Binary files /dev/null and b/g1logo.png differ diff --git a/tools/MAP.refresh.sh b/tools/MAP.refresh.sh new file mode 100755 index 00000000..e286aa42 --- /dev/null +++ b/tools/MAP.refresh.sh @@ -0,0 +1,52 @@ +#!/bin/bash +################################################################################ +# Author: Fred (support@qo-op.com) +# Version: 0.2 +# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) +################################################################################ +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +. "$MY_PATH/../tools/my.sh" +################################################################################ +## Publish All PLAYER TW, +# Run TAG subprocess: tube, voeu +############################################ +echo "## RUNNING MAP.refresh" +[[ ${IPFSNODEID} == "" ]] && echo "IPFSNODEID is empty - EXIT -" && exit 1 + +################################################################# +## IPFSNODEID ASTRONAUTES SIGNALING ## 12345 port +############################ + +# UDATE STATION BALISE +if [[ -d ~/.zen/tmp/${IPFSNODEID} ]]; then + + # ONLY FRESH DATA HERE + # BSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1) + ## Getting actual online version + # ipfs get -o ~/.zen/tmp/${IPFSNODEID} /ipns/${IPFSNODEID}/ + + ## COPY STATION yt-dlp.list + cp $HOME/.zen/.yt-dlp.list ~/.zen/tmp/${IPFSNODEID}/yt-dlp.list + + ## COPY COINS VALUE OF THE DAY + cp ~/.zen/tmp/coucou/*.COINS ~/.zen/tmp/${IPFSNODEID}/ + + ## COPY FRIENDS + PLAYERONE=($(ls -t ~/.zen/game/players/ | grep "@" 2>/dev/null)) + echo "FOUND : ${PLAYERONE[@]}" + ## RUNING FOR ALL LOCAL PLAYERS + for PLAYER in ${PLAYERONE[@]}; do + echo "${PLAYER} SEEKING OWN FRIENDS" + mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/FRIENDS/ + cp -Rf ~/.zen/game/players/${PLAYER}/FRIENDS/* ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/FRIENDS/ + done + echo "############################################ MY MAP " + ls ~/.zen/tmp/${IPFSNODEID}/ + echo "############################################" + NSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1) + ROUTING=$(ipfs add -rwHq ~/.zen/tmp/${IPFSNODEID}/* | tail -n 1 ) + ipfs name publish /ipfs/${ROUTING} + echo ">> $NSIZE Bytes STATION BALISE > ${myIPFS}/ipns/${IPFSNODEID}" + +fi