Compare commits

...

25 Commits

Author SHA1 Message Date
Yann Autissier 5352e972b9 fix template 2022-12-25 22:46:35 +00:00
fred 96cb14ec20 ACTIVATE Ŋ1 PROTOCOL 2022-12-25 23:39:22 +01:00
fred 6660781a67 espeak "Video Number $boucle" > /dev/null 1>&2 2022-12-25 23:15:13 +01:00
fred a435dfedd2 TW dropped in cyberspace 2022-12-25 22:52:32 +01:00
fred 9c98f73ad4 -w 2022-12-25 22:26:34 +01:00
fred 0db95ea686 ok 2022-12-25 22:20:50 +01:00
fred 7718f6ad7f miuex 2022-12-25 18:43:27 +01:00
fred e8bd784bf3 squeeze a fake loop 2022-12-25 18:23:02 +01:00
fred 3bfc1ad67a c'est beau !!! 2022-12-25 18:11:26 +01:00
fred 8e7fbfc9c2 . "${MY_PATH}/tools/myhost.sh" 2022-12-25 17:32:47 +01:00
fred 514cdeed2b function myhost 2022-12-25 15:39:47 +01:00
fred d1e590b787 this is the head of a function register 2022-12-25 15:18:19 +01:00
fred 1d6849058b NEW API PORTAL 2022-12-25 15:12:32 +01:00
fred a4f0f0b69c register.html 2022-12-25 14:20:32 +01:00
fred 031fa04248 espeak better 2022-12-24 02:39:30 +01:00
fred 1ebc8de0a9 speaks better 2022-12-24 02:02:42 +01:00
fred e480a1b9b8 et oué 2022-12-24 00:14:06 +01:00
fred 47c69bdd84 next 20H12 Sonic will be our 4th bootstrap 2022-12-23 23:10:31 +01:00
fred a831e557b7 espeak "Astroport Empty. Enter your magic email" 2022-12-23 22:38:15 +01:00
fred 5805aaf5dc Add PLAYER 2022-12-23 22:32:04 +01:00
fred c57005f076 pseudo.png G1VISA only 2022-12-23 17:02:20 +01:00
fred 57623e9fbd start exit, launch keeps running 2022-12-23 16:00:19 +01:00
fred 7fc9b6bef7 PID or killall 2022-12-23 15:40:57 +01:00
fred ede575d094 fine tuning 2022-12-23 15:36:57 +01:00
fred b199c6f1ad COIN cookies detox & run 2022-12-23 14:43:54 +01:00
25 changed files with 359 additions and 152 deletions

View File

