forked from STI/Astroport.ONE
Compare commits
77 Commits
8088394bd5
...
8eda0e1274
Author | SHA1 | Date |
---|---|---|
Yann Autissier | 8eda0e1274 | |
fred | d9f3b1e4e9 | |
fred | d68387dc44 | |
fred | 800c7113bb | |
fred | aeaee8b462 | |
fred | 1c1945ffbf | |
fred | f540948a84 | |
fred | a104b7c86c | |
fred | f183544267 | |
fred | 67c740333b | |
fred | 3495fce3ff | |
fred | 5265e6d458 | |
fred | 7f35e279c0 | |
fred | 8b94ff9d83 | |
fred | 2cf381f724 | |
fred | 4c3b36ad1e | |
fred | 964f9b4431 | |
fred | fc9b9c36e6 | |
fred | c76af2c2e7 | |
fred | 1bc210de6e | |
fred | 1d4c38498a | |
fred | ba8bbbde57 | |
fred | 6403bad0ae | |
fred | 637c989c14 | |
fred | 518afda508 | |
fred | 573998d3e2 | |
fred | 7b8d975fd1 | |
fred | f93a12fced | |
fred | 9311fc28f8 | |
fred | 465304a96b | |
fred | 7b4131f817 | |
fred | 714577aa1d | |
fred | ff017eb500 | |
fred | 7e7704c9f9 | |
fred | 1f6170ace5 | |
fred | c8820de8cc | |
fred | 46ac37917a | |
fred | 0d73983977 | |
fred | be6042686a | |
fred | 4334cba015 | |
qo-op | e2bbfc1a99 | |
fred | 5cccddbddf | |
fred | 9166b3bc08 | |
fred | e2e1536a26 | |
fred | 170f755cb4 | |
fred | 80f7a22c75 | |
fred | a9ffbaf2fe | |
fred | 2743ddbb8f | |
fred | 53d0d1607d | |
fred | 8219f00caa | |
fred | ce21945856 | |
fred | f279c8bc6c | |
fred | 3742ad8841 | |
fred | db72246364 | |
fred | b9725b49df | |
fred | e463a4d28d | |
fred | 58a07acaa5 | |
fred | ebb5cc117e | |
Yann Autissier | bc0c5d477b | |
fred | 23f9efbb48 | |
fred | 2127b370d6 | |
Yann Autissier | 4f3021c323 | |
Yann Autissier | daad060e6c | |
fred | 95ff8d7dec | |
fred | d41da77a99 | |
fred | f0677e4ca7 | |
fred | f23963d698 | |
fred | 809f888409 | |
fred | 0f20b1ecfb | |
fred | 23650f4cc5 | |
fred | 552e663f7f | |
fred | c2ff81ff5a | |
fred | cf07610968 | |
fred | 43a8b7383e | |
fred | 6ac7a7e30f | |
fred | b27fbaffae | |
fred | 596ad3a823 |
41
12345.sh
41
12345.sh
|
@ -19,7 +19,7 @@ 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])/")
|
||||
|
||||
[[ $isLAN ]] && myHOST="ipfs.localhost" && myHOSTPort="ipfs.localhost:8080" && myHTTP="http://" && myASTROPORT="http://astroport.localhost:1234" ## LAN STATION
|
||||
[[ ! $isLAN ]] && myHOST="astroport.copylaradio.com" && myHOSTPort="ipfs.copylaradio.com" && myHTTP="https://" && myASTROPORT="https://astroport.copylaradio.com" ## WAN STATION
|
||||
[[ ! $isLAN || $USER == "zen" ]] && myHOST="astroport.copylaradio.com" && myHOSTPort="ipfs.copylaradio.com" && myHTTP="https://" && myASTROPORT="https://astroport.copylaradio.com" ## WAN STATION
|
||||
|
||||
PORT=12345
|
||||
|
||||
|
@ -31,7 +31,7 @@ mkdir -p ~/.zen/tmp/coucou/
|
|||
|
||||
## 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)
|
||||
[[ $ncrunning ]] && echo "ERROR - API Server Already Running - ${myHTTP}${myHOST}:1234/?salt=totodu56&pepper=totodu56&getipns " && exit 1
|
||||
[[ $ncrunning ]] && echo "ERROR - API Server Already Running - ${myASTROPORT}/?salt=totodu56&pepper=totodu56&getipns " && exit 1
|
||||
## NOT RUNNING TWICE
|
||||
|
||||
# Some client needs to respect that
|
||||
|
@ -80,7 +80,9 @@ while true; do
|
|||
|
||||
## CHECK 12345 PORT RUNNING (STATION FoF MAP)
|
||||
maprunning=$(ps auxf --sort=+utime | grep -w '_12345.sh' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
||||
[[ ! $maprunning ]] && ($MY_PATH/_12345.sh &) && echo '(ᵔ◡◡ᵔ) LAUNCHING '${myHTTP}${myHOST}:'12345 (ᵔ◡◡ᵔ)'
|
||||
[[ ! $maprunning ]] \
|
||||
&& echo '(ᵔ◡◡ᵔ) LAUNCHING '${myHTTP}${myHOST}:'12345 (ᵔ◡◡ᵔ)' \
|
||||
&& exec $MY_PATH/_12345.sh &
|
||||
|
||||
############### ACTIVATE USE ON QUICK IPFS DRIVE
|
||||
### CREATE IPNS KEY - ACTIVATE WHITH ENOUGH BOOTSTRAP
|
||||
|
@ -102,7 +104,9 @@ 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~127.0.0.1~${myHOST}~g" ~/.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~${myHTTP}${myHOSTPort}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
||||
|
||||
sed -i "s~:12345~:${PORT}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
||||
|
||||
sed -i "s~_SESSIONLNK_~${myHTTP}${myHOSTPort}/ipns/${SESSIONNS}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
||||
|
@ -119,6 +123,10 @@ while true; do
|
|||
URL=$(echo "$REQ" | grep '^GET' | cut -d ' ' -f2 | cut -d '?' -f2)
|
||||
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="$HOST" && myHOSTPort="ipfs.$HOST" && myHTTP="https://" && myASTROPORT="https://$HOST" ## WAN STATION
|
||||
|
||||
############################################################################
|
||||
[[ $URL == "/test" || $URL == "" ]] && continue
|
||||
|
||||
|
@ -140,7 +148,7 @@ while true; do
|
|||
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~${myHTTP}$HOSTP~g" $HOME/.zen/Astroport.ONE/templates/register.html >> ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
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~${myHTTP}${myHOSTPort}~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
|
@ -321,8 +329,6 @@ while true; do
|
|||
|
||||
start=`date +%s`
|
||||
## RECORD DATA MADE IN BROWSER (JSON)
|
||||
SALT=$(urldecode ${arr[1]} | xargs)
|
||||
PEPPER=$(urldecode ${arr[3]} | xargs)
|
||||
NODEID=$(urldecode ${arr[7]} | xargs)
|
||||
DATAID=$(urldecode ${arr[9]} | xargs)
|
||||
|
||||
|
@ -454,8 +460,6 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
|
|||
|
||||
start=`date +%s`
|
||||
|
||||
SALT=$(urldecode ${arr[1]} | xargs)
|
||||
PEPPER=$(urldecode ${arr[3]} | xargs)
|
||||
# WHAT can contain urlencoded FullURL
|
||||
EMAIL=$(urldecode ${arr[7]} | xargs)
|
||||
PSEUDO=$(urldecode ${arr[9]} | xargs)
|
||||
|
@ -473,13 +477,14 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
|
|||
## CREATE PSEUDO FROM
|
||||
if [[ ! $PSEUDO ]]; then
|
||||
PSEUDO=$(echo ${EMAIL} | cut -d '@' -f 1)
|
||||
PSEUDO=${PSEUDO,,}; PSEUDO=${PSEUDO%%[0-9]*}${RANDOM:0:3}
|
||||
PSEUDO=${PSEUDO,,}; PSEUDO=${PSEUDO%%[0-9]*}${RANDOM:0:4}
|
||||
fi
|
||||
|
||||
if [[ ! -d ~/.zen/game/players/${EMAIL} ]]; then
|
||||
echo "# ASTRONAUT NEW VISA Create VISA.new.sh in background (~/.zen/tmp/email.${EMAIL}.${MOATS}.txt)"
|
||||
(
|
||||
startvisa=`date +%s`
|
||||
[[ "$SALT" == "0" && "$PEPPER" == "0" ]] && SALT="" && PEPPER="" # "0" "0" means random salt pepper
|
||||
echo "VISA.new : \"$SALT\" \"$PEPPER\" \"${EMAIL}\" \"$PSEUDO\" \"${WHAT}\"" > ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt
|
||||
$MY_PATH/tools/VISA.new.sh "$SALT" "$PEPPER" "${EMAIL}" "$PSEUDO" "${WHAT}" >> ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt
|
||||
$MY_PATH/tools/mailjet.sh "${EMAIL}" ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt ## Send VISA.new log to EMAIL
|
||||
|
@ -542,21 +547,22 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
|
|||
## Astroport.ONE local use QRCODE Contains ${WHAT} G1PUB
|
||||
QRCODE=$(echo $URL | cut -d ' ' -f2 | cut -d '=' -f 2 | cut -d '&' -f 1) && echo "QRCODE : $QRCODE"
|
||||
g1pubpath=$(grep $QRCODE ~/.zen/game/players/*/.g1pub | cut -d ':' -f 1 2>/dev/null)
|
||||
WHAT=$(echo "$g1pubpath" | rev | cut -d '/' -f 2 | rev 2>/dev/null)
|
||||
PLAYER=$(echo "$g1pubpath" | rev | cut -d '/' -f 2 | rev 2>/dev/null)
|
||||
|
||||
## FORCE LOCAL USE ONLY. Remove to open 1234 API
|
||||
[[ ! -d ~/.zen/game/players/${WHAT} || ${WHAT} == "" ]] && (echo "$HTTPCORS ERROR - QRCODE - NO ${WHAT} ON BOARD !!" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
||||
[[ ! -d ~/.zen/game/players/${PLAYER} || ${PLAYER} == "" ]] && (echo "$HTTPCORS ERROR - QRCODE - NO ${PLAYER} ON BOARD !!" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
||||
|
||||
## USE SECOND HTTP SERVER TO RECEIVE PASS
|
||||
|
||||
[[ ${arr[2]} == "" ]] && (echo "$HTTPCORS ERROR - QRCODE - MISSING ACTION" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
||||
## Demande de copie d'une URL reçue.
|
||||
if [[ ${arr[2]} == "url" ]]; then
|
||||
wsource="${arr[3]}"
|
||||
[[ ${arr[4]} == "type" ]] && wtype="${arr[5]}" || wtype="Youtube"
|
||||
[[ ${arr[4]} == "type" ]] && CHOICE="${arr[5]}" || CHOICE="Youtube"
|
||||
|
||||
## CREATION TIDDLER "G1Voeu" G1CopierYoutube
|
||||
# /.zen/Astropor.ONE/ajouter_media.sh "$(urldecode $wsource)" "$wtype" "$QRCODE" &
|
||||
# CHOICE = "Video" Page MP3 Web
|
||||
~/.zen/Astropor.ONE/ajouter_media.sh "$(urldecode $wsource)" "$PLAYER" "$CHOICE" &
|
||||
|
||||
echo "## Insertion tiddler : G1CopierYoutube"
|
||||
echo '[
|
||||
{
|
||||
|
@ -571,6 +577,11 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
|
|||
## TODO ASTROBOT "G1AstroAPI" READS ~/.zen/tmp/${WHAT}.${MOATS}.import.json
|
||||
|
||||
(echo "$HTTPCORS OK - ~/.zen/tmp/${WHAT}.${MOATS}.import.json WORKS IF YOU MAKE THE WISH voeu 'AstroAPI'" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
||||
|
||||
else
|
||||
|
||||
(echo "$HTTPCORS ERROR - ${arr[2]} - ${arr[3]} UNKNOWN" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
|
|
@ -22,7 +22,7 @@ rm -Rf ~/.zen/tmp/*
|
|||
# echo "$USER ALL=(ALL) NOPASSWD:/bin/systemctl" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/systemctl')
|
||||
[[ -s /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && sleep 5
|
||||
|
||||
espeak "Ding Ding" > /dev/null 2>&1
|
||||
espeak "Code Updating" > /dev/null 2>&1
|
||||
|
||||
|
||||
## PROCESS TW BACKOFFICE TREATMENT
|
||||
|
@ -33,22 +33,18 @@ git pull
|
|||
# Refresh ~/.zen/game/world/G1VOEU
|
||||
# NOW RUN FROM PLAYER.refresh.sh !! ~/.zen/Astroport.ONE/ASTROBOT/VOEUX.refresh.sh
|
||||
|
||||
## CLOSING 1234 API PORT
|
||||
killall 12345.sh
|
||||
killall _12345.sh
|
||||
killall nc
|
||||
killall tail
|
||||
|
||||
espeak "Ding Ding Ding" > /dev/null 2>&1
|
||||
## 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
|
||||
|
||||
espeak "Bills Kills Bills" > /dev/null 2>&1
|
||||
|
||||
|
||||
## 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
|
||||
## REFRESH BOOTSTRAP LIST (OFFICIAL SWARM)
|
||||
|
@ -60,16 +56,19 @@ if [[ ! $isLAN ]]; then
|
|||
done
|
||||
fi
|
||||
|
||||
espeak "Tube Up" > /dev/null 2>&1
|
||||
## Updating yt-dlp
|
||||
$MY_PATH/youtube-dl.sh
|
||||
sudo youtube-dl -U
|
||||
|
||||
########################################################################
|
||||
end=`date +%s`
|
||||
echo "20H12 (♥‿‿♥) Execution time was "`expr $end - $start` seconds.
|
||||
dur=`expr $end - $start`
|
||||
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 Storm Over" > /dev/null 2>&1
|
||||
espeak "Byte Strom End. $dur seconds" > /dev/null 2>&1
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -24,14 +24,19 @@ INDEX="$1"
|
|||
[[ ! ${INDEX} ]] && echo "ERROR - Please provide path to source TW index.html" && exit 1
|
||||
[[ ! -f ${INDEX} ]] && echo "ERROR - Fichier TW absent. ${INDEX}" && exit 1
|
||||
|
||||
WISHKEY="$2" ## IPNS KEY NAME - G1PUB - PLAYER - WISHKEY...
|
||||
[[ ! $WISHKEY ]] && echo "ERROR - Please provide IPFS publish key" && exit 1
|
||||
TWNS=$(ipfs key list -l | grep -w $WISHKEY | cut -d ' ' -f1)
|
||||
[[ ! $TWNS ]] && echo "ERROR - Clef IPNS $WISHKEY introuvable!" && exit 1
|
||||
PLAYER="$2"
|
||||
[[ ! $PLAYER ]] && echo "ERROR - Please provide IPFS publish key" && exit 1
|
||||
|
||||
ASTONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1)
|
||||
[[ ! $ASTONAUTENS ]] && echo "ERROR - Clef IPNS $PLAYER introuvable!" && exit 1
|
||||
|
||||
# Extract tag=tube from TW
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
mkdir -p ~/.zen/tmp/$IPFSNODEID
|
||||
|
||||
###################################################################
|
||||
## CREATE APP NODE PLAYER PUBLICATION DIRECTORY
|
||||
###################################################################
|
||||
mkdir -p $HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/
|
||||
|
||||
###################################################################
|
||||
## tag[CopierYoutube] EXTRACT ~/.zen/tmp/CopierYoutube.json FROM TW
|
||||
|
@ -43,29 +48,43 @@ tiddlywiki --load ${INDEX} \
|
|||
|
||||
echo "DEBUG : cat ~/.zen/tmp/CopierYoutube.json | jq -r"
|
||||
|
||||
BROWSER=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1) ## GET cookies-from-browser
|
||||
|
||||
###################################################################
|
||||
## URL EXTRACTION & TREATMENT
|
||||
## For this TAG, specific extract URL from text field and copy all video from links into tid.json
|
||||
## URL EXTRACTION & yt-dlp.cache.$PLAYER upgrade
|
||||
for YURL in $(cat ~/.zen/tmp/CopierYoutube.json | jq -r '.[].text' | grep 'http'); do
|
||||
echo "Detected $YURL"
|
||||
echo "Extracting video playlist"
|
||||
echo "Extracting video playlist into yt-dlp.cache.$PLAYER"
|
||||
|
||||
### yt-dlp.command
|
||||
[[ ! $(cat ~/.zen/tmp/$IPFSNODEID/yt-dlp.command 2>/dev/null | grep "$YURL") ]] \
|
||||
&& echo "$WISHKEY&$YURL" >> ~/.zen/tmp/$IPFSNODEID/yt-dlp.command
|
||||
|
||||
yt-dlp --print "%(id)s&%(webpage_url)s" "${YURL}" >> ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$WISHKEY
|
||||
### yt-dlp.command
|
||||
CMD=$(cat ~/.zen/tmp/$IPFSNODEID/yt-dlp.command 2>/dev/null | grep "$YURL" | tail -n 1)
|
||||
if [[ ! $CMD ]]; then
|
||||
echo "$PLAYER&$YURL:$MOATS" >> ~/.zen/tmp/$IPFSNODEID/yt-dlp.command
|
||||
echo "NOUVEAU CANAL $PLAYER&$YURL:$MOATS"
|
||||
else
|
||||
lastrun=$(echo "$CMD" | rev | cut -d ':' -f 1 | rev) && echo "$CMD"
|
||||
duree=$(expr ${MOATS} - $lastrun)
|
||||
[[ ! $lastrun ]] && echo "$PLAYER&$YURL:$MOATS" >> ~/.zen/tmp/$IPFSNODEID/yt-dlp.command && duree=604800000
|
||||
# ONE WEEK NEW SCAN
|
||||
if [[ duree -ge 604800000 ]]; then
|
||||
yt-dlp --cookies-from-browser $BROWSER --print "%(id)s&%(webpage_url)s" "${YURL}" >> ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER
|
||||
fi
|
||||
fi
|
||||
|
||||
done # FINISH YURL loop
|
||||
|
||||
## SORT UNIQ CACHE
|
||||
cat ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$WISHKEY | sort | uniq > ~/.zen/tmp/yt-dlp.cache
|
||||
cp ~/.zen/tmp/yt-dlp.cache ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$WISHKEY
|
||||
## SORT UNIQ ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER
|
||||
cat ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER | sort | uniq > ~/.zen/tmp/yt-dlp.cache
|
||||
cp ~/.zen/tmp/yt-dlp.cache ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER
|
||||
|
||||
## UPDATE GLOBAL WITH PLAYER & SWARM yt-dlp NEEDS
|
||||
cat ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER > ~/.zen/tmp/yt-dlp.${PLAYER}.global ## PUT MINE FIRST
|
||||
cat ~/.zen/tmp/swarm/*/yt-dlp.cache.* | sort | uniq >> ~/.zen/tmp/yt-dlp.${PLAYER}.global ## ADD SWARM TO GLOBAL
|
||||
|
||||
###################################################################
|
||||
[[ ! -s ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$WISHKEY ]] && echo "AUCUN YOUTUBEID pour CopierYoutube" && exit 0
|
||||
[[ ! -s ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER ]] && echo "AUCUN YOUTUBEID pour CopierYoutube" && exit 0
|
||||
###################################################################
|
||||
|
||||
boucle=0
|
||||
###################################################################
|
||||
# PROCESS YOUTUBEID VIDEO DOWNLOAD AND CREATE TIDDLER in TW
|
||||
###################################################################
|
||||
|
@ -78,33 +97,28 @@ while read LINE;
|
|||
## Search for $YID.TW.json TIDDLER in local & MySwarm cache
|
||||
MATCH=$(ls -t ~/.zen/tmp/$IPFSNODEID/G1CopierYoutube/*/$YID.TW.json 2>/dev/null | head -n 1)
|
||||
[[ $MATCH ]] \
|
||||
&& TIDDLER="$MATCH" \
|
||||
&& echo "Local Found Tiddler" && TIDDLER="$MATCH" \
|
||||
|| MATCH=$(ls -t ~/.zen/tmp/swarm/*/G1CopierYoutube/*/$YID.TW.json 2>/dev/null | head -n 1)
|
||||
|
||||
[[ $MATCH ]] \
|
||||
&& TIDDLER="$MATCH"
|
||||
&& echo "Swarm Found Tiddler" && TIDDLER="$MATCH"
|
||||
###################################################################
|
||||
|
||||
###################################################################
|
||||
## CREATE APP PUBLICATION
|
||||
###################################################################
|
||||
mkdir -p $HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/
|
||||
|
||||
|
||||
if [[ ! ${TIDDLER} ]]; then
|
||||
###################################################################
|
||||
# COPY VIDEO AND MAKE TIDDLER
|
||||
###################################################################
|
||||
|
||||
ZYURL=$(echo "$LINE" | cut -d '&' -f 2-)
|
||||
echo "COPIE : $ZYURL"
|
||||
[[ $boucle == 13 ]] && echo "MAXIMUM COPY REACHED" && continue
|
||||
|
||||
TITLE="$(yt-dlp --print "%(title)s" "${ZYURL}")"
|
||||
TITLE="$(yt-dlp --cookies-from-browser $BROWSER --print "%(title)s" "${ZYURL}")"
|
||||
TITLE=${TITLE//[^A-zÀ-ÿ0-9 ]/}
|
||||
[[ ! $TITLE ]] && echo "NO TITLE" && continue
|
||||
|
||||
echo ".... Downloading $TITLE.mp4"
|
||||
start=`date +%s`
|
||||
|
||||
echo ".... Trying to download $TITLE.mp4"
|
||||
# https://github.com/yt-dlp/yt-dlp#format-selection-examples
|
||||
# SUBS ? --write-subs --write-auto-subs --sub-langs "fr, en, en-orig" --embed-subs
|
||||
# (bv*[height<=720][vcodec~='^((he|a)vc|h26[45])']+ba)
|
||||
|
@ -117,6 +131,7 @@ if [[ ! ${TIDDLER} ]]; then
|
|||
# --cookies-from-browser browser (xdg-settings get default-web-browser) allow member copies
|
||||
# --dateafter DATE --download-archive myarchive.txt
|
||||
yt-dlp -f "(bv*[ext=mp4][height<=720]+ba/b[height<=720])" \
|
||||
--cookies-from-browser $BROWSER \
|
||||
--download-archive $HOME/.zen/.yt-dlp.list \
|
||||
-S "filesize:700M" --no-mtime --embed-thumbnail --add-metadata \
|
||||
--write-subs --write-auto-subs --sub-langs "fr, en, en-orig" --embed-subs \
|
||||
|
@ -133,6 +148,10 @@ if [[ ! ${TIDDLER} ]]; then
|
|||
[[ ! -f "$HOME/.zen/tmp/yt-dlp/$ZFILE" ]] && echo "No FILE -- CONTINUE --" && continue
|
||||
echo
|
||||
|
||||
## LIMIT TO 12 MAXIMUM COPY PER DAY PER PLAYER
|
||||
boucle=$((boucle+1))
|
||||
espeak "video copy number $bouche" > /dev/null 1>&2
|
||||
|
||||
####################################################
|
||||
echo "FOUND : ~/.zen/tmp/yt-dlp/$ZFILE"
|
||||
FILE_BSIZE=$(du -b "$HOME/.zen/tmp/yt-dlp/$ZFILE" | awk '{print $1}')
|
||||
|
@ -162,13 +181,16 @@ if [[ ! ${TIDDLER} ]]; then
|
|||
MIME=$(file --mime-type -b "$HOME/.zen/tmp/yt-dlp/$ZFILE")
|
||||
|
||||
## ADD TAGS
|
||||
SEC=$(yt-dlp --print "%(duration)s" "${ZYURL}")
|
||||
CHANNEL=$(yt-dlp --print "%(channel)s" "${ZYURL}" | sed -r 's/\<./\U&/g' | sed 's/ //g') # CapitalGluedWords
|
||||
PLAYLIST=$(yt-dlp --print "%(playlist)s" "${ZYURL}" | sed -r 's/\<./\U&/g' | sed 's/ //g')
|
||||
SEC=$(yt-dlp --cookies-from-browser $BROWSER --print "%(duration)s" "${ZYURL}")
|
||||
CHANNEL=$(yt-dlp --cookies-from-browser $BROWSER --print "%(channel)s" "${ZYURL}" | sed -r 's/\<./\U&/g' | sed 's/ //g') # CapitalGluedWords
|
||||
PLAYLIST=$(yt-dlp --cookies-from-browser $BROWSER --print "%(playlist)s" "${ZYURL}" | sed -r 's/\<./\U&/g' | sed 's/ //g')
|
||||
EXTRATAG="$CHANNEL $PLAYLIST"
|
||||
## PREPARE VIDEO HTML5 CODE
|
||||
TEXT="<video controls width=100% poster='/ipfs/"${ANIMH}"'><source src='/ipfs/"${ILINK}"' type='"${MIME}"'></video><br>{{!!duree}}<br><h1><a href='"${ZYURL}"'>"${TITLE}"</a></h1>"
|
||||
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $start`
|
||||
|
||||
echo "Creating Youtube ${YID} tiddler : G1CopierYoutube !"
|
||||
echo $TEXT
|
||||
|
||||
|
@ -187,9 +209,10 @@ if [[ ! ${TIDDLER} ]]; then
|
|||
"mime": "'${MIME}'",
|
||||
"size": "'${FILE_BSIZE}'",
|
||||
"sec": "'${SEC}'",
|
||||
"dur": "'${dur}'",
|
||||
"ipfs": "'/ipfs/${ILINK}'",
|
||||
"youtubeid": "'${YID}'",
|
||||
"tags": "'ipfs G1CopierYoutube ${WISHKEY} ${EXTRATAG} ${MIME}'"
|
||||
"tags": "'ipfs G1CopierYoutube ${PLAYER} ${EXTRATAG} ${MIME}'"
|
||||
}
|
||||
]
|
||||
' > "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json"
|
||||
|
@ -198,17 +221,18 @@ else
|
|||
###################################################################
|
||||
# TIDDLER WAS IN CACHE
|
||||
###################################################################
|
||||
|
||||
cp "${TIDDLER}" "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json"
|
||||
## TODO : ADD EMAIL TO TAG ( TIMESTAMP & ADD SIGNATURE over existing ones)
|
||||
[[ "${TIDDLER}" != "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json" ]] \
|
||||
&& cp "${TIDDLER}" "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
#################################################################
|
||||
### ADDING $YID.TW.json to TWNS INDEX.html
|
||||
### ADDING $YID.TW.json to ASTONAUTENS INDEX.html
|
||||
#################################################################
|
||||
echo "=========================="
|
||||
echo "Adding $YID tiddler to TW /ipns/$TWNS "
|
||||
echo "Adding $YID tiddler to TW /ipns/$ASTONAUTENS "
|
||||
|
||||
rm -f ~/.zen/tmp/$IPFSNODEID/newindex.html
|
||||
|
||||
|
@ -221,12 +245,13 @@ fi
|
|||
# --deletetiddlers '[tag[CopierYoutube]]' ### REFRESH CHANNEL COPY
|
||||
|
||||
if [[ -s ~/.zen/tmp/$IPFSNODEID/newindex.html ]]; then
|
||||
echo "$$$ Mise à jour ${INDEX}"
|
||||
cp ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX}
|
||||
[[ $(diff ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX} ) ]] && cp ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX} && echo "===> Mise à jour ${INDEX}"
|
||||
else
|
||||
echo "Problem with tiddlywiki command. Missing ~/.zen/tmp/$IPFSNODEID/newindex.html"
|
||||
echo "XXXXXXXXXXXXXXXXXXXXXXX"
|
||||
fi
|
||||
|
||||
done < ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$WISHKEY # FINISH YID loop 1
|
||||
done < ~/.zen/tmp/yt-dlp.${PLAYER}.global # FINISH YID loop 1
|
||||
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -178,7 +178,7 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPE
|
|||
</\$button>"
|
||||
|
||||
# NEW IVEU TIDDLER
|
||||
echo "## Creation json tiddler : Qr${PEPPER} /ipfs/${IVOEU}"
|
||||
echo "## Creation json tiddler : G1${PEPPER} /ipfs/${IVOEU}"
|
||||
echo '[
|
||||
{
|
||||
"created": "'${MOATS}'",
|
||||
|
|
|
@ -12,11 +12,18 @@ ME="${0##*/}"
|
|||
# Run TAG subprocess: tube, voeu
|
||||
############################################
|
||||
echo "## RUNNING PLAYER.refresh"
|
||||
IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||
# IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
|
||||
|
||||
PLAYERONE="$1"
|
||||
[[ ! $PLAYERONE ]] && PLAYERONE=($(ls -t ~/.zen/game/players/))
|
||||
|
||||
## RUNING FOR ALL LOCAL PLAYERS
|
||||
for PLAYER in $(ls -t ~/.zen/game/players/); do
|
||||
for PLAYER in ${PLAYERONE[@]}; do
|
||||
[[ ! -d ~/.zen/game/players/$PLAYER ]] && echo "BAD $PLAYERONE" && continue
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
[[ $PLAYER == "user" || $PLAYER == "zen" ]] && continue
|
||||
mkdir -p ~/.zen/tmp/${MOATS}
|
||||
echo "##################################################################"
|
||||
echo ">>>>> PLAYER : $PLAYER >>>>>>>>>>>>> REFRESHING TW STATION"
|
||||
echo "##################################################################"
|
||||
|
@ -42,9 +49,9 @@ for PLAYER in $(ls -t ~/.zen/game/players/); do
|
|||
&& mv ~/.zen/game/players/$PLAYER ~/.zen/game/players/.$PLAYER && continue
|
||||
|
||||
## MY PLAYER
|
||||
ipfs key export $G1PUB -o ~/.zen/tmp/$PLAYER.key
|
||||
ipfs key import $PLAYER ~/.zen/tmp/$PLAYER.key
|
||||
rm -f ~/.zen/tmp/$PLAYER.key
|
||||
ipfs key export $G1PUB -o ~/.zen/tmp/${MOATS}/$PLAYER.key
|
||||
[[ ! $(ipfs key list -l | grep $PLAYER | cut -d ' ' -f1) ]] && ipfs key import $PLAYER ~/.zen/tmp/${MOATS}/$PLAYER.key
|
||||
rm -f ~/.zen/tmp/${MOATS}/$PLAYER.key
|
||||
|
||||
## REFRESH CACHE
|
||||
rm -Rf ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/
|
||||
|
@ -55,11 +62,12 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
|
|||
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
|
||||
|
||||
echo "Getting latest online TW..."
|
||||
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
echo "($YOU) /ipns/$ASTRONAUTENS $LIBRA"
|
||||
[[ $YOU ]] && ipfs --timeout 30s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html \
|
||||
|| curl -m 30 -so ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
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" \
|
||||
|| cp ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html
|
||||
|
||||
## PLAYER TW IS ONLINE ?
|
||||
if [ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html ]; then
|
||||
|
@ -79,31 +87,15 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
|
|||
else
|
||||
## FOUND TW
|
||||
#############################################################
|
||||
## CHECK IF myIP IS ACTUAL OFFICIAL GATEWAY
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html --output ~/.zen/tmp --render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
[[ ! -s ~/.zen/tmp/MadeInZion.json ]] && echo "MadeInZion ERROR - DROPPING " && continue
|
||||
## CHECK WHO IS ACTUAL OFFICIAL GATEWAY
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/MadeInZion.json ]] && echo "MadeInZion : BAD TW (☓‿‿☓) " && continue
|
||||
|
||||
# CRYPTO DECODING CRYPTIP -> myIP
|
||||
cat ~/.zen/tmp/MadeInZion.json | jq -r .[].secret | base16 -d > ~/.zen/tmp/myIP.$G1PUB.enc.2
|
||||
$MY_PATH/../tools/natools.py decrypt -f pubsec -k ~/.zen/game/players/$PLAYER/secret.dunikey -i ~/.zen/tmp/myIP.$G1PUB.enc.2 -o ~/.zen/tmp/myIP.$G1PUB > /dev/null 2>&1
|
||||
GWIP=$(cat ~/.zen/tmp/myIP.$G1PUB > /dev/null 2>&1)
|
||||
player=$(cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r .[].player)
|
||||
|
||||
[[ ! $GWIP ]] && GWIP=$myIP ## CLEAR
|
||||
|
||||
echo "THIS TW is on $GWIP"
|
||||
|
||||
# WHO IS OFFICIAL TW GATEWAY.
|
||||
if [[ ! -s ~/.zen/game/players/$PLAYER/ipfs/G1SSB/_g1.pubkey ]]; then
|
||||
if [[ $GWIP != $myIP ]]; then
|
||||
# NOT MY PLAYER
|
||||
echo "REMOVING PLAYER $PLAYER"
|
||||
rm -Rf ~/.zen/game/players/$PLAYER/
|
||||
ipfs key rm ${PLAYER}
|
||||
ipfs key rm ${G1PUB}
|
||||
echo "*** OFFICIAL GATEWAY : http://$GWIP:8080/ipns/$ASTRONAUTENS ***" && continue
|
||||
fi
|
||||
else
|
||||
echo "OFFICIAL VISA - (⌐■_■) -"
|
||||
[[ $player == $PLAYER ]] \
|
||||
&& echo "$PLAYER OFFICIAL TW - (⌐■_■) -" \
|
||||
|| ( echo "BAD PLAYER=$player in TW" && continue)
|
||||
fi
|
||||
#############################################################
|
||||
## GWIP == myIP or TUBE !!
|
||||
|
@ -127,27 +119,34 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
|
|||
${MY_PATH}/VOEUX.refresh.sh ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$PLAYER"
|
||||
##############################################################
|
||||
|
||||
####################
|
||||
echo "# TUBE as 8080 & 5001"
|
||||
##################################
|
||||
echo "# TW : GW API + LightBeam Feed + Friends"
|
||||
TUBE=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 3)
|
||||
|
||||
####################
|
||||
echo "# CRYPTO ENCODING $GWIP -> CRYPTIP"
|
||||
echo $GWIP > ~/.zen/tmp/GWIP
|
||||
$MY_PATH/../tools/natools.py encrypt -p $G1PUB -i $HOME/.zen/tmp/GWIP -o $HOME/.zen/tmp/myIP.$G1PUB.enc
|
||||
CRYPTIP=$(cat ~/.zen/tmp/myIP.$G1PUB.enc | base16)
|
||||
## WRITE CRYPTIP into MadeInZion tiddler
|
||||
sed -i "s~$SECRET~$CRYPTIP~g" ~/.zen/tmp/MadeInZion.json
|
||||
FEEDNS=$(ipfs key list -l | grep -w "${PLAYER}_feed" | cut -d ' ' -f 1)
|
||||
[[ ! $FEEDNS ]] && FEEDNS=$(ipfs key gen "${PLAYER}_feed")
|
||||
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
|
||||
|
||||
###########################
|
||||
# Modification Tiddlers de contrôle de GW & API
|
||||
echo '[{"title":"$:/ipfs/saver/api/http/localhost/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"http://ipfs.localhost:5001"}]' > ~/.zen/tmp/5001.json
|
||||
echo '[{"title":"$:/ipfs/saver/gateway/http/localhost","tags":"$:/ipfs/core $:/ipfs/saver/gateway","text":"https://ipfs.copylaradio.com"}]' > ~/.zen/tmp/8080.json
|
||||
[[ $isLAN ]] && APIGW="http://ipfs.localhost:5001" && IPFSGW="https://ipfs.copylaradio.com" \
|
||||
|| ( APIGW="https://$(hostname)/api" && IPFSGW="https://ipfs.copylaradio.com" )
|
||||
echo '[{"title":"$:/ipfs/saver/api/http/localhost/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"'$APIGW'"}]' > ~/.zen/tmp/${MOATS}/5001.json
|
||||
echo '[{"title":"$:/ipfs/saver/gateway/http/localhost","tags":"$:/ipfs/core $:/ipfs/saver/gateway","text":"'$IPFSGW'"}]' > ~/.zen/tmp/${MOATS}/8080.json
|
||||
|
||||
FRIENDSFEEDS=$(cat ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/FRIENDSFEEDS 2>/dev/null)
|
||||
echo "FRIENDS FEEDS : "${FRIENDSFEEDS}
|
||||
|
||||
## export FRIENDSFEEDS from Gchange stars
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/state/subscriptions","text":"'${FRIENDSFEEDS}'","tags":""}]' > ~/.zen/tmp/${MOATS}/friends.json
|
||||
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html \
|
||||
--import "$HOME/.zen/tmp/MadeInZion.json" "application/json" \
|
||||
--import "$HOME/.zen/tmp/5001.json" "application/json" \
|
||||
--import "$HOME/.zen/tmp/8080.json" "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-name.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-key.json "application/json" \
|
||||
--import "$HOME/.zen/tmp/${MOATS}/5001.json" "application/json" \
|
||||
--import "$HOME/.zen/tmp/${MOATS}/8080.json" "application/json" \
|
||||
--import "$HOME/.zen/tmp/${MOATS}/friends.json" "application/json" \
|
||||
--output ~/.zen/tmp/${IPFSNODEID}/${PLAYER} --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
|
||||
[[ -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/newindex.html ]] \
|
||||
|
@ -167,12 +166,9 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
|
|||
fi
|
||||
##############################################################
|
||||
|
||||
fi
|
||||
|
||||
##################################################
|
||||
##################################################
|
||||
################## UPDATING PLAYER MOA
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
[[ $DIFF ]] && cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain \
|
||||
~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.moats)
|
||||
|
||||
|
@ -187,13 +183,26 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
|
|||
echo " = /ipfs/$TW"
|
||||
echo "================================================"
|
||||
|
||||
######################### PLAYER_feed
|
||||
IFRIENDHEAD="$(cat ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/IFRIENDHEAD 2>/dev/null)"
|
||||
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )"
|
||||
echo "IFRIENDHEAD :" ${IFRIENDHEAD}
|
||||
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )"
|
||||
# cp -f ~/.zen/game/players/${PLAYER}/ipfs/${FPLAYER}.rss.json ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/${FPLAYER}.rss.json
|
||||
[[ -d ~/.zen/game/players/$PLAYER/FRIENDS ]] \
|
||||
&& cat ${MY_PATH}/../www/iframe.html | sed "s~_ME_~${IPFSGW}/ipns/${ASTRONAUTENS}~g" | sed "s~_IFRIENDHEAD_~${IFRIENDHEAD}~g" > ~/.zen/game/players/$PLAYER/FRIENDS/index.html
|
||||
|
||||
[[ -s ~/.zen/game/players/$PLAYER/FRIENDS/index.html ]] \
|
||||
&& FRAME=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/FRIENDS/index.html | tail -n 1) \
|
||||
&& ipfs name publish --allow-offline -t 24h --key="${PLAYER}_feed" /ipfs/$FRAME
|
||||
|
||||
done
|
||||
|
||||
#################################################################
|
||||
## IPFSNODEID ASTRONAUTES SIGNALING ## 12345 port
|
||||
############################
|
||||
# Scan local cache
|
||||
ls ~/.zen/tmp/${IPFSNODEID}/
|
||||
# ls ~/.zen/tmp/${IPFSNODEID}/
|
||||
BSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1)
|
||||
|
||||
## Merge actual online version
|
||||
|
@ -202,7 +211,7 @@ NSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1)
|
|||
|
||||
[[ $BSIZE != $NSIZE ]] \
|
||||
&& ROUTING=$(ipfs add -rwHq ~/.zen/tmp/${IPFSNODEID}/* | tail -n 1 ) \
|
||||
&& echo "BALISE STATION /ipns/${IPFSNODEID} INDEXES = $NSIZE octets" \
|
||||
&& echo "PUBLISH BALISE STATION /ipns/${IPFSNODEID} = $NSIZE octets" \
|
||||
&& ipfs name publish --allow-offline -t 24h /ipfs/$ROUTING
|
||||
|
||||
echo "PLAYER.refresh DONE."
|
||||
|
|
|
@ -27,7 +27,8 @@ PLAYER="$2" ## IPNS KEY NAME - G1PUB - PLAYER ...
|
|||
[[ ! $ASTRONAUTENS ]] && echo "Missing $PLAYER IPNS KEY - CONTINUE --" && exit 1
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||
# IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||
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])/")
|
||||
|
|
38
Makefile
38
Makefile
|
@ -1,40 +1,52 @@
|
|||
MYOS ?= ../myos
|
||||
MYOS_REPOSITORY ?= https://github.com/aynicos/myos
|
||||
MYOS ?= ../myos
|
||||
MYOS_REPOSITORY ?= $(patsubst %/$(APP),%/myos,$(APP_REPOSITORY))
|
||||
APP ?= $(lastword $(subst /, ,$(APP_REPOSITORY)))
|
||||
APP_REPOSITORY ?= $(shell git config --get remote.origin.url 2>/dev/null)
|
||||
-include $(MYOS)/make/include.mk
|
||||
$(MYOS):
|
||||
-@git clone $(MYOS_REPOSITORY) $(MYOS)
|
||||
|
||||
.PHONY: all install shellcheck shellcheck-% tests
|
||||
SHELL_FILES ?= $(wildcard .*/*.sh */*.sh */*/*.sh)
|
||||
|
||||
.PHONY: all
|
||||
all: install tests
|
||||
|
||||
install: upgrade build myos-host up player
|
||||
|
||||
upgrade: migrate-ipfs migrate-zen
|
||||
.PHONY: install
|
||||
install: myos build player up
|
||||
echo "Welcome to myos docker land - make a user - make a player -"
|
||||
|
||||
.PHONY: migrate
|
||||
migrate-%: home := ~/.zen/game/players
|
||||
migrate-%:
|
||||
[ ! -f /var/lib/docker/volumes/$(HOSTNAME)_$*/_data ] \
|
||||
&& $(RUN) $(SUDO) mkdir -p /var/lib/docker/volumes/$(HOSTNAME)_$*/_data \
|
||||
&& $(RUN) $(SUDO) cp -a ~/.$* /var/lib/docker/volumes/$(HOSTNAME)_$*/_data \
|
||||
&& $(RUN) $(SUDO) chown -R $(USER) /var/lib/docker/volumes/$(HOSTNAME)_$* \
|
||||
|| :
|
||||
if $(SUDO) test ! -d /var/lib/docker/volumes/$(HOSTNAME)_$*; then \
|
||||
$(RUN) $(SUDO) mkdir -p /var/lib/docker/volumes/$(HOSTNAME)_$* \
|
||||
&& $(RUN) $(SUDO) cp -a $(if $($*),$($*)/,~/.$*/) /var/lib/docker/volumes/$(HOSTNAME)_$*/_data \
|
||||
&& $(RUN) $(SUDO) chown -R $(HOST_UID):$(HOST_GID) /var/lib/docker/volumes/$(HOSTNAME)_$*/_data \
|
||||
; \
|
||||
fi
|
||||
|
||||
.PHONY: player
|
||||
player: STACK := User
|
||||
player: docker-network-create-$(USER)
|
||||
$(call make,stack-User-$(if $(DELETE),down,up),$(MYOS),COMPOSE_PROJECT_NAME MAIL)
|
||||
|
||||
.PHONY: player-%
|
||||
player-%: STACK := User
|
||||
player-%:
|
||||
$(if $(filter $*,$(filter-out %-%,$(patsubst docker-compose-%,%,$(filter docker-compose-%,$(MAKE_TARGETS))))), \
|
||||
$(call make,stack-User-$*,$(MYOS),COMPOSE_PROJECT_NAME MAIL) \
|
||||
)
|
||||
|
||||
tests: shellcheck
|
||||
|
||||
.PHONY: shellcheck
|
||||
shellcheck:
|
||||
shellcheck $(SHELL_FILES) ||:
|
||||
|
||||
.PHONY: shellcheck-%
|
||||
shellcheck-%:
|
||||
shellcheck $*/*.sh
|
||||
|
||||
.PHONY: tests
|
||||
tests: shellcheck
|
||||
|
||||
.PHONY: upgrade
|
||||
upgrade: migrate-home migrate-ipfs install
|
||||
|
|
48
README.md
48
README.md
|
@ -64,9 +64,9 @@ L'UTILISATEUR devient un JOUEUR, en semant son propre IPFS, en utilisant un Dock
|
|||
|
||||
Ainsi, les AMIS peuvent héberger d'autres AMIS.
|
||||
|
||||
# RESULTAT
|
||||
# TW
|
||||
|
||||
TW du PLAYER support@qo-op.com
|
||||
PLAYER support@qo-op.com
|
||||
|
||||
https://ipfs.copylaradio.com/ipns/support.qo-op.com.localhost.copylaradio.com
|
||||
|
||||
|
@ -85,38 +85,26 @@ Chaque jour, à 20h12, tous les noeuds synchronisent leur TW en fonction des niv
|
|||
**Nous utilisons [la Ğ1](https://monnaie-libre.fr/) comme "la meilleure invention d'une crypto-monnaie"**
|
||||
|
||||
N'importe qui (avec une connexion par fibre optique) peut créer un nœud chez lui, inviter des amis et partager des "tiddlers" selon leurs "G1Voeu".
|
||||
Vous pouvez rejoindre le swam#0 officiel d'Astroport, en devenant bootstrap et hôte dans http://tube.copylaradio.com:1234 TestNet "DNS Round Robin".
|
||||
Vous pouvez rejoindre le swam#0 officiel d'Astroport, en devenant bootstrap et hôte dans https://astroport.copylaradio.com TestNet "DNS Round Robin".
|
||||
|
||||
Qma9zvrYHGcUPisLKBcG9U9sktThX5VfVci8jfM8D9RspT
|
||||
|
||||
Bien entendu, le mieux est que chacun héberge et publie ses propres données sur son ordinateur "localhost" (pas de délégation de clé privée dans ce cas), de sorte que le protocole de réplication Astroport Ŋ1 peut être utilisé à tout moment. Mais il est préférable de garder une heure de connexion commune afin que les hôtes soient tous disponibles pour un torrent bit massif.
|
||||
|
||||
TW est la première application disponible pour les personnes décentralisées.
|
||||
L'utilisateur peut écrire des notes personnelles, et quelques "tiddlers de commande" pour activer la copie des tiddlers entre les TW d'amis et exécuter des pré et/ou post traitements.
|
||||
|
||||
Le "pays de la cryptographie" n'est plus un endroit structuré par des répertoires et des fichiers, il devient un hachage perdu dans un échange de bits, où les clés mémorisent des chaînes (hachage + horodatage + signature).
|
||||
|
||||
IPFS l'amène au niveau du réseau et crée un "lecteur virtuel fluide" à partir de tous les nœuds ou d'un groupe de nœuds en fonctionnement.
|
||||
En fait, les CDN l'utilisent, mais il s'agit d'une technologie pour les personnes qui utilisent IPFS pour s'éloigner des centres de données, la plupart d'entre elles ne comprennent toujours pas.
|
||||
|
||||
Par rapport à la sémantique du "disque dur".
|
||||
Astroport.ONE crée un "BIOS" pour le lecteur IPFS utilisé avec une paire de clés.
|
||||
|
||||
Le port 1234 redirige vers le "Master Boot Record" (ip:port) redirigeant vers la "Table d'allocation" montrant les fichiers au "Système d'exploitation".
|
||||
Nous utilisons TW comme table d'allocation et interface d'administration et de débogage pour aider à développer une application distribuée au-dessus.
|
||||
|
||||
TW bénéficie automatiquement d'un "service d'hébergement collectif distribué".
|
||||
|
||||
Depuis la page de connexion (BIOS) de la "phase alpha" http://qwantic.com:1234
|
||||
cliquez sur le lien dans le "pop jaune (MBR)" pour atteindre le formulaire de création d'un nouveau.
|
||||
Cliquez sur le pop "jaune suivant (DApp)" (et rafraîchissez car cela peut prendre 30s pour être prêt).
|
||||
|
||||
À partir de deux phrases de passe et d'un courriel, le système génère la paire de clés et l'adresse IPN permanente du TW (seuls ceux qui ont installé la clé dans leur keystore ipfs peuvent la modifier).
|
||||
|
||||
J'espère que cela vous aidera.
|
||||
# 20H12
|
||||
|
||||
[20H12.sh](/qo-op/Astroport.ONE/src/branch/master/20h12.sh)
|
||||
|
||||
Ce rendez-vous permet à toutes les Stations de raffraichir leurs TW.
|
||||
Cette horaire garantie à la "Blockchain" d'être à jour au maximum.
|
||||
|
||||
# DEMO
|
||||
Une Stattion branché sur un panneau solaire et une batterie adéquate, peut fonctionner OnGrid et OffGrid
|
||||
|
||||
|
||||
# - ESSAYEZ IPFS - UN SOCKAGE INALTERABLE ET INTELLIGENT
|
||||
|
||||
### "The Barefoot Architect" de Johan Van Lengen.
|
||||
|
||||
|
@ -124,11 +112,11 @@ Lignes de commandes
|
|||
|
||||
```
|
||||
ipfs ls Qme6a6RscGHTg4e1XsRrpRoNbfA6yojC6XNCBrS8nPSEox/
|
||||
ipfs cat QmbfVUAyX6hsxTMAZY7MhvUmB3AkfLS7KqWihjGfu327yG /tmp/vdoc.pub_the-barefoot-architect.pdf
|
||||
ipfs cat QmbfVUAyX6hsxTMAZY7MhvUmB3AkfLS7KqWihjGfu327yG > /tmp/vdoc.pub_the-barefoot-architect.pdf && xdg-open /tmp/vdoc.pub_the-barefoot-architect.pdf
|
||||
```
|
||||
Après un passage par [ajouter_media.sh](/qo-op/Astroport.ONE/src/branch/master/ajouter_media.sh)
|
||||
|
||||
Vos données son stockées [dans des Tiddlers](http://libra.copylaradio.com:8080/ipns/k51qzi5uqu5dioeckikst5f8jw1tbljom6acjbw9zerl3671921krs4nm1531r#:[tag[G1Films]])
|
||||
Vos données son stockées [dans des Tiddlers](https://ipfs.copylaradio.com/ipns/k51qzi5uqu5dioeckikst5f8jw1tbljom6acjbw9zerl3671921krs4nm1531r#:[tag[G1Films]])
|
||||
|
||||
### Foret Enchantée - PROJET ASTROPORT.pdf
|
||||
|
||||
|
@ -147,7 +135,7 @@ Comme un client qui commande, à qui on attribue un point relai qu'il devra cont
|
|||
|
||||
chaque passerelle de l'essaim sert toujours la même page (voir "templates/index.http")
|
||||
|
||||
http://tube.copylaradio.com:1234, informe où trouver la suite qui permet de découvrir la suite.
|
||||
https://astroport.copylaradio.com, informe où trouver la suite qui permet de découvrir la suite.
|
||||
|
||||
ici pour informer de l'état de la commande (OK, ERROR)
|
||||
```
|
||||
|
@ -167,7 +155,7 @@ _APID_ est la clef IPNS qui contient l'arborescence "json" en lecture
|
|||
Exemple pour l'application "G1Voeu" https://ipfs.copylaradio.com/ipns/12D3KooWL2FcDJ41U9SyLuvDmA5qGzyoaj2RoEHiJPpCvY8jvx9u
|
||||
|
||||
Application "messaging"
|
||||
http://tube.copylaradio.com:1234/?salt=toto&pepper=toto&messaging=on
|
||||
https://astroport.copylaradio.com/?salt=toto&pepper=toto&messaging=on
|
||||
|
||||
Pour écrire une application on pourra utiliser "jsipfs"
|
||||
|
||||
|
@ -177,7 +165,7 @@ https://js.ipfs.tech/
|
|||
Ajoutez l'appel API "testcraft" pour enregistrer vos json
|
||||
?salt=toto&pepper=toto&testcraft=on&nodeid=_IPFDNODEID_&DATAID=_IPDSID_
|
||||
|
||||
http://tube.copylaradio.com:1234/?salt=toto&pepper=toto&testcraft=on&nodeid=12D3KooWK1ACupF7RD3MNvkBFU9Z6fX11pKRAR99WDzEUiYp5t8j&dataid=QmZXo87nn34i54HhuMrbuXM5fKXymhV3Zj9exeZDK6s4WD
|
||||
https://astroport.copylaradio.com/?salt=toto&pepper=toto&testcraft=on&nodeid=12D3KooWK1ACupF7RD3MNvkBFU9Z6fX11pKRAR99WDzEUiYp5t8j&dataid=QmZXo87nn34i54HhuMrbuXM5fKXymhV3Zj9exeZDK6s4WD
|
||||
|
||||
```
|
||||
# APP = g1pub, messaging, testcraft, ....
|
||||
|
@ -215,7 +203,7 @@ Proposez vos "Templates"
|
|||
|
||||
> [Simulateur Astronaute/Voeux](https://ncase.me/loopy/v1.1/?data=[[[3,646,229,0.5,%22Astronaute%22,5],[4,806,372,0.16,%22G1Voeu%22,3],[5,449,133,0.83,%22G1Talent%22,1],[6,928,124,0.5,%22Astronaute%22,0],[7,1055,293,0.5,%22Astronaute%22,0],[8,883,587,0.5,%22Astronaute%22,0],[10,691,54,0.5,%22G1Voeu%22,3]],[[3,5,82,1,0],[3,4,-87,1,0],[6,4,83,1,0],[4,5,176,1,0],[8,8,85,1,12],[8,4,-45,1,0],[7,4,34,1,0],[5,3,49,1,0],[7,7,101,1,225],[6,6,113,1,-84],[3,3,90,1,75],[5,4,-293,1,0],[3,10,34,1,0]],[],10%5D)
|
||||
|
||||
> [Essaim Astroport.ONE](https://ncase.me/loopy/v1.1/?data=[[[1,419,351,1,%22Astroport.ONE%22,3],[2,506,530,1,%22Terrien%22,5],[3,499,95,1,%22IPFS%22,1],[4,272,225,1,%22Astroport.ONE%22,3],[5,620,297,0.16,%22Astroport.ONE%22,4],[7,927,69,0.66,%22Astroport.ONE%22,3],[8,798,175,0.66,%22Astroport.ONE%22,3]],[[2,1,94,-1,0],[1,2,89,1,0],[2,5,-122,1,0],[5,3,58,1,0],[3,5,25,1,0],[4,3,117,1,0],[3,4,-152,1,0],[1,3,60,1,0],[3,1,-18,1,0],[7,3,-44,1,0],[3,7,15,1,0],[8,3,37,1,0],[3,8,-47,1,0]],[[798,557,%22http%253A%252F%252Ftube.copylaradio.com%253A1234%250A(salt%2520%252F%2520pepper%2520%252F%2520email)%2520%253D%2520TW%2520%252B%2520AstroBot%2520API%22],[256,141,%22Station%2520Officielle%250A(Bootstrap%2520%252B%2520RoundRobin%2520DNS)%22],[868,332,%22D%25C3%25A9l%25C3%25A9gation%2520de%2520clef%250A(Tiers%2520de%2520confiance)%22]],9%5D)
|
||||
> [Essaim Astroport.ONE](https://ncase.me/loopy/v1.1/?data=[[[1,419,351,1,%22Astroport.ONE%22,3],[2,506,530,1,%22Terrien%22,5],[3,499,95,1,%22IPFS%22,1],[4,272,225,1,%22Astroport.ONE%22,3],[5,620,297,0.16,%22Astroport.ONE%22,4],[7,927,69,0.66,%22Astroport.ONE%22,3],[8,798,175,0.66,%22Astroport.ONE%22,3]],[[2,1,94,-1,0],[1,2,89,1,0],[2,5,-122,1,0],[5,3,58,1,0],[3,5,25,1,0],[4,3,117,1,0],[3,4,-152,1,0],[1,3,60,1,0],[3,1,-18,1,0],[7,3,-44,1,0],[3,7,15,1,0],[8,3,37,1,0],[3,8,-47,1,0]],[[798,557,%22https%253A%252F%252Fipfs.copylaradio.com%253A1234%250A(salt%2520%252F%2520pepper%2520%252F%2520email)%2520%253D%2520TW%2520%252B%2520AstroBot%2520API%22],[256,141,%22Station%2520Officielle%250A(Bootstrap%2520%252B%2520RoundRobin%2520DNS)%22],[868,332,%22D%25C3%25A9l%25C3%25A9gation%2520de%2520clef%250A(Tiers%2520de%2520confiance)%22]],9%5D)
|
||||
|
||||
|
||||
|
||||
|
|
187
ajouter_media.sh
187
ajouter_media.sh
|
@ -32,20 +32,26 @@ 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
|
||||
|
||||
URL="$1"
|
||||
PLAYER="$2"
|
||||
CHOICE="$3"
|
||||
|
||||
# Check who is .current PLAYER
|
||||
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
||||
[[ ${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"
|
||||
|
||||
(cd $MY_PATH && git pull && espeak "code ok") &
|
||||
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null)
|
||||
[[ $G1PUB == "" ]] && espeak "ERROR NO G 1 PUBLIC KEY FOUND - EXIT" && exit 1
|
||||
|
||||
|
@ -58,15 +64,16 @@ MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
|||
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
|
||||
[[ $IPFSNODEID == "" ]] && echo "IPFSNODEID manquant" && espeak "IPFS NODE ID Missing" && exit 1
|
||||
|
||||
BROWSER=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1) ## GET cookies-from-browser
|
||||
|
||||
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"
|
||||
|
||||
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="${PLAYER} Type de media à importer ?" --entry-text="Video" Page MP3 Web)
|
||||
[ ! $2 ] && IMPORT=$(zenity --entry --width 640 --title="$URL => Astroport" --text="${PLAYER} Type de media à importer ?" --entry-text="Video" Page MP3 Web) || IMPORT="$CHOICE"
|
||||
[[ $IMPORT == "" ]] && espeak "No choice made. Exiting program" && exit 1
|
||||
[[ $IMPORT == "Video" ]] && IMPORT="Youtube"
|
||||
CHOICE="$IMPORT"
|
||||
|
@ -139,8 +146,8 @@ espeak "Ready !"
|
|||
|
||||
########################################################################
|
||||
# CHOOSE CATEGORY (remove anime, not working!)
|
||||
[[ $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 == "" ]] && exit 1
|
||||
[ ! $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
|
||||
CAT=$(echo "${CHOICE}" | awk '{print tolower($0)}')
|
||||
|
@ -169,7 +176,7 @@ case ${CAT} in
|
|||
|
||||
espeak "Ready to record your webcam"
|
||||
|
||||
zenity --warning --width 300 --text "${PLAYER}. Prêt à enregistrer votre video ?"
|
||||
[ ! $2 ] && zenity --warning --width 300 --text "${PLAYER}. Prêt à enregistrer votre video ?"
|
||||
|
||||
## RECORD WEBCAM VIDEO
|
||||
${MY_PATH}/tools/vlc_webcam.sh
|
||||
|
@ -191,8 +198,8 @@ case ${CAT} in
|
|||
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
|
||||
[ ! $2 ] && [[ $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 == "" ]] && echo "URL EMPTY " && exit 1
|
||||
|
||||
REVSOURCE="$(echo "$YTURL" | awk -F/ '{print $3}' | rev)_"
|
||||
|
||||
|
@ -203,9 +210,14 @@ mkdir -p ${YTEMP}
|
|||
# youtube-dl $YTURL
|
||||
echo "VIDEO $YTURL"
|
||||
|
||||
/usr/local/bin/youtube-dl -f '[ext=mp4]+best[height<=480]+[filesize<300M]' \
|
||||
--no-playlist --write-info-json \
|
||||
--no-mtime -o "${YTEMP}/%(id)s&%(title)s.%(ext)s" $YTURL
|
||||
# --write-subs --write-auto-subs --sub-langs "fr, en, en-orig" --embed-subs
|
||||
|
||||
/usr/local/bin/youtube-dl -f "(bv*[ext=mp4][height<=720]+ba/b[height<=720])" \
|
||||
--cookies-from-browser $BROWSER \
|
||||
--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
|
||||
|
||||
# Get filename, extract ID, make destination dir and move copy.
|
||||
YFILE=$(ls -S ${YTEMP} | head -n 1)
|
||||
|
@ -223,30 +235,6 @@ espeak "OK $YNAME copied"
|
|||
MEDIAID="$REVSOURCE${YID}"
|
||||
TITLE="${YNAME%.*}"
|
||||
MEDIAKEY="YOUTUBE_${MEDIAID}"
|
||||
## CORRECT PARAMETERS to Make Kodi compatible YASTRXBIAN FILE
|
||||
|
||||
espeak "Please. Choose your tags"
|
||||
|
||||
[ ! $2 ] && GENRES=$(zenity --list --checklist --title="GENRE" --height=${haut} \
|
||||
--text="Choisissez le(s) genre(s) d'information(s) contenue(s) dans cette vidéo \"${TITLE}\" publiée sur OASIS" \
|
||||
--column="Use" \
|
||||
--column="Feature" \
|
||||
FALSE Savoir \
|
||||
FALSE Nature \
|
||||
FALSE Habiter \
|
||||
FALSE Nourrir \
|
||||
FALSE Deplacer \
|
||||
FALSE Guerir \
|
||||
FALSE Divertir \
|
||||
FALSE Musique \
|
||||
FALSE DIY \
|
||||
FALSE Science \
|
||||
FALSE Humain \
|
||||
FALSE Animal \
|
||||
TRUE Eveil \
|
||||
TRUE ${PLAYER// /-}) || GENRES="${PLAYER// /-}"
|
||||
|
||||
# FORMAT GENRES genre1|genre2|genre3
|
||||
|
||||
FILE_PATH="$HOME/Astroport/youtube/$MEDIAID"
|
||||
mkdir -p ${FILE_PATH} && mv -f ${YTEMP}/* ${FILE_PATH}/
|
||||
|
@ -287,7 +275,7 @@ rm -Rf ${YTEMP}
|
|||
cd ~/.zen/tmp/
|
||||
|
||||
URL=$(echo $URL | grep -Eo '^http[s]?://[^/]+')
|
||||
[[ $URL == "" ]] && URL=$(zenity --entry --width 300 --title "Lien du site Web à copier" --text "Indiquez le lien (URL)" --entry-text="")
|
||||
[ ! $2 ] && [[ $URL == "" ]] && URL=$(zenity --entry --width 300 --title "Lien du site Web à copier" --text "Indiquez le lien (URL)" --entry-text="")
|
||||
|
||||
## Extract http(s)://domain.tld
|
||||
URL=$(echo $URL | grep -Eo '^http[s]?://[^/]+') # URL="https://discuss.ipfs.io"
|
||||
|
@ -367,6 +355,7 @@ echo '[
|
|||
"type": "'text/vnd.tiddlywiki'",
|
||||
"text": "'$TEXT'",
|
||||
"size": "'${FILE_BSIZE}'",
|
||||
"filesize": "'${FILE_SIZE}'",
|
||||
"g1pub": "'${G1PUB}'",
|
||||
"ipfs": "'/ipfs/${IPFSREPFILEID}'",
|
||||
"mediakey": "'${MEDIAKEY}'",
|
||||
|
@ -399,11 +388,11 @@ echo '[
|
|||
## EVOLVE TO ARTICLE
|
||||
# httrack --mirror --ext-depth=0 --depth=1 --near --stay-on-same-address --keep-links=0 --path article-x --quiet https://example.com/article-x/
|
||||
|
||||
[[ $URL == "" ]] && URL=$(zenity --entry --width 300 --title "Lien de la page à convertir en PDF" --text "Indiquez le lien (URL)" --entry-text="")
|
||||
[ ! $2 ] && [[ $URL == "" ]] && URL=$(zenity --entry --width 300 --title "URL à convertir en PDF (VIDE POUR UN FICHIER LOCAL)" --text "Indiquez le lien (URL)" --entry-text="")
|
||||
|
||||
if [[ $URL != "" ]]; then
|
||||
## 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
|
||||
[ ! $2 ] && [[ ! $(which chromium) ]] && zenity --warning --width ${large} --text "Utilitaire de copie de page web absent.. Lancez la commande 'sudo apt install chromium'" && exit 1
|
||||
|
||||
cd ~/.zen/tmp/ && rm -f output.pdf
|
||||
|
||||
|
@ -415,9 +404,9 @@ echo '[
|
|||
if [[ $URL == "" ]]; then
|
||||
|
||||
# SELECT FILE TO ADD TO ASTROPORT/KODI
|
||||
FILE=$(zenity --file-selection --title="Sélectionner le fichier à ajouter")
|
||||
[ ! $2 ] && FILE=$(zenity --file-selection --title="Sélectionner le fichier à ajouter")
|
||||
echo "${FILE}"
|
||||
[[ $FILE == "" ]] && exit 1
|
||||
[[ $FILE == "" ]] && echo "NO FILE" && exit 1
|
||||
|
||||
# Remove file extension to get file name => STITLE
|
||||
FILE_PATH="$(dirname "${FILE}")"
|
||||
|
@ -435,10 +424,10 @@ echo '[
|
|||
|
||||
CTITLE=$(echo $URL | rev | cut -d '/' -f 1 | rev)
|
||||
|
||||
TITLE=$(zenity --entry --width 480 --title "Titre" --text "Quel nom de fichier à donner à cette page ? " --entry-text="${CTITLE}")
|
||||
[[ $TITLE == "" ]] && exit 1
|
||||
FILE_NAME="$(echo "${TITLE}" | detox --inline).pdf" ## TODO make it better
|
||||
[ ! $2 ] && TITLE=$(zenity --entry --width 480 --title "Titre" --text "Quel nom donner à ce fichier ? " --entry-text="${CTITLE}") || TITLE="$CTITLE"
|
||||
[[ "$TITLE" == "" ]] && echo "NO TITLE" && exit 1
|
||||
|
||||
FILE_NAME="$(echo "${TITLE}" | detox --inline).pdf" ## TODO make it better
|
||||
REVSOURCE="$(echo "$URL" | awk -F/ '{print $3}' | rev | detox --inline)_"
|
||||
|
||||
MEDIAID="$REVSOURCE$(echo "${TITLE}" | detox --inline)"
|
||||
|
@ -465,38 +454,42 @@ echo '[
|
|||
|
||||
espeak " Youtube music copying. Please help us to make the Web your Web"
|
||||
|
||||
zenity --warning --width 600 --text 'DEVELOPPEMENT ZONE - https://git.p2p.legal - P2P INTERNET FACTORY'
|
||||
# [ ! $2 ] && zenity --warning --width 600 --text 'DEVELOPPEMENT ZONE - https://git.p2p.legal - P2P INTERNET FACTORY'
|
||||
|
||||
# Create TEMP directory
|
||||
YTEMP="$HOME/.zen/tmp/$(date -u +%s%N | cut -b1-13)"
|
||||
mkdir -p ${YTEMP}
|
||||
|
||||
YTURL="$URL"
|
||||
[[ $YTURL == "" ]] && artist=$(zenity --entry --width 400 --title "Extraction MP3 depuis Youtube" --text "Artiste recherché ou Lien Youtube" --entry-text="")
|
||||
[[ $artist == "" ]] && exit 1
|
||||
[ ! $2 ] && [[ $YTURL == "" ]] && artist=$(zenity --entry --width 400 --title "Extraction MP3 depuis Youtube" --text "Artiste recherché ou Lien Youtube" --entry-text="")
|
||||
[[ $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
|
||||
song=$(zenity --entry --width 300 --title "Titre à chercher sur Youtube" --text "Titre recherché" --entry-text="")
|
||||
[ ! $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
|
||||
|
||||
# Download mp3 from 1st youtube search video result (--write-info-json)
|
||||
/usr/local/bin/youtube-dl --default-search ytsearch1: \
|
||||
--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 $song"
|
||||
|
||||
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
|
||||
|
||||
|
@ -563,6 +556,7 @@ echo '[
|
|||
"type": "'audio/mpeg'",
|
||||
"text": "'$TEXT'",
|
||||
"size": "'${FILE_BSIZE}'",
|
||||
"filesize": "'${FILE_SIZE}'",
|
||||
"g1pub": "'${G1PUB}'",
|
||||
"ipfs": "'/ipfs/${IPFSREPFILEID}'",
|
||||
"mediakey": "'${MEDIAKEY}'",
|
||||
|
@ -693,6 +687,14 @@ FILM_GENRES=$(zenity --list --checklist --title="GENRE" --height=${haut}\
|
|||
# FORMAT GENRES ["genre1","genre2"] # USE IF YOU ACTIVATE KODI COMPATIBILITY
|
||||
GENRES="[\"$(echo ${FILM_GENRES} | sed s/\|/\",\"/g)\"]"
|
||||
|
||||
# CONVERT INPUT TO MP4 #######################
|
||||
[[ $FILE_EXT != "mp4" ]] \
|
||||
&& espeak "Converting to M P 4. Please wait" \
|
||||
&& echo "CONVERT TO MP4 : ffmpeg -loglevel quiet -i ${FILE_PATH}/${FILE_NAME} -c:v libx264 -c:a aac ${FILE_PATH}/$FILE_TITLE.mp4" \
|
||||
&& ffmpeg -loglevel quiet -i "${FILE_PATH}/${FILE_NAME}" -c:v libx264 -c:a aac "${FILE_PATH}/$FILE_TITLE.mp4" \
|
||||
&& FILE_EXT="mp4" && FILE_NAME="$FILE_TITLE.mp4" \
|
||||
&& espeak "M P 4 ready"
|
||||
|
||||
mkdir -p ~/Astroport/${CAT}/${MEDIAID}/
|
||||
|
||||
[[ ! -s "$HOME/Astroport/${CAT}/${MEDIAID}/${TITLE}${SAISON}.${FILE_EXT}" ]] \
|
||||
|
@ -720,11 +722,11 @@ echo "${CAT};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/i
|
|||
# \_/ |_|\__,_|\___|\___/
|
||||
# TIMESTAMP INDEX
|
||||
|
||||
video | obs)
|
||||
video)
|
||||
|
||||
espeak "Add your personnal video in TW"
|
||||
|
||||
zenity --warning --width 600 --text 'DEV ZONE - HELP US - REGISTER - https://git.p2p.legal'
|
||||
zenity --warning --width 600 --text 'DEV ZONE - HELP US - https://git.p2p.legal'
|
||||
|
||||
## GENERAL MEDIAKEY for uploaded video. Title + Decription + hashtag + hashipfs
|
||||
# SELECT FILE TO ADD TO ASTROPORT/KODI
|
||||
|
@ -744,7 +746,7 @@ echo "${CAT};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/i
|
|||
&& FILE_EXT="mp4" && FILE_NAME="$FILE_TITLE.mp4"
|
||||
|
||||
# VIDEO TITLE
|
||||
TITLE=$(zenity --entry --width 300 --title "Titre" --text "Indiquez un titre pour cette vidéo" --entry-text="${FILE_TITLE}")
|
||||
TITLE=$(zenity --entry --width 300 --title "Titre" --text "Indiquez le titre de cette vidéo" --entry-text="${FILE_TITLE}")
|
||||
[[ $TITLE == "" ]] && exit 1
|
||||
TITLE=$(echo "${TITLE}" | sed "s/[(][^)]*[)]//g" | sed -e 's/;/_/g' ) # Clean TITLE (NO ;)
|
||||
|
||||
|
@ -753,10 +755,10 @@ echo "${CAT};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/i
|
|||
mkdir -p ~/Astroport/${CAT}/${MEDIAID}/
|
||||
MEDIAKEY="VIDEO_${MEDIAID}"
|
||||
|
||||
## CREATE SIMPLE JSON (REMOVE== it ?
|
||||
## CREATE SIMPLE JSON (EXPERIENCE WITH it)
|
||||
jq -n --arg ts "$MEDIAID" --arg title "$TITLE" --arg desc "$DESCRIPTION" --arg htag "$HASHTAG" '{"timestamp":$ts,"ipfs":"_IPFSREPFILEID_","ipns":"_IPNSKEY_","title":$title,"desc":$desc,"tag":$htag}' > ~/Astroport/${CAT}/${MEDIAID}/video.json
|
||||
|
||||
## MOVE FILE TO IMPORT ZONE
|
||||
## MOVE FILE FOR new_file_in_astroport POST TREATMENT
|
||||
[[ ! -s "$HOME/Astroport/${CAT}/${MEDIAID}/${TITLE}${SAISON}.${FILE_EXT}" ]] \
|
||||
&& cp "${FILE_PATH}/${FILE_NAME}" "$HOME/Astroport/${CAT}/${MEDIAID}/${TITLE}${SAISON}.${FILE_EXT}"
|
||||
|
||||
|
@ -776,7 +778,7 @@ echo "${CAT};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/i
|
|||
########################################################################
|
||||
*)
|
||||
|
||||
zenity --warning --width ${large} --text "Impossible d'interpréter votre commande $CAT"
|
||||
[ ! $2 ] && zenity --warning --width ${large} --text "Impossible d'interpréter votre commande $CAT"
|
||||
exit 1
|
||||
|
||||
;;
|
||||
|
@ -822,8 +824,7 @@ if [[ ! -s ~/Astroport/${CAT}/${MEDIAID}/${MEDIAKEY}.dragdrop.json ]]; then
|
|||
|
||||
timestamp=$(date -u +%s%N | cut -b1-13)
|
||||
|
||||
## OLD CODE !!! ADD TO ASTROPORT SCRIPT
|
||||
## NOW CREATE TIDDLER INTO PLAYER TW
|
||||
## CREATE BASH SCRIPT
|
||||
|
||||
echo "MEDIAKEY=${MEDIAKEY}" > ~/Astroport/Add_${MEDIAKEY}_script.sh
|
||||
|
||||
|
@ -854,28 +855,44 @@ if [[ ! -s ~/Astroport/${CAT}/${MEDIAID}/${MEDIAKEY}.dragdrop.json ]]; then
|
|||
|
||||
espeak "Adding $CAT to I P F S. Please Wait"
|
||||
|
||||
## RUN BASH SCRIPT
|
||||
bash ~/Astroport/Add_${MEDIAKEY}_script.sh "noh265"
|
||||
|
||||
## OR PUT IN YOUR QUEUE
|
||||
## CREATING TIMELINE FOR BATCH TREATMENT
|
||||
#~ mkdir -p ~/.zen/tmp/${IPFSNODEID}/ajouter_media.sh/
|
||||
#~ echo "${MEDIAKEY}" > ~/.zen/tmp/${IPFSNODEID}/ajouter_media.sh/${MOATS}
|
||||
|
||||
##
|
||||
|
||||
|
||||
fi
|
||||
|
||||
espeak "Updating T W"
|
||||
#######################################
|
||||
########################## TIDDLER JSON READY
|
||||
#######################################
|
||||
if [[ -s ~/Astroport/${CAT}/${MEDIAID}/${MEDIAKEY}.dragdrop.json ]]; then
|
||||
espeak "Updating T W"
|
||||
|
||||
########################################################################
|
||||
## ADD TIDDLER TO TW
|
||||
########################################################################
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
## GETTING LAST TW via IPFS or HTTP GW
|
||||
LIBRA=$(head -n 2 ${MY_PATH}/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
rm -f ~/.zen/tmp/ajouter_media.html > /dev/null 2>&1
|
||||
[[ $YOU ]] && echo " ipfs --timeout 30s cat /ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 30s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/ajouter_media.html
|
||||
[[ ! -s ~/.zen/tmp/ajouter_media.html ]] && echo "curl -m 12 $LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/tmp/ajouter_media.html "$LIBRA/ipns/${ASTRONAUTENS}"
|
||||
[[ ! -s ~/.zen/tmp/ajouter_media.html ]] && espeak "WARNING. WARNING. impossible to find your TW online"
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ]] && espeak "FATAL ERROR. No player TW copy found ! EXIT" && exit 1
|
||||
## TODO : CHECK CACHE LAST MODIFIED
|
||||
echo "%%%%%%%%%%%%%% I GOT YOUR TW %%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
########################################################################
|
||||
## ADD TIDDLER TO TW
|
||||
########################################################################
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
## GETTING LAST TW via IPFS or HTTP GW
|
||||
LIBRA=$(head -n 2 ${MY_PATH}/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
rm -f ~/.zen/tmp/ajouter_media.html > /dev/null 2>&1
|
||||
[[ $YOU ]] && echo " ipfs --timeout 30s cat /ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 30s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/ajouter_media.html
|
||||
[[ ! -s ~/.zen/tmp/ajouter_media.html ]] && echo "curl -m 12 $LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/tmp/ajouter_media.html "$LIBRA/ipns/${ASTRONAUTENS}"
|
||||
[[ ! -s ~/.zen/tmp/ajouter_media.html ]] && espeak "WARNING. WARNING. impossible to find your TW online"
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ]] && espeak "FATAL ERROR. No player TW copy found ! EXIT" && exit 1
|
||||
## TODO : CHECK CACHE LAST MODIFIED
|
||||
echo "%%%%%%%%%%%%%% I GOT YOUR TW %%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
|
||||
[[ -s ~/.zen/tmp/ajouter_media.html ]] && cp -f ~/.zen/tmp/ajouter_media.html ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html && espeak "TW Found"
|
||||
###############################
|
||||
[[ -s ~/.zen/tmp/ajouter_media.html ]] \
|
||||
&& cp -f ~/.zen/tmp/ajouter_media.html ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
|
||||
&& espeak "TW Found" \
|
||||
|| espeak "USING LOCAL COPY"
|
||||
###############################
|
||||
|
||||
echo "Nouveau MEDIAKEY dans TW $PSEUDO / ${PLAYER} : http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
|
||||
|
@ -909,8 +926,16 @@ echo "%%%%%%%%%%%%%% I GOT YOUR TW %%%%%%%%%%%%%%%%%%%%%%%%%%"
|
|||
|
||||
fi
|
||||
|
||||
espeak "OK We did it"
|
||||
|
||||
else
|
||||
|
||||
espeak "Sorry. No Tiddler found"
|
||||
|
||||
fi
|
||||
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $start`
|
||||
espeak "OK We did it and It tooks $dur seconds to acomplish"
|
||||
espeak "It tooks $dur seconds to acomplish"
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -0,0 +1,186 @@
|
|||
#!/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=$(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"
|
||||
|
||||
ME="${0##*/}"
|
||||
TS=$(date -u +%s%N | cut -b1-13)
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
echo '
|
||||
_ ____ _____ ____ ___ ____ ___ ____ _____ ___ _ _ _____
|
||||
/ \ / ___|_ _| _ \ / _ \| _ \ / _ \| _ \_ _| / _ \| \ | | ____|
|
||||
/ _ \ \___ \ | | | |_) | | | | |_) | | | | |_) || | | | | | \| | _|
|
||||
/ ___ \ ___) || | | _ <| |_| | __/| |_| | _ < | | | |_| | |\ | |___
|
||||
/_/ \_\____/ |_| |_| \_\\___/|_| \___/|_| \_\|_| \___/|_| \_|_____|
|
||||
|
||||
Ambassade numérique pair à pair sur IPFS.
|
||||
|
||||
@@@@@@@@@@@@@@@@@@
|
||||
ASTROPORT
|
||||
VISA : MadeInZion
|
||||
@@@@@@@@@@@@@@@@@@'
|
||||
echo
|
||||
|
||||
## VERIFY SOFTWARE DEPENDENCIES
|
||||
[[ ! $(which ipfs) ]] && echo "EXIT. Vous devez avoir installé ipfs CLI sur votre ordinateur" && echo "https://dist.ipfs.io/#go-ipfs" && exit 1
|
||||
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||
[[ ! $YOU ]] && echo "Lancez 'ipfs daemon' SVP sudo systemctl start ipfs" && exit 1
|
||||
export IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
|
||||
|
||||
echo 'PRESS ENTER... '; read
|
||||
|
||||
## CREATE AND OR CONNECT USER
|
||||
PS3='Astronaute connectez votre PLAYER ___ '
|
||||
players=("NOUVEAU VISA" "IMPORT PLAYER" $(ls ~/.zen/game/players 2>/dev/null))
|
||||
## MULTIPLAYER
|
||||
|
||||
select fav in "${players[@]}"; do
|
||||
case $fav in
|
||||
"NOUVEAU VISA")
|
||||
${MY_PATH}/tools/VISA.new.sh
|
||||
fav=$(cat ~/.zen/tmp/PSEUDO 2>/dev/null) && rm ~/.zen/tmp/PSEUDO
|
||||
echo "Astronaute $fav bienvenue dans le jeu de terraformation forêt jardin MadeInZion"
|
||||
exit
|
||||
;;
|
||||
"IMPORT PLAYER")
|
||||
echo "'Identifiant'"
|
||||
read SALT
|
||||
echo "'Mot de passe'"
|
||||
read PEPPER
|
||||
echo "'Adresse Email'"
|
||||
read EMAIL
|
||||
${MY_PATH}/tools/VISA.new.sh "$SALT" "$PEPPER" "$EMAIL"
|
||||
fav=$(cat ~/.zen/tmp/PSEUDO 2>/dev/null) && rm ~/.zen/tmp/PSEUDO
|
||||
echo "Astronaute $fav heureux de vous acceuillir"
|
||||
exit
|
||||
;;
|
||||
"")
|
||||
echo "Choix obligatoire. exit"
|
||||
exit
|
||||
;;
|
||||
*) echo "Salut $fav"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
PLAYER=$fav
|
||||
|
||||
|
||||
pass=$(cat ~/.zen/game/players/$PLAYER/.pass 2>/dev/null)
|
||||
########################################## DEVEL
|
||||
echo "Saisissez votre PASS -- UPGRADE CRYPTO FREELY -- $pass" && read PASS
|
||||
|
||||
## DECODE CURRENT PLAYER CRYPTO
|
||||
# echo "********* DECODAGE SecuredSocketLayer *********"
|
||||
# rm -f ~/.zen/tmp/${PLAYER}.dunikey 2>/dev/null
|
||||
# openssl enc -aes-256-cbc -d -in "$HOME/.zen/game/players/${PLAYER}/enc.secret.dunikey" -out "$HOME/.zen/tmp/${PLAYER}.dunikey" -k $pass 2>&1>/dev/null
|
||||
[[ $PASS != $pass ]] && echo "ERROR. MAUVAIS PASS. EXIT" && exit 1
|
||||
|
||||
rm -f ~/.zen/game/players/.current
|
||||
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
|
||||
|
||||
echo "________LOGIN OK____________";
|
||||
echo
|
||||
echo "DECHIFFRAGE CLEFS ASTRONAUTE"
|
||||
echo "Votre Pass Astroport.ONE : $(cat ~/.zen/game/players/$PLAYER/.pass 2>/dev/null)"
|
||||
export G1PUB=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
[ ! ${G1PUB} ] && echo "ERROR. MAUVAIS PASS. EXIT" && exit 1
|
||||
|
||||
echo "Clef Publque Astronaute : $G1PUB"
|
||||
echo "ENTREE ACCORDEE"
|
||||
echo
|
||||
export ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
|
||||
|
||||
echo "$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null) TW/Moa"
|
||||
echo "http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||
echo "Activation Réseau P2P Astroport !"
|
||||
|
||||
echo
|
||||
PS3="$PLAYER choisissez : __ "
|
||||
choices=("AJOUTER VLOG" "CREER UN VOEU" "IMPRIMER QRVOEU" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
|
||||
select fav in "${choices[@]}"; do
|
||||
case $fav in
|
||||
"IMPRIMER VISA")
|
||||
echo "IMPRESSION"
|
||||
${MY_PATH}/tools/VISA.print.sh "$PLAYER"
|
||||
;;
|
||||
|
||||
"EXPORTER VISA")
|
||||
echo "EXPORT IDENTITE ASTRONAUTE"
|
||||
du -h ~/.zen/game/players/$PLAYER/
|
||||
echo "MANUAL BACKUP ZIP ~/.zen/game/players/$PLAYER/"
|
||||
## EXPORT TW + VOEUX IPNS KEYS
|
||||
|
||||
|
||||
break
|
||||
;;
|
||||
|
||||
"SUPPRIMER VISA")
|
||||
echo "ATTENTION ${PLAYER} SUPPRESSION DEFINITIVE !!"
|
||||
echo "Enter to continue. Ctrl+C to stop"
|
||||
read
|
||||
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"
|
||||
$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
|
||||
echo "rm -Rf ~/.zen/game/players/$PLAYER"
|
||||
rm -Rf ~/.zen/game/players/$PLAYER
|
||||
|
||||
break
|
||||
;;
|
||||
|
||||
"AJOUTER VLOG")
|
||||
echo "Lancement Webcam..."
|
||||
${MY_PATH}/tools/vlc_webcam.sh "$PLAYER"
|
||||
;;
|
||||
|
||||
"CREER UN VOEU")
|
||||
echo "QRCode à coller sur les lieux ou objets portant une Gvaleur"
|
||||
cp ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/$PLAYER.html
|
||||
${MY_PATH}/ASTROBOT/G1Voeu.sh "" "$PLAYER" "~/.zen/tmp/$PLAYER.html"
|
||||
DIFF=$(diff ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/$PLAYER.html)
|
||||
if [[ $DIFF ]]; then
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain \
|
||||
~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.moats)
|
||||
|
||||
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||
ipfs name publish --allow-offline -t 72h --key=$PLAYER /ipfs/$TW
|
||||
|
||||
echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
|
||||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
||||
fi
|
||||
echo "================================================"
|
||||
echo "$PLAYER : http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||
echo "================================================"
|
||||
;;
|
||||
|
||||
"IMPRIMER QRVOEU")
|
||||
${MY_PATH}/tools/VOEUX.print.sh $PLAYER
|
||||
;;
|
||||
|
||||
"QUITTER")
|
||||
echo "CIAO" && exit 0
|
||||
;;
|
||||
|
||||
"")
|
||||
echo "Mauvais choix."
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
|
||||
exit 0
|
|
@ -1,7 +1,10 @@
|
|||
COMPOSE_FILE_VDI := true
|
||||
COMPOSE_IGNORE_ORPHANS := true
|
||||
DOCKER_IMAGES_MYOS := x2go:xfce-debian
|
||||
ENV_VARS += HOST_ASTROPORT_SERVICE_1234_TAGS
|
||||
HOST_ASTROPORT_SERVICE_1234_TAGS ?= urlprefix-astroport.$(DOMAIN)/
|
||||
ENV_VARS += HOST_ASTROPORT_SERVICE_DOMAIN HOST_ASTROPORT_SERVICE_NAME HOST_ASTROPORT_SERVICE_1234_TAGS
|
||||
HOST_ASTROPORT_SERVICE_DOMAIN ?= $(firstword $(DOMAIN))
|
||||
HOST_ASTROPORT_SERVICE_NAME ?= astroport
|
||||
HOST_ASTROPORT_SERVICE_1234_TAGS ?= $(call tagprefix,HOST_ASTROPORT,1234)
|
||||
HOST_ASTROPORT_UFW_UPDATE := 1234/tcp 12245:12445/tcp 45720/tcp
|
||||
MAKE_VARS += SSH_PORT User host
|
||||
SERVICE := astroport
|
|
@ -121,7 +121,7 @@ RUN chmod +rx /usr/local/bin/cronlock
|
|||
|
||||
# config ssmtp
|
||||
COPY templates/.ssmtprc /etc/ssmtp/ssmtp.conf
|
||||
RUN chmod 600 /etc/ssmtp/ssmtp.conf
|
||||
RUN chmod 640 /etc/ssmtp/ssmtp.conf && chgrp mail /etc/ssmtp/ssmtp.conf
|
||||
|
||||
EXPOSE 1234 12345
|
||||
|
||||
|
@ -191,7 +191,7 @@ VOLUME "/home/$USER/Astroport"
|
|||
|
||||
# homedir
|
||||
RUN mkdir -p "/home/$USER/.ipfs" "/home/$USER/.zen/game/players" "/home/$USER/Astroport" \
|
||||
&& chown "$USER" "/home/$USER/.ipfs" "/home/$USER/.zen/game/players" "/home/$USER/Astroport"
|
||||
&& chown -R "$USER" "/home/$USER"
|
||||
|
||||
HEALTHCHECK CMD [ $(ps aux |grep 'nc -l -p' |wc -l) -lt 199 ] && echo -n OK
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ log() {
|
|||
}
|
||||
|
||||
zen() {
|
||||
mkdir -p /home/zen/Astroport
|
||||
sudo chown zen:users /home/zen /home/zen/.zen /home/zen/.zen/game /home/zen/.zen/game/players
|
||||
[ -d "$ASTROPORT_DIR" ] && cd "$ASTROPORT_DIR" && git pull -q || git clone -q "$ASTROPORT_REPO" "$ASTROPORT_DIR"
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@ services:
|
|||
- GID=${HOST_GID}
|
||||
- UID=${HOST_UID}
|
||||
container_name: ${COMPOSE_PROJECT_NAME}-astroport
|
||||
environment:
|
||||
- ENV=${ENV}
|
||||
- SHELL=${DOCKER_SHELL}
|
||||
domainname: ${HOST_ASTROPORT_SERVICE_DOMAIN:-localhost}
|
||||
hostname: ${HOST_ASTROPORT_SERVICE_NAME:-astroport}
|
||||
image: ${DOCKER_REPOSITORY}/astroport:${DOCKER_IMAGE_TAG}
|
||||
labels:
|
||||
- SERVICE_1234_CHECK_HTTP=/test
|
||||
|
|
|
@ -12,12 +12,10 @@ services:
|
|||
restart: unless-stopped
|
||||
tty: true
|
||||
volumes:
|
||||
- data:/home/zen/Astroport:cached
|
||||
- home:/home/zen/.zen/game/players:delegated
|
||||
- ipfs:/home/zen/.ipfs:cached,ro
|
||||
working_dir: /home/zen
|
||||
|
||||
volumes:
|
||||
data:
|
||||
home:
|
||||
ipfs:
|
||||
|
|
101
install.sh
101
install.sh
|
@ -9,25 +9,19 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|||
ME="${0##*/}"
|
||||
start=`date +%s`
|
||||
|
||||
[ $(id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1
|
||||
|
||||
################################################################## SUDO
|
||||
########################################################################
|
||||
[ $(id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. " && exit 1
|
||||
[[ ! $(groups | grep -w sudo) ]] && echo "AUCUN GROUPE \"sudo\" : su -; usermod -aG sudo $USER" && exit 1
|
||||
################################################################### IPFS
|
||||
########################################################################
|
||||
[[ ! $(which ipfs) ]] \
|
||||
&& echo "=== Installez IPFS KUBO puis relancez Install ===" \
|
||||
&& echo "bash <(wget -qO- https://git.p2p.legal/qo-op/Astroport.ONE/raw/branch/master/kubo_v0.16.0_linux-amd64.install.sh)" \
|
||||
&& [[ $(uname -p) == "x86_64" ]] \
|
||||
&& bash <(wget -qO- https://git.p2p.legal/qo-op/Astroport.ONE/raw/branch/master/kubo_v0.16.0_linux-amd64.install.sh)
|
||||
|
||||
|
||||
#### GIT CLONE ###############################################################
|
||||
[[ ! $(which git) ]] && sudo apt install -y git
|
||||
echo "=== CLONAGE '~/.zen/Astroport.ONE' depuis https://git.p2p.legal"
|
||||
mkdir -p ~/.zen
|
||||
cd ~/.zen
|
||||
|
||||
export GIT_SSL_NO_VERIFY=true
|
||||
git clone --depth 1 https://git.p2p.legal/qo-op/Astroport.ONE.git
|
||||
# TODO INSTALL FROM IPFS / IPNS
|
||||
&& bash <(wget -qO- https://git.p2p.legal/qo-op/Astroport.ONE/raw/branch/master/kubo_v0.16.0_linux-amd64.install.sh) \
|
||||
|| echo "=== Installez IPFS KUBO puis relancez Install ==="
|
||||
[[ ! $(which ipfs) ]] && echo "INSTALL IPFS PLEASE" && exit 1
|
||||
#################################################################### TEST
|
||||
|
||||
# MAIN # SI AUCUNE CLEF DE STATION...
|
||||
if [[ ! -d ~/.zen/game/players/ ]];
|
||||
|
@ -44,11 +38,11 @@ echo "tail -f /tmp/install.errors.log"
|
|||
echo "##################################################"
|
||||
|
||||
echo ; echo "Mise à jour des dépots de votre distribution..."
|
||||
[[ $XDG_SESSION_TYPE == 'x11' ]] && sudo add-apt-repository ppa:obsproject/obs-studio
|
||||
#~ [[ $XDG_SESSION_TYPE == 'x11' ]] && sudo add-apt-repository ppa:obsproject/obs-studio
|
||||
sudo apt-get update
|
||||
|
||||
|
||||
for i in x11-utils xclip zenity obs-studio kodi; do
|
||||
for i in x11-utils xclip zenity chromium kodi; do
|
||||
if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
|
||||
echo ">>> Installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
|
||||
[[ $XDG_SESSION_TYPE == 'x11' ]] && sudo apt install -y $i;
|
||||
|
@ -60,7 +54,7 @@ echo "#############################################"
|
|||
echo "######### PATIENCE ####"
|
||||
echo "#############################################"
|
||||
|
||||
for i in git make fail2ban npm netcat-traditional inotify-tools curl net-tools libsodium* python3-pip python3-setuptools python3-wheel python3-dotenv python3-gpg python3-jwcrypto python3-brotli mpack; do
|
||||
for i in git make fail2ban npm netcat-traditional 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
|
||||
|
@ -72,7 +66,7 @@ echo "#############################################"
|
|||
echo "######### PATIENCE ######"
|
||||
echo "#############################################"
|
||||
# removed : sqlite
|
||||
for i in qrencode basez jq bc file gawk yt-dlp ffmpeg dnsutils ntpdate v4l-utils espeak vlc mp3info musl-dev openssl* detox nmap httrack html2text ssmtp imagemagick; do
|
||||
for i in qrencode ca-certificates basez jq bc file gawk yt-dlp ffmpeg dnsutils ntpdate v4l-utils espeak vlc mp3info musl-dev openssl* detox nmap httrack html2text ssmtp imagemagick; 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
|
||||
|
@ -81,25 +75,33 @@ for i in qrencode basez jq bc file gawk yt-dlp ffmpeg dnsutils ntpdate v4l-utils
|
|||
fi
|
||||
done
|
||||
|
||||
#### GIT CLONE ###############################################################
|
||||
echo "=== CLONAGE CODE '~/.zen/Astroport.ONE' depuis https://git.p2p.legal"
|
||||
mkdir -p ~/.zen
|
||||
cd ~/.zen
|
||||
git clone --depth 1 https://git.p2p.legal/qo-op/Astroport.ONE.git
|
||||
# TODO INSTALL FROM IPFS / IPNS
|
||||
|
||||
echo "#############################################"
|
||||
echo "######### PATIENCE ############"
|
||||
echo "#############################################"
|
||||
##########################################################
|
||||
echo "### INSTALL TW node.js"
|
||||
sudo npm install -g tiddlywiki sjcl-cli
|
||||
sudo npm install -g tiddlywiki
|
||||
[[ $? != 0 ]] && echo "INSTALL tiddlywikiFAILED." && echo "INSTALL tiddlywiki FAILED." >> /tmp/install.errors.log && continue
|
||||
|
||||
echo "#############################################"
|
||||
echo "######### PATIENCE #################"
|
||||
echo "#############################################"
|
||||
|
||||
##########################################################
|
||||
echo "## INSTALLATION AstroGEEK OpenCV = 'Intelligence Amie' - DEV - "
|
||||
# echo "## INSTALLATION AstroGEEK OpenCV = 'Intelligence Amie' - DEV - "
|
||||
# sudo apt-get install python3-opencv -y
|
||||
|
||||
## MAILJET SSMTP RELAYING : ADD YOUR CREDENTIALS
|
||||
sudo cp ~/.zen/Astroport.ONE/templates/.ssmtprc /etc/ssmtp/ssmtp.conf
|
||||
sudo chmod 600 /etc/ssmtp/ssmtp.conf
|
||||
sudo ln -s /usr/sbin/ssmtp /usr/bin/ssmtp
|
||||
sudo chmod 640 /etc/ssmtp/ssmtp.conf
|
||||
sudo chgrp mail /etc/ssmtp/ssmtp.conf
|
||||
|
||||
echo "$USER:support@g1sms.fr:mail.asycn.io:587" | (sudo su -c 'tee -a /etc/ssmtp/revaliases')
|
||||
|
||||
|
@ -245,25 +247,54 @@ echo "# ADDING <<<Astroport>>> DESKTOP SHORTCUT"
|
|||
|
||||
mkdir -p ~/.zen/tmp
|
||||
|
||||
echo "#############################################"
|
||||
|
||||
## SYMLINK youtube-dl TO yt-dlp
|
||||
sudo ln -s /usr/local/bin/yt-dlp /usr/local/bin/youtube-dl
|
||||
which youtube-dl
|
||||
echo "#############################################"
|
||||
## INSTALL yt-dlp & SYMLINK youtube-dl
|
||||
~/.zen/Astroport.ONE/youtube-dl.sh
|
||||
|
||||
|
||||
echo "#############################################"
|
||||
echo "#############################################"
|
||||
## Desktop install
|
||||
echo "Astroport.ONE INSTALL"
|
||||
end=`date +%s`
|
||||
echo Execution time was `expr $end - $start` seconds.
|
||||
echo "#############################################"
|
||||
echo "# START VISA ENGINE : ~/.zen/Astroport.ONE/start.sh"
|
||||
echo "#############################################"
|
||||
echo
|
||||
echo "Démarrer en mode Aventure. Tapez ENTRER."
|
||||
read ADVENTURE
|
||||
[[ $ADVENTURE ]] && ~/.zen/Astroport.ONE/start.sh \
|
||||
|| ~/.zen/Astroport.ONE/adventure/adventure.sh
|
||||
echo "#############################################"
|
||||
echo "%%%%%%%%%%%%%%%%%%%%"
|
||||
echo "VOUS AVEZ DEJA UN COMPTE SUR GCHANGE ?"
|
||||
echo " Saisissez vos identifiants"
|
||||
echo "%%%%%%%%%%%%%%%%%%%%"
|
||||
echo
|
||||
echo "Sinon Tapez 2 fois sur ENTRER."
|
||||
read SALT
|
||||
[[ $SALT ]] && echo "Entrez votre mot de passe : "
|
||||
read PEPPER
|
||||
[[ $SALT && ! $PEPPER ]] && SALT=""
|
||||
|
||||
~/.zen/Astroport.ONE/tools/VISA.new.sh "$SALT" "$PEPPER"
|
||||
|
||||
echo "#############################################"
|
||||
|
||||
if [[ $XDG_SESSION_TYPE == 'x11' ]]; then
|
||||
##########################################################
|
||||
echo "EXPERIMENTAL ### INIT KODI PAR IPFS ## "
|
||||
read KODI
|
||||
if [[ $KODI ]]; then
|
||||
mkdir -p ~/.zen/tmp/kodi
|
||||
echo "PATIENTEZ..."
|
||||
ipfs get -o ~/.zen/tmp/kodi/ /ipfs/Qmc763hnsuTqSTDBNagmzca4fSzmcTp9kHoeosaPKC8QvK
|
||||
echo '## KODI INSTALL FRANCETV + VSTREAM + FILMSFORACTION'
|
||||
|
||||
cp -Rf ~/.zen/tmp/kodi/* ~/.kodi/ \
|
||||
&& cp -Rf ~/.zen/Astroport.ONE/templates/.uqld /tmp && cd /tmp/.uqld \
|
||||
&& g++ -o uqload_downloader uqload_downloader.cpp Downloader.cpp -lcurl \
|
||||
&& [[ -f uqload_downloader ]] && sudo mv uqload_downloader /usr/local/bin/ \
|
||||
&& sudo ln -s ~/.zen/Astroport.ONE/tools/download_from_kodi_log.sh /usr/local/bin/download_from_kodi_log
|
||||
|
||||
cd $MY_PATH
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
|
|
186
start.sh
186
start.sh
|
@ -14,185 +14,15 @@ 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"
|
||||
###################################################
|
||||
killall 12345.sh; killall "_12345.sh"; killall nc
|
||||
[[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid)
|
||||
# killall "12345.sh"; killall "_12345.sh"; killall "nc"; killall "command.sh"
|
||||
mkdir -p ~/.zen/tmp
|
||||
|
||||
~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log &
|
||||
|
||||
sleep 1
|
||||
echo "HTTP API : http://$myIP:1234"
|
||||
cat ~/.zen/tmp/12345.log
|
||||
echo "API DEBUG : tail -f ~/.zen/tmp/12345.log"
|
||||
###################################################
|
||||
|
||||
echo '
|
||||
_ ____ _____ ____ ___ ____ ___ ____ _____ ___ _ _ _____
|
||||
/ \ / ___|_ _| _ \ / _ \| _ \ / _ \| _ \_ _| / _ \| \ | | ____|
|
||||
/ _ \ \___ \ | | | |_) | | | | |_) | | | | |_) || | | | | | \| | _|
|
||||
/ ___ \ ___) || | | _ <| |_| | __/| |_| | _ < | | | |_| | |\ | |___
|
||||
/_/ \_\____/ |_| |_| \_\\___/|_| \___/|_| \_\|_| \___/|_| \_|_____|
|
||||
|
||||
Ambassade numérique pair à pair sur IPFS.
|
||||
|
||||
@@@@@@@@@@@@@@@@@@
|
||||
ASTROPORT
|
||||
VISA : MadeInZion
|
||||
@@@@@@@@@@@@@@@@@@'
|
||||
echo
|
||||
|
||||
## VERIFY SOFTWARE DEPENDENCIES
|
||||
[[ ! $(which ipfs) ]] && echo "EXIT. Vous devez avoir installé ipfs CLI sur votre ordinateur" && echo "https://dist.ipfs.io/#go-ipfs" && exit 1
|
||||
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||
[[ ! $YOU ]] && echo "Lancez 'ipfs daemon' SVP sudo systemctl start ipfs" && exit 1
|
||||
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
|
||||
|
||||
echo 'PRESS ENTER... '; read
|
||||
|
||||
## CREATE AND OR CONNECT USER
|
||||
PS3='Astronaute connectez votre PLAYER ___ '
|
||||
players=("NOUVEAU VISA" "IMPORT PLAYER" $(ls ~/.zen/game/players 2>/dev/null))
|
||||
## MULTIPLAYER
|
||||
|
||||
select fav in "${players[@]}"; do
|
||||
case $fav in
|
||||
"NOUVEAU VISA")
|
||||
${MY_PATH}/tools/VISA.new.sh
|
||||
fav=$(cat ~/.zen/tmp/PSEUDO 2>/dev/null) && rm ~/.zen/tmp/PSEUDO
|
||||
echo "Astronaute $fav bienvenue dans le jeu de terraformation forêt jardin MadeInZion"
|
||||
exit
|
||||
;;
|
||||
"IMPORT PLAYER")
|
||||
echo "'Identifiant'"
|
||||
read SALT
|
||||
echo "'Mot de passe'"
|
||||
read PEPPER
|
||||
echo "'Adresse Email'"
|
||||
read EMAIL
|
||||
${MY_PATH}/tools/VISA.new.sh "$SALT" "$PEPPER" "$EMAIL"
|
||||
fav=$(cat ~/.zen/tmp/PSEUDO 2>/dev/null) && rm ~/.zen/tmp/PSEUDO
|
||||
echo "Astronaute $fav heureux de vous acceuillir"
|
||||
exit
|
||||
;;
|
||||
"")
|
||||
echo "Choix obligatoire. exit"
|
||||
exit
|
||||
;;
|
||||
*) echo "Salut $fav"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
PLAYER=$fav
|
||||
|
||||
|
||||
pass=$(cat ~/.zen/game/players/$PLAYER/.pass 2>/dev/null)
|
||||
########################################## DEVEL
|
||||
echo "Saisissez votre PASS -- UPGRADE CRYPTO FREELY -- $pass" && read PASS
|
||||
|
||||
## DECODE CURRENT PLAYER CRYPTO
|
||||
# echo "********* DECODAGE SecuredSocketLayer *********"
|
||||
# rm -f ~/.zen/tmp/${PLAYER}.dunikey 2>/dev/null
|
||||
# openssl enc -aes-256-cbc -d -in "$HOME/.zen/game/players/${PLAYER}/enc.secret.dunikey" -out "$HOME/.zen/tmp/${PLAYER}.dunikey" -k $pass 2>&1>/dev/null
|
||||
[[ $PASS != $pass ]] && echo "ERROR. MAUVAIS PASS. EXIT" && exit 1
|
||||
|
||||
rm -f ~/.zen/game/players/.current
|
||||
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
|
||||
|
||||
echo "________LOGIN OK____________";
|
||||
echo
|
||||
echo "DECHIFFRAGE CLEFS ASTRONAUTE"
|
||||
echo "Votre Pass Astroport.ONE : $(cat ~/.zen/game/players/$PLAYER/.pass 2>/dev/null)"
|
||||
G1PUB=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
[ ! ${G1PUB} ] && echo "ERROR. MAUVAIS PASS. EXIT" && exit 1
|
||||
|
||||
echo "Clef Publque Astronaute : $G1PUB"
|
||||
echo "ENTREE ACCORDEE"
|
||||
echo
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
|
||||
|
||||
echo "$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null) TW/Moa"
|
||||
echo "http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||
echo "Activation Réseau P2P Astroport !"
|
||||
|
||||
echo
|
||||
PS3="$PLAYER choisissez : __ "
|
||||
choices=("AJOUTER VLOG" "CREER UN VOEU" "IMPRIMER QRVOEU" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
|
||||
select fav in "${choices[@]}"; do
|
||||
case $fav in
|
||||
"IMPRIMER VISA")
|
||||
echo "IMPRESSION"
|
||||
${MY_PATH}/tools/VISA.print.sh
|
||||
;;
|
||||
|
||||
"EXPORTER VISA")
|
||||
echo "EXPORT IDENTITE ASTRONAUTE"
|
||||
du -h ~/.zen/game/players/$PLAYER/
|
||||
echo "MANUAL BACKUP ZIP ~/.zen/game/players/$PLAYER/"
|
||||
## EXPORT TW + VOEUX IPNS KEYS
|
||||
|
||||
|
||||
break
|
||||
;;
|
||||
|
||||
"SUPPRIMER VISA")
|
||||
echo "ATTENTION SUPPRESSION DEFINITIVE !!"
|
||||
echo "Enter to continue. Ctrl+C to stop"
|
||||
read
|
||||
ipfs key rm $PLAYER; ipfs key rm $G1PUB;
|
||||
for voeu in $(ls ~/.zen/game/players/$PLAYER/voeux/); do
|
||||
ipfs key rm $voeu
|
||||
[[ $voeu != "" ]] && rm -Rf ~/.zen/game/world/$voeu
|
||||
done
|
||||
echo "REMOVE 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
|
||||
echo "rm -Rf ~/.zen/game/players/$PLAYER"
|
||||
rm -Rf ~/.zen/game/players/$PLAYER
|
||||
|
||||
break
|
||||
;;
|
||||
|
||||
"AJOUTER VLOG")
|
||||
echo "Lancement Webcam..."
|
||||
${MY_PATH}/tools/vlc_webcam.sh "$PLAYER"
|
||||
;;
|
||||
|
||||
"CREER UN VOEU")
|
||||
echo "QRCode à coller sur les lieux ou objets portant une Gvaleur"
|
||||
cp ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/$PLAYER.html
|
||||
${MY_PATH}/ASTROBOT/G1Voeu.sh "" "$PLAYER" "~/.zen/tmp/$PLAYER.html"
|
||||
DIFF=$(diff ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/$PLAYER.html)
|
||||
if [[ $DIFF ]]; then
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain \
|
||||
~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.moats)
|
||||
|
||||
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||
ipfs name publish --allow-offline -t 72h --key=$PLAYER /ipfs/$TW
|
||||
|
||||
echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
|
||||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
||||
fi
|
||||
echo "================================================"
|
||||
echo "$PLAYER : http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||
echo "================================================"
|
||||
;;
|
||||
|
||||
"IMPRIMER QRVOEU")
|
||||
${MY_PATH}/tools/VOEUX.print.sh $PLAYER
|
||||
;;
|
||||
|
||||
"QUITTER")
|
||||
echo "CIAO" && exit 0
|
||||
;;
|
||||
|
||||
"")
|
||||
echo "Mauvais choix."
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
|
||||
exit 0
|
||||
echo $! > ~/.zen/.pid && wait
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/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
|
||||
ME="${0##*/}"
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
echo "ASTROPORT.ONE $USER@$HOSTNAME
|
||||
@@@@@@@@@@@@@@@@@@
|
||||
STOP AT $MOATS
|
||||
@@@@@@@@@@@@@@@@@@"
|
||||
echo
|
||||
|
||||
echo "STOPPING PROCESS & CRON"
|
||||
###################################################
|
||||
killall 12345.sh; killall "_12345.sh"; killall nc
|
||||
###################################################
|
||||
${MY_PATH}/tools/cron_VRFY.sh OFF
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,122 @@
|
|||
#include "Downloader.h"
|
||||
|
||||
#if !defined(WIN32) && !defined(_WIN32) && !defined(__WIN32__) && !defined(__NT__)
|
||||
error_t fopen_s(FILE** f, const char* name, const char* mode)
|
||||
{ // https://stackoverflow.com/questions/1513209/is-there-a-way-to-use-fopen-s-with-gcc-or-at-least-create-a-define-about-it
|
||||
error_t ret = 0;
|
||||
assert(f);
|
||||
*f = fopen(name, mode);
|
||||
if (!*f)
|
||||
{
|
||||
ret = errno;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
Downloader::Downloader()
|
||||
{
|
||||
m_fp = nullptr;
|
||||
m_downloadCallback = nullptr;
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
m_curl = curl_easy_init();
|
||||
curl_easy_setopt(m_curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
curl_easy_setopt(m_curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
curl_easy_setopt(m_curl, CURLOPT_COOKIEFILE, "");
|
||||
curl_easy_setopt(m_curl, CURLOPT_COOKIEJAR, "");
|
||||
curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, this);
|
||||
}
|
||||
|
||||
Downloader::Downloader(std::string uqUrl, std::string outputFile) : Downloader()
|
||||
{
|
||||
setUqUrl(uqUrl);
|
||||
setOutputFile(outputFile);
|
||||
}
|
||||
|
||||
void Downloader::setUqUrl(std::string uqUrl)
|
||||
{
|
||||
m_uqUrl = uqUrl;
|
||||
}
|
||||
|
||||
void Downloader::setOutputFile(std::string outputFile)
|
||||
{
|
||||
m_outputFile = outputFile;
|
||||
}
|
||||
|
||||
void Downloader::setDownloadCallback(void* callback)
|
||||
{
|
||||
if (callback != nullptr)
|
||||
{
|
||||
curl_easy_setopt(m_curl, CURLOPT_NOPROGRESS, false);
|
||||
m_downloadCallback = callback;
|
||||
}
|
||||
}
|
||||
|
||||
Downloader::~Downloader()
|
||||
{
|
||||
if (m_curl)
|
||||
{
|
||||
curl_easy_cleanup(m_curl);
|
||||
curl_global_cleanup();
|
||||
}
|
||||
if (m_fp != nullptr)
|
||||
{
|
||||
fclose(m_fp);
|
||||
}
|
||||
}
|
||||
|
||||
size_t Downloader::writefunc(void* ptr, size_t size, size_t nmemb, std::string* s)
|
||||
{
|
||||
s->append(static_cast<char*>(ptr), size * nmemb);
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
void Downloader::download()
|
||||
{
|
||||
if (m_uqUrl == "" || m_outputFile == "")
|
||||
{
|
||||
throw string("Error: please specify URL and output file");
|
||||
}
|
||||
if (!m_curl)
|
||||
{
|
||||
throw string("Error: curl init");
|
||||
}
|
||||
if (uqdCheckAccess(m_outputFile.c_str(), 0) == 0)
|
||||
{
|
||||
throw string("Error: " + m_outputFile + " already exists");
|
||||
}
|
||||
fopen_s(&m_fp, m_outputFile.c_str(), "wb");
|
||||
string strHTML;
|
||||
curl_easy_setopt(m_curl, CURLOPT_URL, m_uqUrl.c_str());
|
||||
curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, &Downloader::writefunc);
|
||||
curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, &strHTML);
|
||||
m_res = curl_easy_perform(m_curl);
|
||||
if (m_res != CURLE_OK)
|
||||
{
|
||||
throw string("Error: curl_easy_perform() failed: " + string(curl_easy_strerror(m_res)));
|
||||
}
|
||||
size_t posBegVid = strHTML.find("sources: [\"https://");
|
||||
size_t posEndVid = strHTML.find("/v.mp4\"]");
|
||||
if (posBegVid == std::string::npos || posEndVid == std::string::npos)
|
||||
{
|
||||
throw string("Video URL not found");
|
||||
}
|
||||
string videoURL = strHTML.substr(posBegVid + 11, posEndVid - posBegVid - 5);
|
||||
|
||||
if (m_downloadCallback != nullptr)
|
||||
{
|
||||
curl_easy_setopt(m_curl, CURLOPT_XFERINFOFUNCTION, m_downloadCallback);
|
||||
}
|
||||
|
||||
curl_easy_setopt(m_curl, CURLOPT_URL, videoURL.c_str());
|
||||
curl_easy_setopt(m_curl, CURLOPT_REFERER, m_uqUrl.c_str());
|
||||
curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, NULL);
|
||||
curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, m_fp);
|
||||
m_res = curl_easy_perform(m_curl);
|
||||
if (m_res != CURLE_OK)
|
||||
{
|
||||
throw string("Error: curl_easy_perform() failed: " + string(curl_easy_strerror(m_res)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
#include <io.h>
|
||||
#define uqdCheckAccess(pathname, mode) _access(pathname, mode)
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <cassert>
|
||||
#define uqdCheckAccess(pathname, mode) access(pathname, mode)
|
||||
error_t fopen_s(FILE** f, const char* name, const char* mode);
|
||||
#endif
|
||||
#include <curl/curl.h>
|
||||
|
||||
class Downloader
|
||||
{
|
||||
public:
|
||||
Downloader();
|
||||
Downloader(std::string uqUrl, std::string outputFile);
|
||||
~Downloader();
|
||||
void setUqUrl(std::string uqUrl);
|
||||
void setOutputFile(std::string outputFile);
|
||||
void setDownloadCallback(void* callback);
|
||||
void download();
|
||||
|
||||
private:
|
||||
static size_t writefunc(void *curl, size_t size, std::size_t nmemb, std::string *s);
|
||||
std::string m_uqUrl, m_outputFile;
|
||||
CURL* m_curl;
|
||||
CURLcode m_res;
|
||||
FILE* m_fp;
|
||||
void* m_downloadCallback;
|
||||
};
|
|
@ -0,0 +1,43 @@
|
|||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include "Downloader.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int downloadCallback(void* p, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 3)
|
||||
{
|
||||
cerr << "Usage: " << argv[0] << "https://uqload.com/embed-xxxxxxx.html movie.mp4" << endl;
|
||||
return -1;
|
||||
}
|
||||
string pageInit = string(argv[1]), outputFile=string(argv[2]);
|
||||
Downloader *uqDownloader=new Downloader(pageInit, outputFile);
|
||||
uqDownloader->setDownloadCallback((void*)downloadCallback);
|
||||
try
|
||||
{
|
||||
uqDownloader->download();
|
||||
}
|
||||
catch (const string& e)
|
||||
{
|
||||
cerr << e << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int downloadCallback(void* p, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
|
||||
{
|
||||
if (dltotal != 0.0)
|
||||
{
|
||||
cout << setprecision(3) << ((double)dlnow / (double)dltotal) * 100 << " %\r" << flush;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
https://uqload.com/embed-h63yfu9dkw1r.html
|
||||
test.mp4
|
||||
*/
|
|
@ -1 +1 @@
|
|||
[{"title":"$:/ipfs/saver/api/http/local/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"http://ipfs.localhost:5001"}]
|
||||
[{"title":"$:/ipfs/saver/api/http/local/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"_NID_"}]
|
||||
|
|
|
@ -1 +1 @@
|
|||
[{"title":"$:/ipfs/saver/gateway/local/myip","tags":"$:/ipfs/core $:/ipfs/saver/gateway","text":"http://ipfs.localhost:8080"}]
|
||||
[{"title":"$:/ipfs/saver/gateway/local/myip","tags":"$:/ipfs/core $:/ipfs/saver/gateway","text":"_NID_"}]
|
||||
|
|
|
@ -39,15 +39,15 @@ Content-Type: text/html; charset=UTF-8
|
|||
|
||||
</style>
|
||||
|
||||
<title>[Astroport](_HOSTNAME_) - IPFS BIOS - Interplanetray File System + Basic Input Output System + Scuttlebut Confidence Layer Ŋ1 </title>
|
||||
<title>[Astroport] - IPFS BIOS - G1 / Ŋ1 - Confidence Networks (_HOSTNAME_)</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center>
|
||||
<h2>IPFS BIOS<br> - TW Astroport Ŋ1 -</h2>
|
||||
<h2>IPFS BIOS<br> - Astroport Ŋ1 Explorer -</h2>
|
||||
<div id="yellow">
|
||||
<h3><a href="http://127.0.0.1:12345"> >>> IPFS (◕‿‿◕) FORMAT <<< </a></h3>
|
||||
<h3><a href="http://127.0.0.1:12345"> >>> BunkerBOX (◕‿‿◕) Ready <<< </a></h3>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
@ -56,10 +56,11 @@ Content-Type: text/html; charset=UTF-8
|
|||
<form action = "http://127.0.0.1:1234" method = "GET">
|
||||
<br>
|
||||
<h2>
|
||||
Déjà inscrit<br>
|
||||
INSCRIPTION<br><br>
|
||||
Phrase Une : <input name=salt value=''></br>
|
||||
Phrase Deux : <input name=pepper value=''></br>
|
||||
( TW officiel <input type="checkbox" id="official" name="official"> - Visiteur <input type="checkbox" id="g1pub" name="g1pub" checked> )</br>
|
||||
TW <input type="hidden" id="g1pub" name="g1pub" value="on"></br>
|
||||
Email : <input name=email value=''></br>
|
||||
</br>
|
||||
<input type='submit' value='[(♥‿‿♥)]'>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>[Astroport] Ouvrez votre TW :: Station _HOSTNAME_ (_IPFSNODEID_) </title>
|
||||
<title>[Astroport] TW :: 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/layout.css" type="text/css" />
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
[{"text":"_PLAYERSFEED_","tags":"","title":"$:/plugins/astroport/lightbeams/state/subscriptions"}]
|
File diff suppressed because one or more lines are too long
|
@ -8,6 +8,7 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
|
|||
[[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost"
|
||||
|
||||
IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||
export PLAYERFEEDS=""
|
||||
|
||||
ME="${0##*/}"
|
||||
######################################################################### CONNECT PLAYER WITH GCHANGE
|
||||
|
@ -53,29 +54,32 @@ if [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/cesium.json ]]; then
|
|||
# SITE=$(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '.socials' 2>/dev/null)
|
||||
|
||||
########################################################################
|
||||
echo "${PLAYER} GCHANGE+ PROFILE https://gchange.fr"
|
||||
echo "GCHANGE+ PROFILE https://gchange.fr"
|
||||
# echo "set -n "${NAME}" -d "${DESCR}" -v "${VILLE}" -a "${ADRESSE}""
|
||||
########################################################################
|
||||
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" set -n "${NAME}" -d "${DESCR}" -v "${VILLE}" -a "${ADRESSE}" -s "https://ipfs.copylaradio.com/ipns/$ASTRONAUTENS" #GCHANGE+
|
||||
[[ ! $? == 0 ]] && echo "GCHANGE PROFILE CREATION FAILED"
|
||||
|
||||
## SET CESIUM WALLET
|
||||
########################################################################
|
||||
echo "${PLAYER} CESIUM+ PROFILE https://demo.cesium.app/#/app/wot/lg?q=$G1PUB"
|
||||
########################################################################
|
||||
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://g1.data.e-is.pro" set -n "${NAME}" -d "${DESCR}" -v "${VILLE}" -a "${ADRESSE}" --s "http://ipfs.localhost:8080/ipns/$ASTRONAUTENS" #CESIUM+
|
||||
[[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED"
|
||||
echo
|
||||
## TODO : GET THE MEMBER KEY TO SEND MESSAGE THROUGH CESIUM+
|
||||
|
||||
#~ ## SET CESIUM WALLET
|
||||
#~ ########################################################################
|
||||
#~ echo "CESIUM+ https://demo.cesium.app/#/app/wot/lg?q=$G1PUB"
|
||||
#~ ########################################################################
|
||||
#~ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://g1.data.e-is.pro" set -n "${NAME}" -d "${DESCR}" -v "${VILLE}" -a "${ADRESSE}" --s "http://ipfs.localhost:8080/ipns/$ASTRONAUTENS" #CESIUM+
|
||||
#~ [[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED"
|
||||
|
||||
fi
|
||||
|
||||
## GET PROFILE BACK
|
||||
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" get > ~/.zen/game/players/${PLAYER}/ipfs/gchange.json
|
||||
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://g1.data.e-is.pro" get > ~/.zen/game/players/${PLAYER}/ipfs/cesium.json
|
||||
#~ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://g1.data.e-is.pro" get > ~/.zen/game/players/${PLAYER}/ipfs/cesium.json
|
||||
|
||||
########################################################################
|
||||
|
||||
echo "### ${PLAYER} ##########################################################"
|
||||
echo "SCANNING - $G1PUB Gchange FRIENDS"
|
||||
echo "### ${PLAYER} #################"
|
||||
echo "SCANNING - $G1PUB STAR FRIENDS"
|
||||
echo "########################################################################"
|
||||
################## CHECKING WHO GAVE ME STARS
|
||||
################## BOOTSTRAP LIKES THEM BACK
|
||||
|
@ -89,7 +93,7 @@ echo "Checking received stars"
|
|||
-k ~/.zen/game/players/${PLAYER}/secret.dunikey \
|
||||
-n "https://data.gchange.fr" stars > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json
|
||||
|
||||
[[ ! $(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json | jq -r '.likes[].issuer') ]] && echo "Niveau Ŋ0 - Activez le niveau de confiance Ŋ1" && exit 0
|
||||
[[ ! $(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json | jq -r '.likes[].issuer') ]] && echo "Activez votre Toile de Confiance Ŋ1 sur GChange" && exit 0
|
||||
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json | jq -r '.likes[].issuer' | sort | uniq > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/liking_me
|
||||
# echo "cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json | jq -r" # DEBUG
|
||||
|
@ -98,10 +102,10 @@ for liking_me in $(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/liking_me | sort | uni
|
|||
do
|
||||
[[ "${liking_me}" == "" ]] && continue ## Protect from empty line !!
|
||||
echo "........................."
|
||||
ASTRONAUTENS=$(~/.zen/Astroport.ONE/tools/g1_to_ipfs.py ${liking_me})
|
||||
FRIENDNS=$(~/.zen/Astroport.ONE/tools/g1_to_ipfs.py ${liking_me})
|
||||
echo "==========================="
|
||||
echo "${liking_me} IS LIKING ME"
|
||||
echo "TW ? http://tube.copylaradio.com:8080/ipns/$ASTRONAUTENS "
|
||||
echo "TW ? https://ipfs.copylaradio.com/ipns/$FRIENDNS "
|
||||
|
||||
##### CHECKING IF WE LIKE EACH OTHER Ŋ1 LEVEL
|
||||
echo "Receiving Stars : cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json | jq -r"
|
||||
|
@ -144,17 +148,21 @@ do
|
|||
echo "Getting $FRIENDTITLE latest online TW..."
|
||||
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
echo "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
echo "http://$myIP:8080/ipns/$ASTRONAUTENS ($YOU)"
|
||||
[[ $YOU ]] && ipfs --timeout 17s cat /ipns/$ASTRONAUTENS > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html ]] && curl -m 17 -so ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
echo "$LIBRA/ipns/$FRIENDNS"
|
||||
echo "http://$myIP:8080/ipns/$FRIENDNS ($YOU)"
|
||||
|
||||
# DISPLAY TIMER
|
||||
${MY_PATH}/displaytimer.sh 17 &
|
||||
|
||||
[[ $YOU ]] && ipfs --timeout 17s cat /ipns/$FRIENDNS > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html ]] && curl -m 17 -so ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html "$LIBRA/ipns/$FRIENDNS"
|
||||
|
||||
## PLAYER TW EXISTING ?
|
||||
if [ ! -s ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html ]; then
|
||||
|
||||
## AUCUN VISA ASTRONAUTE ENVOYER UN MESSAGE PAR GCHANGE
|
||||
echo "AUCUN TW ACTIF. ENVOYONS LUI UN MESSAGE..."
|
||||
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" send -d "${liking_me}" -t "HEY BRO !" -m ">>> (◕‿‿◕) <<< https://ipfs.copylaradio.com/ipns/$ASTRONAUTENS >>> (◕‿‿◕) <<< ACTIVE TON TW ICI : https://astroport.copylaradio.com"
|
||||
echo "AUCUN TW ACTIF. PREVENONS LE"
|
||||
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" send -d "${liking_me}" -t "HEY BRO !" -m "G1 TW BunkerBOX >>> (⌐■_■) <<< https://ipfs.copylaradio.com/ipns/$ASTRONAUTENS >>> (ᵔ◡◡ᵔ) <<< "
|
||||
|
||||
else
|
||||
|
||||
|
@ -171,12 +179,25 @@ do
|
|||
--output ~/.zen/game/players/${PLAYER}/ipfs --render '.' "${FPLAYER}.rss.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days:created[-30]]'
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/${FPLAYER}.rss.json ]] && echo "NO ${FPLAYER} RSS - CONTINUE -" && continue
|
||||
|
||||
tiddlywiki --load ${FTW} \
|
||||
--output ~/.zen/game/players/${PLAYER}/ipfs --render '.' "${FPLAYER}.lightbeam-key.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-key'
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/${FPLAYER}.lightbeam-key.json ]] && echo "NO ${FPLAYER} lightbeam-key - CONTINUE -" && continue
|
||||
ASTRONAUTEFEED=$(cat ~/.zen/game/players/${PLAYER}/ipfs/${FPLAYER}.lightbeam-key.json | jq -r .[].text)
|
||||
|
||||
## ADD THIS FPLAYER RSS FEED INTO PLAYER TW
|
||||
## PUSH DATA TO 12345 SWARM KEY
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}
|
||||
cp -f ~/.zen/game/players/${PLAYER}/ipfs/${FPLAYER}.rss.json ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/${FPLAYER}.rss.json
|
||||
|
||||
## TODO INSERT INTO $:/plugins/astroport/lightbeams/state/subscriptions
|
||||
export FRIENDSFEEDS="$ASTRONAUTEFEED\n$FRIENDSFEEDS"
|
||||
echo "$FRIENDSFEEDS" > ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/FRIENDSFEEDS
|
||||
|
||||
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )" $FRIENDSFEEDS
|
||||
|
||||
export IFRIENDHEAD="<a target='you' href='/ipns/"$FRIENDNS"'>$$FRIENDTITLE</a>$IFRIENDHEAD"
|
||||
echo "$IFRIENDHEAD" > ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/IFRIENDHEAD
|
||||
|
||||
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )" $IFRIENDHEAD
|
||||
|
||||
|
||||
echo "APP=RSS : PLAYER FPLAYER RSS PUBLICATION READY"
|
||||
|
@ -201,7 +222,7 @@ do
|
|||
|
||||
else
|
||||
|
||||
echo "ARE WE BRO?"
|
||||
echo "BRO?"
|
||||
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" send -d "${G1PUB}" -t "Bro ?" -m "https://www.gchange.fr/#/app/user/${liking_me}/"
|
||||
|
||||
fi
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 2020.03.24
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
|
||||
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
|
||||
start=`date +%s`
|
||||
|
||||
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || 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" && exit 1
|
||||
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
|
||||
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) || ( echo "noipfsid" && exit 1 )
|
||||
########################################################################
|
||||
########################################################################
|
||||
# This script used to initialize 'FRIENDS' data and star.level with beetween crew and new Astronaut
|
||||
# Astronaut is sendind level3 to Captain / # Captain send level1 to Astronaut
|
||||
# astrXbian keychains are written to disk... So IPFS obey to this organisation.
|
||||
########################################################################
|
||||
########################################################################
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
# Check who is currently current connected 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 )
|
||||
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
|
||||
|
||||
# Astroport Station "Captain" connected?
|
||||
source ~/.zen/ipfs.sync; echo "CAPTAIN is $CAPTAIN $(${MY_PATH}/face.sh cool)"
|
||||
|
||||
|
||||
# New Astronaut is entering Astroport
|
||||
# UPDATING players friend relations
|
||||
# Inform Captain.
|
||||
for player in $(ls ~/.zen/game/players/); do
|
||||
# $player g1pub
|
||||
g1pub=$(cat ~/.zen/game/players/$player/.g1pub) || continue
|
||||
ipfsnodeid=$(cat ~/.zen/game/players/$player/.ipfsnodeid) || continue
|
||||
|
||||
[[ $PLAYER == $player ]] && continue
|
||||
## Adding ME as Astronauts Friend. Sharing Stars.
|
||||
# Inform Network / Application levels. Friend of Friends appears here.
|
||||
|
||||
echo "Adding $player to my astrXbian ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub"
|
||||
read
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub # Opening FRIEND RELATION
|
||||
echo "$player" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/player # This Astronaut become my level 1 friend
|
||||
echo "1" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/stars.level # This Astronaut become my level 1 friend
|
||||
echo "$ipfsnodeid" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/ipfsnodeid # This Astronaut become my level 1 friend
|
||||
|
||||
if [[ $player == "$CAPTAIN" ]]; then
|
||||
echo "Cet Astronaute est le CAPITAINE. Confiance 3 !!!"
|
||||
echo "3" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/stars.level # Ugrade to Level 3 Friend
|
||||
# Need to receive confidence back before acting as Astronaut. 3 days to compare dreams & reality.
|
||||
fi
|
||||
|
||||
echo "Adding myself to $player ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB"
|
||||
read
|
||||
mkdir -p ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB # AUTO SYMETRIC RELATION TODO : Not overpassing anymore ?
|
||||
echo "$PLAYER" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/player # This Astronaut become my level 1 friend
|
||||
echo "1" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/stars.level
|
||||
echo "$IPFSNODEID" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/ipfsnodeid # TODO : Not overpassing anymore ?
|
||||
echo "Compromis de Confiance 1 ajouté à $player"
|
||||
|
||||
|
||||
done
|
||||
|
|
@ -29,12 +29,16 @@ 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"
|
||||
|
||||
[[ $isLAN ]] && myIPFSGW="http://ipfs.localhost:8080" && myASTROPORT="http://astroport.localhost:1234" ## LAN STATION
|
||||
[[ ! $isLAN || $USER == "zen" ]] && myIPFSGW="https://ipfs.copylaradio.com" && myASTROPORT="https://astroport.copylaradio.com" ## WAN STATION
|
||||
|
||||
################################################################################
|
||||
|
||||
## CHECK if PLAYER resolve any ASTRONAUTENS
|
||||
[[ ${PLAYER} ]] && ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
|
||||
[[ ${ASTRONAUTENS} ]] && echo "IPNS $PLAYER EXISTANT http://$myIP:8080/${ASTRONAUTENS} !! DO NOTHING - EXIT -" && exit 0
|
||||
[[ ${ASTRONAUTENS} ]] && echo "WARNING IPNS $PLAYER EXISTANT ${myIPFSGW}/ipns/${ASTRONAUTENS} - EXIT -" && exit 0
|
||||
|
||||
## Chargement TW !!!
|
||||
if [[ $SALT != "" && PEPPER != "" ]]; then
|
||||
|
@ -48,6 +52,7 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
|||
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/TW
|
||||
|
||||
echo "SCANNING /ipns/${ASTRONAUTENS}"
|
||||
## GETTING LAST TW via IPFS or HTTP GW
|
||||
[[ $YOU ]] \
|
||||
&& ipfs --timeout 20s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/${MOATS}/TW/index.html
|
||||
|
@ -69,17 +74,20 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
|||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
|
||||
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].astroport)
|
||||
|
||||
IPNSTAIL=$(echo $ASTROPORT | rev | cut -f 1 -d '/' | rev)
|
||||
echo "TW ASTROPORT GATEWAY : ${ASTROPORT}"
|
||||
if [[ $ASTROPORT ]]; then
|
||||
IPNSTAIL=$(echo $ASTROPORT | rev | cut -f 1 -d '/' | rev)
|
||||
echo "TW ASTROPORT GATEWAY : ${ASTROPORT}"
|
||||
|
||||
[[ $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"
|
||||
[[ $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"
|
||||
|
||||
fi
|
||||
|
||||
# DO NOT CONTINUE
|
||||
echo "VISA ALREADY EXISTING"
|
||||
echo "TW ADDRESS IN USE"
|
||||
|
||||
rm -Rf ~/.zen/tmp/${MOATS}
|
||||
|
||||
|
@ -89,7 +97,8 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
|||
|
||||
fi
|
||||
################################################################################
|
||||
TWMODEL="/ipfs/bafybeihk2xserdii7wcnvojbyuyxx6qzlcgtzvraeucpyrhcfwy2ssvbhu"
|
||||
TWMODEL="/ipfs/bafybeica3zeovko4pfatsbnlniaoq2lfe7i2oin6wohx6gwgixf655szwy"
|
||||
# ipfs cat $TWMODEL > templates/twdefault.html
|
||||
##################################################### # NEW PLAYER ###############
|
||||
################################################################################
|
||||
echo "=============================================
|
||||
|
@ -113,15 +122,16 @@ PSEUDO=${PLAYER%%[0-9]*}
|
|||
[[ ! $PSEUDO ]] && echo "Choisissez un pseudo : " && read PSEUDO
|
||||
PSEUDO=${PSEUDO,,}
|
||||
PSEUDO=${PSEUDO%%[0-9]*}
|
||||
[[ $(ls ~/.zen/game/players/$PSEUDO* 2>/dev/null) ]] && echo "CE PSEUDO EST DEJA UN PLAYER. EXIT" && exit 1
|
||||
[[ $(ls ~/.zen/game/players/$PSEUDO 2>/dev/null) ]] && echo "CE PSEUDO EST DEJA UN PLAYER. EXIT" && exit 1
|
||||
|
||||
# PSEUDO=${PSEUDO,,} #lowercase
|
||||
[[ ! $PLAYER ]] && PLAYER=${PSEUDO}${RANDOM:0:2}$(${MY_PATH}/diceware.sh 1 | xargs)${RANDOM:0:2} \
|
||||
&& echo "$PLAYER ! VOTRE EMAIL SVP ?" && read OPLAYER && [[ $OPLAYER ]] && PLAYER=$OPLAYER
|
||||
&& echo "ADRESSE EMAIL ?" && read OPLAYER && [[ $OPLAYER ]] && PLAYER=$OPLAYER
|
||||
|
||||
[[ -d ~/.zen/game/players/$PLAYER ]] && echo "FATAL ERROR $PLAYER NAME COLLISION. TRY AGAIN." && exit 1
|
||||
|
||||
[[ ! $PSEUDO ]] && PSEUDO=$PLAYER
|
||||
echo; echo "Génération de vos identités Astronaute (PLAYER):"; sleep 1; echo "$PLAYER"; sleep 2
|
||||
[[ ! $PSEUDO ]] && PSEUDO="Anonymous"
|
||||
echo; echo "Génération de votre crypto identité PLAYER :"; sleep 1; echo "$PLAYER"; sleep 2
|
||||
|
||||
# 6 DIGIT PASS CODE TO PROTECT QRSEC
|
||||
PASS=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-7)
|
||||
|
@ -134,8 +144,8 @@ PASS=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-7)
|
|||
# echo "Votre clef moa_$PLAYER <=> $MOANS ($MOAKEYFILE)"; sleep 2
|
||||
############################################################
|
||||
echo
|
||||
echo "Compte Gchange et portefeuille G1.
|
||||
Utilisez ces identifiants pour rejoindre le réseau JUNE
|
||||
echo "Votre compte Gchange et portefeuille G1.
|
||||
Utilisez ces identifiants pour rejoindre la Monnaie Libre
|
||||
|
||||
$SALT
|
||||
$PEPPER
|
||||
|
@ -145,18 +155,31 @@ Rendez-vous sur https://gchange.fr"; sleep 3
|
|||
echo; echo "Création de votre clef multi-accès..."; sleep 2
|
||||
echo;
|
||||
|
||||
${MY_PATH}/keygen -t duniter -o /tmp/secret.dunikey "$SALT" "$PEPPER"
|
||||
${MY_PATH}/keygen -t duniter -o ~/.zen/tmp/${MOATS}/secret.dunikey "$SALT" "$PEPPER"
|
||||
|
||||
G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
G1PUB=$(cat ~/.zen/tmp/${MOATS}/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
|
||||
[[ ! $G1PUB ]] && echo "Désolé. clef Cesium absente." && exit 1
|
||||
|
||||
|
||||
## CREATE Player personnal files storage and IPFS publish directory
|
||||
mkdir -p ~/.zen/game/players/$PLAYER # Prepare PLAYER datastructure
|
||||
mkdir -p ~/.zen/tmp/
|
||||
|
||||
mv /tmp/secret.dunikey ~/.zen/game/players/$PLAYER/
|
||||
# PLAYER=geg-la_debrouille@super.chez-moi.com
|
||||
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
|
||||
echo "NEXT STYLE GW : https://ipfs.$CLYUSER$YOMAIN.$HOSTNAME"
|
||||
#~ [[ ! $isLAN ]] && NID="https://ipfs.$CLYUSER$YOMAIN.$HOSTNAME" && WID="$NID/api"
|
||||
NID="${myIPFSGW}" && WID="$NID/api"
|
||||
[[ $isLAN ]] && NID="http://ipfs.localhost:8080" && WID="http://ipfs.localhost:5001"
|
||||
|
||||
### 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/
|
||||
|
||||
# Create Player "IPNS Key" (key import)
|
||||
${MY_PATH}/keygen -t ipfs -o ~/.zen/game/players/$PLAYER/secret.player "$SALT" "$PEPPER"
|
||||
|
@ -169,17 +192,17 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|||
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)
|
||||
|
||||
## SEC PASS PROTECTED QRCODE
|
||||
secFromDunikey=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep "sec" | cut -d ' ' -f2)
|
||||
echo "$secFromDunikey" > /tmp/${PSEUDO}.sec
|
||||
openssl enc -aes-256-cbc -salt -in /tmp/${PSEUDO}.sec -out "/tmp/enc.${PSEUDO}.sec" -k $PASS 2>/dev/null
|
||||
PASsec=$(cat /tmp/enc.${PSEUDO}.sec | base58) && rm -f /tmp/${PSEUDO}.sec
|
||||
echo "$secFromDunikey" > ~/.zen/tmp/${MOATS}/${PSEUDO}.sec
|
||||
openssl enc -aes-256-cbc -salt -in ~/.zen/tmp/${MOATS}/${PSEUDO}.sec -out "$HOME/.zen/tmp/${MOATS}/enc.${PSEUDO}.sec" -k $PASS 2>/dev/null
|
||||
PASsec=$(cat ~/.zen/tmp/${MOATS}/enc.${PSEUDO}.sec | base58) && rm -f ~/.zen/tmp/${MOATS}/${PSEUDO}.sec
|
||||
qrencode -s 12 -o $HOME/.zen/game/players/$PLAYER/QRsec.png $PASsec
|
||||
|
||||
echo "Votre Clef publique G1 est : $G1PUB"; sleep 1
|
||||
|
||||
### INITALISATION WIKI dans leurs répertoires de publication IPFS
|
||||
############ TODO améliorer templates, sed, ajouter index.html, etc...
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
echo
|
||||
echo "***** Activation du Canal TW Astronaute $PLAYER *****"
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/moa/
|
||||
|
@ -188,14 +211,18 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|||
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
# INSERT ASTROPORT ADRESS
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
|
||||
ASTROPORT=$(cat ~/.zen/tmp/Astroport.json | jq -r .[].astroport)
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
|
||||
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].astroport)
|
||||
sed -i "s~$ASTROPORT~/ipns/${IPFSNODEID}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
# TW CHAIN INIT WITH TWMODEL
|
||||
sed -i "s~_MOATS_~${MOATS}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~_CHAIN_~${TWMODEL}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
sed -i "s~_SALT_~${SALT}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~_PEPPER_~${PEPPER}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~_PASS_~${PASS}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
sed -i "s~_URL_~${URL}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
# INSERT PLAYER DATA
|
||||
|
@ -213,49 +240,59 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|||
sed -i "s~_MEDIAKEY_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~k2k4r8kxfnknsdf7tpyc46ks2jb3s9uvd3lqtcv9xlq9rsoem7jajd75~${ASTRONAUTENS}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
sed -i "s~ipfs.infura.io~ipfs.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html # USELESS ?!
|
||||
sed -i "s~tube.copylaradio.com~ipfs.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~ipfs.copylaradio.com~ipfs.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
#
|
||||
sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html # 8080 & 5001 BEING THE RECORDING GATEWAY (WAN or ipfs.localhost)
|
||||
|
||||
#
|
||||
echo "# CRYPTO ENCODING secret.dunikey -> TW _SECRET_ "
|
||||
echo $myIP > ~/.zen/tmp/myIP
|
||||
$MY_PATH/natools.py encrypt -p $G1PUB -i $HOME/.zen/game/players/$PLAYER/secret.dunikey -o $HOME/.zen/tmp/secret.dunikey.$G1PUB.enc
|
||||
ENCODING=$(cat ~/.zen/tmp/secret.dunikey.$G1PUB.enc | base16)
|
||||
###########
|
||||
echo "# CRYPTO ENCODING _SECRET_ "
|
||||
$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 TEST"
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp --render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
cat ~/.zen/tmp/MadeInZion.json | jq -r .[].secret | base16 -d > ~/.zen/tmp/myIP.$G1PUB.enc.2
|
||||
$MY_PATH/natools.py decrypt -f pubsec -k $HOME/.zen/game/players/$PLAYER/secret.dunikey -i $HOME/.zen/tmp/myIP.$G1PUB.enc.2 -o $HOME/.zen/tmp/myIP.2
|
||||
#
|
||||
###########
|
||||
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}/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/myIP.2 ]] && echo "NATOOLS ENCODED secret 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}/crypto.2
|
||||
###########
|
||||
|
||||
rm -f ~/.zen/tmp/myIP.2
|
||||
# Create"$PLAYER_feed" Key
|
||||
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
|
||||
|
||||
## ADD SYSTEM TW
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html \
|
||||
--import ~/.zen/Astroport.ONE/templates/data/local.api.json "application/json" \
|
||||
--import ~/.zen/Astroport.ONE/templates/data/local.gw.json "application/json" \
|
||||
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
[[ -f ~/.zen/tmp/newindex.html ]] && cp ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-name.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-key.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/local.api.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/local.gw.json "application/json" \
|
||||
--output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
[[ -s ~/.zen/tmp/${MOATS}/newindex.html ]] && cp -f ~/.zen/tmp/${MOATS}/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
## ID CARD
|
||||
convert ~/.zen/game/players/$PLAYER/QR.png -resize 300 /tmp/QR.png
|
||||
convert ${MY_PATH}/../images/astroport.jpg -resize 300 /tmp/ASTROPORT.png
|
||||
## 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
|
||||
|
||||
composite -compose Over -gravity SouthWest -geometry +280+20 /tmp/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png /tmp/astroport.png
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/QR.png /tmp/astroport.png /tmp/one.png
|
||||
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png /tmp/one.png /tmp/image.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 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\"" /tmp/one.png /tmp/image.png
|
||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,40 \"$PLAYER\"" /tmp/image.png /tmp/pseudo.png
|
||||
convert -gravity northeast -pointsize 25 -fill black -draw "text 20,180 \"$PASS\"" /tmp/pseudo.png /tmp/pass.png
|
||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,100 \"$SALT\"" /tmp/pass.png /tmp/salt.png
|
||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,140 \"$PEPPER\"" /tmp/salt.png ~/.zen/game/players/$PLAYER/ID.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)
|
||||
|
@ -281,7 +318,7 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|||
# astrXbian compatible IPFS sub structure =>$XZUID
|
||||
cp ~/.zen/game/players/$PLAYER/.player ~/.zen/game/players/$PLAYER/ipfs/_xbian.zuid
|
||||
cp ~/.zen/game/players/$PLAYER/.player ~/.zen/game/players/$PLAYER/ipfs/
|
||||
# PUBLIC Ŋ7 ZONE
|
||||
# PUBLIC Ŋ0 ZONE
|
||||
|
||||
echo "${ASTRONAUTENS}" > ~/.zen/game/players/$PLAYER/.playerns
|
||||
|
||||
|
@ -290,11 +327,16 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|||
|
||||
qrencode -s 12 -o "$HOME/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png" "https://ipfs.copylaradio.com/ipns/${ASTRONAUTENS}"
|
||||
|
||||
echo; echo "Création de votre Clef et QR codes d'accès au niveau Astroport Ŋ1"; sleep 1
|
||||
echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sleep 1
|
||||
|
||||
echo; echo "*** HOME : ~/.zen/game/players/$PLAYER/"; sleep 1
|
||||
echo "*** PLAYER : $PLAYER";
|
||||
echo; echo "GW : https://ipfs.copylaradio.com/ipns/${ASTRONAUTENS}"; sleep 1
|
||||
echo "--- PLAYER : $PLAYER";
|
||||
echo; echo "VISA : ${myIPFSGW}/ipfs/${IASTRO}"
|
||||
echo; echo "+ TW : ${myIPFSGW}/ipns/${ASTRONAUTENS}"
|
||||
echo; echo "+ RSS : ${myIPFSGW}/ipns/${FEEDNS}"; sleep 1
|
||||
|
||||
[[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open "${myIPFSGW}/ipns/${ASTRONAUTENS}"
|
||||
|
||||
[[ ! -L ~/.zen/game/players/.current ]] && ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
|
||||
|
||||
# PASS CRYPTING KEY
|
||||
#~ echo; echo "Sécurisation de vos clefs... "; sleep 1
|
||||
|
@ -314,27 +356,29 @@ echo "$PASS" > ~/.zen/game/players/$PLAYER/.pass
|
|||
#####################################################
|
||||
|
||||
## DISCONNECT AND CONNECT CURRENT PLAYER
|
||||
rm -f ~/.zen/game/players/.current
|
||||
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
|
||||
#~ rm -f ~/.zen/game/players/.current
|
||||
#~ ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
|
||||
|
||||
## MANAGE GCHANGE+ & Ŋ1 EXPLORATION
|
||||
${MY_PATH}/Connect_PLAYER_To_Gchange.sh "$PLAYER"
|
||||
|
||||
### IF PRINTER -> PRINT VISA
|
||||
LP=$(ls /dev/usb/lp*)
|
||||
[[ $LP ]] && ${MY_PATH}/VISA.print.sh &
|
||||
LP=$(ls /dev/usb/lp* 2>/dev/null)
|
||||
[[ $LP ]] && ${MY_PATH}/VISA.print.sh "$PLAYER" &
|
||||
|
||||
## INIT FRIENDSHIP CAPTAIN/ASTRONAUTS (LATER THROUGH GCHANGE)
|
||||
## ${MY_PATH}/FRIENDS.init.sh
|
||||
## NO. GCHANGE+ IS THE MAIN INTERFACE, astrXbian manage
|
||||
echo "$(${MY_PATH}/face.sh cool)"
|
||||
echo "Bienvenue 'Astronaute' $PSEUDO ($PLAYER)"
|
||||
echo "Votre PASS"; sleep 1
|
||||
echo
|
||||
echo "Notez vos PHRASES et votre PASS"; sleep 1
|
||||
|
||||
echo $PSEUDO > ~/.zen/tmp/PSEUDO ## Return data to start.sh
|
||||
|
||||
echo "$PASS"
|
||||
|
||||
|
||||
## CLEANING CACHE
|
||||
rm -Rf ~/.zen/tmp/${MOATS}
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -11,30 +11,32 @@ MY_PATH="`dirname \"$0\"`" # relative
|
|||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
PLAYER="$1"
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
[[ ! -f ~/.zen/game/players/.current/QR.png ]] &&\
|
||||
echo "ERREUR. Aucun PLAYER Astronaute connecté .ERREUR ~/.zen/game/players/.current/" && exit 1
|
||||
[[ ! -f ~/.zen/game/players/${PLAYER}/QR.png ]] &&\
|
||||
echo "ERREUR. Aucun PLAYER Astronaute connecté .ERREUR ~/.zen/game/players/${PLAYER}/" && 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/${PLAYER}/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
|
||||
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
|
||||
|
||||
|
||||
PASS=$(cat ~/.zen/game/players/.current/.pass)
|
||||
PASS=$(cat ~/.zen/game/players/${PLAYER}/.pass)
|
||||
|
||||
SALT=$(cat ~/.zen/game/players/.current/secret.june | head -n 1)
|
||||
PEPPER=$(cat ~/.zen/game/players/.current/secret.june | tail -n 1)
|
||||
SALT=$(cat ~/.zen/game/players/${PLAYER}/secret.june | head -n 1)
|
||||
PEPPER=$(cat ~/.zen/game/players/${PLAYER}/secret.june | tail -n 1)
|
||||
|
||||
LP=$(ls /dev/usb/lp*)
|
||||
|
||||
convert ~/.zen/game/players/.current/QR.png -resize 300 /tmp/QR.png
|
||||
convert ~/.zen/game/players/${PLAYER}/QR.png -resize 300 /tmp/QR.png
|
||||
convert ${MY_PATH}/../images/astroport.jpg -resize 300 /tmp/ASTROPORT.png
|
||||
|
||||
composite -compose Over -gravity SouthWest -geometry +280+20 /tmp/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png /tmp/astroport.png
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/QR.png /tmp/astroport.png /tmp/one.png
|
||||
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png /tmp/one.png /tmp/image.png
|
||||
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/${PLAYER}/QRsec.png /tmp/one.png /tmp/image.png
|
||||
|
||||
convert -gravity northwest -pointsize 35 -fill black -draw "text 50,300 \"$PSEUDO\"" /tmp/one.png /tmp/image.png
|
||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 300,40 \"$PLAYER\"" /tmp/image.png /tmp/pseudo.png
|
||||
|
|
|
@ -28,12 +28,12 @@ exit 2
|
|||
|
||||
# IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/uqload_downloader/
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/uqdl/
|
||||
|
||||
## CHOOSE kodi.${OLD}log
|
||||
[[ $1 == "old" ]] && OLD='old.' || OLD=''
|
||||
|
||||
[[ ! $(which kodi) ]] && echo "KODI IS MISSING. VISIT https://copylaradio.com" && exit 1
|
||||
[[ ! $(which kodi) ]] && echo "KODI IS MISSING." && exit 1
|
||||
|
||||
## LOOP
|
||||
cycle=1
|
||||
|
@ -44,21 +44,22 @@ do
|
|||
echo "########################################################################"
|
||||
echo "MANUAL : uqload_downloader https://uqload.com/$uqlink \"$HOME/Astroport/$uqname.mp4\""
|
||||
|
||||
! cat ~/.zen/tmp/${IPFSNODEID}/uqload_downloader/commands.fifo | grep -w "$uqname.mp4" && \
|
||||
echo "uqload_downloader https://uqload.com/$uqlink \"$HOME/Astroport/$uqname.mp4\"" >> ~/.zen/tmp/${IPFSNODEID}/uqload_downloader/commands.fifo || \
|
||||
! cat ~/.zen/tmp/${IPFSNODEID}/uqdl/commands.fifo | grep -w "$uqname.mp4" && \
|
||||
echo "uqload_downloader https://uqload.com/$uqlink \"$HOME/Astroport/$uqname.mp4\"" >> ~/.zen/tmp/${IPFSNODEID}/uqdl/commands.fifo || \
|
||||
echo "$uqname.mp4 conflict"
|
||||
|
||||
## CHECK & MANAGE COPY
|
||||
if [[ $(find $HOME/Astroport -name "$uqname*" -type f -print) ]];
|
||||
if [[ $(find $HOME/Astroport -name "$uqname.mp4" -type f -print) ]];
|
||||
then
|
||||
echo "COPY ALREADY IN $HOME/Astroport/"
|
||||
continue
|
||||
else
|
||||
echo "DETECTED MOVIE : $uqname (https://uqload.com/$uqlink)"
|
||||
uqload_downloader https://uqload.com/$uqlink "$HOME/Astroport/$uqname.mp4"
|
||||
echo "COPY ~/astroport/$uqname.mp4 DONE"
|
||||
echo "COPY ~/Astroport/$uqname.mp4 DONE"
|
||||
## ARE WE RUNNING ON ASTROPORT STATION?
|
||||
[[ ${IPFSNODEID} && -d ~/.zen/Astroport.ONE/ ]] && ~/.zen/Astroport.ONE/ajouter_media.sh
|
||||
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
myIP=$(hostname -I | awk '{print $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])/")
|
||||
|
||||
|
|
|
@ -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
|
||||
########################################################################"
|
||||
|
||||
|
||||
|
|
|
@ -281,12 +281,12 @@ then
|
|||
if [[ $(echo "$MIME" | grep 'video') ]]; then
|
||||
|
||||
TEXT="<video controls width=100% poster='/ipfs/"${ANIMH}"'><source src='/ipfs/"${IPFSID}"' type='"${MIME}"'></video>
|
||||
<br>{{!!duree}}<br>
|
||||
<br>{{!!duree}} - {{!!filesize}} - {{!!dur}} sec.<br>
|
||||
"$H1"
|
||||
<h2>"$DESCRIPTION"</h2>"
|
||||
|
||||
TidType="text/vnd.tiddlywiki" ## MAYBE REAL ONCE TW CAN SHOW ATTACHED IPFS VIDEO (TODO: TESTINGS)
|
||||
TAGS="G1${CAT} ${PLAYER} ${FILETAG} $SAISON $GENRE ipfs ${HASHTAG} $YEAR"
|
||||
TAGS="G1${CAT} ${PLAYER} ${FILETAG} $SAISON $GENRE ipfs ${HASHTAG} $YEAR $MIME"
|
||||
# TyPE="$MIME"
|
||||
# CANON="/ipfs/"${IPFSID}
|
||||
CANON=''
|
||||
|
@ -315,8 +315,9 @@ then
|
|||
"gifanime": "'/ipfs/${ANIMH}'",
|
||||
"type": "'${TidType}'",
|
||||
"mime": "'${MIME}'",
|
||||
"ipfsdur": "'${ipfsdur}'",
|
||||
"dur": "'${ipfsdur}'",
|
||||
"cat": "'${CAT}'",
|
||||
"filesize": "'${FILE_SIZE}'",
|
||||
"size": "'${FILE_BSIZE}'",
|
||||
"description": "'${DESCRIPTION}'",
|
||||
"screenshot": "'/ipfs/${POSTER}'",
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>TW IFRAME</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.embed-responsive {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.embed-responsive::before {
|
||||
display: block;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.embed-responsive-16by9::before {
|
||||
padding-top: 56.25%;
|
||||
}
|
||||
|
||||
.embed-responsive .embed-responsive-item {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.col-md-4 {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@media(min-width: 768px) {
|
||||
.col-md-4 {
|
||||
max-width: 50%;
|
||||
flex: 0 0 50%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
*, *:before, *:after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 40px;
|
||||
font-family: 'Open Sans', 'sans-serif';
|
||||
background-color: #fff;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
h1, p {
|
||||
margin: 0 0 1em 0;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
max-width: 940px;
|
||||
margin: 0 20px;
|
||||
display: grid;
|
||||
grid-gap: 10px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 500px) {
|
||||
|
||||
/* no grid support? */
|
||||
.sidebar {
|
||||
float: left;
|
||||
width: 19.1489%;
|
||||
}
|
||||
|
||||
.content {
|
||||
float: right;
|
||||
width: 79.7872%;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
margin: 0 auto;
|
||||
grid-template-columns: 1fr 3fr;
|
||||
}
|
||||
|
||||
.header, .footer {
|
||||
grid-column: 1 / -1;
|
||||
/* needed for the floated layout */
|
||||
clear: both;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.wrapper > * {
|
||||
background-color: #444;
|
||||
color: #fff;
|
||||
border-radius: 5px;
|
||||
padding: 20px;
|
||||
font-size: 150%;
|
||||
/* needed for the floated layout*/
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* We need to set the widths used on floated items back to auto, and remove the bottom margin as when we have grid we have gaps. */
|
||||
@supports (display: grid) {
|
||||
.wrapper > * {
|
||||
width: auto;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header class="header">
|
||||
<h1>Astroport.ONE</h1>
|
||||
<a target="you" href="_ME_">ME</a> : _IFRIENDHEAD_
|
||||
</header>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="embed-responsive embed-responsive-16by9">
|
||||
<iframe name="me" class="embed-responsive-item" src="_ME_" allowfullscreen></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="embed-responsive embed-responsive-16by9">
|
||||
<iframe name="you" class="embed-responsive-item" src="https://qo-op.com" allowfullscreen></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue