This commit is contained in:
fred 2022-12-12 22:17:55 +01:00
parent 7e7704c9f9
commit ff017eb500
4 changed files with 29 additions and 27 deletions

View File

@ -40,12 +40,12 @@ CHOICE="$3"
[[ ${PLAYER} == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
[[ ${PLAYER} == "" ]] \
&& espeak "YOU MUST CONNECT A PLAYER" \
&& OUTPUT=$(zenity --forms --width 480 --title="CONNEXION" --text="Ecrivez la formule magique" --separator="~" --add-entry="Phrase 1" --add-entry="Phrase 2") \
&& SALT=$(awk -F '~' '{print $1}' <<<$OUTPUT) \
&& PEPPER=$(awk -F '~' '{print $2}' <<<$OUTPUT) \
&& PLAYER=$(zenity --entry --width 300 --title "PLAYER" --text "Indiquez votre email" --entry-text="user@domain.tld") \
&& ${MY_PATH}/tools/VISA.new.sh "$SALT" "$PEPPER" "$PLAYER"
&& players=($(ls ~/.zen/game/players 2>/dev/null)) \
&& espeak "PLEASE CONNECT A PLAYER" \
&& 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
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null)
espeak "Hello $PSEUDO"
@ -144,7 +144,7 @@ espeak "Ready !"
########################################################################
# CHOOSE CATEGORY (remove anime, not working!)
[ ! $2 ] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Quelle catégorie pour ce media ?" --entry-text="Vlog" Video Film Serie Web Page Youtube Mp3)
[ ! $2 ] && [[ $CHOICE == "" ]] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Quelle catégorie pour ce media ?" --entry-text="Vlog" Video Film Serie Web Page Youtube Mp3)
[[ $CHOICE == "" ]] && echo "NO CHOICE MADE" && exit 1
# LOWER CARACTERS
@ -482,12 +482,13 @@ mkdir -p ${YTEMP}
YTURL="$URL"
[ ! $2 ] && [[ $YTURL == "" ]] && artist=$(zenity --entry --width 400 --title "Extraction MP3 depuis Youtube" --text "Artiste recherché ou Lien Youtube" --entry-text="")
[[ $artist == "" ]] && echo "NO COPY TO MAKE" && exit 1
[[ $YTURL == "" ]] && [[ $artist == "" ]] && echo "NO COPY TO MAKE" && exit 1
## CHECK if artist is LINK or ID
length=${#artist}
islink=$(echo "$artist" | grep "http")
if [[ ! $islink && $length != 11 ]]
if [[ $YTURL == "" && $islink == "" && $length != 11 ]]
then
# Ask for song name
[ ! $2 ] && song=$(zenity --entry --width 300 --title "Titre à chercher sur Youtube" --text "Titre recherché" --entry-text="")
@ -502,12 +503,13 @@ then
else
# artist is the URL ot the song
[[ $YTURL == "" ]] && YTURL="$artist"
/usr/local/bin/youtube-dl \
--cookies-from-browser $BROWSER \
--ignore-errors --no-mtime \
--embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" --add-metadata \
--extract-audio --audio-format mp3 -o "${YTEMP}/%(id)s&%(title)s.%(ext)s" "$artist"
--extract-audio --audio-format mp3 -o "${YTEMP}/%(id)s&%(title)s.%(ext)s" "$YTURL"
fi

View File

@ -1 +1 @@
[{"title":"$:/ipfs/saver/api/http/local/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"_NID_/api"}]
[{"title":"$:/ipfs/saver/api/http/local/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"_NID_"}]

View File

@ -29,7 +29,8 @@ IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
################################################################################
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(echo $myIP | 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"
[[ ! $myIP || $isLAN ]] && myIP="localhost"
################################################################################
## CHECK if PLAYER resolve any ASTRONAUTENS
@ -165,8 +166,12 @@ YUSER=$(echo $PLAYER | cut -d '@' -f1) # YUSER=geg-la_debrouille
LYUSER=($(echo "$YUSER" | sed 's/[^a-zA-Z0-9]/\ /g')) # LYUSER=(geg la debrouille)
CLYUSER=$(printf '%s\n' "${LYUSER[@]}" | tac | tr '\n' '.' ) # CLYUSER=debrouille.la.geg.
YOMAIN=$(echo $PLAYER | cut -d '@' -f 2) # YOMAIN=super.chez-moi.com
NID="https://ipfs.$CLYUSER$YOMAIN.$HOSTNAME"
echo "$NID"
[[ $isLAN ]] && NID="http://ipfs.localhost:8080" && WID="http://ipfs.localhost:5001"
[[ ! $isLAN ]] && NID="https://ipfs.$CLYUSER$YOMAIN.$HOSTNAME" && WID="$NID/api"
### CREATE $NID ADDRESS FOR API & ROUND ROBIN FOR GW
cat ~/.zen/Astroport.ONE/templates/data/local.api.json | sed -i "s~_NID_~$WID~g" > ~/.zen/tmp/${MOATS}/local.api.json
cat ~/.zen/Astroport.ONE/templates/data/local.gw.json | sed -i "s~_NID_~$NID~g" > ~/.zen/tmp/${MOATS}/local.gw.json
mv ~/.zen/tmp/${MOATS}/secret.dunikey ~/.zen/game/players/$PLAYER/
@ -237,34 +242,29 @@ echo "$NID"
###########
echo "# CRYPTO ENCODING _SECRET_ "
echo $myIP > ~/.zen/tmp/${MOATS}/myIP
$MY_PATH/natools.py encrypt -p $G1PUB -i $HOME/.zen/game/players/$PLAYER/secret.dunikey -o $HOME/.zen/tmp/${MOATS}/secret.dunikey.$G1PUB.enc
ENCODING=$(cat ~/.zen/tmp/${MOATS}/secret.dunikey.$G1PUB.enc | base16)
sed -i "s~_SECRET_~$ENCODING~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
###########
echo "# CRYPTO DECODING TESTING..."
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r .[].secret | base16 -d > ~/.zen/tmp/${MOATS}/myIP.$G1PUB.enc.2
$MY_PATH/natools.py decrypt -f pubsec -k $HOME/.zen/game/players/$PLAYER/secret.dunikey -i $HOME/.zen/tmp/${MOATS}/myIP.$G1PUB.enc.2 -o $HOME/.zen/tmp/${MOATS}/myIP.2
cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r .[].secret | base16 -d > ~/.zen/tmp/${MOATS}/crypto.$G1PUB.enc.2
$MY_PATH/natools.py decrypt -f pubsec -k $HOME/.zen/game/players/$PLAYER/secret.dunikey -i $HOME/.zen/tmp/${MOATS}/crypto.$G1PUB.enc.2 -o $HOME/.zen/tmp/${MOATS}/crypto.2
###########
## CRYPTO PROCESS VALIDATED
[[ -s ~/.zen/tmp/${MOATS}/myIP.2 ]] && echo "NATOOLS LOADED" \
[[ -s ~/.zen/tmp/${MOATS}/crypto.2 ]] && echo "NATOOLS LOADED" \
|| sed -i "s~$ENCODING~$myIP~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html # Revert to plaintext _SECRET_ myIP
rm -f ~/.zen/tmp/${MOATS}/myIP.2
rm -f ~/.zen/tmp/${MOATS}/crypto.2
###########
# Create"$PLAYER_feed" Key
FEEDNS=$(ipfs key gen "$PLAYER_feed")
FEEDNS=$(ipfs key gen "${PLAYER}_feed")
## MAKE LightBeam Plugin Tiddler $PLAYER_feed
# $:/plugins/astroport/lightbeams/saver/ipns/lightbeam-key
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-name","text":"'${PLAYER}_feed'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-name.json
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-key","text":"'${FEEDNS}'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-key.json
### CREATE $NID ADDRESS FOR API & ROUND ROBIN FOR GW
cat ~/.zen/Astroport.ONE/templates/data/local.api.json | sed -i "s~_NID_~$NID~g" > ~/.zen/tmp/${MOATS}/local.api.json
cat ~/.zen/Astroport.ONE/templates/data/local.gw.json | sed -i "s~_NID_~https://ipfs.copylaradio.com~g" > ~/.zen/tmp/${MOATS}/local.gw.json
## ADD SYSTEM TW
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html \
--import ~/.zen/tmp/${MOATS}/lightbeam-name.json "application/json" \
@ -324,7 +324,7 @@ qrencode -s 12 -o "$HOME/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png" "https:/
echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sleep 1
echo "--- PLAYER : $PLAYER";
echo; echo "VISA : https://ipfs.copylaradio.com/ipns/${IASTRO}"
echo; echo "VISA : https://ipfs.copylaradio.com/ipfs/${IASTRO}"
echo; echo "+ TW : https://ipfs.copylaradio.com/ipns/${ASTRONAUTENS}"
echo; echo "+ RSS : https://ipfs.copylaradio.com/ipns/${FEEDNS}"; sleep 1

View File

@ -28,7 +28,7 @@ MESSAGE="( ◕‿◕)\n\n Bonjour $PLAYER\n\n UN MESSAGE POUR VOUS.\n\nAstroport
echo "
########################################################################
# EMAIL $SUBJECT $messfile TO $mail
# $SUBJECT + $messfile -> $mail
########################################################################"