@ -13,20 +13,9 @@ MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
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])/")
myDOMAINName=$(hostname -d 2>/dev/null) && [ -z "$myDOMAINName" ] && myDOMAINName=$(domainname 2>/dev/null) && [[ "$myDOMAINName" == "(none)" ]] && myDOMAINName="localhost"
myHOSTName=$(hostname |sed 's/\.'${myDOMAINName}'$//')
[ -n "$myDOMAINName" ] && myHOSTName="${myHOSTName}.${myDOMAINName}" || myDOMAINName=${myHOSTName#*.}
[ -z "$myDOMAINName" ] && myDOMAINName=localhost
myHOST="astroport.${myDOMAINName}"
myIPFS="http://ipfs.${myDOMAINName}:8080"
myASTROPORT="http://astroport.${myDOMAINName}:1234"
[[ ! $isLAN || $USER == "zen" ]] && myIPFS="https://ipfs.${myDOMAINName}" && myASTROPORT="https://astroport.${myDOMAINName}" ## WAN STATION
. "${MY_PATH}/tools/myhash.sh"
. "${MY_PATH}/tools/myhost.sh"
. "${MY_PATH}/tools/template.sh"
PORT=12345
@ -34,7 +23,7 @@ PORT=12345
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) ## SWARM#0 ENTRANCE URL
TUBE=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 3)
mkdir -p ~/.zen/tmp/coucou/
mkdir -p ~/.zen/tmp/coucou/ ~/.zen/game/players/localhost
## CHECK FOR ANY ALREADY RUNNING nc
ncrunning=$(ps auxf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
@ -48,7 +37,6 @@ Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET
Server: Astroport.ONE
Content-Type: text/html; charset=UTF-8
"
echo "_________________________________________________________ $(date)"
echo "LAUNCHING Astroport API Server - TUBE : $LIBRA - "
@ -110,17 +98,11 @@ while true; do
############### ############### ############### ############### templates/index.http
# REPLACE myHOST in http response template (fixing next API meeting point)
sed "s~127.0.0.1:12345~${myHOST}:${PORT}~g" $HOME/.zen/Astroport.ONE/templates/index.http > ~/.zen/tmp/coucou/${MOATS}.myHOST.http
sed -i "s~http://127.0.0.1:1234~${myASTROPORT}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
sed -i "s~http://127.0.0.1:8080~${myIPFS}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
sed -i "s~:12345~:${PORT}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
sed -i "s~_SESSIONLNK_~${myIPFS}/ipns/${SESSIONNS}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http ## NODE PUBLISH
sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http ## HOSTNAME
############### ############### ############### ###############
echo "$HTTPCORS" > ~/.zen/tmp/coucou/${MOATS}.myHOST.http
template_register >> ~/.zen/tmp/coucou/${MOATS}.myHOST.http
sed -i -e "s~\"${myIPFS}/\"~\"$(myIpfs)\"~g" \
-e "s~http://${myHOST}:12345~http://${myHOST}:${PORT}~g" \
~/.zen/tmp/coucou/${MOATS}.myHOST.http
############################################################################
## SERVE LANDING REDIRECT PAGE ~/.zen/tmp/coucou/${MOATS}.myHOST.http on PORT 1234 (LOOP BLOCKING POINT)
@ -131,8 +113,7 @@ while true; do
HOSTP=$(echo "$REQ" | grep '^Host:' | cut -d ' ' -f2 | cut -d '?' -f2)
HOST=$(echo "$HOSTP" | cut -d ':' -f 1)
## TODO APPLY GENERAL isLAN or zen !isLAN CALACULA>TONS
[[ ! $isLAN || $USER == "zen" ]] && myHOST="$HOSTNAME" && myHOSTPort="ipfs.$HOSTNAME" && myHTTP="https://" && myASTROPORT="https://$HOSTNAME" ## WAN STATION
############### ############### ############### ###############
############################################################################
[[ $URL == "/test" || $URL == "" ]] && continue
@ -152,21 +133,9 @@ while true; do
## / CONTACT
if [[ $URL == "/" ]]; then
echo "/ CONTACT : $HOSTP"
echo "___________________________ Preparing default return register.html"
echo "$HTTPCORS" > ~/.zen/tmp/coucou/${MOATS}.index.redirect ## HTTP 1.1 HEADER + HTML BODY
sed "s~http://127.0.0.1:1234~${myASTROPORT}~g" $HOME/.zen/Astroport.ONE/templates/register.html >> ~/.zen/tmp/coucou/${MOATS}.index.redirect
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
sed -i "s~http://127.0.0.1:8080~${myIPFS}~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
## Random Background image ;)
sed -i "s~.000.~.$(printf '%03d' $(echo ${RANDOM} % 18 | bc)).~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
end=`date +%s`
echo " (‿/‿) ${myHTTP}$HOSTP / Execution time was "`expr $end - $start` seconds.
echo " (‿/‿) $myHOST:$PORT / Execution time was "`expr $end - $start` seconds.
continue
fi
@ -193,7 +162,7 @@ while true; do
###################################################################################################
# API ZERO ## Made In Zion & La Bureautique
if [[ ${arr[0]} == "salt" ]]; then
[[ ! $APPNAME ]] && echo "NO APPNAME - CONTINUE" && continue
[[ ! $APPNAME || $SALT == "pepper" ]] && echo "NO APPNAME - BAD APP - CONTINUE" && continue
############################################################################
# WRITING API # SALT # PEPPER # MAKING THE KEY EXIST #########
################### KEY GEN ###################################
@ -222,7 +191,7 @@ while true; do
ASTRONAUTENS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key )
[[ ! ${ASTRONAUTENS} ]] && (echo "$HTTPCORS ERROR - (╥☁╥ ) - ASTRONAUTENS COMPUTATION DISFUNCTON" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
echo "TW ADDRESS : ${myHTTP}$HOSTP/ipns/${ASTRONAUTENS}"
echo "TW ADDRESS : $myIPFS/ipns/${ASTRONAUTENS}"
echo
################### KEY GEN ###################################
@ -231,6 +200,7 @@ while true; do
( ## SUB PROCESS
COINS=$($MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key balance)
echo "+++ WALLET BALANCE _ $COINS (G1) _"
[[ $COINS == "" || $COINS == "null" ]] && $MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key -n "https://data.gchange.fr" send -d "${G1PUB}" -t "BRO." -m "TAPA DE JUNE ? VA AVEC >>> https://cesium.app >>> (ᵔ◡◡ᵔ) FLASHER TON G1VISA "
end=`date +%s`
echo "G1WALLET (☓‿‿☓) Execution time was "`expr $end - $start` seconds.
) &
@ -240,7 +210,7 @@ while true; do
## ARCHIVE TOCTOC ${WHAT}S KEEP LOG (TODO : ERASE)
########################################
mkdir -p ~/.zen/game/players/.toctoc/
ISTHERE=$(ls -t ~/.zen/game/players/.toctoc/*.${G1PUB}.ipns.key 2>/dev/null | tail -n 1)
ISTHERE=$(ls -t ~/.zen/game/players/.toctoc/*.${G1PUB}.ipns.key 2>/dev/null | tail -n 1 | cut -d '.' -f 1)
TTIME=$(echo $ISTHERE | rev | cut -d '.' -f 4 | cut -d '/' -f 1 | rev)
if [[ ! $ISTHERE ]]; then
echo "${APPNAME} 1ST TOCTOC : ${MOATS}"
@ -260,6 +230,7 @@ while true; do
##############################################
if [[ $APPNAME == "pay" ]]; then
echo "$APPNAME : $WHAT $OBJ $VAL"
echo "${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key -a ${WHAT} -p ${VAL} -c 'Bro'"
echo "$HTTPCORS $(${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key -a ${WHAT} -p ${VAL} -c 'Bro')" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
end=`date +%s`
echo "(G_G ) PAYING Execution time was "`expr $end - $start` seconds.
@ -270,7 +241,7 @@ while true; do
##############################################
# MESSAGING
##############################################
if [[ $APPNAME == "messaging" || $APPNAME == "email" ]]; then
if [[ $APPNAME == "messaging" ]]; then
( ## & SUB PROCESS
@ -300,7 +271,7 @@ while true; do
#~ ( ## USING IPNS SESSION KEY
#~ REPONSE=$(cat ~/.zen/tmp/coucou/${MOATS}.messaging.json | ipfs add -q)
#~ ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE
#~ echo "SESSION ${myHTTP}$HOSTP/ipns/$SESSIONNS "
#~ echo "SESSION ${myIPFS}/ipns/$SESSIONNS "
#~ ) &
end=`date +%s`
@ -319,7 +290,7 @@ while true; do
########################################
# G1PUB WITH NO EMAIL -> Open Gchange Profile & Update TW cache
########################################
if [[ "$APPNAME" == "g1pub" && ${arr[7]} == "" ]]; then
if [[ "$APPNAME" == "g1pub" && "$OBJ" != "email" ]]; then
[[ ${WHAT} == "astro" ]] && REPLACE="$LIBRA/ipns/$ASTRONAUTENS" \
|| REPLACE="https://www.gchange.fr/#/app/user/${G1PUB}"
@ -480,14 +451,14 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
###################################################################################################
###################################################################################################
# API ONE : ?salt=PHRASE%20UNE&pepper=PHRASE%20DEUX&g1pub=on&email=EMAIL&pseudo=PROFILENAME
if [[ ${arr[6]} == "email" && ${arr[7]} != "" ]]; then
if [[ ${OBJ} == "email" && "${VAL}" != "" ]]; then
[[ $APPNAME != "g1pub" ]] && (echo "$HTTPCORS ERROR - BAD COMMAND $APPNAME" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && continue
start=`date +%s`
# WHAT can contain urlencoded FullURL
EMAIL=$(urldecode ${arr[7]} | xargs)
EMAIL="${VAL}"
PSEUDO=$(urldecode ${arr[9]} | xargs)
[[ ! ${EMAIL} ]] && (echo "$HTTPCORS ERROR - MISSING ${EMAIL} FOR ${WHAT} CONTACT" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && continue
@ -540,17 +511,6 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
fi
##############################################
# VIDEOURL : ADD URL TO 'CopierYoutube' tagged Tiddler : TODO
##############################################
if [[ $APPNAME == "CopierYoutube" ]]; then
echo "$HTTPCORS /ipns/${ASTRONAUTENS} ADDING ${WHAT}"| nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
end=`date +%s`
echo $APPNAME "(☉_☉ ) ${WHAT} Execution time was "`expr $end - $start` seconds.
continue
fi
## RESPONDING
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > ~/.zen/tmp/coucou/${MOATS}.official.swallow &
echo "HTTP 1.1 PROTOCOL DOCUMENT READY"

View File

@ -24,13 +24,12 @@ rm -Rf ~/.zen/tmp/*
espeak "Code Updating" > /dev/null 2>&1
## PROCESS TW BACKOFFICE TREATMENT
cd ~/.zen/Astroport.ONE/
git pull
## SOON /ipns/ Address !!!
espeak "Tube Up" > /dev/null 2>&1
espeak "Updating yt-dlp" > /dev/null 2>&1
## Updating yt-dlp
$MY_PATH/youtube-dl.sh
sudo youtube-dl -U
@ -38,28 +37,21 @@ sudo youtube-dl -U
# Refresh ~/.zen/game/world/G1VOEU
# NOW RUN FROM PLAYER.refresh.sh !! ~/.zen/Astroport.ONE/ASTROBOT/VOEUX.refresh.sh
## CLOSING API PORT
[[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid)
espeak "Players refresh" > /dev/null 2>&1
# Refresh ~/.zen/game/players/PLAYER
~/.zen/Astroport.ONE/ASTROBOT/PLAYER.refresh.sh
## OPEN API ENGINE
espeak "Restarting API" > /dev/null 2>&1
~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log &
PID=$!
echo $PID > ~/.zen/.pid
if [[ ! $isLAN ]]; then
## if [[ ! $isLAN ]]; then
## REFRESH BOOTSTRAP LIST (OFFICIAL SWARM)
espeak "bootstrap refresh" > /dev/null 2>&1
ipfs bootstrap rm --all > /dev/null 2>&1
for bootnode in $(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#") # remove comments
do
ipfsnodeid=${bootnode##*/}
ipfs bootstrap add $bootnode
done
fi
## fi
########################################################################
end=`date +%s`
@ -69,6 +61,14 @@ echo "20H12 (♥‿‿♥) Execution time was $dur" seconds.
## MAIL LOG : support@qo-op.com
$MY_PATH/tools/mailjet.sh "support@qo-op.com" "/tmp/20h12.log"
espeak "Byte Strom End. $dur seconds" > /dev/null 2>&1
espeak "20 12 duration was $dur seconds" > /dev/null 2>&1
## CLOSING API PORT
[[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid)
## OPEN API ENGINE
espeak "Restarting API" > /dev/null 2>&1
~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log &
PID=$!
echo $PID > ~/.zen/.pid
exit 0

7
ASCI_ASTROPORT.txt Normal file
View File

@ -0,0 +1,7 @@
::: :::::::: ::::::::::: ::::::::: :::::::: ::::::::: :::::::: ::::::::: :::::::::::
:+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+:
+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+
+#++:++#++: +#++:++#++ +#+ +#++:++#: +#+ +:+ +#++:++#+ +#+ +:+ +#++:++#: +#+
+#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+
#+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+#
### ### ######## ### ### ### ######## ### ######## ### ### ###

View File

@ -113,8 +113,7 @@ if [[ ! ${TIDDLER} ]]; then
echo "COPIE : $ZYURL"
[[ $boucle == 13 ]] && echo "MAXIMUM COPY REACHED FOR TODAY" && continue
TITLE="$(yt-dlp --cookies-from-browser $BROWSER --print "%(title)s" "${ZYURL}")"
TITLE=${TITLE//[^A-zÀ-ÿ0-9 ]/}
TITLE="$(yt-dlp --cookies-from-browser $BROWSER --print "%(title)s" "${ZYURL}" | detox --inline)"
[[ ! $TITLE ]] && echo "NO TITLE" && continue
start=`date +%s`
@ -151,7 +150,7 @@ if [[ ! ${TIDDLER} ]]; then
## LIMIT TO 12 MAXIMUM COPY PER DAY PER PLAYER
boucle=$((boucle+1))
espeak "video copy number $bouche" > /dev/null 1>&2
espeak "Video Number $boucle" > /dev/null 1>&2
####################################################
echo "FOUND : ~/.zen/tmp/yt-dlp/$ZFILE"

View File

@ -41,7 +41,7 @@ for PLAYER in ${PLAYERONE[@]}; do
ASTRONS=$(cat ~/.zen/game/players/$PLAYER/.playerns 2>/dev/null)
## REFRESH ASTRONAUTE TW
ASTRONAUTENS=$(ipfs key list -l | grep $PLAYER | cut -d ' ' -f1)
ASTRONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1)
[[ ! $ASTRONAUTENS ]] && echo "WARNING No $PLAYER in keystore --" && ASTRONAUTENS=$ASTRONS
## VISA EMITER STATION MUST ACT ONLY
@ -65,8 +65,8 @@ isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.1
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
echo "/ipns/$ASTRONAUTENS ON $LIBRA"
ipfs --timeout 60s -o ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html /ipns/$ASTRONAUTENS \
|| curl -m 30 -so ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS" \
ipfs --timeout 60s get -o ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html /ipns/$ASTRONAUTENS \
|| curl -m 60 -so ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS" \
|| cp ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html
## PLAYER TW IS ONLINE ?

View File

@ -3,11 +3,16 @@
#################################################################
# astroport.libra.copylaradio.com
/ip4/149.102.158.67/udp/4001/quic/p2p/12D3KooWL2FcDJ41U9SyLuvDmA5qGzyoaj2RoEHiJPpCvY8jvx9u
# astroport.cancer.copylaradio.com
/ip4/185.202.238.69/tcp/4001/p2p/12D3KooWDYpPdfCFf3CbKpcLNmyA2vmJs4JY55k8yje9R1MxSgdB
# astroport.aries.copylaradio.com
/ip4/37.187.127.175/tcp/4001/p2p/12D3KooWSQYTxeoZZ39SNosEKxi7RUdGTtAQAqpKeZJxjzqqrZTx
# astroport.sonic.copylaradio.com
/ip4/161.97.174.60/tcp/4001/p2p/12D3KooWJki74EkJ8YUhrAfr2UwtQiJKBY94PYLmVnEQe9jo3aqC
#################################################################
###### WISHING TO ADD YOUR NODE TO OFFICIAL ASTROPORT BOOSTRAP LIST ?
###### ===> CONTACT support@qo-op.com

View File

@ -37,16 +37,25 @@ player-%:
$(call make,stack-User-$*,$(MYOS),$(PLAYER_MAKE_VARS)) \
)
.PHONY: shellcheck
shellcheck:
.PHONY: upgrade
upgrade: migrate-home migrate-ipfs install
## TESTS
.PHONY: check
check:
shellcheck $(SHELL_FILES) ||:
.PHONY: shellcheck-%
shellcheck-%:
shellcheck $*/*.sh
.PHONY: tests
tests: shellcheck
.PHONY: shellspec
specs: shellspec-specs;
.PHONY: upgrade
upgrade: migrate-home migrate-ipfs install
.PHONY: shellspec-%
shellspec-%:
shellspec -f tap $*
.PHONY: tests
tests: check specs

View File

@ -53,7 +53,7 @@ while true; do
## FIXING TIC TAC FOR NODE & SWARM REFRESH
if [[ duree -gt 3600000 ]]; then
(
( ##### SUB-PROCESS
start=`date +%s`
############# GET BOOTSTRAP SWARM DATA
@ -107,7 +107,7 @@ while true; do
end=`date +%s`
echo "(*__*) MySwam Update ($BSIZE B) duration was "`expr $end - $start`' seconds.'
) &
) & ##### SUB-PROCESS
# last run recording
echo "${MOATS}" > ~/.zen/tmp/${IPFSNODEID}/.MySwarm.moats

View File

@ -32,6 +32,8 @@ 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
URL="$1"
PLAYER="$2"
CHOICE="$3"
@ -45,12 +47,16 @@ CHOICE="$3"
&& 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 \
[[ ${PLAYER} == "" ]] && exit 1
[[ ${PLAYER} == "" ]] \
&& ${MY_PATH}/start.sh \
&& espeak "Astroport Empty. Enter your magic email" \
&& xdg-open "https://qo-op.com" \
&& exit 1
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null)
espeak "Hello $PSEUDO"
(cd $MY_PATH && git pull && espeak "code ok") &
( cd $MY_PATH && git pull ) &
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null)
[[ $G1PUB == "" ]] && espeak "ERROR NO G 1 PUBLIC KEY FOUND - EXIT" && exit 1
@ -79,6 +85,11 @@ if [ $URL ]; then
CHOICE="$IMPORT"
fi
( ## SUB PROCESS
# Get PLAYER wallet amount
COINS=$($MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey balance | cut -d '.' -f 1)
[[ $COINS == "" || $COINS == "null" ]] && espeak "Missing coins. Free Run." || espeak "You have $COINS Coins"
)
# GET SCREEN DIMENSIONS
screen=$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
@ -130,7 +141,7 @@ fi
ISADDING=$(ps auxf --sort=+utime | grep -w 'ipfs add' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
ISPUBLISHING=$(ps auxf --sort=+utime | grep -w 'ipfs name publish' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
[[ $ISADDING || $ISPUBLISHING ]] \
&& espeak "I P F S progressing. Please try again later" && exit 1
&& espeak "I P F S not ready. Wait and try again" && exit 1
########################################################################
espeak "restart I P F S daemon"
@ -210,39 +221,30 @@ mkdir -p ${YTEMP}
# youtube-dl $YTURL
echo "VIDEO $YTURL"
# --write-subs --write-auto-subs --sub-langs "fr, en, en-orig" --embed-subs
LINE="$(yt-dlp --cookies-from-browser $BROWSER --print "%(id)s&%(title)s" "${YTURL}")"
YID=$(echo "$LINE" | cut -d '&' -f 1)
TITLE=$(echo "$LINE" | cut -d '&' -f 2- | detox --inline)
/usr/local/bin/youtube-dl -f "(bv*[ext=mp4][height<=480]+ba/b[height<=480])" \
--cookies-from-browser $BROWSER \
/usr/local/bin/youtube-dl -f "(bv*[ext=mp4][height<=720]+ba/b[height<=720])" \
--cookies-from-browser $BROWSER --verbose --audio-format mp3\
--download-archive $HOME/.zen/.yt-dlp.list \
-S res,ext:mp4:m4a --recode mp4 --no-mtime --embed-thumbnail --add-metadata \
--no-playlist --write-info-json --write-description --no-get-comments \
--no-mtime -o "${YTEMP}/%(id)s&%(title)s.%(ext)s" $YTURL
-S res,ext:mp4:m4a --recode mp4 --no-mtime --embed-thumbnail --add-metadata \
-o "${YTEMP}/$TITLE.%(ext)s" "$YTURL"
# Get filename, extract ID, make destination dir and move copy.
YFILE=$(ls -S ${YTEMP} | head -n 1)
FILE_NAME="$(basename "${YFILE}")"
ZFILE="$TITLE.mp4"
echo "$ZFILE"
FILE_NAME="$(basename "${ZFILE}")"
FILE_EXT="${FILE_NAME##*.}"
JSON_FILE=$(echo ${FILE_NAME} | sed "s/${FILE_EXT}/json/g")
YID=$(echo "${FILE_NAME}" | cut -d "&" -f 1)
YNAME=$(echo "${FILE_NAME}" | cut -d "&" -f 2- | sed "s/[(][^)]*[)]//g" | sed -e 's/[^A-Za-z0-9._-]/_/g' | sed -e 's/__/_/g' ) # Remove YoutubeID_ and (what is in perentheses)
[[ $(which detox) ]] && YNAME=$(echo "${FILE_NAME}" | cut -d "&" -f 2- | detox --inline)
espeak "OK $YNAME copied"
echo "OK $ZFILE copied"
espeak "OK $TITLE copied"
MEDIAID="$REVSOURCE${YID}"
TITLE="${YNAME%.*}"
MEDIAKEY="YOUTUBE_${MEDIAID}"
FILE_PATH="$HOME/Astroport/youtube/$MEDIAID"
mkdir -p ${FILE_PATH} && mv -f ${YTEMP}/* ${FILE_PATH}/
# rename FILE_NAME to YNAME (URL clean)
mv "${FILE_PATH}/${FILE_NAME}" "${FILE_PATH}/${YNAME}" && FILE_NAME="${YNAME}"
# get & rename video.json
jsonfile=$(ls ${FILE_PATH}/*.json)
mv "${jsonfile}" "${FILE_PATH}/video.json"
FILE_RES=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "${FILE_PATH}/${FILE_NAME}" | cut -d "x" -f 2)
RES=${FILE_RES%?}0p
@ -472,7 +474,7 @@ then
# Ask for song name
[ ! $2 ] && song=$(zenity --entry --width 300 --title "Titre à chercher sur Youtube" --text "Titre recherché" --entry-text="")
[[ $song == "" ]] && espeak "I was expecting a song name. Sorry. I Am out." && exit 1
espeak "Searching $artist $song"
# Download mp3 from 1st youtube search video result (--write-info-json)
/usr/local/bin/youtube-dl --default-search ytsearch1: \
--cookies-from-browser $BROWSER \
@ -483,7 +485,7 @@ then
else
[[ $YTURL == "" ]] && YTURL="$artist"
espeak "Copying Link"
/usr/local/bin/youtube-dl \
--cookies-from-browser $BROWSER \
--ignore-errors --no-mtime \

View File

@ -127,12 +127,17 @@ select fav in "${choices[@]}"; do
echo "ATTENTION ${PLAYER} SUPPRESSION DEFINITIVE !!"
echo "Enter to continue. Ctrl+C to stop"
read
echo "REPLACE $IPFSNODEID WITH _ASTROPORT_"
sed "s~${IPFSNODEID}~_ASTROPORT_~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/$PLAYER.html
TW=$(ipfs add -Hq ~/.zen/tmp/$PLAYER.html | tail -n 1)
ipfs name publish --allow-offline --key=$PLAYER /ipfs/$TW
espeak "TW dropped in cyberspace..."
ipfs key rm ${PLAYER}; ipfs key rm ${PLAYER}_feed; ipfs key rm $G1PUB;
for voeu in $(ls ~/.zen/game/players/$PLAYER/voeux/ 2>/dev/null); do
ipfs key rm $voeu
[[ $voeu != "" ]] && rm -Rf ~/.zen/game/world/$voeu
done
echo "REMOVE GCHANGE PROFILE"
echo "REMOVING GCHANGE+ PROFILE"
$MY_PATH/tools/jaklis/jaklis.py -k $HOME/.zen/game/players/$PLAYER/secret.dunikey -n https://data.gchange.fr erase
#~ echo "REMOVE CESIUM+"
#~ $MY_PATH/tools/jaklis/jaklis.py -k $HOME/.zen/game/players/$PLAYER/secret.dunikey -n https://g1.data.e-is.pro erase

View File

@ -25,7 +25,7 @@ case "${1:-${cmd:-start}}" in
cron
log &
zen
exec "$ASTROPORT_DIR/start.sh"
exec "$ASTROPORT_DIR/launch.sh"
;;
install)

View File

@ -30,7 +30,7 @@ then
# Check requirements
echo "Installateur Astroport.ONE pour distributions DEBIAN et dérivées : LinuxMint (https://www.linuxmint.com/)"
echo "$USER appuyez sur ENTRER."; read TEST; [[ "$TEST" != "" ]] && echo "SORTIE" && exit 0 ## Ajouter confirmation à chaque nouvelle étape (+explications)
# echo "$USER appuyez sur ENTRER."; read TEST; [[ "$TEST" != "" ]] && echo "SORTIE" && exit 0 ## Ajouter confirmation à chaque nouvelle étape (+explications)
echo "#############################################"
echo "###### IPFS BIOS INSTALL ##############################"
echo "################ CRYPTO TW Ŋ1 PROTOCOL #############"
@ -278,12 +278,14 @@ echo "#############################################"
if [[ $XDG_SESSION_TYPE == 'x11' ]]; then
##########################################################
## ON BOARDING PLAYER
~/.zen/Astroport.ONE/start.sh &
~/.zen/Astroport.ONE/start.sh
~/.zen/Astroport.ONE/tools/displaytimer.sh 3
espeak "Enter your magic TW keys"
xdg-open "http://astroport.localhost:1234"
echo "EXPERIMENTAL ### RECOPIEZ VOS VSTREAM KODI DANS IPFS ## "
echo "EXPERIMENTAL ### RECOPIEZ VOS VSTREAM KODI DANS IPFS ## OUI ? ENTER sinon Ctrl+C"
read KODI
if [[ $KODI ]]; then
if [[ ! $KODI ]]; then
mkdir -p ~/.zen/tmp/kodi
echo "PATIENTEZ..."

29
launch.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
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"
ME="${0##*/}"
TS=$(date -u +%s%N | cut -b1-13)
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
echo "cron_VRFY.sh ON"
###################################################
${MY_PATH}/tools/cron_VRFY.sh ON
echo "(RE)STARTING 12345.sh"
###################################################
[[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid) \
|| ( killall "12345.sh"; killall "_12345.sh"; killall "nc" )
mkdir -p ~/.zen/tmp
~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log &
echo $! > ~/.zen/.pid && wait

16
search2 Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
clear
echo "------------------------------------------------------------------------------"
if [ "$1" == "" ]; then
echo " Nothing to search for!"
else
echo " Searching for "$1" recursively. Please Wait..."
echo "------------------------------------------------------------------------------"
grep -h -r --exclude=B00 -H --colour=always "$1" ./
fi
echo "------------------------------------------------------------------------------"
if [ "$2" != "" ]; then
echo " To replace \"$1\" whith \"$2\", please run"
echo " grep -rl '$1' ./ | while read file; do sed -i 's~$1~$2~g' \$file; done"
fi
## THIS IS A GREAT RETRO ENGINEERING AND CODING TOOLS

50
specs/astroport_spec.sh Normal file
View File

@ -0,0 +1,50 @@
#shellcheck shell=sh
set -eu
Describe 'Dependency'
Describe 'ipfs:'
It 'is available'
When run ipfs --help
The output should include "ipfs"
The status should be success
The stderr should equal ""
End
End
End
Describe 'Astroport'
Describe 'tools/myhost.sh'
Include ./tools/myhost.sh
myhost() {
echo $myHOST
echo $myIPFS
}
It 'does my env variables'
When call myhost
The output should include astroport.
The output should include ipfs.
The status should be success
The stderr should equal ""
End
End
Describe 'tools/template.sh'
Include ./tools/myhost.sh
Include ./tools/template.sh
It 'does host html register page'
When call template_register
The stdout should include $(hostname)
The stdout should include $IPFSNODEID
The stdout should include $myASTROPORT
The stdout should include $myIPFS
The status should be success
The stderr should equal ""
End
It 'does localhost html register page'
When call template_register_localhost
The stdout should include "input name='salt' value=''"
The stdout should include "input name='pepper' value=''"
The status should be success
The stderr should equal ""
End
End
End

View File

@ -20,9 +20,10 @@ ${MY_PATH}/tools/cron_VRFY.sh ON
echo "(RE)STARTING 12345.sh"
###################################################
[[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid)
# killall "12345.sh"; killall "_12345.sh"; killall "nc"; killall "command.sh"
[[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid) \
|| ( killall "12345.sh"; killall "_12345.sh"; killall "nc" )
mkdir -p ~/.zen/tmp
~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log &
echo $! > ~/.zen/.pid && wait
echo $! > ~/.zen/.pid

View File

@ -82,7 +82,7 @@ setTimeout(() => {
el.style.visibility = 'visible';
}, 3000); // 👈️ delay in milliseconds
var timeLeft = 30;
var timeLeft = 2524608000;
var elem = document.getElementById('countdown');
var timerId = setInterval(countdown, 1000);

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>[Astroport] :: Station _HOSTNAME_ :: _IPFSNODEID_ </title>
<link rel="icon" type="image/png" href="http://127.0.0.1:8080/ipfs/QmaCh8mywWfxkXF3JziFzqZS6yZFo3eNS5fSfnzJqdSQvX/logo.png" />
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmaCh8mywWfxkXF3JziFzqZS6yZFo3eNS5fSfnzJqdSQvX/decoration.css" type="text/css" />
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmaCh8mywWfxkXF3JziFzqZS6yZFo3eNS5fSfnzJqdSQvX/decoration.css" type="text/css" />
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmaCh8mywWfxkXF3JziFzqZS6yZFo3eNS5fSfnzJqdSQvX/layout.css" type="text/css" />
<style>
@ -15,6 +15,9 @@ body {
}
html {
height: 100%
}
header {
opacity: 0.8;
}
input[type=submit] {
width: 12em; height: 4em;
@ -25,13 +28,20 @@ html {
input {
width: 20em; height: 2em;
}
#yellow {
background: yellow;
position: absolute;
top: 40%;
left: 60%;
visibility: hidden;
}
</style>
</head>
<body>
<header>
<h6>
<a href="http://127.0.0.1:1234/"> <span>"/ipfs/</span>TW<span>"</span></a>
<a href="http://127.0.0.1:1234/">/ipfs/<span>"TW"</span></a>
</h6>
</header>
@ -39,29 +49,37 @@ html {
<center>
<b>--- Welkom - Mirë se vini - Willkommen - Welkomma - Welcome - Marhaban - Bari galoust - Xos gelmissiniz - Welkum - Ongi etorri- Swagata - Ansuf yiswen - ščyra zaprašajem - Kyo tzo pa eit - Ani kié - Dobro došli - Dagemer mat - Dobre doshŭl - Benvinguts - Ulihebisdi - Huān yíng - Karibu - Eoso eoseyo - Benvenuti - Bel bonjou - Bienvini - Dobrodošli - Velkommen - Bienvenido - Bonvenon - Tere tulemast - Gabitê - Vælkomin - Tervetuloa - Welkom - Wìllkòmme - Binvignut - Fàilte - Benvido - Croeso - Planvenguda - Mikouabô - Kalos irthate - -Eguahé porá - Baroukh habaim - ... ----</b><br>
<h1>Astroport</h1>
<header>
<form id="formlink" action = "http://127.0.0.1:1234" method = "GET" enctype="application/x-www-form-urlencoded">
<h1><span>Astroport</span> Ŋ0</h1>
<br>
<b>Activez votre BunkedBOX</b></br></br>
Phrase 1 : <input name=salt value=''></br>
Phrase 2 : <input name=pepper value=''></br></br>
<b>COPIEZ VOS VIDEOS YOUTUBE FAVORITES</b><input type="hidden" name=g1pub value='https://www.youtube.com/playlist?list=LL'></br>
Email : <input name=email value=''></br></br>
<input type='submit' value='(☼‿‿☼)'>
<input type='hidden' name='salt' value='0'></br></br>
<input type='hidden' name='pepper' value='0'></br></br>
<h2><span>ENREGISTREZ VOS VIDEOS YOUTUBE FAVORITES</span></h2><input type="hidden" name=g1pub value='https://www.youtube.com/playlist?list=LL'></br>
<span>Email : </span><input name=email value=''></br></br>
<input type='submit' value='[(♥‿‿♥)]'>
</form>
<div id="yellow">
<h3><a href="http://127.0.0.1:12345"> >>> (◕‿‿◕) <<< </a></h3>
</div>
</h2>
</br>
<p>
<b>Besoin d'aide ? Contactez support@qo-op.com</b>
</p>
</header>
</center>
<article>
<div class="row justify-center">
<h1 class="video-title">
<a href="https://git.p2p.legal/qo-op/Astroport.ONE" target="code">CODE : Astroport.ONE - BunkedBOX edition -</a><br>
<a target="code" href="http://opencollective.com/monnaie-libre/projects/bunker-box">Recopiez les vidéos que vous aimez dans les capsules multimédia de votre TW, dans IPFS et les partager entre amis!
Devenez propriétaire d'INTERNET. Rendez in-censurable, in-arrêtable la liberté d'expression. LE PROJET!</a>
<center><a href="https://twitch.com/zicmama" target="twitch">COCODING TWITCH TW</a><br></center><br>
<a href="https://astroport.com">Astroport.ONE</a>
<a href="https://git.p2p.legal/qo-op/Astroport.ONE" target="code">- ♥BOX Edition - </a>
<a href="https://olympe.network">Olympe.Network</a><br>
<a target="code" href="http://opencollective.com/monnaie-libre/projects/bunker-box">Recopiez les vidéos que vous aimez dans les capsules multimédia de votre TW!
<br>Une fois votre G1Visa obtenu, direction <a target="gchange" href="https://gchange.fr">https://gchange.fr</a> !</a>
</h1>
</div>
</article>
@ -115,11 +133,17 @@ Take possession of your TW. Make freedom of expression uncensurable, unstoppable
<script>
const el = document.getElementById('yellow');
setTimeout(() => {
el.style.visibility = 'visible';
}, 23456); // 👈️ delay in milliseconds
var arrTimes = [];
var i = 0; // start
var timesToTest = 3;
var tThreshold = 300; //ms
var testImage = "http://libra.copylaradio.com:8080/ipfs/QmUUyiuCM4yXgaeGyqC2SVUUXZksuxhDfHQYpUpZPuL2oS/astroport.jpg"; // small image in your server
var testImage = "https://ipfs.copylaradio.com/ipfs/QmUUyiuCM4yXgaeGyqC2SVUUXZksuxhDfHQYpUpZPuL2oS/astroport.jpg"; // small image in your server
var dummyImage = new Image();
var isConnectedFast = false;

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,7 @@ PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null)
ASTRONS=$(cat ~/.zen/game/players/${PLAYER}/.playerns 2>/dev/null)
## REFRESH ASTRONAUTE TW
ASTRONAUTENS=$(ipfs key list -l | grep ${PLAYER} | cut -d ' ' -f1)
ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
[[ ! $ASTRONAUTENS ]] && echo "WARNING No ${PLAYER} in keystore -- EXIT" && exit 1
[[ ! -f ~/.zen/game/players/${PLAYER}/QR.png ]] && echo "NOT MY ${PLAYER} -- EXIT" && exit 1

View File

@ -78,11 +78,14 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
IPNSTAIL=$(echo $ASTROPORT | rev | cut -f 1 -d '/' | rev)
echo "TW ASTROPORT GATEWAY : ${ASTROPORT}"
[[ $IPNSTAIL == "_ASTROPORT_" ]] \
&& echo "GET CYBERSPACE TW : TODO CONNECT TO DOCK"
[[ $IPNSTAIL == $IPFSNODEID ]] \
&& echo "UPDATING $PLAYER LOCAL CACHE ~/.zen/game/players/$PLAYER/ipfs/moa" \
&& mkdir -p ~/.zen/game/players/$PLAYER/ipfs/moa \
&& cp ~/.zen/tmp/${MOATS}/TW/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/ \
|| echo "PLAYER on $ASTROPORT Station"
|| echo "PLAYER CONNECTED TO $ASTROPORT STATION"
fi
@ -97,7 +100,7 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
fi
################################################################################
TWMODEL="/ipfs/bafybeichgkzj5tkf3zuobrxqxr2evomuedsehfagstcel72gqy4lai3kqa"
TWMODEL="/ipfs/bafybeiel2pidycxek6jxjwat5wt4estn2fm4phhvhmlmmhq7dcltbp7nsi"
# ipfs cat $TWMODEL > templates/twdefault.html
##################################################### # NEW PLAYER ###############
################################################################################
@ -192,6 +195,9 @@ NID="${myIPFSGW}" && WID="$NID/api"
cp ~/.zen/game/players/$PLAYER/QR.png ~/.zen/game/players/$PLAYER/ipfs/QR.png
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/ipfs/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible)
qrencode -s 12 -o ~/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png "https://ipfs.copylaradio.com/ipns/${ASTRONAUTENS}"
## SEC PASS PROTECTED QRCODE
secFromDunikey=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep "sec" | cut -d ' ' -f2)
echo "$secFromDunikey" > ~/.zen/tmp/${MOATS}/${PSEUDO}.sec
@ -282,20 +288,27 @@ NID="${myIPFSGW}" && WID="$NID/api"
## ID CARD & QRCODE
convert ~/.zen/game/players/$PLAYER/QR.png -resize 300 ~/.zen/tmp/${MOATS}/QR.png
convert ${MY_PATH}/../images/astroport.jpg -resize 300 ~/.zen/tmp/${MOATS}/ASTROPORT.png
convert ~/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png -resize 240 ~/.zen/tmp/${MOATS}/TW.png
convert ${MY_PATH}/../images/astroport.jpg -resize 240 ~/.zen/tmp/${MOATS}/ASTROPORT.png
composite -compose Over -gravity SouthWest -geometry +280+20 ~/.zen/tmp/${MOATS}/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/${MOATS}/astroport.png
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/${MOATS}/QR.png ~/.zen/tmp/${MOATS}/astroport.png ~/.zen/tmp/${MOATS}/one.png
composite -compose Over -gravity East -geometry +0+0 ~/.zen/tmp/${MOATS}/TW.png ~/.zen/tmp/${MOATS}/astroport.png ~/.zen/tmp/${MOATS}/astroport2.png
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/${MOATS}/QR.png ~/.zen/tmp/${MOATS}/astroport2.png ~/.zen/tmp/${MOATS}/one.png
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
convert -gravity northwest -pointsize 35 -fill black -draw "text 50,300 \"$PSEUDO\"" ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,40 \"$PLAYER\"" ~/.zen/tmp/${MOATS}/image.png ~/.zen/tmp/${MOATS}/pseudo.png
convert -gravity northeast -pointsize 25 -fill black -draw "text 20,180 \"$PASS\"" ~/.zen/tmp/${MOATS}/pseudo.png ~/.zen/tmp/${MOATS}/pass.png
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,100 \"$SALT\"" ~/.zen/tmp/${MOATS}/pass.png ~/.zen/tmp/${MOATS}/salt.png
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,140 \"$PEPPER\"" ~/.zen/tmp/${MOATS}/salt.png ~/.zen/game/players/$PLAYER/ID.png
# INSERTED IMAGE IPFS
IASTRO=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ID.png | tail -n 1)
# IASTRO=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ID.png | tail -n 1) ## G1VISA PUBLIC / PRIVATE
IASTRO=$(ipfs add -Hq ~/.zen/tmp/${MOATS}/pseudo.png | tail -n 1) ## G1VISA PUBLIC ONLY
sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IASTRO}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
echo
@ -325,8 +338,6 @@ NID="${myIPFSGW}" && WID="$NID/api"
echo "$SALT" > ~/.zen/game/players/$PLAYER/secret.june
echo "$PEPPER" >> ~/.zen/game/players/$PLAYER/secret.june
qrencode -s 12 -o "$HOME/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png" "https://ipfs.copylaradio.com/ipns/${ASTRONAUTENS}"
echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sleep 1
echo "--- PLAYER : $PLAYER";

