From 30617eb9a856f308a6978eaa8882d395ecbd217d Mon Sep 17 00:00:00 2001 From: fred Date: Fri, 10 Feb 2023 02:07:28 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=A5BOX=20CopierYoutube=20CHANGES?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API/PLAYER.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/API/PLAYER.sh b/API/PLAYER.sh index 5fdea964..4d67e1e3 100755 --- a/API/PLAYER.sh +++ b/API/PLAYER.sh @@ -108,23 +108,30 @@ PORT=$1 PLAYER=$2 APPNAME=$3 WHAT=$4 OBJ=$5 VAL=$6 { "created": "'${MOATS}'", "modified": "'${MOATS}'", - "title": "'CONTROL ♥BOX'", + "title": "'♥BOX'", "type": "'text/vnd.tiddlywiki'", "text": "'$WHAT'", - "g1pub": "'${G1PUB}'" + "g1pub": "'${G1PUB}'", "tags": "'CopierYoutube ${PLAYER}'" } ] ' > "$HOME/.zen/tmp/CoeurBOX.json" - rm -f ~/.zen/tmp/$PLAYER.html + rm -f ~/.zen/tmp/$PLAYER.html ## REMPLACE le Tiddler "CopierYoutube" tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html \ - --deletetiddlers '[tag[CopierYoutube]]' + --deletetiddlers '[tag[CopierYoutube]]' \ + --output ~/.zen/tmp/ --render "$:/core/save/all" "one.html" "text/plain" + + [[ -s ~/.zen/tmp/one.html ]] && echo "tag[CopierYoutube] removed" + + tiddlywiki --load ~/.zen/tmp/one.html \ --import "$HOME/.zen/tmp/CoeurBOX.json" "application/json" \ --output ~/.zen/tmp/ --render "$:/core/save/all" "$PLAYER.html" "text/plain" + [[ ! -s ~/.zen/tmp/$PLAYER.html ]] && echo "ERROR NO TW RESULTING" && exit 0 + echo "~/.zen/tmp/$PLAYER.html OK" ## ANY CHANGES ? ############################################################## DIFF=$(diff ~/.zen/tmp/$PLAYER.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html) @@ -132,6 +139,9 @@ PORT=$1 PLAYER=$2 APPNAME=$3 WHAT=$4 OBJ=$5 VAL=$6 echo "DIFFERENCE DETECTED !! " echo "Backup & Upgrade TW local copy..." cp ~/.zen/tmp/$PLAYER.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html + else + echo "SAME TW" + exit 0 fi ############################################################## @@ -144,14 +154,17 @@ PORT=$1 PLAYER=$2 APPNAME=$3 WHAT=$4 OBJ=$5 VAL=$6 TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1) ipfs name publish --allow-offline -t 24h --key=$PLAYER /ipfs/$TW - [[ $DIFF ]] && echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain - echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats + [[ $DIFF ]] && echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain \ + && echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats echo "================================================" echo "$PLAYER : $myIPFS/ipns/$ASTRONAUTENS" echo " = /ipfs/$TW" echo "================================================" + 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 & # ### REFRESH CHANNEL COPY