From 2e9df3d0f5414f138ccb2d0201c237baa3292300 Mon Sep 17 00:00:00 2001 From: fred Date: Mon, 31 Oct 2022 17:22:40 +0100 Subject: [PATCH] woooo --- 12345.sh | 24 +++++++----- ASTROBOT/PLAYER.refresh.sh | 2 +- ajouter_media.sh | 80 +++++++++++++++++++++----------------- tools/vlc_webcam.sh | 47 +++++++++++----------- 4 files changed, 83 insertions(+), 70 deletions(-) diff --git a/12345.sh b/12345.sh index fe70a287..e48f550e 100755 --- a/12345.sh +++ b/12345.sh @@ -69,8 +69,8 @@ while true; do # RESET VARIABLES SALT=""; PEPPER=""; TYPE="" echo "************************************************************************* " - echo "ASTROPORT API SERVER UP.......................... http://$myIP:1234 PORT" - echo "$MOATS LANDING PAGE http://$myIP:${PORT}" + echo "ASTROPORT 1234 UP & RUNNING.......................... http://$myIP:1234 PORT" + echo "$MOATS NEXT COMMAND DELIVERY PAGE http://$myIP:${PORT}" ############### ############### ############### ############### templates/index.http # REPLACE myIP in http response template (fixing next API meeting point) @@ -159,28 +159,28 @@ sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect ######################################## ## ARCHIVE TOCTOC WHATS & KEEPS LOGS CLEAN - mkdir -p ~/.zen/game/players/toctoc/ - ISTHERE=$(ls -t ~/.zen/game/players/toctoc/*.${G1PUB}.ipns.key 2>/dev/null | tail -n 1) + mkdir -p ~/.zen/game/players/.toctoc/ + ISTHERE=$(ls -t ~/.zen/game/players/.toctoc/*.${G1PUB}.ipns.key 2>/dev/null | tail -n 1) TTIME=$(echo $ISTHERE | rev | cut -d '.' -f 4 | cut -d '/' -f 1 | rev) if [[ ! $ISTHERE ]]; then echo "WHAT 1ST TOCTOC : $MOATS" - cp ~/.zen/tmp/coucou/${MOATS}.* ~/.zen/game/players/toctoc/ + 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 -## TYPE SLECTION ######################## +## TYPE SLECTION ######################## # MESSAGING if [[ $TYPE == "messaging" ]]; then - + ( echo "Extracting ${G1PUB} messages..." - ~/.zen/Astroport.ONE/tools/timeout.sh -t 3 \ + ~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \ ${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key read -n 10 -j > ~/.zen/tmp/coucou/messin.${G1PUB}.json [[ ! -s ~/.zen/tmp/coucou/messin.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/coucou/messin.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/coucou/messin.${G1PUB}.json - ~/.zen/Astroport.ONE/tools/timeout.sh -t 3 \ + ~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \ ${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key read -n 10 -j -o > ~/.zen/tmp/coucou/messout.${G1PUB}.json [[ ! -s ~/.zen/tmp/coucou/messout.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/coucou/messout.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/coucou/messout.${G1PUB}.json @@ -194,7 +194,7 @@ sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect ## ADDING HTTP/1.1 PROTOCOL HEADER echo "HTTP/1.1 200 OK Server: Astroport -Content-Type: text/html; charset=UTF-8 +Content-Type: application/json; charset=UTF-8 " > ~/.zen/tmp/coucou/${MOATS}.index.redirect cat ~/.zen/tmp/coucou/${MOATS}.messaging.json >> ~/.zen/tmp/coucou/${MOATS}.index.redirect @@ -203,6 +203,10 @@ cat ~/.zen/tmp/coucou/${MOATS}.messaging.json >> ~/.zen/tmp/coucou/${MOATS}.inde ### echo "SESSION http://$myIP:8080/ipns/$SESSIONNS " cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 & + end=`date +%s` + echo Execution time was `expr $end - $start` seconds. + ) & + end=`date +%s` echo Execution time was `expr $end - $start` seconds. continue diff --git a/ASTROBOT/PLAYER.refresh.sh b/ASTROBOT/PLAYER.refresh.sh index e9671573..bd215442 100755 --- a/ASTROBOT/PLAYER.refresh.sh +++ b/ASTROBOT/PLAYER.refresh.sh @@ -15,7 +15,7 @@ echo "## RUNNING PLAYER.refresh" ## RUNING FOR ALL LOCAL PLAYERS for PLAYER in $(ls -t ~/.zen/game/players/); do - [[ $PLAYER == 'toctoc' ]] && echo "toctoc" && continue + [[ $PLAYER == '.toctoc' ]] && echo ".toctoc users " && continue echo "##################################################################" echo ">>>>> PLAYER : $PLAYER >>>>>>>>>>>>> REFRESHING TW STATION" echo "##################################################################" diff --git a/ajouter_media.sh b/ajouter_media.sh index a358850e..c5d87dec 100755 --- a/ajouter_media.sh +++ b/ajouter_media.sh @@ -29,19 +29,27 @@ ME="${0##*/}" [[ $(which xdpyinfo) == "" ]] && echo "ERREUR! Installez x11-utils" && echo "sudo apt install x11-utils" && exit 1 # Check who is .current 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 ) +PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) +[[ $PLAYER == "" ]] && espeak "ERROR CONNECT YOUR PLAYER - EXIT" && exit 1 +PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) +G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) +[[ $G1PUB == "" ]] && espeak "ERROR NO G1 PUBLIC KEY FOUND - EXIT" && exit 1 + PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 ) ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1) -[[ $ASTRONAUTENS == "" ]] && echo "ASTRONAUTE manquant" && exit 1 +[[ $ASTRONAUTENS == "" ]] && echo "ASTRONAUTE manquant" && espeak "Astronaut Key Missing" && exit 1 + +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) URL="$1" if [ $URL ]; then echo "URL: $URL" REVSOURCE="$(echo "$URL" | awk -F/ '{print $3}' | rev)_" - [ ! $2 ] && IMPORT=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Que copier depuis cette source ?" --entry-text="Video" MP3 Web) || IMPORT="Youtube" + [ ! $2 ] && IMPORT=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Que copier depuis cette source ?" --entry-text="Page" Video MP3 Web) + [[ $IMPORT == "" ]] && espeak "No choice made. Exiting program" && exit 1 [[ $IMPORT == "Video" ]] && IMPORT="Youtube" CHOICE="$IMPORT" fi @@ -59,9 +67,6 @@ height=$(echo $screen | cut -d 'x' -f 2) large=$((width-300)) haut=$((height-200)) -######################################################################## -PLAYER=$(cat ~/.zen/game/players/.current/.player) - ######################################################################## ## CADRE EXCEPTION COPIE PRIVE # https://www.legifrance.gouv.fr/codes/article_lc/LEGIARTI000006278917/2008-12-11/ @@ -90,25 +95,23 @@ case $? in esac fi -## CHECK IF ASTROPORT/CRON/IPFS IS RUNNING -YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) -[[ ! $YOU ]] && RUN=$(zenity --entry --width 300 --title="Astroport IPFS OFF" --text="Activer Astroport ?" --entry-text="OUI" NON) && [[ $RUN == "" || $RUN == "NON" ]] && exit 1 -[[ $YOU && ! $1 ]] && RUN=$(zenity --entry --width 300 --title="Astroport IPFS ON" --text="Désactiver Astroport ? Non, vous voulez ajouter un Media?" --entry-text="OUI" NON) ## DES/ACTIVATION ASTROPORT -if [[ $RUN == "OUI" ]]; then +if [[ $1 == "on" ]]; then STRAP=$(ipfs bootstrap) BOOT=$(zenity --entry --width 300 --title="Catégorie" --text="$STRAP Changez de Bootstrap" --entry-text="Aucun" astrXbian Public) [[ $BOOT == "Aucun" ]] && ipfs bootstrap rm --all [[ $BOOT == "astrXbian" ]] && for bootnode in $(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#"); do ipfs bootstrap add $bootnode; done [[ $BOOT == "Public" ]] && for bootnode in $(cat ~/.zen/astrXbian/A_boostrap_public.txt | grep -Ev "#"); do ipfs bootstrap add $bootnode; done - REP=$(~/.zen/Astroport.ONE/tools/cron_VRFY.sh) && zenity --warning --width 600 --text "$REP" + REP=$(~/.zen/Astroport.ONE/tools/cron_VRFY.sh ON) && zenity --warning --width 600 --text "$REP" fi + +## CHECK IF ASTROPORT/CRON/IPFS IS RUNNING YOU=$(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 1 +[[ ! $YOU ]] && espeak "I P F S not running - EXIT" && exit 1 ######################################################################## # CHOOSE CATEGORY (remove anime, not working!) -[[ $CHOICE == "" ]] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Choisissez la catégorie de votre ajout" --entry-text="Film" Serie Youtube AstroBlog Video) +[[ $CHOICE == "" ]] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Choisissez la catégorie de votre media" --entry-text="Vlog" Film Serie Youtube Video) [[ $CHOICE == "" ]] && exit 1 # LOWER CARACTERS @@ -132,10 +135,9 @@ case ${CAT} in # # ######################################################################## - astroblog) + vlog) - # INSTASCAN G1PUB CAPTURE - ~/.zen/Astroport.ONE/tools/instascan_login.sh "ONE" + espeak "vlog is video blogging" zenity --warning --width 300 --text "$PLAYER. Prêt à enregistrer votre video ?" @@ -156,6 +158,8 @@ case ${CAT} in ######################################################################## youtube) + espeak "youtube : video copying" + YTURL="$URL" [[ $YTURL == "" ]] && YTURL=$(zenity --entry --width 300 --title "Lien ou identifiant à copier" --text "Indiquez le lien (URL) ou l'ID de la vidéo" --entry-text="") [[ $YTURL == "" ]] && exit 1 @@ -236,8 +240,13 @@ rm -Rf ${YTEMP} # CASE ## WEB web) + espeak "web : clone web site. Please help debugging" + ## wget current URL -> index.html ## TEST ## TEST httrack ?? - [[ ! $(which httrack) ]] && zenity --warning --width ${large} --text "Utilitaire de copie de site web absent.. Lancez la commande 'sudo apt install httrack'" && exit 1 + [[ ! $(which httrack) ]] && espeak "Plase install httrack software - EXIT" && \ + zenity --warning --width ${large} --text "Utilitaire de copie de site web absent.. Lancez la commande 'sudo apt install httrack'" && \ + exit 1 + echo "httrack --mirror $URL" # TODO : FOR NOW NOT WORKING FILE_NAME="index.html" REVSOURCE="$(echo "$URL" | rev | sha256sum | cut -d ' ' -f 1)_"; echo $REVSOURCE # URL="https://discuss.ipfs.io/t/limit-ipfs-get-command/3573/6" @@ -259,6 +268,8 @@ rm -Rf ${YTEMP} # CASE ## PAGE page) + espeak "page : convert into portable digital document" + ## record one page to PDF [[ ! $(which chromium) ]] && zenity --warning --width ${large} --text "Utilitaire de copie de page web absent.. Lancez la commande 'sudo apt install chromium'" && exit 1 cd /tmp/ && rm -f output.pdf @@ -288,7 +299,10 @@ rm -Rf ${YTEMP} ######################################################################## mp3) -zenity --warning --width 600 --text 'WARNING. HEAVY DEBUG ZONE . Join us at https://git.p2p.legal' + espeak "mp3 is music copying. Please help..." + +zenity --warning --width 600 --text 'DEVELOPPER ZONE ONLY - https://git.p2p.legal' +exit 0 # Create TEMP directory YTEMP="$HOME/.zen/tmp/$(date -u +%s%N | cut -b1-13)" @@ -360,6 +374,8 @@ exit 0 ######################################################################## film | serie) + espeak "thank you for sharing your best movies" + # SELECT FILE TO ADD TO ASTROPORT/KODI FILE=$(zenity --file-selection --title="Sélectionner le fichier à ajouter") echo "${FILE}" @@ -494,6 +510,8 @@ echo "${CAT};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/i video) + epeak "video is adding your personnal video in TW" + zenity --warning --width 600 --text 'DEVELOPPEMENT. SVP. Inscrivez-vous sur https://git.p2p.legal' ## GENERAL MEDIAKEY for uploaded video. Title + Decription + hashtag + hashipfs @@ -625,20 +643,9 @@ zenity --warning --width 300 --text "Ajout du Tiddler $MEDIAKEY à votre TW 'moa ######################################################################## ## ADD TIDDLER TO TW ######################################################################## -VOEUXLIST=($(cat /home/fred/.zen/game/players/.current/voeux/*/.title)) # LIST PLAYER VOEUX -echo "${VOEUXLIST}" -# TODO : Make it work Add FALSE between each voeu in VOEUXLIST -# VCHOOSE=$(zenity --list --checklist --title="VOEUX"\ -# --text="Choisissez le voeux ou ajouter \"${TITLE}\""\ -# --column="Use"\ -# --column="Feature"\ -# ${VOEUXLIST}) -## CHOOSE VOEU TW -## ADD TIDDLER TO VOEUTW -## ADD VOEUTW TO IPFS... -## OR ADD TO PLAYER TW -## TODO MAKE FUNCTION, idem dans G1VOEUX !! - echo "Nouveau MEDIAKEY dans MOA $PSEUDO / $PLAYER : http://127.0.0.1:8080/ipns/$ASTRONAUTENS" +echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" +############################### + echo "Nouveau MEDIAKEY dans TW $PSEUDO / $PLAYER : http://$myIP:8080/ipns/$ASTRONAUTENS" tiddlywiki --verbose --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html \ --import ~/astroport/${CAT}/${MEDIAID}/${MEDIAKEY}.dragdrop.json "application/json" \ --output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain" @@ -647,7 +654,6 @@ echo "${VOEUXLIST}" if [[ -s ~/.zen/tmp/newindex.html ]]; then echo "Mise à jour ~/.zen/game/players/$PLAYER/ipfs/moa/index.html" cp -f ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html - MOATS=$(date -u +"%Y%m%d%H%M%S%4N") echo "Avancement blockchain TW $PLAYER : $MOATS" cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$MOATS @@ -661,4 +667,6 @@ echo "${VOEUXLIST}" echo fi + espeak "Well done my friend. You are feeding the blob. Happy TW" + exit 0 diff --git a/tools/vlc_webcam.sh b/tools/vlc_webcam.sh index a95f4f1f..63ab2f3b 100755 --- a/tools/vlc_webcam.sh +++ b/tools/vlc_webcam.sh @@ -24,7 +24,7 @@ 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) -mkdir -p ~/.zen/tmp/${IPFSNODEID}/vlog/${ASTRONAUTENS} +mkdir -p ~/.zen/game/players/${PLAYER}/vlog screencapture(){ vlc \ @@ -84,29 +84,30 @@ echo "FOUND : ~/.zen/tmp/output.mp4" espeak "FILE SIZE = $FILE_SIZE" espeak "OK" -mkdir -p ~/.zen/game/players/.${PLAYER}/vlog +mkdir -p ~/.zen/game/players/${PLAYER}/vlog ## Creating new video chain index.html -OLDID=$(cat ~/.zen/game/players/.${PLAYER}/.vlog.index 2>/dev/null) +OLDID=$(cat ~/.zen/game/players/${PLAYER}/.vlog.index 2>/dev/null) if [[ $OLDID ]]; then - sed s/_OLDID_/$OLDID/g ${MY_PATH}/../templates/video_chain.html > ~/.zen/tmp/${IPFSNODEID}/vlog/${ASTRONAUTENS}/${MOATS}.index.html - sed -i s/_IPFSID_/$IPFSID/g ~/.zen/tmp/${IPFSNODEID}/vlog/${ASTRONAUTENS}/${MOATS}.index.html + sed s/_OLDID_/$OLDID/g ${MY_PATH}/../templates/video_chain.html > ~/.zen/game/players/${PLAYER}/vlog/${MOATS}.index.html + sed -i s/_IPFSID_/$IPFSID/g ~/.zen/game/players/${PLAYER}/vlog/${MOATS}.index.html else - sed s/_IPFSID_/$IPFSID/g ${MY_PATH}/../templates/video_first.html > ~/.zen/tmp/${IPFSNODEID}/vlog/${ASTRONAUTENS}/${MOATS}.index.html + sed s/_IPFSID_/$IPFSID/g ${MY_PATH}/../templates/video_first.html > ~/.zen/game/players/${PLAYER}/vlog/${MOATS}.index.html fi -sed -i s/_DATE_/$(date -u "+%Y-%m-%d#%H:%M:%S")/g ~/.zen/tmp/${IPFSNODEID}/vlog/${ASTRONAUTENS}/${MOATS}.index.html -sed "s~_PSEUDO_~$PLAYER~g" ~/.zen/tmp/${IPFSNODEID}/vlog/${ASTRONAUTENS}/${MOATS}.index.html > ~/.zen/game/players/.${PLAYER}/vlog/index.html +sed -i s/_DATE_/$(date -u "+%Y-%m-%d#%H:%M:%S")/g ~/.zen/game/players/${PLAYER}/vlog/${MOATS}.index.html +## TODO : THIS IS NOT CHANGING _PSEUDO_ WHY? +sed "s~_PSEUDO_~$PLAYER~g" ~/.zen/game/players/${PLAYER}/vlog/${MOATS}.index.html > ~/.zen/game/players/${PLAYER}/vlog/index.html # Copy style & js -cp -R ${MY_PATH}/../templates/styles ~/.zen/game/players/.${PLAYER}/vlog/ -cp -R ${MY_PATH}/../templates/js ~/.zen/game/players/.${PLAYER}/vlog/ +cp -R ${MY_PATH}/../templates/styles ~/.zen/game/players/${PLAYER}/vlog/ +cp -R ${MY_PATH}/../templates/js ~/.zen/game/players/${PLAYER}/vlog/ -IPFSROOT=$(ipfs add -rHq ~/.zen/game/players/.${PLAYER}/vlog | tail -n 1) -echo $IPFSROOT > ~/.zen/game/players/.${PLAYER}/.vlog.index +IPFSROOT=$(ipfs add -rHq ~/.zen/game/players/${PLAYER}/vlog | tail -n 1) +echo $IPFSROOT > ~/.zen/game/players/${PLAYER}/.vlog.index # TEMPLATE EVOLUTION -sed 's/_PSEUDO_/$PSEUDO/g' ~/.zen/tmp/${IPFSNODEID}/vlog/${ASTRONAUTENS}/${MOATS}.index.html > ~/.zen/game/players/.${PLAYER}/vlog/index.html -sed 's/_IPFSROOT_/$IPFSROOT/g' ~/.zen/tmp/${IPFSNODEID}/vlog/${ASTRONAUTENS}/${MOATS}.index.html > ~/.zen/game/players/.${PLAYER}/vlog/index.html -IPFSROOT=$(ipfs add -rHq ~/.zen/game/players/.${PLAYER}/vlog | tail -n 1) +sed 's/_PSEUDO_/$PSEUDO/g' ~/.zen/game/players/${PLAYER}/vlog/${MOATS}.index.html > ~/.zen/game/players/${PLAYER}/vlog/index.html +sed 's/_IPFSROOT_/$IPFSROOT/g' ~/.zen/game/players/${PLAYER}/vlog/${MOATS}.index.html > ~/.zen/game/players/${PLAYER}/vlog/index.html +IPFSROOT=$(ipfs add -rHq ~/.zen/game/players/${PLAYER}/vlog | tail -n 1) echo "NEW VIDEO http://127.0.0.1:8080/ipfs/$IPFSROOT" ## OUVERTURE VLOG CHAIN @@ -123,8 +124,8 @@ ANIMH=$(ipfs add -q ~/.zen/tmp/screen.gif) REAL=$(file --mime-type "$HOME/astroport/video/vlog/$PLAYER_$MEDIAID.mp4" | cut -d ':' -f 2 | cut -d ' ' -f 2) ## TW not displaying direct ipfs video link (only image, pdf, ...) so insert