better like that

This commit is contained in:
fred 2022-12-28 23:11:16 +01:00
parent 15b7378d5d
commit c7a83d6c07
6 changed files with 139 additions and 133 deletions

View File

@ -528,22 +528,33 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
# PAY : /?player=PLAYER&pay=1&dest=G1PUB
##############################################
if [[ $APPNAME == "pay" ]]; then
echo "$HTTPCORS" > ~/.zen/tmp/$PLAYER.pay.$VAL.http
echo "$HTTPCORS" > ~/.zen/tmp/$PLAYER.pay.$WHAT.http
if [[ $VAL =~ [0-9] ]]; then
if [[ $WHAT =~ ^[0-9]+$ ]]; then
echo "${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey pay -a ${WHAT} -p ${VAL} -c 'Bro' -m"
${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/$PLAYER.pay.$VAL.http
elif [[ $VAL == "balance" || $VAL == "history" || $VAL == "get" ]]; then
echo "${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey $VAL"
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey $VAL 2>&1 >> ~/.zen/tmp/$PLAYER.pay.$VAL.http
${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/$PLAYER.pay.$WHAT.http
fi
cat ~/.zen/tmp/$PLAYER.pay.$VAL.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
if [[ "$WHAT" == "history" ]]; then
sed -i "s~text/html~application/json~g" ~/.zen/tmp/$PLAYER.pay.$WHAT.http
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey history -j >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
fi
if [[ "$WHAT" == "get" ]]; then
sed -i "s~text/html~application/json~g" ~/.zen/tmp/$PLAYER.pay.$WHAT.http
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey get >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
fi
if [[ "$WHAT" == "balance" ]]; then
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey balance >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
fi
cat ~/.zen/tmp/$PLAYER.pay.$WHAT.http
cat ~/.zen/tmp/$PLAYER.pay.$WHAT.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
end=`date +%s`
echo "(G_G ) PAYING Execution time was "`expr $end - $start` seconds.
echo "(G_G ) G1BANK Operation time was "`expr $end - $start` seconds.
continue
fi

View File

@ -230,7 +230,7 @@ else
# TIDDLER WAS IN CACHE
###################################################################
## TODO : ADD EMAIL TO TAG ( TIMESTAMP & ADD SIGNATURE over existing ones)
cp "${TIDDLER}" "$HOME/.zen/game/$PLAYER/G1CopierYoutube/"
cp "${TIDDLER}" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/"
fi
@ -253,8 +253,8 @@ fi
if [[ -s ~/.zen/tmp/$IPFSNODEID/newindex.html ]]; then
## COPY JSON TIDDLER TO PLAYER
cp "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json" "$HOME/.zen/game/$PLAYER/G1CopierYoutube/"
ln -s "$HOME/.zen/game/$PLAYER/G1CopierYoutube/$YID.TW.json" "$HOME/.zen/game/$PLAYER/G1CopierYoutube/$ZFILE.json"
cp "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/"
ln -s "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$YID.TW.json" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$ZFILE.json"
[[ $(diff ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX} ) ]] && cp ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX} && echo "===> Mise à jour ${INDEX}"
else
echo "Problem with tiddlywiki command. Missing ~/.zen/tmp/$IPFSNODEID/newindex.html"

View File

@ -116,7 +116,7 @@ isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.1
##############################################################
## RUN ASTROBOT G1Voeux SUBPROCESS (SPECIFIC Ŋ1 COPY)
##############################################################
${MY_PATH}/VOEUX.refresh.sh ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$PLAYER"
${MY_PATH}/VOEUX.refresh.sh "$PLAYER"
##############################################################
##################################

View File

@ -10,11 +10,7 @@ ME="${0##*/}"
################################################################################
# Inspect game wishes, refresh latest IPNS version
# SubProcess Backup and chain
INDEX="$1"
[[ ! $INDEX ]] && echo "Please provide path to source TW index.html - EXIT -" && exit 1
[[ ! -f $INDEX ]] && echo "Fichier TW absent. $INDEX - EXIT -" && exit 1
PLAYER="$2" ## IPNS KEY NAME - G1PUB - PLAYER ...
PLAYER="$1" ## IPNS KEY NAME - G1PUB - PLAYER ...
[[ ! $PLAYER ]] && echo "Please provide IPFS publish key" && exit 1
PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null)
@ -30,9 +26,8 @@ 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"
[[ ! $INDEX ]] && INDEX="$HOME/.zen/game/players/$PLAYER/ipfs/moa/index.html"
[[ ! -s $INDEX ]] && echo "TW $PLAYER manquant" && exit 1
mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu

View File

@ -35,7 +35,7 @@ alias espeak='espeak 1>&2>/dev/null'
[[ $(which ffmpeg) == "" ]] && echo "ERREUR! Installez ffmpeg" && echo "sudo apt install ffmpeg" && exit 1
[[ $(which xdpyinfo) == "" ]] && echo "ERREUR! Installez x11-utils" && echo "sudo apt install x11-utils" && exit 1
exec 2>&1 >> ~/.zen/tmp/ajouter_media.log
# exec 2>&1 >> ~/.zen/tmp/ajouter_media.log
URL="$1"
PLAYER="$2"
@ -48,7 +48,7 @@ CHOICE="$3"
&& players=($(ls ~/.zen/game/players 2>/dev/null)) \
&& espeak "PLEASE CONNECT A PLAYER" \
&& OUTPUT=$(zenity --entry --width 640 --title="=> Astroport" --text="ASTRONAUTE ?" --entry-text=${players[@]}) \
&& [[ $OUTPUT ]] && PLAYER=$OUTPUT && rm -f ~/.zen/game/players/.current && ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current \
&& [[ $OUTPUT ]] && PLAYER=$OUTPUT && rm -f ~/.zen/game/players/.current && ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
[[ ${PLAYER} == "" ]] \
&& ${MY_PATH}/start.sh \

View File

@ -121,6 +121,12 @@ myPlayer() {
[ -n "$myPlayer" ] && echo "$myPlayer"
}
myPlayerPath() {
[ -n "$myPlayer" ] \
&& myPlayerPath=$(cd "$(myPath)"/"$(myPlayer)" && pwd -P)
echo "$myPlayerPath"
}
myPlayerApi() {
ipfs --api "$(cat "$(myPlayerPath)"/.ipfs/api )" swarm peers >/dev/null 2>&1 \
&& myPlayerApi=$(cat "$(myPlayerPath)"/.ipfs/api) \
@ -157,12 +163,6 @@ myPlayerNs() {
[ -n "$myPlayerNs" ] && echo "$myPlayerNs"
}
myPlayerPath() {
[ -n "$myPlayer" ] \
&& myPlayerPath=$(cd "$(myPath)"/"$(myPlayer)" && pwd -P) \
&& echo "$myPlayerPath"
}
myPlayerPseudo() {
myPlayerPseudo=$(cat "$(myPlayerPath)"/.pseudo 2>/dev/null)
[ -n "$myPlayerPseudo" ] && echo "$myPseudo"