diff --git a/20h12.process.sh b/20h12.process.sh index 3e326a2c..1c5c6845 100755 --- a/20h12.process.sh +++ b/20h12.process.sh @@ -24,7 +24,7 @@ LOWMODE=$(sudo systemctl status ipfs | grep disabled) ## IPFS DISABLED - START O # echo "$USER ALL=(ALL) NOPASSWD:/bin/systemctl" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/systemctl') sudo systemctl restart ipfs && sleep 10 -espeak "CODE git pull" > /dev/null 2>&1 +# espeak "CODE git pull" > /dev/null 2>&1 ## PROCESS TW BACKOFFICE TREATMENT [[ -s ~/.zen/G1BILLET/G1BILLETS.sh ]] \ @@ -36,7 +36,7 @@ git pull ## SOON /ipns/ Address !!! -espeak "20 HOURS 12 MINUTES. ASTROBOT RUNNING." > /dev/null 2>&1 +# espeak "20 HOURS 12 MINUTES. ASTROBOT RUNNING." > /dev/null 2>&1 ## Updating yt-dlp $MY_PATH/youtube-dl.sh sudo youtube-dl -U @@ -44,14 +44,14 @@ sudo youtube-dl -U # Refresh ~/.zen/game/world/G1VOEU # NOW RUN FROM PLAYER.refresh.sh !! ~/.zen/Astroport.ONE/RUNTIME/VOEUX.refresh.sh -espeak "Players refresh" > /dev/null 2>&1 +# espeak "Players refresh" > /dev/null 2>&1 # Refresh ~/.zen/game/players/PLAYER ~/.zen/Astroport.ONE/RUNTIME/PLAYER.refresh.sh -espeak "REFRESHING UPLANET" > /dev/null 2>&1 +# espeak "REFRESHING UPLANET" > /dev/null 2>&1 ~/.zen/Astroport.ONE/RUNTIME/UPLANET.refresh.sh -espeak "REFRESHING NODE" > /dev/null 2>&1 +# espeak "REFRESHING NODE" > /dev/null 2>&1 ~/.zen/Astroport.ONE/RUNTIME/NODE.refresh.sh @@ -71,7 +71,11 @@ espeak "REFRESHING NODE" > /dev/null 2>&1 ######################################################################## end=`date +%s` dur=`expr $end - $start` -echo "20H12 (♥‿‿♥) Execution time was $dur" seconds. +hours=$((dur / 3600)) +minutes=$(( (dur % 3600) / 60 )) +seconds=$((dur % 60)) +echo "DURATION ${hours} hours ${minutes} minutes ${seconds} seconds" +echo "20H12 (♥‿‿♥) Execution time was $dur seconds." # ~/.zen/Astroport.ONE/tools/ipfs_P2P_forward.sh ## COULD FORWARD LOCAL TCP PORT TO SWARM rm ~/.zen/game/players/localhost/latest @@ -79,9 +83,9 @@ rm ~/.zen/game/players/localhost/latest ## MAIL LOG : support@qo-op.com ## $MY_PATH/tools/mailjet.sh "support@qo-op.com" "/tmp/20h12.log" -espeak "duration was $dur seconds" > /dev/null 2>&1 +espeak "DURATION ${hours} hours ${minutes} minutes ${seconds} seconds" > /dev/null 2>&1 -espeak "Restarting Astroport Services" > /dev/null 2>&1 +# espeak "Restarting Astroport Services" > /dev/null 2>&1 ## CLOSING API PORT [[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid) > /dev/null 2>&1 ## KILL ALL REMAINING nc @@ -95,7 +99,6 @@ if [[ ! -f /etc/systemd/system/astroport.service ]]; then else sudo systemctl restart astroport [[ -s ~/.zen/G1BILLET/G1BILLETS.sh ]] && sudo systemctl restart g1billet - sudo systemctl restart ipfs echo "Astroport processes systemd restart" fi @@ -103,9 +106,9 @@ fi echo "IPFS LOW MODE ?" ## IPFS DISABLED : STOP IT [[ $LOWMODE != "" ]] \ - && echo "$LOWMODE" \ + && echo "ON. $LOWMODE" \ && sleep 360 \ && sudo systemctl stop ipfs \ - || sudo systemctl restart ipfs + || { echo "OFF. RESTART IPFS" && sudo systemctl restart ipfs; } exit 0 diff --git a/docker/astroport/Dockerfile b/docker/astroport/Dockerfile index 43cf342c..6934518e 100644 --- a/docker/astroport/Dockerfile +++ b/docker/astroport/Dockerfile @@ -7,6 +7,7 @@ ARG DOCKER_SYSTEM=Linux RUN apt-get update \ && apt-get -fy upgrade \ && DEBIAN_FRONTEND=noninteractive apt-get -fy install \ + argon2 \ basez \ bash \ bc \ diff --git a/install.sh b/install.sh index d0827d3b..6592f668 100755 --- a/install.sh +++ b/install.sh @@ -44,7 +44,7 @@ echo "#############################################" echo "######### INSTALL BASE & PYTHON3 PACKAGE ####" echo "#############################################" -for i in git make cmake fail2ban npm netcat-traditional ncdu chromium* miller inotify-tools curl net-tools libsodium* libcurl4-openssl-dev python3-pip python3-setuptools python3-wheel python3-dotenv python3-gpg python3-jwcrypto python3-brotli mpack; do +for i in git make cmake fail2ban npm argon2 netcat-traditional ncdu chromium* miller inotify-tools curl net-tools libsodium* libcurl4-openssl-dev python3-pip python3-setuptools python3-wheel python3-dotenv python3-gpg python3-jwcrypto python3-brotli mpack; do if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then echo ">>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" sudo apt install -y $i diff --git a/tools/_new_mp3_in_astroport.sh b/tools/_new_mp3_in_astroport.sh deleted file mode 100755 index fd18ea5c..00000000 --- a/tools/_new_mp3_in_astroport.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/bash -######################################################################## -# Author: Fred (support@qo-op.com) -# Version: 0.3 -# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) -######################################################################## -# COPY ~/Astroport/${PLAYER}/mp3/artist/song files to IPFS -######## #### ### ## # -MY_PATH="`dirname \"$0\"`" # relative -MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized -. "$MY_PATH/my.sh" -ME="${0##*/}" -YOU=$(myIpfsApi) -G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) -# GET XZUID -[[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title) || XZUID=$(hostname -f) -######################################################################## -path="$1" -# Add trailing / if needed -length=${#path} -last_char=${path:length-1:1} -[[ $last_char != "/" ]] && path="$path/"; : - -file="$2" - -echo "$0 PATH/ \"$path\" FILE \"$file\"" -[[ ! -f "${path}${file}" ]] && echo "Fichier introuvable ... EXIT" && exit 1 - -echo '#### NEED REWRITING #####' && exit 0 -read - -YTEMP="/tmp/$(date -u +%s%N | cut -b1-13)" -mkdir -p ${YTEMP} - -YID=$(echo "${file}" | cut -d "_" -f 1) -YNAME=$(echo "${file}" | cut -d "_" -f 2-) -TITLE="${YNAME%.*}" -FILE_EXT="${file##*.}" -[[ "$FILE_EXT" != "mp3" ]] && echo "Extension inconnue. Seul le format mp3 est accepté ... EXIT" && exit 1 - -[[ ! $(echo "$path" | cut -d '/' -f 4 | grep 'astroport') ]] && echo "Les fichiers sont à placer dans ~/Astroport/${PLAYER}/mp3/ MERCI" && exit 1 -CAT=$(echo "$path" | cut -d '/' -f 5 ) # mp3 -ARTIST=$(echo "$path" | cut -d '/' -f 6 ) # artist || YID -ALBUM=$(echo "$path" | cut -d '/' -f 7 ) # album || _o-o_ || EMPTY -[[ "$ALBUM" == "" ]] && echo "ARTIST = YID = $ARTIST" - -CAT=$(echo "$CAT" | awk '{ print tolower($0) }') - -######################################################################## -######################################################################## -# MOVE SECTION in new_mp3_in_astroport.sh -DURATION=$(mp3info -p "%S" "${path}${file}") -float=$(echo "$DURATION/1.618" | bc -l) && GOLDENTIME=${float%.*} - -## EXTRACT 5 seconds from GOLDENTIME -ffmpeg -loglevel quiet -ss $GOLDENTIME -t 5 -i "${path}${file}" /tmp/5s_${YID}.mp3 - -## TRY TO RECOGNIZE WITH mazash -## CHECK if 8600 port is active -## ipfs p2p forward /x/oasis-mazash /ip4/127.0.0.1/tcp/8600 /p2p/12D3KooWBYme2BsNUrtx4mEdNX6Yioa9AV7opWzQp6nrPs6ZKabN -SAMPLEID=$(ipfs add -q /tmp/5s_${YID}.mp3) -RECOG=$(curl -sX POST "http://localhost:8600/api/v1/mazash/recognize" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"cid\":\"${SAMPLEID}\",\"extension\":\".mp3\"}") -CONFIANCE=$(echo $RECOG | jq .results[].input_confidence | tail -n 1) -MAZASHID=$(echo $RECOG | jq .results[].file_sha1 | tail -n 1) -IPNSID=$(echo $RECOG | jq .results[].song_name | tail -n 1) - -echo "$CONFIANCE MATCHING $MAZASHID ($IPNSID)" - -## NEEDED TO CREATE IPNS KEY -INDEXPREFIX="MP3_" -REFERENCE="${YID}" - -######################################################################## -######################################################################## -######################################################################## - -echo "-----------------------------------------------------------------" - -IPFSREPFILEID=$(ipfs add -wq "${path}${file}" | tail -n 1) -[[ $IPFSREPFILEID == "" ]] && echo "ipfs add ERROR" && exit 1 -echo "-----------------------------------------------------------------" -echo "IPFS: $file : ipfs ls /ipfs/$IPFSREPFILEID" -echo "-----------------------------------------------------------------" - -URLENCODE_FILE_NAME=$(echo ${file} | jq -Rr @uri) - -######################################################################## -## CREATE NEW ipns KEY : ${INDEXPREFIX}${REFERENCE} -######################################################################## -######################################################################## -[[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB} ]] && mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB} && KEY=$(ipfs key gen "${INDEXPREFIX}${REFERENCE}") && KEYFILE=$(ls -t ~/.ipfs/keystore/ | head -n 1) -## INIT ipns -if [[ $KEY ]]; then - # memorize IPNS key filename for easiest exchange - echo "$KEYFILE" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.ipns.key.keystore_filename - # Publishing IPNS key - echo "$KEY" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.ipns.link - # .zen could contain ZEN for economic value - touch ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.zen - - ################ ENCRYPT keystore/$KEYFILE - $MY_PATH/tools/natools.py encrypt -p $G1PUB -i ~/.ipfs/keystore/$KEYFILE -o ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.ipns.key.natools.encrypt -else - KEY=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.ipns.link) - KEYFILE=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.ipns.key.keystore_filename) -fi - -# CLEAR ipfs link (then encrypted to manage exchange regulation) -echo "/ipfs/$IPFSREPFILEID/${file}" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.ipfs.filelink -################ ENCRYPT .ipfs.filelink -$MY_PATH/tools/natools.py encrypt -p $G1PUB -i ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.ipfs.filelink -o ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.ipfs.filelink.natools.encrypt -rm ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.ipfs.filelink - -echo "${file}" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.ipfs.filename -echo "${TITLE}" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.title -echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/.timestamp - -# IPNS index.html Redirect to ipfs streaming link (could be contract or anything else !!) -echo "" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/index.html - -IPNSLINK=$(ipfs key list -l | grep ${INDEXPREFIX}${REFERENCE} | cut -d ' ' -f 1) -echo " -