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 # PAY : /?player=PLAYER&pay=1&dest=G1PUB
############################################## ##############################################
if [[ $APPNAME == "pay" ]]; then 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" 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 ${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
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
fi 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` 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 continue
fi fi

View File

@ -230,7 +230,7 @@ else
# TIDDLER WAS IN CACHE # TIDDLER WAS IN CACHE
################################################################### ###################################################################
## TODO : ADD EMAIL TO TAG ( TIMESTAMP & ADD SIGNATURE over existing ones) ## 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 fi
@ -253,8 +253,8 @@ fi
if [[ -s ~/.zen/tmp/$IPFSNODEID/newindex.html ]]; then if [[ -s ~/.zen/tmp/$IPFSNODEID/newindex.html ]]; then
## COPY JSON TIDDLER TO PLAYER ## COPY JSON TIDDLER TO PLAYER
cp "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json" "$HOME/.zen/game/$PLAYER/G1CopierYoutube/" cp "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/"
ln -s "$HOME/.zen/game/$PLAYER/G1CopierYoutube/$YID.TW.json" "$HOME/.zen/game/$PLAYER/G1CopierYoutube/$ZFILE.json" 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}" [[ $(diff ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX} ) ]] && cp ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX} && echo "===> Mise à jour ${INDEX}"
else else
echo "Problem with tiddlywiki command. Missing ~/.zen/tmp/$IPFSNODEID/newindex.html" 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) ## 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 # Inspect game wishes, refresh latest IPNS version
# SubProcess Backup and chain # SubProcess Backup and chain
INDEX="$1" PLAYER="$1" ## IPNS KEY NAME - G1PUB - PLAYER ...
[[ ! $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 ]] && echo "Please provide IPFS publish key" && exit 1 [[ ! $PLAYER ]] && echo "Please provide IPFS publish key" && exit 1
PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null) 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=$(ipfs id -f='<id>\n')
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
myIP=$(hostname -I | awk '{print $1}' | head -n 1) [[ ! $INDEX ]] && INDEX="$HOME/.zen/game/players/$PLAYER/ipfs/moa/index.html"
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])/") [[ ! -s $INDEX ]] && echo "TW $PLAYER manquant" && exit 1
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu 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 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 [[ $(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" URL="$1"
PLAYER="$2" PLAYER="$2"
@ -48,7 +48,7 @@ CHOICE="$3"
&& players=($(ls ~/.zen/game/players 2>/dev/null)) \ && players=($(ls ~/.zen/game/players 2>/dev/null)) \
&& espeak "PLEASE CONNECT A PLAYER" \ && espeak "PLEASE CONNECT A PLAYER" \
&& OUTPUT=$(zenity --entry --width 640 --title="=> Astroport" --text="ASTRONAUTE ?" --entry-text=${players[@]}) \ && 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} == "" ]] \ [[ ${PLAYER} == "" ]] \
&& ${MY_PATH}/start.sh \ && ${MY_PATH}/start.sh \

View File

@ -1,193 +1,193 @@
#shellcheck shell=sh disable=SC2034 #shellcheck shell=sh disable=SC2034
isLan() { isLan() {
isLan=$(ip route |awk '$1 == "default" {print $3}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/" \ isLan=$(ip route |awk '$1 == "default" {print $3}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/" \
|| 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])/" \ || 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])/" \
|| true) || true)
[ -n "$isLan" ] && echo "$isLan" || true [ -n "$isLan" ] && echo "$isLan" || true
} 2>/dev/null } 2>/dev/null
isPlayerLegal() { isPlayerLegal() {
isPlayerLegal=$(cat "$(myPlayerPath)"/.legal 2>/dev/null || true) isPlayerLegal=$(cat "$(myPlayerPath)"/.legal 2>/dev/null || true)
[ -n "$isPlayerLegal" ] && echo "$isPlayerLegal" || true [ -n "$isPlayerLegal" ] && echo "$isPlayerLegal" || true
} }
myAstronauteKey() { myAstronauteKey() {
myAstronauteKey=$(ipfs --api "$(myIpfsApi)" key list -l | awk '$2 == "'"$(myPlayer)"'" {print $1}') myAstronauteKey=$(ipfs --api "$(myIpfsApi)" key list -l | awk '$2 == "'"$(myPlayer)"'" {print $1}')
[ -n "$myAstronauteKey" ] && echo "$myAstronauteKey" [ -n "$myAstronauteKey" ] && echo "$myAstronauteKey"
} }
myDomainName() { myDomainName() {
myDomainName=$(hostname -d 2>/dev/null) && [ -z "$myDomainName" ] && myDomainName=$(domainname 2>/dev/null) && [ "$myDomainName" = "(none)" ] && myDomainName="localhost" myDomainName=$(hostname -d 2>/dev/null) && [ -z "$myDomainName" ] && myDomainName=$(domainname 2>/dev/null) && [ "$myDomainName" = "(none)" ] && myDomainName="localhost"
[ -n "$myDomainName" ] && echo "$myDomainName" [ -n "$myDomainName" ] && echo "$myDomainName"
} }
myIpfsHash() { myIpfsHash() {
[ -f "$(myPath)"/localhost/latest ] \ [ -f "$(myPath)"/localhost/latest ] \
&& myIpfsHash=$(cat "$(myPath)"/localhost/latest) \ && myIpfsHash=$(cat "$(myPath)"/localhost/latest) \
|| myIpfsHash=$(myTmpl |ipfs add -q) || myIpfsHash=$(myTmpl |ipfs add -q)
[ ! -f "$(myPath)"/localhost/latest ] \ [ ! -f "$(myPath)"/localhost/latest ] \
&& echo "$myIpfsHash" > "$(myPath)"/localhost/latest && echo "$myIpfsHash" > "$(myPath)"/localhost/latest
[ -n "$myIpfsHash" ] && echo "$myIpfsHash" [ -n "$myIpfsHash" ] && echo "$myIpfsHash"
} }
myHttp() { myHttp() {
[ -n "$(myHttpHeader)" ] \ [ -n "$(myHttpHeader)" ] \
&& myHttp="$(myHttpHeader) && myHttp="$(myHttpHeader)
" || myHttp="" " || myHttp=""
[ -n "$(myHttpContent)" ] \ [ -n "$(myHttpContent)" ] \
&& myHttp="${myHttp}$(myHttpContent)" && myHttp="${myHttp}$(myHttpContent)"
[ -n "$myHttp" ] \ [ -n "$myHttp" ] \
&& echo "$myHttp" && echo "$myHttp"
} }
myHttpContent() { myHttpContent() {
[ -n "$(myIpfsHash)" ] \ [ -n "$(myIpfsHash)" ] \
&& myHttpContent="<html><head><title>302 Found</title></head><body><h1>Found</h1> && myHttpContent="<html><head><title>302 Found</title></head><body><h1>Found</h1>
<p>The document is <a href=\"ipfs/$(myIpfsHash)\">here</a> in IPFS.</p></body></html>" \ <p>The document is <a href=\"ipfs/$(myIpfsHash)\">here</a> in IPFS.</p></body></html>" \
&& echo "$myHttpContent" && echo "$myHttpContent"
} }
myHttpHeader() { myHttpHeader() {
[ -n "$(myIpfsHash)" ] \ [ -n "$(myIpfsHash)" ] \
&& myHttpHeader="HTTP/1.0 302 Found && myHttpHeader="HTTP/1.0 302 Found
Content-Type: text/html; charset=UTF-8 Content-Type: text/html; charset=UTF-8
Content-Length: $(myHttpContent |wc -c) Content-Length: $(myHttpContent |wc -c)
Date: $(date -R) Date: $(date -R)
Location: ipfs/$(myIpfsHash) Location: ipfs/$(myIpfsHash)
Server: and" Server: and"
[ -n "$(myIpfsKey)" ] && myHttpHeader="${myHttpHeader} [ -n "$(myIpfsKey)" ] && myHttpHeader="${myHttpHeader}
set-cookie: AND=$(myIpfsKey); expires=$(date -R -d "+1 month"); path=/; domain=.$(myDomainName); Secure; SameSite=lax" set-cookie: AND=$(myIpfsKey); expires=$(date -R -d "+1 month"); path=/; domain=.$(myDomainName); Secure; SameSite=lax"
[ -n "$myHttpHeader" ] && echo "$myHttpHeader" [ -n "$myHttpHeader" ] && echo "$myHttpHeader"
} }
myHome() { myHome() {
myHome=$(cd ~ && pwd -P) myHome=$(cd ~ && pwd -P)
[ -n "$myHome" ] && echo "$myHome" [ -n "$myHome" ] && echo "$myHome"
} }
myHostName() { myHostName() {
myHostName=$(hostname |sed 's/\.'"$(myDomainName)"'$//') myHostName=$(hostname |sed 's/\.'"$(myDomainName)"'$//')
[ -n "$(myDomainName)" ] && myHostName="${myHostName}.$(myDomainName)" || myDomainName=${myHostName#*.} [ -n "$(myDomainName)" ] && myHostName="${myHostName}.$(myDomainName)" || myDomainName=${myHostName#*.}
[ -n "$myHostName" ] && echo "$myHostName" [ -n "$myHostName" ] && echo "$myHostName"
} }
myIp() { myIp() {
myIp=$(hostname -I | awk '{print $1}' | head -n 1) myIp=$(hostname -I | awk '{print $1}' | head -n 1)
[ -n "$myIp" ] && echo "$myIp" [ -n "$myIp" ] && echo "$myIp"
} }
myIpfs() { myIpfs() {
[ -n "$(myIpfsHash)" ] \ [ -n "$(myIpfsHash)" ] \
&& myIpfs="${myIPFS}/ipfs/$(myIpfsHash)" \ && myIpfs="${myIPFS}/ipfs/$(myIpfsHash)" \
&& echo "$myIpfs" && echo "$myIpfs"
} }
myIpfsApi() { myIpfsApi() {
ipfs --api "$(cat "$(myHome)"/.ipfs/api)" swarm peers >/dev/null 2>&1 \ ipfs --api "$(cat "$(myHome)"/.ipfs/api)" swarm peers >/dev/null 2>&1 \
&& myIpfsApi=$(cat "$(myHome)"/.ipfs/api) \ && myIpfsApi=$(cat "$(myHome)"/.ipfs/api) \
&& echo "$myIpfsApi" && echo "$myIpfsApi"
} }
myIpfsKey() { myIpfsKey() {
myIpfsKey=$(ipfs --api "$(myIpfsApi)" key list -l | awk '$2 == "self" {print $1}') myIpfsKey=$(ipfs --api "$(myIpfsApi)" key list -l | awk '$2 == "self" {print $1}')
[ -n "$myIpfsKey" ] && echo "$myIpfsKey" [ -n "$myIpfsKey" ] && echo "$myIpfsKey"
} }
myIpfsKeystore() { myIpfsKeystore() {
myIpfsKeystore=$(cd "$(myHome)"/.ipfs/keystore && pwd -P) myIpfsKeystore=$(cd "$(myHome)"/.ipfs/keystore && pwd -P)
[ -n "$myIpfsKeystore" ] && echo "$myIpfsKeystore" [ -n "$myIpfsKeystore" ] && echo "$myIpfsKeystore"
} }
myIpfsPeerId() { myIpfsPeerId() {
myIpfsPeerId=$(jq -r .Identity.PeerID "$(myHome)"/.ipfs/config) myIpfsPeerId=$(jq -r .Identity.PeerID "$(myHome)"/.ipfs/config)
[ -n "$myIpfsPeerId" ] && echo "$myIpfsPeerId" [ -n "$myIpfsPeerId" ] && echo "$myIpfsPeerId"
} }
myIpns() { myIpns() {
[ -n "$(myIpfsKey)" ] \ [ -n "$(myIpfsKey)" ] \
&& myIpns="${myIPFS}/ipns/$(myIpfsKey)" \ && myIpns="${myIPFS}/ipns/$(myIpfsKey)" \
&& echo "$myIpns" && echo "$myIpns"
} }
myPath() { myPath() {
myPath=$(cd ~/.zen/game/players/ && pwd -P) myPath=$(cd ~/.zen/game/players/ && pwd -P)
[ -n "$myPath" ] && echo "$myPath" [ -n "$myPath" ] && echo "$myPath"
} }
myPlayer() { myPlayer() {
myPlayer=$(cat "$(myPath)"/.current/.player 2>/dev/null) myPlayer=$(cat "$(myPath)"/.current/.player 2>/dev/null)
[ -n "$myPlayer" ] && echo "$myPlayer" [ -n "$myPlayer" ] && echo "$myPlayer"
}
myPlayerApi() {
ipfs --api "$(cat "$(myPlayerPath)"/.ipfs/api )" swarm peers >/dev/null 2>&1 \
&& myPlayerApi=$(cat "$(myPlayerPath)"/.ipfs/api) \
&& echo "$myPlayerApi"
}
myPlayerBrowser() {
myPlayerBrowser=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1)
[ -n "$myPlayerBrowser" ] && echo "$myPlayerBrowser"
}
myPlayerFeedKey() {
myPlayerFeedKey=$(ipfs --api "$(myPlayerApi)" key list -l | awk '$2 == "'"$(myPlayer)"'_feed" {print $1}')
[ -n "$myPlayerFeedKey" ] && echo "$myPlayerFeedKey"
}
myPlayerG1Pub() {
myPlayerG1Pub=$(cat "$(myPlayerPath)"/.g1pub 2>/dev/null)
[ -n "$myPlayerG1Pub" ] && echo "$myPlayerG1Pub"
}
myPlayerKey() {
myPlayerKey=$(ipfs --api "$(myPlayerApi)" key list -l | awk '$2 == "'"$(myPlayer)"'" {print $1}')
[ -n "$myPlayerKey" ] && echo "$myPlayerKey"
}
myPlayerKeystore() {
myPlayerKeystore=$(cd "$(myPlayerPath)"/.ipfs/keystore && pwd -P)
[ -n "$myPlayerKeystore" ] && echo "$myPlayerKeystore"
}
myPlayerNs() {
myPlayerNs=$(cat "$(myPlayerPath)"/.playerns 2>/dev/null)
[ -n "$myPlayerNs" ] && echo "$myPlayerNs"
} }
myPlayerPath() { myPlayerPath() {
[ -n "$myPlayer" ] \ [ -n "$myPlayer" ] \
&& myPlayerPath=$(cd "$(myPath)"/"$(myPlayer)" && pwd -P) \ && myPlayerPath=$(cd "$(myPath)"/"$(myPlayer)" && pwd -P)
&& echo "$myPlayerPath" echo "$myPlayerPath"
}
myPlayerApi() {
ipfs --api "$(cat "$(myPlayerPath)"/.ipfs/api )" swarm peers >/dev/null 2>&1 \
&& myPlayerApi=$(cat "$(myPlayerPath)"/.ipfs/api) \
&& echo "$myPlayerApi"
}
myPlayerBrowser() {
myPlayerBrowser=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1)
[ -n "$myPlayerBrowser" ] && echo "$myPlayerBrowser"
}
myPlayerFeedKey() {
myPlayerFeedKey=$(ipfs --api "$(myPlayerApi)" key list -l | awk '$2 == "'"$(myPlayer)"'_feed" {print $1}')
[ -n "$myPlayerFeedKey" ] && echo "$myPlayerFeedKey"
}
myPlayerG1Pub() {
myPlayerG1Pub=$(cat "$(myPlayerPath)"/.g1pub 2>/dev/null)
[ -n "$myPlayerG1Pub" ] && echo "$myPlayerG1Pub"
}
myPlayerKey() {
myPlayerKey=$(ipfs --api "$(myPlayerApi)" key list -l | awk '$2 == "'"$(myPlayer)"'" {print $1}')
[ -n "$myPlayerKey" ] && echo "$myPlayerKey"
}
myPlayerKeystore() {
myPlayerKeystore=$(cd "$(myPlayerPath)"/.ipfs/keystore && pwd -P)
[ -n "$myPlayerKeystore" ] && echo "$myPlayerKeystore"
}
myPlayerNs() {
myPlayerNs=$(cat "$(myPlayerPath)"/.playerns 2>/dev/null)
[ -n "$myPlayerNs" ] && echo "$myPlayerNs"
} }
myPlayerPseudo() { myPlayerPseudo() {
myPlayerPseudo=$(cat "$(myPlayerPath)"/.pseudo 2>/dev/null) myPlayerPseudo=$(cat "$(myPlayerPath)"/.pseudo 2>/dev/null)
[ -n "$myPlayerPseudo" ] && echo "$myPseudo" [ -n "$myPlayerPseudo" ] && echo "$myPseudo"
} }
myTmpl() { myTmpl() {
myTmpl=$($RUN sed \ myTmpl=$($RUN sed \
-e "s~\"http://127.0.0.1:1234/\"~\"${myIPFS}/\"~g" \ -e "s~\"http://127.0.0.1:1234/\"~\"${myIPFS}/\"~g" \
-e "s~\"http://127.0.0.1:1234\"~\"${myASTROPORT}\"~g" \ -e "s~\"http://127.0.0.1:1234\"~\"${myASTROPORT}\"~g" \
-e "s~http://127.0.0.1:8080~${myIPFS}~g" \ -e "s~http://127.0.0.1:8080~${myIPFS}~g" \
-e "s~http://127.0.0.1:12345~http://${myHOST}:12345~g" \ -e "s~http://127.0.0.1:12345~http://${myHOST}:12345~g" \
-e "s~_IPFSNODEID_~${IPFSNODEID}~g" \ -e "s~_IPFSNODEID_~${IPFSNODEID}~g" \
-e "s~_HOSTNAME_~$(hostname)~g" \ -e "s~_HOSTNAME_~$(hostname)~g" \
-e "s~.000.~.$(printf '%03d' "$(seq 0 17 |shuf -n 1)").~g" \ -e "s~.000.~.$(printf '%03d' "$(seq 0 17 |shuf -n 1)").~g" \
~/.zen/Astroport.ONE/templates/register.html) ~/.zen/Astroport.ONE/templates/register.html)
[ -n "$isLAN" ] \ [ -n "$isLAN" ] \
&& myTmpl=$($RUN echo "$myTmpl" | sed \ && myTmpl=$($RUN echo "$myTmpl" | sed \
-e "s~<input type='"'hidden'"' name='"'salt'"' value='"'0'"'>~<input name='"'salt'"' value='"''"'>~g" \ -e "s~<input type='"'hidden'"' name='"'salt'"' value='"'0'"'>~<input name='"'salt'"' value='"''"'>~g" \
-e "s~<input type='"'hidden'"' name='"'pepper'"' value='"'0'"'>~<input name='"'pepper'"' value='"''"'>~g") -e "s~<input type='"'hidden'"' name='"'pepper'"' value='"'0'"'>~<input name='"'pepper'"' value='"''"'>~g")
[ -n "$myTmpl" ] && echo "$myTmpl" [ -n "$myTmpl" ] && echo "$myTmpl"
} }
myTs() { myTs() {
myTs=$(date -u +"%Y%m%d%H%M%S%4N") myTs=$(date -u +"%Y%m%d%H%M%S%4N")
[ -n "$myTs" ] && echo "$myTs" [ -n "$myTs" ] && echo "$myTs"
} }
MOATS="$(myTs)" MOATS="$(myTs)"