qrcode=G1Tag export API : OK + other goodies

This commit is contained in:
fred 2023-04-24 15:51:48 +02:00
parent 4d6cf631fa
commit 400c9f6358
6 changed files with 51 additions and 54 deletions

View File

@ -248,24 +248,26 @@ fi
################################################################################
## QRCODE = G1* : MODE G1VOEU : RETURN WISHNS - IPNS App link - or direct tw tag selected json
# ~/?qrcode=G1VoeuTag&tw=_IPNS_PLAYER_(&json)
# ~/?qrcode=G1Tag&tw=_IPNS_PLAYER_(&json)
################################################################################
if [[ ${QRCODE:0:2} == "G1" && ${AND} == "tw" ]]; then
VOEU=${QRCODE}
ASTROPATH=$(grep -r ${THIS} ~/.zen/game/players/*/ipfs/moa | grep ${QRCODE} | tail -n 1 | cut -d ':' -f 1 | rev | cut -d '/' -f 2- | rev 2>/dev/null)
echo $ASTROPATH
VOEU=${QRCODE:2} ## "G1G1Voeu" => "G1Voeu"
# THIS is TW IPNS
ASTROPATH=$(grep -r ${THIS} ~/.zen/game/players/*/ipfs/moa | tail -n 1 | cut -d ':' -f 1 | rev | cut -d '/' -f 2- | rev 2>/dev/null)
echo "ASTROPATH=${ASTROPATH}"
INDEX=$ASTROPATH/index.html
INDEX=${ASTROPATH}/index.html
echo $INDEX
if [[ -s ${INDEX} ]]; then
if [[ ${APPNAME} == "json" ]]; then
##############################################
echo "DIRECT Tag = ${QRCODE:2} OUTPUT"
echo "DIRECT Tag = ${VOEU} OUTPUT"
## DIRECT JSON OUTPUT
tiddlywiki --load ${INDEX} --output ~/.zen/tmp/${MOATS} \
--render '.' "g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag['${QRCODE:2}']]'
--render '.' "g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag['${VOEU}']]'
echo "$HTTPCORS" > ~/.zen/tmp/${MOATS}/index.redirect
sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}/index.redirect
@ -315,9 +317,9 @@ fi
################################################################################
## QRCODE IS IPNS FORMAT : CHANGE .current AND MAKE G1BILLETS
ASTROPATH=$(grep -r $QRCODE ~/.zen/game/players/*/ipfs/moa | tail -n 1 | cut -d ':' -f 1 | rev | cut -d '/' -f 2- | rev 2>/dev/null)
if [[ $ASTROPATH != "" && $APPNAME == "" ]]; then
if [[ ${ASTROPATH} != "" && $APPNAME == "" ]]; then
PLAYER=$(echo $ASTROPATH | rev | cut -d '/' -f 3 | rev)
PLAYER=$(echo ${ASTROPATH} | rev | cut -d '/' -f 3 | rev)
rm ~/.zen/game/players/.current
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current

View File

@ -54,35 +54,6 @@ Content-Type: text/html; charset=UTF-8
echo "TW ADDRESS : $myIPFS/ipns/${ASTRONAUTENS}"
echo
################### KEY GEN ###################################
# Get PLAYER wallet amount
#~ ( ## SUB PROCESS ## ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/COINS
#~ COINS=$(~/.zen/Astroport.ONE/tools/timeout.sh -t 20 ${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key balance)
#~ echo "+++ WALLET BALANCE _ $COINS (G1) _"
#~ [[ $COINS == "" || $COINS == "null" ]] \
#~ && ~/.zen/Astroport.ONE/tools/timeout.sh -t 20 ${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key send -d "${G1PUB}" -t "BRO" -m "0 G1 (ᵔ◡◡ᵔ) FLASH TON G1VISA" \
#~ && ~/.zen/Astroport.ONE/tools/mailjet.sh $PLAYER "Votre portefeuille est vide. Alimentez votre G1Visa avec Cesium."
#~ end=`date +%s`
#~ echo "G1WALLET (☓‿‿☓) Execution time was "`expr $end - $start` seconds.
#~ ) &
########################################
########################################
## 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 | 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}"
#~ cp ~/.zen/tmp/coucou/${MOATS}.* ~/.zen/game/players/.toctoc/
#~ else ## KEEP 1ST CONTACT ONLY
#~ OLDONE=$(ls -t ~/.zen/tmp/coucou/*.${G1PUB}.ipns.key | tail -n 1)
#~ DTIME=$(echo $OLDONE | rev | cut -d '.' -f 4 | cut -d '/' -f 1 | rev)
#~ [[ $DTIME != ${MOATS} ]] && rm ~/.zen/tmp/coucou/$DTIME.*
#~ fi
########################################
## APPNAME SELECTION ########################
########################################

View File

@ -22,7 +22,7 @@ echo "$ME RUNNING"
########################################################################
# CHECK TODAY INCOMING PAYMENT
# IF COMMENT CONTAINS EMAIL ADDRESSES
# THEN CREATE VISA+TW AND SEND PAIMENT REMOVING FIRST FROM LIST
# THEN AND SEND PAIMENT TO NEXT (REMOVING IT FROM LIST)
########################################################################
# this could lead in several account creation sharing % of incomes each time
########################################################################
@ -51,6 +51,7 @@ MOATS="$3"
mkdir -p $HOME/.zen/tmp/${IPFSNODEID}/G1PalPay/${PLAYER}/
mkdir -p $HOME/.zen/game/players/${PLAYER}/G1PalPay/
mkdir -p $HOME/.zen/tmp/${MOATS}
echo "=========== ( ◕‿◕) (◕‿◕ ) =============="
~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey history -n 10 -j > $HOME/.zen/game/players/${PLAYER}/G1PalPay/$PLAYER.history.json
@ -138,6 +139,8 @@ echo "export ASTROTW=$ASTRONAUTENS ASTROG1=$ASTROG1 ASTROMAIL=$EMAIL ASTROFEED=$
done < ~/.zen/tmp/${MOATS}/myPalPay.json
echo "=========== %%%%% (°▃▃°) %%%%%%% =============="
#################################################################
#################################################################
### NEXT #####
@ -213,7 +216,7 @@ echo "export ASTROTW=$ASTRONAUTENS ASTROG1=$ASTROG1 ASTROMAIL=$EMAIL ASTROFEED=$
done < ~/.zen/tmp/${MOATS}/@tags.json
echo "****************************************"
echo "=========== ( ◕‿◕) (◕‿◕ ) =============="
rm -Rf $HOME/.zen/tmp/${MOATS}

View File

@ -292,7 +292,7 @@ GET /?qrcode=${G1PUB} | ${ASTRONAUTENS} | ${PGP_G1PASS_STRING}
* Is G1*? Redirect to G1WishApp / Export Tags from TW
[http://astroport.localhost:1234/?qrcode=G1Serie&tw=k51qzi5uqu5dgobi9ozzzvdftqfd3hd7a1488nzymky1edz8j779jov7sbemc0](http://astroport.localhost:1234/?qrcode=G1Serie&tw=k51qzi5uqu5dgobi9ozzzvdftqfd3hd7a1488nzymky1edz8j779jov7sbemc0)
[http://astroport.localhost:1234/?qrcode=G1G1Serie&tw=k51qzi5uqu5dgobi9ozzzvdftqfd3hd7a1488nzymky1edz8j779jov7sbemc0](http://astroport.localhost:1234/?qrcode=G1Serie&tw=k51qzi5uqu5dgobi9ozzzvdftqfd3hd7a1488nzymky1edz8j779jov7sbemc0)
redirect to
[http://ipfs.localhost:8080/ipns/k51qzi5uqu5din47zmnzk6tmk1tjqaeaj9pbb3qilmstbsf9uyc12qpdmigtd3/](http://ipfs.localhost:8080/ipns/k51qzi5uqu5din47zmnzk6tmk1tjqaeaj9pbb3qilmstbsf9uyc12qpdmigtd3/)

View File

@ -48,23 +48,37 @@ exec 2>&1 >> ~/.zen/tmp/ajouter_media.log
URL="$1"
PLAYER="$2"
CHOICE="$3"
echo ">>> RUNNING 'ajouter_media.sh' URL=$URL PLAYER=$PLAYER CHOICE=$CHOICE"
# Check who is .current PLAYER
players=($(ls ~/.zen/game/players | grep "@" 2>/dev/null))
# Check who is PLAYER ?
if [[ ${PLAYER} == "" ]]; then
[[ ${#players[@]} -ge 1 ]] \
&& espeak "SELECT YOUR PLAYER" && OUTPUT=$(zenity --list --width 480 --height 200 --title="Choix du PLAYER" --column="Astronaute" "${players[@]}") \
|| OUTPUT="${players}"
players=($(ls ~/.zen/game/players | grep "@" 2>/dev/null))
PLAYER=$OUTPUT
if [[ ${#players[@]} -ge 1 ]]; then
espeak "SELECT YOUR PLAYER"
OUTPUT=$(zenity --list --width 480 --height 200 --title="Choix du PLAYER" --column="Astronaute" "${players[@]}")
[[ ${OUTPUT} == "" ]] && espeak "No player selected. EXIT" && exit 1
else
OUTPUT="${players}"
fi
[[ $OUTPUT ]] \
PLAYER=${OUTPUT}
else
OUTPUT=${PLAYER}
fi
[[ ${OUTPUT} != "" ]] \
&& rm -f ~/.zen/game/players/.current \
&& ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current \
&& espeak "CONNECTED" \
&& . "${MY_PATH}/tools/my.sh"
[[ $OUTPUT == "" ]] \
## NO PLAYER AT ALL
[[ ${OUTPUT} == "" ]] \
&& espeak "Astronaut. Please register." \
&& xdg-open "http://astroport.localhost:1234" \
&& exit 1 \
@ -89,8 +103,8 @@ if [ $URL ]; then
echo "URL: $URL"
REVSOURCE="$(echo "$URL" | awk -F/ '{print $3}' | rev)_"
[ ! $2 ] && IMPORT=$(zenity --entry --width 640 --title="$URL => Astroport" --text="${PLAYER} Type de media à importer ?" --entry-text="Video" PDF MP3 Web) || IMPORT="$CHOICE"
[[ $IMPORT == "" ]] && espeak "No choice made. Exiting program" && exit 1
[[ ${CHOICE} == "" ]] && IMPORT=$(zenity --entry --width 640 --title="$URL => Astroport" --text="${PLAYER} Type de media à importer ?" --entry-text="Video" PDF MP3 Web) || IMPORT="$CHOICE"
[[ $IMPORT == "" ]] && espeak "No choice made. Exit" && exit 1
[[ $IMPORT == "Video" ]] && IMPORT="Youtube"
CHOICE="$IMPORT"
@ -98,6 +112,7 @@ fi
###
COINS=$($MY_PATH/tools/COINScheck.sh $G1PUB | tail -n 1)
echo "$PLAYER wallet = $COINS G1"
###
# GET SCREEN DIMENSIONS
@ -107,8 +122,9 @@ height=$(echo $screen | cut -d 'x' -f 2)
large=$((width-300))
haut=$((height-200))
###
########################################################################
## CADRE EXCEPTION COPIE PRIVE
## EXCEPTION COPIE PRIVE
# https://www.legifrance.gouv.fr/codes/article_lc/LEGIARTI000006278917/2008-12-11/
if [[ ! -f ~/.zen/game/players/${PLAYER}/legal ]]; then
zenity --width ${large} --height=${haut} --text-info \
@ -146,7 +162,7 @@ if [[ $1 == "on" ]]; then
fi
###
# IS THERE ANY RUNNING IPFS ADD
# IS THERE ANY RUNNING IPFS ADD OR PUBLISH IN PROGRESS ?
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 ]] \
@ -156,9 +172,14 @@ ISPUBLISHING=$(ps auxf --sort=+utime | grep -w 'ipfs name publish' | grep -v -E
espeak "restarting I P F S daemon"
[[ "$isLAN" ]] && sudo systemctl restart ipfs
## CHECK IF IPFS DAEMON IS STARTS WELL
floop=0
while [[ ! $(netstat -tan | grep 5001 | grep LISTEN) ]]; do
sleep 1
((floop++)) && [ $floop -gt 10 ] && espeak 'Please check but IPFS cannot start' && exit 1
done
## CHECK IF ASTROPORT/CRON/IPFS IS RUNNING
YOU=$(myIpfsApi)
[[ ! $YOU ]] && espeak "I P F S not running - EXIT" && exit 1

View File

@ -94,7 +94,7 @@ header {
</h2>
</br>
<p>
<b><a target="pad" href="https://vdo.copylaradio.com/?room=cocoding">COCODING MEETING ROOM</a></b>
<b><a target="pad" href="https://vdo.copylaradio.com/?room=cocoding">COCODING CHAT ROOM</a></b>
</p>
</header>