Compare commits

...

46 Commits

Author SHA1 Message Date
Yann Autissier 25d3d9d24f fix install 2022-07-25 21:37:09 +00:00
fred fb029124bc TW5 evolution 2022-07-08 17:07:00 +02:00
fred 4eb521a8a9 add gpg 2022-07-07 13:11:30 +02:00
fred 08a91c07b4 correction tw5 init 2022-07-05 14:03:22 +02:00
fred 927f61b4d1 better TW5 integration, precharged to allow further control over MEDIAKEY 2022-07-04 17:04:46 +02:00
fred 2431cb5369 ## Create TW5 index.html to give easy control access to MEDIAKEY and KEY owner 2022-07-04 15:18:54 +02:00
fred 0fb0692980 Aya Merge branch 'master' of https://git.p2p.legal/axiom-team/astrXbian 2022-07-03 14:44:36 +02:00
fred c1eccdfe11 change CORS parameters depending on your allowed astroport domains 2022-07-03 14:44:27 +02:00
Yann Autissier f0036ca121 fix install 2022-07-01 19:32:58 +02:00
qo-op cccd6969f9 Merge pull request '[ENH] Add tests' (#39) from make_it into master
Reviewed-on: axiom-team/astrXbian#39
2022-06-26 21:40:44 +02:00
fred a800da8a21 $3 is the G1PUB of the PLAYER 2022-06-26 21:32:08 +02:00
Yann Autissier c1aa201afd Merge branch 'master'
Conflicts:
	install.sh
2022-06-26 20:54:14 +02:00
fred 03a032590b AstroBlog first 2022-06-23 19:26:55 +02:00
fred 3c9c5faedb Quicker autoPINfriends 2022-06-23 19:15:46 +02:00
fred 1a1eda6f4a gchange+ synchro to check 2022-06-23 18:38:43 +02:00
fred 1f6aa0e23c Refresh experimental Astronaut TW channels 2022-06-22 17:31:35 +02:00
fred 251b5f24af New Bootstrap Station "cancer.copylaradio.com" (CAPTAIN = yan14tricot75 = GmUD53TFfEfb6NiVqYXwxMGbxpP9nKgHPgF4jex6FBvj) 2022-06-22 17:04:22 +02:00
fred b21b7e3426 netcat-traditional 2022-06-22 16:19:03 +02:00
fred b36cb9f7c4 netcat-openbsd 1234 trick 2022-06-22 16:11:58 +02:00
fred efc542158c Ask PIN to myself 2022-06-16 00:35:53 +02:00
fred a67fb6486c screen capture error was stopping import 2022-06-14 04:45:46 +02:00
fred c4d8eefd2b INSTASCAN API 2022-06-14 04:10:50 +02:00
fred de1cedf157 Problem with instascan relaunching... 2022-06-14 04:09:21 +02:00
fred b6bf164b57 screen.png correction 2022-06-14 04:08:54 +02:00
fred 93ba46433d is it correct now? 2022-06-14 02:04:16 +02:00
fred 231c549788 $3 is Gchange G1PUB 2022-06-14 02:01:39 +02:00
fred 67e77f20e1 Convert symlink $(readlink ~/.zen/ipfs) 2022-06-14 01:12:58 +02:00
fred 50cf9e0fcb Send message to Gchange + tiddler.json Station publication 2022-06-14 00:53:46 +02:00
fred efda32a4d5 Activate g1-compagnon API (nc 1234 http port bash relay) 2022-06-14 00:52:01 +02:00
fred 3825b1bebc Add external call from 1234 port Welcome g1-compagnon API 2022-06-14 00:01:35 +02:00
fred a9d76db1a4 protobuf downgrade !! F... Google. 2022-06-13 17:23:06 +02:00
aynic.os bc5c14d2ae rebase master 2021-06-09 00:55:20 +02:00
aynic.os ead1ba7a57 test 2021-06-08 21:25:22 +02:00
aynic.os dac3cfb158 test 2021-06-08 21:25:22 +02:00
aynic.os 5d6a32c1d5 test 2021-06-08 21:25:22 +02:00
aynic.os a1976ed498 test 2021-06-08 21:25:22 +02:00
aynic.os 785f715830 test 2021-06-08 21:25:20 +02:00
aynic.os 2dfa0ee7d2 test 2021-06-08 21:24:13 +02:00
aynic.os 68ccdcb394 test 2021-06-08 21:24:12 +02:00
aynic.os c7b272dfc5 test 2021-06-08 21:24:12 +02:00
aynic.os fba00c3225 test 2021-06-08 21:24:12 +02:00
aynic.os e9e1fd989d test 2021-06-08 21:24:12 +02:00
aynic.os d2b1d94967 test 2021-06-08 21:24:10 +02:00
aynic.os a5ea0292f2 1st test 2021-06-08 21:22:16 +02:00
aynic.os b76111f017 add make 2021-06-08 21:22:15 +02:00
aynic.os aebacbf56f cleanup warning git clone 2021-06-08 21:22:15 +02:00
20 changed files with 626 additions and 294 deletions

View File

@ -1 +0,0 @@
swp_token=1605043494:0cb63ecc71f6d029418e827aed3e7c9f:c8201b8ffdb3703b1d01884bce4f7584

View File

@ -1 +0,0 @@
swp_token=1603922533:31aac141fc8c1f57a856ac4be928d2c0:067e0bd7719ed36e424bd1d672ebecdb

View File

@ -90,7 +90,7 @@ ipfs config --json Experimental.Libp2pStreamMounting true
ipfs config --json Experimental.P2pHttpProxy true
ipfs config --json Swarm.ConnMgr.LowWater 0
ipfs config --json Swarm.ConnMgr.HighWater 0
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://astroport", "https://astroport.com", "https://qo-op.com", "https://tube.copylaradio.com" ]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'
######### CLEAN DEFAULT BOOTSTRAP TO STAY INVISIBLE ###########

View File

@ -3,3 +3,5 @@
/ip4/51.15.166.54/tcp/4001/p2p/12D3KooWBYme2BsNUrtx4mEdNX6Yioa9AV7opWzQp6nrPs6ZKabN
# aries.copylaradio.com (thuya83pk) = HbBJDXDrN8swxvMohMxmegYRyZ7m99jqgxwwN1gwxck2
/ip4/37.187.127.175/tcp/4001/p2p/12D3KooWSQYTxeoZZ39SNosEKxi7RUdGTtAQAqpKeZJxjzqqrZTx
# cancer.copylaradio.com (yan14tricot75) = GmUD53TFfEfb6NiVqYXwxMGbxpP9nKgHPgF4jex6FBvj
/ip4/185.202.238.69/udp/4001/quic/p2p/12D3KooWRaqNpB2xr8w5WGDvU9HHj9MST9Rnp1kmMGc67e6z98ef

View File

@ -302,6 +302,7 @@ echo "$USER ALL=(ALL) NOPASSWD:/usr/local/bin/brother_ql_print" | (sudo su -c 'E
## INSTALL TiddlyWiki
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/index.html ]] && mkdir -p ~/.zen/ipfs/.${IPFSNODEID} && cp ~/.zen/astrXbian/.install/templates/tiddlywiki/index.html ~/.zen/ipfs/.${IPFSNODEID}/index.html
[[ -f ~/.zen/Astroport.ONE/templates/moawiki.html ]] && cp ~/.zen/Astroport.ONE/templates/moawiki.html ~/.zen/ipfs/.${IPFSNODEID}/index.html
########################################################################

30
Makefile Normal file
View File

