This commit is contained in:
fred 2022-12-14 00:24:14 +01:00
parent 964f9b4431
commit 4c3b36ad1e
5 changed files with 21 additions and 83 deletions

View File

@ -221,7 +221,8 @@ else
# TIDDLER WAS IN CACHE
###################################################################
## TODO : ADD EMAIL TO TAG ( TIMESTAMP & ADD SIGNATURE over existing ones)
cp "${TIDDLER}" "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json"
[[ "${TIDDLER}" != "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json" ]] \
&& cp "${TIDDLER}" "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json"
fi
@ -243,8 +244,7 @@ fi
# --deletetiddlers '[tag[CopierYoutube]]' ### REFRESH CHANNEL COPY
if [[ -s ~/.zen/tmp/$IPFSNODEID/newindex.html ]]; then
echo "===> Mise à jour ${INDEX}"
cp ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX}
[[ $(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"
echo "XXXXXXXXXXXXXXXXXXXXXXX"

View File

@ -12,7 +12,8 @@ ME="${0##*/}"
# Run TAG subprocess: tube, voeu
############################################
echo "## RUNNING PLAYER.refresh"
IPFSNODEID=$(ipfs id -f='<id>\n')
# IPFSNODEID=$(ipfs id -f='<id>\n')
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
PLAYERONE="$1"
[[ ! $PLAYERONE ]] && PLAYERONE=($(ls -t ~/.zen/game/players/))
@ -184,10 +185,12 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
echo "IFRIENDHEAD :" ${IFRIENDHEAD}
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )"
# cp -f ~/.zen/game/players/${PLAYER}/ipfs/${FPLAYER}.rss.json ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/${FPLAYER}.rss.json
cat ${MY_PATH}/../www/iframe.html | sed "s~_IFRIENDHEAD_~${IFRIENDHEAD}~g" | sed "s~_ME_~${IPFSGW}/ipns/${ASTRONAUTENS}~g" > ~/.zen/game/players/$PLAYER/FRIENDS/index.html
[[ -d ~/.zen/game/players/$PLAYER/FRIENDS ]] \
&& cat ${MY_PATH}/../www/iframe.html | sed "s~_ME_~${IPFSGW}/ipns/${ASTRONAUTENS}~g" > ~/.zen/game/players/$PLAYER/FRIENDS/index.html
FRAME=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/FRIENDS/index.html | tail -n 1)
ipfs name publish --allow-offline -t 24h --key="${PLAYER}_feed" /ipfs/$FRAME
[[ -s ~/.zen/game/players/$PLAYER/FRIENDS/index.html ]] \
&& FRAME=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/FRIENDS/index.html | tail -n 1) \
&& ipfs name publish --allow-offline -t 24h --key="${PLAYER}_feed" /ipfs/$FRAME
done
@ -195,7 +198,7 @@ done
## IPFSNODEID ASTRONAUTES SIGNALING ## 12345 port
############################
# Scan local cache
ls ~/.zen/tmp/${IPFSNODEID}/
# ls ~/.zen/tmp/${IPFSNODEID}/
BSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1)
## Merge actual online version

View File

@ -27,7 +27,8 @@ PLAYER="$2" ## IPNS KEY NAME - G1PUB - PLAYER ...
[[ ! $ASTRONAUTENS ]] && echo "Missing $PLAYER IPNS KEY - CONTINUE --" && exit 1
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
IPFSNODEID=$(ipfs id -f='<id>\n')
# IPFSNODEID=$(ipfs id -f='<id>\n')
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
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])/")

View File

@ -185,9 +185,14 @@ do
mkdir -p ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}
cp -f ~/.zen/game/players/${PLAYER}/ipfs/${FPLAYER}.rss.json ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/${FPLAYER}.rss.json
## TODO INSERT INTO $:/plugins/astroport/lightbeams/state/subscriptions
export FRIENDSFEEDS="$ASTRONAUTEFEED\n$FRIENDSFEEDS"
export IFRIENDHEAD="<a target='you' href='/ipns/"$FRIENDNS"'>$$FRIENDTITLE</a>$IFRIENDHEAD"
export FRIENDSFEEDS="$ASTRONAUTEFEED\n$FRIENDSFEEDS"
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )" $FRIENDSFEEDS
export IFRIENDHEAD="<a target='you' href='/ipns/"$FRIENDNS"'>$$FRIENDTITLE</a>$IFRIENDHEAD"
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )" $IFRIENDHEAD
echo "APP=RSS : PLAYER FPLAYER RSS PUBLICATION READY"
echo "~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/${FPLAYER}.rss.json"

View File

@ -1,71 +0,0 @@
#!/bin/bash
########################################################################
# Author: Fred (support@qo-op.com)
# Version: 2020.03.24
# 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
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
start=`date +%s`
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) || ( echo "noipfsid" && exit 1 )
########################################################################
########################################################################
# This script used to initialize 'FRIENDS' data and star.level with beetween crew and new Astronaut
# Astronaut is sendind level3 to Captain / # Captain send level1 to Astronaut
# astrXbian keychains are written to disk... So IPFS obey to this organisation.
########################################################################
########################################################################
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
# Check who is currently current connected PLAYER
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
# Astroport Station "Captain" connected?
source ~/.zen/ipfs.sync; echo "CAPTAIN is $CAPTAIN $(${MY_PATH}/face.sh cool)"
# New Astronaut is entering Astroport
# UPDATING players friend relations
# Inform Captain.
for player in $(ls ~/.zen/game/players/); do
# $player g1pub
g1pub=$(cat ~/.zen/game/players/$player/.g1pub) || continue
ipfsnodeid=$(cat ~/.zen/game/players/$player/.ipfsnodeid) || continue
[[ $PLAYER == $player ]] && continue
## Adding ME as Astronauts Friend. Sharing Stars.
# Inform Network / Application levels. Friend of Friends appears here.
echo "Adding $player to my astrXbian ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub"
read
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub # Opening FRIEND RELATION
echo "$player" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/player # This Astronaut become my level 1 friend
echo "1" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/stars.level # This Astronaut become my level 1 friend
echo "$ipfsnodeid" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/ipfsnodeid # This Astronaut become my level 1 friend
if [[ $player == "$CAPTAIN" ]]; then
echo "Cet Astronaute est le CAPITAINE. Confiance 3 !!!"
echo "3" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/stars.level # Ugrade to Level 3 Friend
# Need to receive confidence back before acting as Astronaut. 3 days to compare dreams & reality.
fi
echo "Adding myself to $player ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB"
read
mkdir -p ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB # AUTO SYMETRIC RELATION TODO : Not overpassing anymore ?
echo "$PLAYER" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/player # This Astronaut become my level 1 friend
echo "1" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/stars.level
echo "$IPFSNODEID" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/ipfsnodeid # TODO : Not overpassing anymore ?
echo "Compromis de Confiance 1 ajouté à $player"
done