51
tools/myhash.sh Normal file
View File

@ -0,0 +1,51 @@
#shellcheck shell=sh
myHash() {
[ -f ~/.zen/game/players/localhost/latest ] \
&& myHash=$(cat ~/.zen/game/players/localhost/latest) \
|| myHash=$(template_register |ipfs add -q)
[ ! -f ~/.zen/game/players/localhost/latest ] \
&& echo "$myHash" > ~/.zen/game/players/localhost/latest
[ -n "$myHash" ] \
&& echo "$myHash"
}
myHttp() {
echo "$(myHttpHeader)"
echo
echo "$(myHttpContent)"
}
myIpfs() {
myIpfs=${myIPFS}/ipfs/$(myHash)
echo "$myIpfs"
}
myIpns() {
myIpns=${myIPFS}/ipns/$(myKey)
echo "$myIpns"
}
myKey() {
myKey=$(ipfs key list -l | awk '$2 == "self" {print $1}')
[ -n "$myKey" ] && echo "$myKey"
}
myHttpContent() {
myHash=$(myHash)
myHttpContent="<html><head><title>302 Found</title></head><body><h1>Found</h1>
<p>The document has moved <a href="ipfs/$myHash">here</a>.</p></body></html>"
echo "$myHttpContent"
}
myHttpHeader() {
myHttpContent=$(myHttpContent)
myHttpHeader="HTTP/1.0 302 Found
Content-Type: text/html; charset=UTF-8
Content-Length: $(myHttpContent |wc -c)
Date: $(date -R)
Location: ipfs/$myHash
set-cookie: AND=$myKey; expires=$(date -R -d "+1 month"); path=/; domain=.$myDomainName; Secure; SameSite=lax
Server: and"
echo "$myHttpHeader"
}

16
tools/myhost.sh Executable file
View File

@ -0,0 +1,16 @@
#shellcheck shell=sh
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
IPFSNODEID=$(jq -r .Identity.PeerID ~/.ipfs/config)
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])/")
myDomainName=$(hostname -d 2>/dev/null) && [ -z "$myDomainName" ] && myDomainName=$(domainname 2>/dev/null) && [ "$myDomainName" = "(none)" ] && myDomainName="localhost"
myHostName=$(hostname |sed 's/\.'${myDomainName}'$//')
[ -n "$myDomainName" ] && myHostName="${myHostName}.${myDomainName}" || myDomainName=${myHostName#*.}
[ -z "$myDomainName" ] && myDomainName=localhost
myHOST="astroport.${myDomainName}"
myIPFS="http://ipfs.${myDomainName}:8080"
myASTROPORT="http://astroport.${myDomainName}:1234"
[ -z "$isLAN" ] && myIPFS="https://ipfs.${myDomainName}" && myASTROPORT="https://astroport.${myDomainName}" ||: ## WAN STATION

View File

@ -189,6 +189,7 @@ echo "-----------------------------------------------------------------"
startipfs=`date +%s`
echo "ADDING FILE SIZE = $FILE_SIZE ($FILE_BSIZE octets)"
espeak "Adding $FILE_SIZE file" 2>&1 > /dev/null
IPFS=$(ipfs add -wq "${path}${file}")
IPFSREPFILEID=$(echo $IPFS | cut -d ' ' -f 2)
IPFSID=$(echo $IPFS | cut -d ' ' -f 1)

19
tools/template.sh Executable file
View File

@ -0,0 +1,19 @@
#shellcheck shell=sh
template_register() {
[ -n "$isLAN" ] \
&& SED_SCRIPT='sed -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"' \
|| SED_SCRIPT='tee'
$RUN sed \
-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:8080~${myIPFS}~g" \
-e "s~http://127.0.0.1:12345~http://${myHOST}:12345~g" \
-e "s~_IPFSNODEID_~${IPFSNODEID}~g" \
-e "s~_HOSTNAME_~$(hostname)~g" \
-e "s~.000.~.$(printf '%03d' $(seq 0 17 |shuf -n 1)).~g" \
~/.zen/Astroport.ONE/templates/register.html | \
eval ${SED_SCRIPT:-tee}
}