@ -0,0 +1,30 @@
MYOS ?= ../myos
-include $(MYOS)/make/include.mk
.PHONY: all default install shellcheck shellcheck-% shellspec shellspec-% tests uninstall
SHELL_FILES ?= $(wildcard .*/*.sh */*.sh */*/*.sh)
$(MYOS):
git clone https://git.p2p.legal/aya/myos $(MYOS)
default: tests
all: install tests
install:
./install.sh
tests: shellcheck shellspec
shellcheck:
shellcheck $(SHELL_FILES) ||:
shellcheck-%:
shellcheck $*/*.sh
shellspec: shellspec-specs
shellspec-%:
shellspec -f tap $*
uninstall:

View File

@ -29,6 +29,16 @@ G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
[[ $(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
# 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 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
URL="$1"
if [ $URL ]; then
echo "URL: $URL"
@ -38,7 +48,7 @@ if [ $URL ]; then
CHOICE="$IMPORT"
fi
[[ $CHOICE == "Web" ]] && CHOICE=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Cette source Web est à enregistrer comme " --entry-text="Page" WebSite)
[[ $CHOICE == "Web" ]] && CHOICE="Page" #&& CHOICE=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Cette source Web est à enregistrer comme " --entry-text="Page" WebSite)
# REMOVE GtkDialog errors for zenity
shopt -s expand_aliases
@ -102,7 +112,7 @@ YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail
########################################################################
# CHOOSE CATEGORY (remove anime, not working!)
[[ $CHOICE == "" ]] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Choisissez la catégorie de votre media" --entry-text="Film" Serie Youtube Video)
[[ $CHOICE == "" ]] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Choisissez la catégorie de votre ajout" --entry-text="AstroBlog" Film Serie Youtube Video)
[[ $CHOICE == "" ]] && exit 1
# LOWER CARACTERS
@ -117,6 +127,29 @@ PREFIX=$(echo "${CAT}" | head -c 1 | awk '{ print toupper($0) }' ) # ex: F, S, A
########################################################################
case ${CAT} in
########################################################################
# CASE ## ASTRONAUTE
# _ _
# __ _ ___| |_ _ __ ___ _ __ __ _ _ _| |_ ___
# / _` / __| __| '__/ _ \| '_ \ / _` | | | | __/ _ \
# | (_| \__ \ |_| | | (_) | | | | (_| | |_| | || __/
# \__,_|___/\__|_| \___/|_| |_|\__,_|\__,_|\__\___|
#
#
########################################################################
astroblog)
# INSTASCAN G1PUB CAPTURE
~/.zen/Astroport.ONE/tools/instascan_login.sh "ONE"
zenity --warning --width 300 --text "$PLAYER. Prêt à enregistrer votre video ?"
## RECORD WEBCAM VIDEO
~/.zen/Astroport.ONE/tools/vlc_webcam.sh
exit 0
;;
########################################################################
# CASE ## YOUTUBE
# _ _
# _ _ ___ _ _| |_ _ _| |__ ___
@ -433,18 +466,20 @@ GENRES="[\"$(echo ${FILM_GENRES} | sed s/\|/\",\"/g)\"]"
########################################################################
# Screen capture is used as thumbnail
########################################################################
zenity --warning --width 300 --text "Cliquez nous capturons votre écran comme vignette MEDIA"
sleep 1
[[ $(echo $DISPLAY | cut -d ':' -f 1) == "" ]] && import -window root /tmp/screen.png
if [[ $(echo $DISPLAY | cut -d ':' -f 1) == "" ]]; then
zenity --warning --width 300 --text "Cliquez nous capturons votre écran comme vignette MEDIA"
sleep 1
import -window root /tmp/screen.png
fi
###################################
### MOVING FILE TO ~/astroport ####
###################################
mkdir -p ~/astroport/${CAT}/${MEDIAID}/
mv -f "${FILE_PATH}/${FILE_NAME}" "$HOME/astroport/${CAT}/${MEDIAID}/${TITLE}.${FILE_EXT}"
mv /tmp/screen.png ~/astroport/${CAT}/${MEDIAID}/screen.png
mv -f "${FILE_PATH}/${FILE_NAME}" "$HOME/astroport/${CAT}/${MEDIAID}/${TITLE}.${FILE_EXT}"
if [ $? == 0 ]; then
zenity --warning --width ${large} --text "Votre fichier ~/astroport/${CAT}/${MEDIAID}/${TITLE}.${FILE_EXT} est prêt à embarquer. Cliquez sur OK, nous allons préparer son script d'ajout à Astroport..."
else
@ -526,7 +561,7 @@ MIME=$(file --mime-type $HOME/astroport/${CAT}/${MEDIAID}/${TITLE}.${FILE_EXT} |
########################################################################
# ADD $FILE to IPFS / ASTROPORT / KODI
echo "new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_NAME}\""
echo "new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_NAME}\"" $3
[[ -f ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt ]] && cat ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt
# LOG NOISE # [[ -f ~/astroport/${CAT}/${MEDIAID}/video.json ]] && cat ~/astroport/${CAT}/${MEDIAID}/video.json
########################################################################
@ -541,29 +576,28 @@ echo "new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_N
timestamp=$(date -u +%s%N | cut -b1-13)
## AUTO DESTRUCTIVE ADD TO ASTROPORT IPFS SCRIPT
## AUTO DESTRUCTIVE LATER ADD TO ASTROPORT SCRIPT
echo "MEDIAKEY=${MEDIAKEY}" > ~/astroport/Add_${MEDIAKEY}_script.sh
[[ $CHOICE == "TMDB" ]] && echo "echo \"Encoder ${FILE_NAME} en h265 avant import ? Tapez sur ENTER.. Sinon saisissez qqch avant...\"
reponse=\$1
[[ ! \$reponse ]] && read reponse
if [[ ! \$reponse ]]; then
ffmpeg -i \"$HOME/astroport/${CAT}/${MEDIAID}/${FILE_NAME}\" -vcodec libx265 -crf 28 $HOME/astroport/${MEDIAID}.mp4
mv \"$HOME/astroport/${CAT}/${MEDIAID}/${FILE_NAME}\" \"$HOME/astroport/${CAT}/${MEDIAID}/${FILE_NAME}.old\"
mv $HOME/astroport/${MEDIAID}.mp4 \"$HOME/astroport/${CAT}/${MEDIAID}/${FILE_NAME}.mp4\"
~/.zen/astrXbian/zen/new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_NAME}.mp4\"
else" >> ~/astroport/Add_${MEDIAKEY}_script.sh
#[[ $CHOICE == "TMDB" ]] && echo "echo \"Encoder ${FILE_NAME} en h265 avant import ? Tapez sur ENTER.. Sinon saisissez qqch avant...\"
#reponse=\$1
#[[ ! \$reponse ]] && read reponse
#if [[ ! \$reponse ]]; then
# ffmpeg -i \"$HOME/astroport/${CAT}/${MEDIAID}/${FILE_NAME}\" -vcodec libx265 -crf 28 $HOME/astroport/${MEDIAID}.mp4
# mv \"$HOME/astroport/${CAT}/${MEDIAID}/${FILE_NAME}\" \"$HOME/astroport/${CAT}/${MEDIAID}/${FILE_NAME}.old\"
# mv $HOME/astroport/${MEDIAID}.mp4 \"$HOME/astroport/${CAT}/${MEDIAID}/${FILE_NAME}.mp4\"
# ~/.zen/astrXbian/zen/new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_NAME}.mp4\"
#else" >> ~/astroport/Add_${MEDIAKEY}_script.sh
echo "~/.zen/astrXbian/zen/new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_NAME}\" " >> ~/astroport/Add_${MEDIAKEY}_script.sh
# $3 is the G1PUB of the PLAYER (search in code to find where)
echo "~/.zen/astrXbian/zen/new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_NAME}\" \"$3\"" >> ~/astroport/Add_${MEDIAKEY}_script.sh
[[ $CHOICE == "TMDB" ]] && echo "fi" >> ~/astroport/Add_${MEDIAKEY}_script.sh
#[[ $CHOICE == "TMDB" ]] && echo "fi" >> ~/astroport/Add_${MEDIAKEY}_script.sh
echo "rm -f /tmp/\${MEDIAKEY}.pass
rm -f /tmp/\${MEDIAKEY}.dunikey ## REMOVE KEYS
mv ~/astroport/Add_${MEDIAKEY}_script.sh ~/astroport/Done_${FILE_NAME}.sh
" >> ~/astroport/Add_${MEDIAKEY}_script.sh
chmod +x ~/astroport/Add_${MEDIAKEY}_script.sh
## DELAYED IPFS ADD TO ASTROPORT ... COULD BE MANAGED BY CRON
@ -600,14 +634,16 @@ FILE_SIZE=$(echo "${FILE_BSIZE}" | awk '{ split( "B KB MB GB TB PB" , v ); s=1;
#fi
########################################################################
########################################################################
if [ $1 ]; then
bash ~/astroport/Add_${MEDIAKEY}_script.sh "noh265"
[ $? == 0 ] && echo "${MEDIAKEY} is RECORDED in ASTROPORT. GOOD." && exit 0
zenity --question --width 300 --text "OK! ~/astroport/Add_${MEDIAKEY}_script.sh ($FILE_SIZE). Voulez-vous lancer immédiatement l'ajout dans Astroport ?"; \
[ $? == 0 ] && bash ~/astroport/Add_${MEDIAKEY}_script.sh "noh265" \
&& zenity --warning --width 300 --text "Ajoutez ce media dans vos journaux public 'qo-op' ou administratif 'moa'" \
&& [[ $(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) ]] \
&& xdg-open "http://127.0.0.1:8080/ipns/$(cat ~/.zen/game/players/.current/.playerns)" \
|| ( zenity --warning --width 300 --text "Désolé une erreur est survenue... /tmp/${MEDIAKEY}.log" && exit 1 )\
exit 0
echo "${MEDIAKEY} = RECORDED TO IPFS."
cat /tmp/${MEDIAKEY}.log
else
zenity --question --width 300 --text "OK! ~/astroport/Add_${MEDIAKEY}_script.sh ($FILE_SIZE). Voulez-vous lancer immédiatement l'ajout dans Astroport ?"; \
[ $? == 0 ] && bash ~/astroport/Add_${MEDIAKEY}_script.sh "noh265" \
&& zenity --warning --width 300 --text "Ajoutez ce media dans vos journaux public 'qo-op' ou administratif 'moa'" \
&& [[ $(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) ]] \
&& xdg-open "http://127.0.0.1:8080/ipns/$(cat ~/.zen/game/players/.current/.playerns)" \
|| ( zenity --warning --width 300 --text "Désolé une erreur est survenue... cat /tmp/${MEDIAKEY}.log" && exit 1 )\
fi
exit 0

View File

@ -164,7 +164,15 @@ fi
if [[ $(($runtime % 15)) == 0 ]]; then
########## DESYNCH SWARM NODE REQUESTS #################
[[ ! -d ~/.zen/Astroport.ONE ]] && cd ~/.zen && git clone https://git.p2p.legal/qo-op/Astroport.ONE.git
[[ -d ~/.zen/Astroport.ONE ]] && cd ~/.zen/Astroport.ONE && sleep $((1 + RANDOM % 12)) && git pull
########################################################################
# RE/LAUNCHING INSTASCAN API
instascan=$(ps auxf --sort=+utime | grep -w nc | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
[[ $instascan ]] && killall instascan_login.sh && killall nc # && ~/.zen/Astroport.ONE/tools/instascan_login.sh &
# [[ ! $instascan ]] && ~/.zen/Astroport.ONE/tools/instascan_login.sh &
# git reset --hard
cd $MY_PATH
sleep $((1 + RANDOM % 3)) && git pull
@ -210,7 +218,9 @@ fi
## SYNC GCHANGE EVERY 12 hours runtime
if [[ $(($runtime % 725)) == 0 || "$runtime" == "5" ]]; then
kill -9 $(ps auxf --sort=+utime | grep -w gchange_INIT.sh | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}') && echo "KILLING gchange_INIT.sh"
$MY_PATH/zen/gchange_INIT.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.gchange_INIT.txt
# $MY_PATH/zen/gchange_INIT.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.gchange_INIT.txt
# ~/.zen/Astroport.ONE/tools/Connect_PLAYER_To_Gchange.sh > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.gchange_INIT.tx
# TODO REWRITE GCHANGE SYNC.
fi
# If NEW ~/.ipfs/config.new => restarting IPFS daemon (not too often as 6h)
if [[ -f ~/.ipfs/config.new && $(diff ~/.ipfs/config.new ~/.ipfs/config) && $runtime -gt 360 ]]; then
@ -230,8 +240,8 @@ if [[ $(($runtime % 26)) == 0 ]]; then
kill -9 $(ps auxf --sort=+utime | grep -w ipfs_SWARM_refresh.sh | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}') && echo "KILLING ipfs_SWARM_refresh.sh"
killall chromium
$MY_PATH/zen/ipfs_SWARM_refresh.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.ipfs_SWARM_refresh.txt
$MY_PATH/zen/tools/autoPINfriends.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.autoPINfriends.txt
fi
##################################################################
#
# _________ ______
@ -328,6 +338,7 @@ echo '
# New full test review in gchange_INIT.sh
rm -f ~/.ipfs/test.disk
rm -f /tmp/instascan.log
# LOG ROTATE WEEKLY
[[ -f /tmp/astroport.log ]] && [[ ! -f ~/.zen/astroport.$weeknumber.log.tgz ]] && tar cvzf ~/.zen/astroport.$weeknumber.log.tgz /tmp/astroport.log && echo "" > /tmp/astroport.log

128
include.sh Normal file
View File

@ -0,0 +1,128 @@
#!/bin/bash
[ "${DEBUG}" ] && set -x
i_am() {
echo 'v0.5.0'
}
i_am_root() {
[ $(id -u) -eq 0 ]
}
i_am_xbian() {
[[ "$USER" == "xbian" ]]
}
i_should_install() {
[[ ! -f ~/.zen/secret.dunikey ]]
}
import_astrXbian() {
echo "=== Clonage git CODE 'astrXbian' + 'Astroport.ONE' depuis https://git.p2p.legal"
mkdir -p ~/.zen
cd ~/.zen
# TODO INSTALL FROM IPFS / IPNS
[ ! -d astrXbian ] \
&& git clone https://git.p2p.legal/axiom-team/astrXbian.git \
|| GIT_DIR=astrXbian/.git git pull
[ ! -d Astroport.ONE ] \
&& git clone https://git.p2p.legal/qo-op/Astroport.ONE.git \
|| GIT_DIR=Astroport.ONE git pull
}
import_astroport() {
echo "INITIALISATIOn Astroport/KODI"
echo "Appuyez sur la touche ENTREE pour démarrer le mode Aventure"
echo "sinon interrompez ici l'installation, et activez votre Ambassade ~/.zen/Astroport.ONE/start.sh"
read
~/.zen/Astroport.ONE/adventure.sh
# ~/.zen/astrXbian/ISOconfig.sh
}
import_ipfs() {
## Scripts pour systemd ou InitV (xbian)
echo "=== Activation SYSTEM IPFS"
~/.zen/astrXbian/.install/ipfs_alone.sh
}
import_jaklis() {
echo "=== Configuration jaklis: Centre de communication CESIUM+ GCHANGE+"
cd ~/.zen/astrXbian/zen/jaklis
./setup.sh
}
import_kodi() {
[[ ! $(which kodi) && "$user" != "xbian" ]] &&\
echo ">>> installation kodi + vstream = votre videotheque ! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" \
&& sudo apt-get install kodi -y \
&& ~/.zen/astrXbian/.install/kodi_uqload_downloader.sh
echo "=== IMPORT configuration ASTROPORT dans ~/.kodi"
cp -Rf ~/.zen/astrXbian/.install/.kodi ~/
}
install_requirements() {
echo "mise à jour des dépots de votre distribution..."
sudo apt-get update
PACKAGES=""
INSTALL_PACKAGES=""
[[ "$user" != "xbian" ]] && PACKAGES="x11-utils xclip zenity handbrake*"
PACKAGES="${PACKAGES} git fail2ban netcat-traditional inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv swig libgpgme-dev mpack libssl-dev libffi-dev"
PACKAGES="${PACKAGES} build-essential qrencode jq bc file gawk yt-dlp ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox nmap httrack html2text ssmtp imagemagick libcurl4-openssl-dev"
# python pip install dependencies
PACKAGES="${PACKAGES} libcairo2-dev libgirepository1.0-dev pkg-config"
# AstroGEEK OpenCV = 'Intelligence Amie'
PACKAGES="${PACKAGES} python3-opencv"
for package in ${PACKAGES}; do\
[ $(dpkg-query -W -f='${status}' ${package} 2>/dev/null | grep -c "ok installed") -eq 0 ] \
&& apt-cache show ${package} > /dev/null 2>&1 \
&& INSTALL_PACKAGES="${INSTALL_PACKAGES} ${package}"
done
[ -n "${INSTALL_PACKAGES# *}" ] \
&& echo ">>> installation ${INSTALL_PACKAGES} <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" \
&& sudo apt install -y ${INSTALL_PACKAGES}
## Correct PDF restrictions for imagemagick
echo "# Correction des droits export PDF imagemagick"
if [[ $(cat /etc/ImageMagick-6/policy.xml | grep PDF) ]]; then
cat /etc/ImageMagick-6/policy.xml | grep -Ev PDF > /tmp/policy.xml
sudo cp /tmp/policy.xml /etc/ImageMagick-6/policy.xml
fi
echo "###########################"
echo "## INSTALL PYTHON CRYPTO LAYER "
echo "###########################"
echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc && source ~/.bashrc; echo ">>> PATH=$PATH"
python3 -m pip install -U pip
python3 -m pip install setuptools wheel
python3 -m pip install cryptography Ed25519 base58 google duniterpy pynacl pgpy gpg
python3 -m pip install pycairo
python3 -m pip install nicotine-plus silkaj
python3 -m pip install protobuf==3.19.0
if [[ "$USER" == "pi" ]]; then ## PROPOSE QR_CODE PRINTER SUR RPI
echo "Ambassade? Souhaitez vous ajouter imprimante 'brother_ql'? Saisissez OUI, sinon laissez vide et tapez sur ENTRER"
read saisie
if [[ $saisie != "" ]]; then
sudo apt install printer-driver-all cups -y
sudo pip3 install brother_ql
sudo cupsctl --remote-admin
sudo usermod -aG lpadmin pi
sudo usermod -a -G gammu pi
fi
fi
# python3 -m pip install -U silkaj
## python -> python3 link
sudo ln -f -s /usr/bin/python3 /usr/bin/python
}
prepare_next_boot() {
cat /etc/rc.local | grep -Ev "exit 0" > /tmp/new.rc.local ## REMOVE "exit 0"
# PREPARE NEXT BOOT - Network config - NEXTBOOT - ISOConfig - NEXTBOOT - OK
echo "su - xbian -c '~/.zen/astrXbian/FirstBOOT.sh'" >> /tmp/new.rc.local
echo "exit 0" >> /tmp/new.rc.local
sudo cp -f /tmp/new.rc.local /etc/rc.local
}

View File

@ -1,6 +1,7 @@
#!/bin/bash
########################################################################
# Version: 0.3
# Version: 0.5.0
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
{
@ -8,120 +9,55 @@ MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
[ $(id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1
# INSTALLATION section of README does wget file install.sh and run it with bash
if [ -f ${MY_PATH}/include.sh ]; then
. ${MY_PATH}/include.sh
else
. <(wget -T3 -qO- https://git.p2p.legal/axiom-team/astrXbian/raw/branch/master/include.sh)
fi
! type i_should_install >/dev/null 2>&1 && echo 'ERROR: Unable to load include.sh' && exit 1
########################################################################
[[ ! $(which ipfs) ]] && echo "=== Installez IPFS !!" && echo "https://docs.ipfs.io/install/command-line/#official-distributions" && exit 1
i_am_root && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1
# MAIN # SI AUCUNE CLEF DE STATION...
if [[ ! -f ~/.zen/secret.dunikey ]];
if i_should_install;
then
# Check requirements
echo "AstrXbian installateur pour distributions DEBIAN et dérivées : LinuxMint (https://www.linuxmint.com/) ou XBIAN (https://xbian.org) recommandées"
echo "Appuyez sur ENTRER pour commencer."; read TEST; [[ "$TEST" != "" ]] && echo "SORTIE" && exit 0 ## Ajouter confirmation à chaque nouvelle étape (+explications)
echo ; echo "Mise à jour des dépots de votre distribution..."
sudo apt-get update
[[ ! $(which ipfs) ]] && echo "=== installez ipfs !!" && echo "https://docs.ipfs.io/install/command-line/#official-distributions" && exit 1
echo "astrxbian installateur pour distributions debian et dérivées : linuxmint (https://www.linuxmint.com/) ou xbian (https://xbian.org) recommandées"
echo "appuyez sur entrer pour commencer."; read test; [[ "$test" != "" ]] && echo "sortie" && exit 0 ## ajouter confirmation à chaque nouvelle étape (+explications)
echo
[[ "$USER" != "xbian" ]] &&\
for i in x11-utils xclip zenity handbrake*; do\
[ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ] &&\
echo ">>> Installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";\
sudo apt install -y $i;
done
# Install requirements
install_requirements
for i in git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev; 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
fi
done
# Clone astrXbian and Astroport.One
import_astrXbian
for i in build-essential qrencode jq bc file gawk yt-dlp ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox nmap httrack html2text ssmtp imagemagick ttf-mscorefonts-installer libcurl4-openssl-dev; 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
fi
done
# Init ipfs
import_ipfs
[[ ! $(which kodi) && "$USER" != "xbian" ]] &&\
echo ">>> Installation Kodi + Vstream = VOTRE VIDEOTHEQUE ! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";\
sudo apt-get install kodi -y;\
${MY_PATH}/.install/kodi_uqload_downloader.sh
# Copy astroport config in kodi
# import_kodi
echo "## INSTALLATION AstroGEEK OpenCV = 'Intelligence Amie' "
sudo apt-get install python3-opencv -y
## Correct PDF restrictions for imagemagick
echo "# Correction des droits export PDF imagemagick"
if [[ $(cat /etc/ImageMagick-6/policy.xml | grep PDF) ]]; then
cat /etc/ImageMagick-6/policy.xml | grep -Ev PDF > /tmp/policy.xml
sudo cp /tmp/policy.xml /etc/ImageMagick-6/policy.xml
fi
echo "###########################"
echo "## INSTALL PYTHON CRYPTO LAYER "
echo "###########################"
echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc && source ~/.bashrc; echo ">>> PATH=$PATH"
python3 -m pip install -U pip
python3 -m pip install -U setuptools wheel
python3 -m pip install -U cryptography Ed25519 base58 google protobuf duniterpy pynacl pgpy
python3 -m pip install -U nicotine-plus silkaj
if [[ "$USER" == "pi" ]]; then ## PROPOSE QR_CODE PRINTER SUR RPI
echo "Ambassade? Souhaitez vous ajouter imprimante 'brother_ql'? Saisissez OUI, sinon laissez vide et tapez sur ENTRER"
read saisie
if [[ $saisie != "" ]]; then
sudo apt install printer-driver-all cups -y
sudo pip3 install brother_ql
sudo cupsctl --remote-admin
sudo usermod -aG lpadmin pi
sudo usermod -a -G gammu pi
fi
fi
# python3 -m pip install -U silkaj
## python -> python3 link
sudo ln -f -s /usr/bin/python3 /usr/bin/python
########################################################################
echo "=== Clonage git CODE 'astrXbian' + 'Astroport.ONE' depuis https://git.p2p.legal"
mkdir -p ~/.zen
cd ~/.zen
git clone https://git.p2p.legal/axiom-team/astrXbian.git
git clone https://git.p2p.legal/qo-op/Astroport.ONE.git
# TODO INSTALL FROM IPFS / IPNS
## Scripts pour systemd ou InitV (xbian)
echo "=== Activation SYSTEM IPFS"
~/.zen/astrXbian/.install/ipfs_alone.sh
########################################################################
echo "=== IMPORT configuration ASTROPORT dans ~/.kodi"
cp -Rf ~/.zen/astrXbian/.install/.kodi ~/
########################################################################
echo "=== Configuration jaklis: Centre de communication CESIUM+ GCHANGE+"
cd ~/.zen/astrXbian/zen/jaklis
./setup.sh
# Jaklis setup
import_jaklis
########################################################################
echo "=== Sécurisation DEFCON SUDOERS FAIL2BAN"
## XBIAN fail2ban ERROR correction ##
#[....] Starting authentication failure monitor: fail2ban No file(s) found for glob /var/log/auth.log
[[ "$USER" == "xbian" ]] && sudo sed -i "s/auth.log/faillog/g" /etc/fail2ban/paths-common.conf
i_am_xbian && sudo sed -i "s/auth.log/faillog/g" /etc/fail2ban/paths-common.conf
# NODE activates fail2ban IN zen/ipfs_SWARM_refresh.sh
### MODIFIYING /etc/sudoers ###
[[ "$USER" == "xbian" ]] && echo "xbian ALL=(ALL) NOPASSWD:ALL" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/astroport')
i_am_xbian && echo "xbian ALL=(ALL) NOPASSWD:ALL" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/astroport')
# PERSONNAL DEFCON LEVEL
# cp ~/.zen/astrXbian/DEFCON ~/.zen/
if [[ "$USER" == "xbian" ]]
if i_am_xbian
then
echo "enabling ipfs initV service autostart"
cd /etc/rc2.d && sudo ln -s ../init.d/ipfs S02ipfs
@ -156,26 +92,17 @@ echo ">>> INFO : Ajoutez l'extension 'OpenWith' à votre navigateur !!
# https://addons.mozilla.org/firefox/addon/open-with/
# https://chrome.google.com/webstore/detail/open-with/cogjlncmljjnjpbgppagklanlcbchlno"
if [[ "$USER" != "xbian" ]]
if ! i_am_xbian
then
## Desktop install
echo "INITIALISATIOn Astroport/KODI"
echo "Appuyez sur la touche ENTREE pour démarrer le mode Aventure"
echo "sinon interrompez ici l'installation, et activez votre Ambassade ~/.zen/Astroport.ONE/start.sh"
read
~/.zen/Astroport.ONE/adventure.sh
# ~/.zen/astrXbian/ISOconfig.sh
## Desktop install
import_astroport
else
## Rpi Xbian install.
cat /etc/rc.local | grep -Ev "exit 0" > /tmp/new.rc.local ## REMOVE "exit 0"
# PREPARE NEXT BOOT - Network config - NEXTBOOT - ISOConfig - NEXTBOOT - OK
echo "su - xbian -c '~/.zen/astrXbian/FirstBOOT.sh'" >> /tmp/new.rc.local
echo "exit 0" >> /tmp/new.rc.local
sudo cp -f /tmp/new.rc.local /etc/rc.local
## Rpi Xbian install.
prepare_next_boot
echo "STOP!! Redémarrer Xbian pour continuer la configuration de votre station Astroport/KODI"
echo "Faites une ISO : sudo xbian-config"
exit 0
echo "STOP!! Redémarrer Xbian pour continuer la configuration de votre station Astroport/KODI"
echo "Faites une ISO : sudo xbian-config"
exit 0
fi
# MAIN # -f ~/.zen/secret.june (ISOConfig déjà lancé) ##
@ -195,3 +122,5 @@ https://astroport.com
# MAIN #
fi
}
~/.zen/astrXbian/zen/cron_VRFY.sh

54
specs/astrXbian_spec.sh Normal file
View File

@ -0,0 +1,54 @@
#shellcheck shell=sh
Describe 'AstrXbian'
Describe 'install.sh'
Include ./include.sh
It 'should check it applies to me'
When call i_am
The output should eq 'v0.5.0'
End
It 'should check I am not superuser'
When call i_am_root
The status should not be success
End
It 'should check I need to install'
When call i_should_install
The status should be success
End
It 'should check requirements, but not tested'
Skip "You should implement check_requirements tests"
When run check_requirements
The status should be success
End
It 'should import astrXbian, but not tested'
Skip "You should implement import_astrXbian tests"
When run import_astrXbian
The status should be success
End
It 'should import astroport, but not tested'
Skip "You should implement import_astroport tests"
When run import_astroport
The status should be success
End
It 'should import IPFS, but not tested'
Skip "You should implement import_ipfs tests"
When run import_ipfs
The status should be success
End
It 'should import Jaklis, but not tested'
Skip "You should implement import_jaklis tests"
When run import_jaklis
The status should be success
End
It 'should import Kodi, but not tested'
Skip "You should implement import_kodi tests"
When run import_kodi
The status should be success
End
It 'should prepare astrXbian for first boot, but not tested'
Skip "You should implement prepare_next_boot tests"
When run prepare_next_boot
The status should be success
End
End
End

View File

@ -46,7 +46,7 @@ curl -s ${GCHANGE}/user/profile/${G1PUB} > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gc
Gtitle=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange.json | jq -r '._source.title')
[[ $Gtitle ]] && echo "$Gtitle" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title
echo"# ACTUAL _g1.gchange_title=$Gtitle"
echo "# ACTUAL _g1.gchange_title=$Gtitle"
# UPDATE _g1.astroport_title with city
Atitle="Station $YOU@$XZUID"

View File

@ -1,6 +1,6 @@
#!/bin/bash
########################################################################
# Author: Fred (support@qo-op.com)
# Author: Fred (support@qo-op.com) - Rewriter - Anonymous
# Version: 2020.12.03
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################

33
zen/ipns_MOA_publish.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
########################################################################
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
########################################################################
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
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 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
ipfs --timeout=3s ls /ipns/$MOANS
if [ $? != 0 ]; then
#echo "## PUBLISHING moa_${PLAYER} /ipns/$MOANS"
ls ~/.zen/game/players/$PLAYER/moa/*
IPUSH=$(ipfs add -rwHq ~/.zen/game/players/$PLAYER/moa/* | tail -n 1)
echo $IPUSH > ~/.zen/game/players/$PLAYER/moa/$PLAYER.moa.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/moa/$PLAYER.moa.ts
echo 1 > ~/.zen/game/players/$PLAYER/moa/$PLAYER.moa.n
ipfs name publish --key=moa_${PLAYER} /ipfs/$IPUSH 2>/dev/null
else
## MISE A JOUR CACHE
ipfs get -o ~/.zen/game/players/$PLAYER/moa/ /ipns/$MOANS
fi
echo "PUBLISHED ~/.zen/ipfs TO http://127.0.0.1:8080/ipns/$QOOPNS"

31
zen/ipns_PLAYER_publish.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
########################################################################
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
########################################################################
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
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 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
ipfs --timeout=3s ls /ipns/$PLAYERNS
if [ $? != 0 ]; then
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/index.html | tail -n 1)
echo $IPUSH > ~/.zen/game/players/$PLAYER/$PLAYER.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/$PLAYER.ts
echo 1 > ~/.zen/game/players/$PLAYER/$PLAYER.n
ipfs name publish --key=${PLAYER} /ipfs/$IPUSH 2>/dev/null
else
## MISE A JOUR CACHE (TODO : ADD CHAIN TO BE ABLE TO REVERSE TIME) - "Activate archive.org"
ipfs get -o ~/.zen/game/players/$PLAYER/index.html /ipns/$PLAYERNS
fi
echo "PUBLISHED ~/.zen/ipfs TO http://127.0.0.1:8080/ipns/$PLAYERNS"

32
zen/ipns_TW5_publish.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
########################################################################
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
########################################################################
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
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 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
ipfs --timeout=3s ls /ipns/$QOOPNS
if [ $? != 0 ]; then
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/index.html | tail -n 1)
echo $IPUSH > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/$PLAYER.qo-op.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/$PLAYER.qo-op.ts
echo 1 > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/$PLAYER.qo-op.n
ipfs name publish --key=qo-op_${PLAYER} /ipfs/$IPUSH 2>/dev/null
else
## MISE A JOUR CACHE
ipfs get -o ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/index.html /ipns/$QOOPNS
fi
echo "PUBLISHED ~/.zen/ipfs TO http://127.0.0.1:8080/ipns/$QOOPNS"

View File

@ -6,13 +6,20 @@ 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
########################################################################
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
[[ $IPFSNODEID == "" ]] && echo "ipfs TIMEOUT" && exit 1
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 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
########################################################################
## TESSERACT DOUBLE ACTION
########################################################################
echo "Adding ~/.zen/ipfs to IPFS"
echo "Adding ~/.zen/ipfs/ to IPFS"
# MIPFS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
# OLDCHAIN=$(cat ~/.zen/ipfs/.${IPFSNODEID}/.chain)
# echo "OLD: $OLDCHAIN != NEW:$MIPFS ?"
@ -20,7 +27,7 @@ echo "Adding ~/.zen/ipfs to IPFS"
# then
echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/ipfs/.${IPFSNODEID}/.timestamp
echo $MIPFS > ~/.zen/ipfs/.${IPFSNODEID}/.chain
MIPFS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
MIPFS=$(ipfs add -rHq $(readlink ~/.zen/ipfs) | tail -n 1)
NODEIPNS=$(ipfs --timeout=180s name publish --quieter /ipfs/$MIPFS)
echo "$NODEIPNS:TIME:$(cat ~/.zen/ipfs/.${IPFSNODEID}/.timestamp):CHAIN:$(cat ~/.zen/ipfs/.${IPFSNODEID}/.chain)"
# fi

View File

@ -229,6 +229,13 @@ if [[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode} && "$P
$MY_PATH/tools/natools.py encrypt -p $PINnode -i /tmp/.ipfsid -o "~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfsid.encrypt"
# .ipfsid.encrypt is searched by each Station running ./zen/tools/autoPINfriends.sh
fi
## Ask PIN to myself
mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}
$MY_PATH/tools/natools.py encrypt -p $G1PUB -i /tmp/.ipfs.filelink -o "~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}/.ipfs.filelink.encrypt"
$MY_PATH/tools/natools.py encrypt -p $G1PUB -i /tmp/.ipfsid -o "~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}/.ipfsid.encrypt"
########################################################################
## GREAT natools can convert IPNS MEDIAKEY into .dunikey file
########################################################################
@ -269,7 +276,7 @@ echo "anonymous" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode
# MEMORIZE my PIN
mkdir -p ~/.zen/PIN/${IPFSREPFILEID}/
touch ~/.zen/PIN/${IPFSREPFILEID}/${G1PUB}
# echo "$(ipfs key list -l | grep ${MEDIAKEY} | cut -d ' ' -f 1)" > ~/.zen/PIN/${ipfsrepidfile}/IPNSLINK # NO!! Would let PINing nodes change index.html///
# echo "$(ipfs key list -l | grep ${MEDIAKEY} | cut -d ' ' -f 1)" > ~/.zen/PIN/${ipfsrepidfile}/IPNSLINK # NO!! CHOOSE TODO Would let PINing nodes change index.html///
########################################################################
## encrypt links for myself
@ -285,6 +292,7 @@ rm /tmp/.ipfsid
## ENCRYPT TO STOP CLEAR DATA LEAKING
[[ -f ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
[[ -f ~/astroport/${TYPE}/${REFERENCE}/screen.png ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/screen.png ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
[[ -f ~/astroport/${TYPE}/${REFERENCE}/youtube.png ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/youtube.png ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/screen.png
[[ -f ~/astroport/${TYPE}/${REFERENCE}/video.json ]] &&\
cp -f ~/astroport/${TYPE}/${REFERENCE}/video.json ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/ &&\
cp -f ~/astroport/${TYPE}/${REFERENCE}/video.json ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/
@ -308,6 +316,8 @@ rm /tmp/.ipfsid
# one star level (no encrypt)
# index.html is presenting Astroport/Kodi service then redirect to
# $G1PUB/index.html contains redirection to ipfs link
## NEW RELEASE
## Create TW5 index.html to give easy control access to MEDIAKEY and KEY owner
########################################################################
########################################################################
@ -328,18 +338,44 @@ IPNSLINK=$(ipfs key list -l | grep ${MEDIAKEY} | cut -d ' ' -f 1)
| sed "s/\${TITLE}/$TITLE/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
### PATCH TW5 (TODO SPLIT TEMPLATES & DIFFERENTIATE MIMETYPE TIDDLERS)
echo "=======> Mediakey TW5 /ipns/$KEY"
cp ~/.zen/Astroport.ONE/templates/dreamcatcher.html ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null)
sed -i "s~_MOATS_~${MOATS}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
sed -i "s~_PLAYER_~${XZUID}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
sed -i "s~_PSEUDO_~${PSEUDO}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
sed -i "s~_G1PUB_~${G1PUB}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
sed -i "s~_TITRE_~${TITLE}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
sed -i "s~_IPFSROOT_~${IPFSREPFILEID}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
sed -i "s~_IPFSID_~${IPFSID}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
MIME=$(file --mime-type "$HOME/astroport/${TYPE}/${REFERENCE}/${file}" | cut -d ':' -f 2 | cut -d ' ' -f 2)
sed -i "s~_MIME_~${MIME}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
sed -i "s~_MEDIAKEY_~${MEDIAKEY}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
sed -i "s~_KEY_~${KEY}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
# Configure IPNS publication key
sed -i "s~k2k4r8naeti1ny2hsk3a0ziwz22urwiu633hauluwopf4vwjk4x68qgk~${KEY}~g" ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
### PATCH TW5
## SECOND REDIRECT PAGE ${MEDIAKEY}/${G1PUB}/index.html
# https://tube.copylaradio.com/ipns/$IPNSLINK/${G1PUB}/
#envsubst < ../www/boris/youtube_watch_step3.html > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
echo "=======> Mediakey Contract index.html "
cat /home/$YOU/.zen/astrXbian/www/boris/youtube_watch_step3.html \
| sed "s/\${TITLE}/$TITLE/g" \
| sed "s/\${IPFSNODEID}/$IPFSNODEID/g" \
| sed "s/\${XZUID}/$XZUID/g" \
| sed "s/\${IPFSREPFILEID}/$IPFSREPFILEID/g" \
| sed "s/\${URLENCODE_FILE_NAME}/$URLENCODE_FILE_NAME/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
# echo "=======> Mediakey Contract index.html "
# cat /home/$YOU/.zen/astrXbian/www/boris/youtube_watch_step3.html \
# | sed "s/\${TITLE}/$TITLE/g" \
# | sed "s/\${IPFSNODEID}/$IPFSNODEID/g" \
# | sed "s/\${XZUID}/$XZUID/g" \
# | sed "s/\${IPFSREPFILEID}/$IPFSREPFILEID/g" \
# | sed "s/\${URLENCODE_FILE_NAME}/$URLENCODE_FILE_NAME/g" \
# > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
# echo "<meta http-equiv=\"Refresh\" content=\"0;URL=http://127.0.0.1:8080/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
@ -453,14 +489,18 @@ then
]
' >> ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json
echo "Add tidller into Station Balise"
cp ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/tiddler.json
echo "SEND TW json to GCHANGE (call from g1-compagnon"
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" send -d "$3" -t "MEDIAKEY ${MEDIAKEY}" -m "MEDIA : https;//astroport.com/ipfs/${IPFSREPFILEID} + TW https;//astroport.com/ipns/$IPFSNODEID/.$IPFSNODEID/KEY/${MEDIAKEY}/${G1PUB}/tiddler.json "
# Will be used by caroussel.html template
# CAROUSSEL=$(ipfs add -wq ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json | head-n 1)
# COPY TIDDLER JSON TO DESKTOP Journal/${TYPE}
[[ "$USER" != "xbian" && -d ~/Bureau ]] && mkdir -p ~/Bureau/Journal/${TYPE} && cp ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json "$HOME/Bureau/Journal/${TYPE}/${TITLE}.dragdrop.json" && xdg-open "~/Bureau/Journal/${TYPE}/"
[[ "$USER" != "xbian" && -d ~/Desktop ]] && mkdir -p ~/Desktop/Journal/${TYPE} && cp ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json "$HOME/Desktop/Journal/${TYPE}/${TITLE}.dragdrop.json" && xdg-open "~/Desktop/Journal/${TYPE}/"
[[ "$USER" != "xbian" && -d ~/Bureau ]] && mkdir -p ~/Bureau/Journal/${TYPE} && cp ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json "$HOME/Bureau/Journal/${TYPE}/${TITLE}.dragdrop.json" && xdg-open "$HOME/Bureau/Journal/${TYPE}/"
[[ "$USER" != "xbian" && -d ~/Desktop ]] && mkdir -p ~/Desktop/Journal/${TYPE} && cp ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json "$HOME/Desktop/Journal/${TYPE}/${TITLE}.dragdrop.json" && xdg-open "$HOME/Desktop/Journal/${TYPE}/"
fi
@ -507,5 +547,5 @@ echo "#### EXCECUTION TIME"
end=`date +%s`
echo Execution time was `expr $end - $start` seconds.
echo "########################################################################"
zenity --warning --width 300 --text "Votre MEDIA a rejoint ASTROPORT en `expr $end - $start` secondes"
[[ ! $3 ]] && zenity --warning --width 300 --text "Votre MEDIA a rejoint ASTROPORT en `expr $end - $start` secondes"
exit 0

View File

@ -41,37 +41,37 @@ IPFSNODEID=$(ipfs id -f='<id>\n')
G1PUB=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
echo "G1SSB Wallet: $G1PUB
IPFS: $IPFSNODEID
__ __ _ _ _______
__ __ _ _ _______
_______ _ __ | \/ | / \ | |/ / ____|
|_ / _ \ '_ \ | |\/| | / _ \ | ' /| _|
/ / __/ | | | | | | |/ ___ \| . \| |___
|_ / _ \ '_ \ | |\/| | / _ \ | ' /| _|
/ / __/ | | | | | | |/ ___ \| . \| |___
/___\___|_| |_| |_| |_/_/ \_\_|\_\_____|
"
########################################################################
# ZenTag is an IPFS/IPNS datastructure shared into IPFS, publish
# ZenTag is an IPFS/IPNS datastructure shared into IPFS, publish
# ~~~ Draft ~~~~ Draft ~~~~ Draft ~~~~ Draft ~~~~ Draft ~~~~
# _chain # ZenTag IPFS Hash
# _chain.n # Sequence Number
# _chain.nanodate # Current nanodate
# _chain.prev # Previous IPFS Hash
# _g1.node.creator # G1SSB wallet pubkey
# _tag.issuer # G1TX ISSUER pubkey
# _tag.zensource # G1TX HASH or SSB timestamp
# _ipfs.node.creatorcat # NODE IPFS ID
# _ipfs.publishkey.BB.aes # BB SYMcypher of IPNS publish key
# _ipfs.publishkey.crypt # G1SSB ASYMcypher of IPNS publish key
# _tag.BB.sha # BB sha256sum
# _tag.uid # ZenTag UID
# _tag.zen # ZentTag balance
# _ipns # /ipns/ address
# _chain # ZenTag IPFS Hash
# _chain.n # Sequence Number
# _chain.nanodate # Current nanodate
# _chain.prev # Previous IPFS Hash
# _g1.node.creator # G1SSB wallet pubkey
# _tag.issuer # G1TX ISSUER pubkey
# _tag.zensource # G1TX HASH or SSB timestamp
# _ipfs.node.creatorcat # NODE IPFS ID
# _ipfs.publishkey.BB.aes # BB SYMcypher of IPNS publish key
# _ipfs.publishkey.crypt # G1SSB ASYMcypher of IPNS publish key
# _tag.BB.sha # BB sha256sum
# _tag.uid # ZenTag UID
# _tag.zen # ZentTag balance
# _ipns # /ipns/ address
# PASSENGER FILE (put to IPFS and cypher link in IPNS ZenTag)
# _passenger.filename # Passenger filename
# _passenger.ipfs.crypt # G1SSB cyphered IPFS Passenger link
# _passenger.read # Zen value asked for READING
# _passenger.park # Zen value paid for PARKING
# _passenger.filename # Passenger filename
# _passenger.ipfs.crypt # G1SSB cyphered IPFS Passenger link
# _passenger.read # Zen value asked for READING
# _passenger.park # Zen value paid for PARKING
# Only if contract executed => add new cyphered links
# _passenger.contract.sh # Zen CONTRACT TODO
# _passenger.contract.sh # Zen CONTRACT TODO
# COmpare with code to verify and extend Draft
# TODO: Could be converted into yaml or json if you like...
########################################################################
@ -85,39 +85,39 @@ if [[ "$METADATA" == "" ]]; then
echo "
# LOVE BANK - PrePaid Card ZenTag
# FULLY BACKED ON IRL G1 LIBRE MONEY (https://cesium.app)
# ____ ____ _____ _____ _ _
# / ___| _ \| ____| ____| \ | | _______ _ __
# | | _| |_) | _| | _| | \| | |_ / _ \ '_ \
# ____ ____ _____ _____ _ _
# / ___| _ \| ____| ____| \ | | _______ _ __
# | | _| |_) | _| | _| | \| | |_ / _ \ '_ \
# | |_| | _ <| |___| |___| |\ | / / __/ | | |
# \____|_| \_\_____|_____|_| \_| /___\___|_| |_|
#
#
"
# COMMENT WILL BREAK (G1 <=> ZEN) STRICT RELATION
[[ ! -f ~/.zen/cache/g1_TX_inputs/zen.$ZENSOURCE ]] && echo "ERROR# UNKNOWN ~/.zen/cache/g1_TX_inputs/zen.$ZENSOURCE !!" && exit 1
ISSUER=$(cat ~/.zen/cache/g1_TX_inputs/zen.$ZENSOURCE)
[[ $ISSUER == "" ]] && echo "ERROR# NO ISSUER FOUND FOR TX $ZENSOURCE !!" && exit 1
[[ $ISSUER == "" ]] && echo "ERROR# NO ISSUER FOUND FOR TX $ZENSOURCE !!" && exit 1
echo "ISSUER = $ISSUER SENT TX $ZENSOURCE !!"
else
echo "
_|_ o ._ _ _ _ _|_ _. ._ _ ._
|_ | | | | (/_ _> |_ (_| | | | |_)
|
_|_ o ._ _ _ _ _|_ _. ._ _ ._
|_ | | | | (/_ _> |_ (_| | | | |_)
|
SSB PASSENGER ~/.zen/miam/$ZENSOURCE
"
[[ ! -d ~/.zen/miam/$ZENSOURCE ]] && echo "ERROR# UNKNOWN ~/.zen/miam/$ZENSOURCE !!" && exit 1
ISSUER=$(cat ~/.zen/miam/$ZENSOURCE/msg_key)
[[ $ISSUER == "" ]] && echo "ERROR# NO ISSUER FOUND FOR miam $ZENSOURCE !!" && exit 1
[[ $ISSUER == "" ]] && echo "ERROR# NO ISSUER FOUND FOR miam $ZENSOURCE !!" && exit 1
echo "ISSUER = SSB Message $ISSUER !!"
fi
########################################################################
# CREATE ZEN TAG
# CREATE ZEN TAG
########################################################################
# Produce unique 6 words diceware to give a name _tag.uid
AA=$(echo $($MY_PATH/tools/diceware.sh 6 | xargs) | sed s/\ /_/g ) # ZenTag Name = Diceware_6_words
@ -126,12 +126,12 @@ AAH=$(echo -n ${AA} | sha256sum | cut -d ' ' -f 1) # ZenTag Name SHA256
# TODO ACTIVATE SWARM UNICITY CHECK
# Create Unique Zentag for all IPFS SWARM!
while [[ $(grep -Rwl "$AA" ~/.zen/ipfs_swarm/.12D3KooW*/TAG/*/_tag.uid) ]]; do
AA=$(echo $($MY_PATH/tools/diceware.sh 6 | xargs) | sed s/\ /_/g )
AAH=$(echo -n ${AA} | sha256sum | cut -d ' ' -f 1)
AA=$(echo $($MY_PATH/tools/diceware.sh 6 | xargs) | sed s/\ /_/g )
AAH=$(echo -n ${AA} | sha256sum | cut -d ' ' -f 1)
done
# BB key is a 4 word diceware printed on QRCode for Human use.
# SHA256 PASSWORD CHECK FOR ALLOWING WRITE ACTION
# SHA256 PASSWORD CHECK FOR ALLOWING WRITE ACTION
BB=$($MY_PATH/tools/diceware.sh 4 | xargs);
BBH=$(echo -n "$BB" | sha256sum | cut -d ' ' -f 1)
@ -141,14 +141,14 @@ BBH=$(echo -n "$BB" | sha256sum | cut -d ' ' -f 1)
mkdir -p ~/.zen/tag/${AAH}
# LOG
echo "
_____ _____ _ ____
_____ _____ _ ____
|__ /___ _ _|_ _|/ \ / ___| __/\__
/ // _ \ °_ \| | / _ \| | _ \ /
/ /| __/ | | | |/ ___ \ |_| | /_ _\
/____\___|_| |_|_/_/ \_\____| \/
/ /| __/ | | | |/ ___ \ |_| | /_ _\
/____\___|_| |_|_/_/ \_\____| \/
*******************************************************
| $AA | $ZEN Zen
| $AA | $ZEN Zen
*******************************************************
CREATING ~/.zen/tag/${AAH}/
"
@ -159,8 +159,8 @@ echo "$ZEN" > ~/.zen/tag/${AAH}/_tag.zen # Tag ZEN amount
echo "${IPFSNODEID}" > ~/.zen/tag/${AAH}/_ipfs.node.creator # NODE IPFS ID
echo "$ZENSOURCE" > ~/.zen/tag/${AAH}/_tag.zensource # ZENSOURCE
echo "$G1PUB" > ~/.zen/tag/${AAH}/_g1.node.creator # CREATOR IPFS NODE G1PUBKEY
echo "$ISSUER" > ~/.zen/tag/${AAH}/_tag.issuer # TX ISSUER G1PUBKEY OR SSB_MESSAGE ID
echo "$ISSUER" > ~/.zen/tag/${AAH}/_tag.issuer # TX ISSUER G1PUBKEY OR SSB_MESSAGE ID
########################################################################
# Create IPNS publishing key ${AA}.key
# =====================================
@ -170,7 +170,7 @@ echo "$ISSUER" > ~/.zen/tag/${AAH}/_tag.issuer # TX ISSUER G1PUBKEY OR SSB_MESSA
########################################################################
#timestamp=$(date -u +%s%N | cut -b1-13)
keyname="${ZENSOURCE}_${AA}.key"
[[ ! $(ipfs key list | grep -F ${AA}.key) ]] && J0=$(ipfs key gen -t rsa -s 2048 $keyname)
[[ ! $(ipfs key list | grep -F ${AA}.key) ]] && J0=$(ipfs key gen -t rsa -s 2048 $keyname)
# WRITE BBH for QRCode BB verification
echo "$BBH" > ~/.zen/tag/${AAH}/_tag.BB.sha
# BB pgp symetric publishkey
@ -185,9 +185,9 @@ CYPHERING PUBLISH KEY
__ _
_/_/ __/|_ __/|_ | |
/ / | / | / / /
/ / /_ __| /_ __| / /
/ / |/ |/ _/_/
|_| /_/
/ / /_ __| /_ __| / /
/ / |/ |/ _/_/
|_| /_/
KEY : $BB
BBH : $BBH
@ -196,61 +196,61 @@ BBH : $BBH
# PASSENGER FILE is added to IPFS (then link is cyphered: NO!)
# https://beechat.network/how-beechats-encryption-works/
# SECURITY IS OBSOLETE AS WE ARE SHARING COPY WITH FRIENDS ;)
# ACTIVATE ZEN CONTRACT... 100 readers impresari
# ACTIVATE ZEN CONTRACT... 100 readers impresari
# LOVE ECONOMY IS FREE. EVERYBODY IS DONATING TO THE OTHERS NOW.
# INCOME != MONEY FORGE (Realtive Moey Theory applies HERE)
# CODE WILL BE CERTIFIED AS IPFS HASH.
if [[ -f $PASSENGER ]]; then
echo "
_ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \
_ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \
( p | a | s | s | e | n | g | e | r )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
"
# SEARCH FOR SAME SOURCE in IPFS... Not to make it twice...
CHECKSWARM=$(grep -Rwl "$ZENSOURCE" ~/.zen/ipfs_swarm/.12D3KooW*/TAG/*/_tag.zensource | tail -n 1 | cut -f 6 -d '/')
[[ $CHECKSWARM == "" ]] && CHECKSWARM=$(grep -Rwl "$ZENSOURCE" ~/.zen/ipfs/.$IPFSNODEID/TAG/*/_tag.zensource | tail -n 1 | cut -f 6 -d '/')
[[ -s ~/.zen/ipfs/.$IPFSNODEID/TAG/$ZENSOURCE/_tag.issuer ]] && ISSUERSWARM=$(cat ~/.zen/ipfs/.$IPFSNODEID/TAG/$ZENSOURCE/_tag.issuer)
[[ "$CHECKSWARM" != "" && "$ISSUERSWARM" == "$ISSUER" ]] && ipfs key rm $keyname && rm -Rf ~/.zen/tag/${AAH} \
&& echo "$ZENSOURCE ALREADY COPIED IN IPFS SWARM. $CHECKSWARM CANCEL" && exit 1
# NO DUPLICATE
# SEARCH FOR SAME SOURCE in IPFS... Not to make it twice...
CHECKSWARM=$(grep -Rwl "$ZENSOURCE" ~/.zen/ipfs_swarm/.12D3KooW*/TAG/*/_tag.zensource | tail -n 1 | cut -f 6 -d '/')
[[ $CHECKSWARM == "" ]] && CHECKSWARM=$(grep -Rwl "$ZENSOURCE" ~/.zen/ipfs/.$IPFSNODEID/TAG/*/_tag.zensource | tail -n 1 | cut -f 6 -d '/')
[[ -s ~/.zen/ipfs/.$IPFSNODEID/TAG/$ZENSOURCE/_tag.issuer ]] && ISSUERSWARM=$(cat ~/.zen/ipfs/.$IPFSNODEID/TAG/$ZENSOURCE/_tag.issuer)
[[ "$CHECKSWARM" != "" && "$ISSUERSWARM" == "$ISSUER" ]] && ipfs key rm $keyname && rm -Rf ~/.zen/tag/${AAH} \
&& echo "$ZENSOURCE ALREADY COPIED IN IPFS SWARM. $CHECKSWARM CANCEL" && exit 1
# NO DUPLICATE
echo "ADDING TO IPFS.................$(date)"
# ADD PASSENGER TO IPFS # COULD BE SUPER LONG !!!
IPASSENGER=$(ipfs add -q "$PASSENGER" -w | tail -n 1)
# TODO COMPARE DISK WRITING SPEED AND AVAILABLE SPACE TO CHOOSE BEST IN SWARM
echo "$(date) ............... YES /ipfs/$IPASSENGER"
echo "$IPASSENGER" > ~/.zen/tag/${AAH}/_passenger.ipfs
# GET FILE NAME
PASSENGERNAME=$(basename -- "$PASSENGER")
echo "$PASSENGERNAME" > ~/.zen/tag/${AAH}/_passenger.filename
echo "ADDING TO IPFS.................$(date)"
# ADD PASSENGER TO IPFS # COULD BE SUPER LONG !!!
IPASSENGER=$(ipfs add -q "$PASSENGER" -w | tail -n 1)
# TODO COMPARE DISK WRITING SPEED AND AVAILABLE SPACE TO CHOOSE BEST IN SWARM
echo "$(date) ............... YES /ipfs/$IPASSENGER"
# G1SSB NODE ACCESS
$MY_PATH/tools/natools.py encrypt -p $G1PUB -i ~/.zen/tag/${AAH}/_passenger.ipfs -o ~/.zen/tag/${AAH}/_passenger.ipfs.crypt
# BB OWNER ACCESS
openssl aes-256-cbc -pbkdf2 -k "$BB" -salt -in ~/.zen/tag/${AAH}/_passenger.ipfs -out ~/.zen/tag/${AAH}/_passenger.ipfs.BB.aes
echo "$IPASSENGER" > ~/.zen/tag/${AAH}/_passenger.ipfs
# GET FILE NAME
PASSENGERNAME=$(basename -- "$PASSENGER")
echo "$PASSENGERNAME" > ~/.zen/tag/${AAH}/_passenger.filename
# CLEAN CLEARTEXT IPFS link ? LATER MAYBE
rm ~/.zen/tag/${AAH}/_passenger.ipfs
# G1SSB NODE ACCESS
$MY_PATH/tools/natools.py encrypt -p $G1PUB -i ~/.zen/tag/${AAH}/_passenger.ipfs -o ~/.zen/tag/${AAH}/_passenger.ipfs.crypt
# BB OWNER ACCESS
openssl aes-256-cbc -pbkdf2 -k "$BB" -salt -in ~/.zen/tag/${AAH}/_passenger.ipfs -out ~/.zen/tag/${AAH}/_passenger.ipfs.BB.aes
# ZEN ECONOMY: ZEN READ payment + PARK rental
echo "$READ" > ~/.zen/tag/${AAH}/_passenger.read
echo "$PARK" > ~/.zen/tag/${AAH}/_passenger.park
# CLEAN CLEARTEXT IPFS link ? LATER MAYBE
rm ~/.zen/tag/${AAH}/_passenger.ipfs
# ZEN ECONOMY: ZEN READ payment + PARK rental
echo "$READ" > ~/.zen/tag/${AAH}/_passenger.read
echo "$PARK" > ~/.zen/tag/${AAH}/_passenger.park
echo "
_passenger.filename : $PASSENGERNAME
_passenger.ipfs : $IPASSENGER
http://127.0.0.1:8080/ipfs/$IPASSENGER/$PASSENGERNAME
# #### ## ##### ###### #####
# # # # # # # # # #
# # # # # # # ##### # #
# # # ###### # # # # #
# # # # # # # # # #
###### #### # # ##### ###### #####
# #### ## ##### ###### #####
# # # # # # # # # #
# # # # # # # ##### # #
# # # ###### # # # # #
# # # # # # # # # #
###### #### # # ##### ###### #####
##################################################################
# DECODE AND READ _passenger.ipfs with BB Passphrase
@ -273,12 +273,12 @@ echo
#You must execute that code.
# ..... TODO ......
# It is bash or javascript or python
# or any language code with connection with g1, ipfs or ssb
# or any language code with connection with g1, ipfs or ssb
# or Send $READ Zen to $G1PUB with $PASSENGERNAME in comment
# .... TODO ....
# Once contract is validated
# Once contract is validated
# NodeN will be able to decrypt _passenger.ipfs.NodeN.crypt'
exit 0
@ -286,13 +286,13 @@ exit 0
EOF
fi
# END PASSENGER FILE
# END PASSENGER FILE
####################
###########################################################
# Copy TAG into IPFS + ipfs name publish -k ${AA}.key
# Copy TAG into IPFS + ipfs name publish -k ${AA}.key
###########################################################
# ZenTAG CHAIN
# ZenTAG CHAIN
echo "0" > ~/.zen/tag/${AAH}/_chain.n # Tag modification number (0 first)
NANODATE=$(date -u +%s%N)
@ -307,7 +307,7 @@ I=$(ipfs add -qr ~/.zen/tag/${AAH} | tail -n 1)
echo "${I}" > ~/.zen/tag/${AAH}/_chain
echo "
_|_ _.o._
_|_ _.o._
(_| |(_||| | : $NANODATE
J0=${J0}
@ -329,37 +329,37 @@ echo "${ISSUER}" > ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/_tag.issuer
echo "${J}" > ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/_tag.ipns
if [[ "${PASSENGERNAME}" != "" ]]; then
echo "${PASSENGERNAME}" > ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/_tag.passenger.filename
# COPY METADATA!! TODO : Please Extend filesource FOR new metadata types. torrent ?
extractor=$(cat "$METADATA" | jq -r '.extractor')
youtubeid=$(cat "$METADATA" | jq -r '.id')
fulltitle=$(cat "$METADATA" | jq -r '.fulltitle')
echo "$fulltitle" > ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/_tag.passenger.fulltitle
# description=$(cat "$METADATA" | jq -r '.description')
artist=$(cat "$METADATA" | jq -r '.artist')
album=$(cat "$METADATA" | jq -r '.album')
duration=$(cat "$METADATA" | jq -r '.duration')
upload_date=$(cat "$METADATA" | jq -r '.upload_date')
uploader_id=$(cat "$METADATA" | jq -r '.uploader_id')
extractor=$(cat "$METADATA" | jq -r '.extractor')
[[ ! -f ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/_tag.passenger.metadata.${extractor}.json ]] \
&& cp -f "${METADATA}" /tmp/
mv /tmp/${youtubeid}.info.json ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/_tag.passenger.metadata.${extractor}.json
echo "${PASSENGERNAME}" > ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/_tag.passenger.filename
# COPY METADATA!! TODO : Please Extend filesource FOR new metadata types. torrent ?
extractor=$(cat "$METADATA" | jq -r '.extractor')
youtubeid=$(cat "$METADATA" | jq -r '.id')
fulltitle=$(cat "$METADATA" | jq -r '.fulltitle')
echo "$fulltitle" > ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/_tag.passenger.fulltitle
# description=$(cat "$METADATA" | jq -r '.description')
artist=$(cat "$METADATA" | jq -r '.artist')
album=$(cat "$METADATA" | jq -r '.album')
duration=$(cat "$METADATA" | jq -r '.duration')
upload_date=$(cat "$METADATA" | jq -r '.upload_date')
uploader_id=$(cat "$METADATA" | jq -r '.uploader_id')
extractor=$(cat "$METADATA" | jq -r '.extractor')
[[ ! -f ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/_tag.passenger.metadata.${extractor}.json ]] \
&& cp -f "${METADATA}" /tmp/
mv /tmp/${youtubeid}.info.json ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/_tag.passenger.metadata.${extractor}.json
fi
ls ~/.zen/ipfs/.$IPFSNODEID/TAG/${ZENSOURCE}/
IWALLETS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
IWALLETS=$(ipfs add -rHq $(readlink ~/.zen/ipfs) | tail -n 1)
NODEIPNS=$(ipfs name publish --quieter /ipfs/$IWALLETS)
echo "
_ ____
_ ____
(_)___ / __/____
/ / __ \/ /_/ ___/
/ / /_/ / __(__ )
/_/ .___/_/ /____/
/_/
/ / /_/ / __(__ )
/_/ .___/_/ /____/
/_/
ipfs ls /ipfs/${I}
ZenTAG : ipfs ls /ipns/${J}
@ -371,8 +371,8 @@ NODE index : ipfs ls /ipns/$IPFSNODEID/.$IPFSNODEID/TAG/${ZENSOURCE}
### PRINTER IS HOOKED TO G1SSB NODE = G1DAB
########################################################################
echo "
_ _ _ _ _ _
/ \|_) / / \| \|_
_ _ _ _ _ _
/ \|_) / / \| \|_
\_X| \ \_\_/|_/|_ .................................
"
# READ QRCODE
@ -381,8 +381,8 @@ qrencode -s 5 -o ~/.zen/tag/${AAH}/_QRCODE.read.png "RJ:${AA}#${J}"
qrencode -s 5 -o ~/.zen/tag/${AAH}/_QRCODE.write.png "BJ:${BB}#${J}"
## TODO PROD REMOVE WRITE FILE
echo "QRCodes CREATED !!
See it :
echo "QRCodes CREATED !!
See it :
xviewer ~/.zen/tag/${AAH}/_QRCODE.read.png &
xviewer ~/.zen/tag/${AAH}/_QRCODE.write.png &
@ -397,7 +397,7 @@ ${AA}
# SBOT PUBLISH
########################################################################
if [[ "${PASSENGERNAME}" != "" ]]; then
echo "$ISSUER"
echo "$ISSUER"
msg="$(sbotc get '{"id":"'"$ISSUER"'"}')"
# echo "$msg" | jq #DEBUG
[[ $msg == "" ]] && echo "ERROR No SSB message for PASSENGER (timestamp: $tstamp)" && exit 1
@ -405,13 +405,13 @@ if [[ "${PASSENGERNAME}" != "" ]]; then
[[ $msg_root == "null" ]] && msg_root=$ISSUER
msg_branch=$(printf %s "$msg" | jq -r .value.content.branch)
[[ $msg_branch == "null" ]] && msg_branch=$ISSUER
# ATTACH ~/.zen/miam/$ZENSOURCE/ssb_thumb.jpg
name="ssb_thumb.jpg"
id="$(sbotc blobs.add < ~/.zen/miam/$ZENSOURCE/ssb_thumb.jpg)"
type="$(file -b --mime-type ~/.zen/miam/$ZENSOURCE/ssb_thumb.jpg)"
size="$(wc -c < ~/.zen/miam/$ZENSOURCE/ssb_thumb.jpg)"
# ATTACH ~/.zen/miam/$ZENSOURCE/ssb_thumb.jpg
name="ssb_thumb.jpg"
id="$(sbotc blobs.add < ~/.zen/miam/$ZENSOURCE/ssb_thumb.jpg)"
type="$(file -b --mime-type ~/.zen/miam/$ZENSOURCE/ssb_thumb.jpg)"
size="$(wc -c < ~/.zen/miam/$ZENSOURCE/ssb_thumb.jpg)"
export MESSAGE=$(cat << EOF
[![ssb_thumb.jpg](${id})](http://127.0.0.1:8080/ipfs/$IPASSENGER/$PASSENGERNAME)
@ -432,10 +432,10 @@ if [[ "${PASSENGERNAME}" != "" ]]; then
#astroport
EOF
)
echo "
__ _ ____
(_ |_)/ \|
__ _ ____
(_ |_)/ \|
__)|_)\_/| POST
root: $msg_root