Merge branch 'master'

Conflicts:
	install.sh
This commit is contained in:
Yann Autissier 2022-06-26 20:47:28 +02:00
commit c1aa201afd
308 changed files with 96157 additions and 1409 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
__pycache__
www/boris/me
www/boris/swarm

View File

@ -31,7 +31,7 @@ SITE_IDENTIFIER = 'astroport'
SITE_NAME = 'ASTROPORT _PROFIL_ (_LOGIN_) (_MDP_)'
SITE_DESC = 'Partage ~/astroport/films (animes, series) avec ses amis https://gchange.fr (https://cesium.app ) via IPFS'
URL_MAIN = 'http://127.0.0.1:8181/ipns/_IPFSNODEID_/._IPFSNODEID_/'
URL_MAIN = 'http://127.0.0.1:8080/ipns/_IPFSNODEID_/._IPFSNODEID_/'
KEY_PASTE_ID = 'PASTE_ID'
SETTING_PASTE_ID = SITE_IDENTIFIER + '_id_'

View File

@ -226,7 +226,7 @@
<setting id="services.useairplaypassword" default="true">false</setting>
<setting id="services.webserver">true</setting>
<setting id="services.webserverpassword" default="true"></setting>
<setting id="services.webserverport">8181</setting>
<setting id="services.webserverport">8081</setting>
<setting id="services.webserverssl" default="true">false</setting>
<setting id="services.webserverusername">xbmc</setting>
<setting id="services.webskin" default="true">webinterface.default</setting>

View File

@ -1,6 +1,6 @@
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Astroport/Kodi
Name=Astroport
Exec=/home/_USER_/.zen/astrXbian/ajouter_video.sh
Icon=/home/_USER_/.zen/astrXbian/logo96.png
Type=Application

View File

@ -17,22 +17,19 @@ sudo true
## Error funciton
err() {
echo -e "ERREUR: $1"
exit 1
echo -e "ERREUR: $1"
exit 1
}
# CHECK if daemon is already running
if [[ $(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) ]]; then
echo "ipfs daemon already running...! Must STOP ipfs AND remove ~/.ipfs to install again !!"
ipfs id && echo "ipfs swarm peers: " && ipfs swarm peers
echo "ipfs bootstrap list: " && ipfs bootstrap list
echo "Please RUN : sudo service ipfs stop"
exit 1
ipfs id && echo "ipfs swarm peers: " && ipfs swarm peers
echo "ipfs bootstrap list: " && ipfs bootstrap list
echo "ipfs daemon already running...!"
exit 0
fi
[[ -d ~/.ipfs ]] && echo "IPFS install exist! Please remove or backup before executing this script" && exit 1
echo -e "Astroport IPFS Layer installation..."
echo -e "Astroport activate IPFS Layer installation..."
# CHECK node IP isLAN?
myIP=$(hostname -I | awk '{print $1}')
@ -40,36 +37,18 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
curl -s https://dist.ipfs.io/ipfs-update/v1.6.0/ipfs-update_v1.6.0_linux-amd64.tar.gz -o $MY_PATH/ipfs-update.tar.gz
elif [ ${MACHINE_TYPE:0:3} == 'arm' ]; then
curl -s https://dist.ipfs.io/ipfs-update/v1.6.0/ipfs-update_v1.6.0_linux-arm.tar.gz -o $MY_PATH/ipfs-update.tar.gz
else
[ ! -f $MY_PATH/ipfs-update.tar.gz ] && err "Your $MACHINE_TYPE is not supported yet... Please add an issue."
fi
echo "INSTALL ipfs-update >>>>>>>>>>>>>>>>>>>>>>>>>>"
sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err "Untar ipfs-update"
rm $MY_PATH/ipfs-update.tar.gz
cd /usr/src/ipfs-update/
sudo ./install.sh || err "Install ipfs-update"
cd $MY_PATH
echo "INSTALL ipfs 0.7.0 >>>>>>>>>>>>>>>>>>>>>>>>>>"
sudo ipfs-update install 0.7.0 || err "Install IPFS"
# INIT ipfs
[[ $isLAN ]] && ipfs init -p lowpower \
|| ipfs init -p server
## Special Xbian init.d config
if [[ "$USER" == "xbian" ]]; then
sudo cp ~/.zen/astrXbian/.install/templates/ipfs/ipfs-initV.sh /etc/init.d/ipfs
sudo chmod 755 /etc/init.d/ipfs
sudo touch /var/log/ipfs.log && sudo chown xbian /var/log/ipfs.log
sudo cp ~/.zen/astrXbian/.install/templates/ipfs/ipfs-initV.sh /etc/init.d/ipfs
sudo chmod 755 /etc/init.d/ipfs
sudo touch /var/log/ipfs.log && sudo chown xbian /var/log/ipfs.log
else
## DEBIAN
echo "CREATE SYSTEMD ipfs SERVICE >>>>>>>>>>>>>>>>>>"
## DEBIAN
echo "CREATE SYSTEMD ipfs SERVICE >>>>>>>>>>>>>>>>>>"
cat > /tmp/ipfs.service <<EOF
[Unit]
Description=IPFS daemon
@ -86,12 +65,12 @@ CPUQuota=60%
WantedBy=multi-user.target
EOF
sudo cp -f /tmp/ipfs.service /etc/systemd/system/
sudo sed -i "s/_USER_/$USER/g" /etc/systemd/system/ipfs.service
sudo cp -f /tmp/ipfs.service /etc/systemd/system/
sudo sed -i "s/_USER_/$USER/g" /etc/systemd/system/ipfs.service
[[ -d ~/.ipfs ]] && sudo chown -R $USER:$USER ~/.ipfs
sudo systemctl daemon-reload
sudo systemctl enable ipfs
[[ -d ~/.ipfs ]] && sudo chown -R $USER:$USER ~/.ipfs
sudo systemctl daemon-reload
sudo systemctl enable ipfs
fi
@ -109,14 +88,18 @@ ipfs config Datastore.StorageMax $diskSize
## Activate Rapid "ipfs p2p"
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-Methods '["PUT", "GET", "POST"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'
######### CLEAN DEFAULT BOOTSTRAP TO STAY INVISIBLE ###########
ipfs bootstrap rm --all
###########################################
# BOOTSTRAP NODES ARE ADDED LATER
###########################################
# AVOID CONFLICT WITH KODI REMOTE
ipfs config Addresses.Gateway "/ip4/127.0.0.1/tcp/8181"
# AVOID CONFLICT WITH KODI ./.install/.kodi/userdata/guisettings.xml
ipfs config Addresses.Gateway "/ip4/0.0.0.0/tcp/8080"
[[ "$USER" != "xbian" ]] && sudo systemctl restart ipfs

View File

@ -0,0 +1,28 @@
#!/bin/bash
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
######## YOUTUBE-DL ##########
## NOW INSTALL yt-dlp AND LINK TO youtube-dl
# _ _ _
#| | _____ __| (_)
#| |/ / _ \ / _` | |
#| < (_) | (_| | |
#|_|\_\___/ \__,_|_|
# COPY UQLOAD LINKS DETECTED IN KODI LOG
##############################################
### TODO INSTALL FROM START and AUTO SCRAPE KODI LOG
##############################################
if [[ ! -f $HOME/.local/bin/uqload_downloader ]]; then
cd /tmp
git clone https://github.com/papiche/uqload_downloader.git
cd uqload_downloader/cli
./download_from_kodi_log.sh
[[ -f $HOME/.local/bin/uqload_downloader ]] && zenity --warning --width ${large} --text "INSTALLATION download_from_kodi_log.sh OK"
cp download_from_kodi_log.sh $HOME/.local/bin/
else
## UTILISEZ $HOME/.local/bin/download_from_kodi_log.sh
zenity --warning --width ${large} --text "UTILISEZ download_from_kodi_log.sh en ligne de commande..."
exit 0
fi

11
.install/nvh/README.md Normal file
View File

@ -0,0 +1,11 @@
# Create custom Nginx reverse proxy easily
Create a reverse proxy for domain tata.toto.com go to port 80 of device 192.168.1.27, with auto-https and 443 redirection:
`./nvh.sh tata.toto.com 192.168.1.27 80 ssl=1`
Create a reverse proxy for my service on localhost on port 10010, no https:
`./nvh.sh mylocalservice.fr 127.0.0.1 10010`
TODO: Add option to configure a webserver, and option for php-fpm7.4 server
enjoy

116
.install/nvh/nvh.sh Executable file
View File

@ -0,0 +1,116 @@
#/bin/bash
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
bold=`tput bold`
blue=`tput setaf 4`
reset=`tput sgr0`
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
sslRedir="$MY_PATH/ssl-bloc-redirect.txt"
tplVHost="$MY_PATH/templates/vhost.txt"
###
# Get Arguments
###
args="$@"
domain="$1"
ip="$2"
port="$3"
parseArgs(){
i=0
for cmd in $args; do
arg[$i]=$cmd
[[ ${arg[$i]} =~ "domain=" ]] && domain=$(echo ${arg[$i]} | grep "\<domain=" | awk -F '=' '{ print $2 }')
[[ ${arg[$i]} =~ "ip=" ]] && ip=$(echo ${arg[$i]} | grep "\<ip=" | awk -F '=' '{ print $2 }')
[[ ${arg[$i]} =~ "port=" ]] && port=$(echo ${arg[$i]} | grep "\<port=" | awk -F '=' '{ print $2 }')
[[ ${arg[$i]} =~ "ssl=" ]] && ssl=$(echo ${arg[$i]} | grep "\<ssl=" | awk -F '=' '{ print $2 }')
((i++))
done
}
parseArgs
newVHost="/etc/nginx/conf.d/$domain.conf"
[[ $ip == "local" ]] && ip="127.0.0.1"
addSSL(){
echo "${yellow}Création du certificat SSL pour $domain...${reset}"
sudo /usr/bin/certbot --nginx certonly -d $domain && echo "${green}Le certificat de $domain a bien été déployé${reset}" || echo "${red}Une erreur s'est produite lors de la création du certificat SSL${reset}"
sudo sed -i -e 's/listen 80;/listen 443 ssl;/' $newVHost
sudo sed -i -e '/includes\/errors.conf/i \\ listen [::]:443 ssl;\n include includes/ssl.conf;' $newVHost
sudo sed -i -e '/error_log/i \\ ssl_certificate /etc/letsencrypt/live/$domain/fullchain.pem;\n ssl_certificate_key /etc/letsencrypt/live/$domain/privkey.pem;\n' $newVHost
sudo cat $sslRedir | sudo tee -a $newVHost > /dev/null
sudo sed -i -e 's/$domain/'"$domain"'/g' $newVHost
}
if [[ -e $newVHost ]]; then
echo "${yellow}Le virtualhost existe déjà${reset}"
if [[ -z $(grep "ssl_certificate_key" $newVHost) ]]; then
echo "Certificat SSL non présent"
if [[ $ssl =~ ^(1|true|oui)$ ]]; then
echo "Installation du certificat SSL ..."
addSSL
sudo service nginx reload && echo "${green}Le domaine $domain à bien été créé et configuré =)${reset}" || echo "${red}Impossible de recharger nginx${reset}"
exit 0
else
echo "${yellow}Aucune action n'a été effectué${reset}"
exit 0
fi
else
echo "${yellow}Le SSL est déjà configuré sur le VHost${reset}"
exit 0
fi
fi
create_vhost(){
echo "${yellow}Génération du nouveau VirtualHost...${reset}"
sudo cp $tplVHost $newVHost
sudo sed -i -e 's/$_DOMAIN/'"$domain"'/g' $newVHost
sudo sed -i -e 's/$_IP/'"$ip"'/g' $newVHost
sudo sed -i -e 's/$_PORT/'"$port"'/g' $newVHost
if [[ $ssl =~ ^(1|true|oui)$ ]]; then
printf "${yellow}Configuration SSL du VHost...${reset}"
addSSL && echo "${green}OK${reset}" || echo "${red}KO${reset}"
else
echo "${yellow}Aucune configuration SSL ne sera effectué.${reset}"
fi
sudo service nginx reload && echo "${green}Le domaine $domain à bien été créé et configuré =)${reset}" || echo "${red}Impossible de recharger nginx${reset}"
}
echo "Nous allons créer le domaine ${blue}$domain ${reset}qui sera lié au port ${blue}$port ${reset}de l'IP ${blue}$ip.${reset}"
if [[ $p2vmProvided != 1 ]]; then
read -p "${bold}Confirmez-vous cette action ?${reset} (${green}y${reset} ou ${red}n${reset}) : " yn
case $yn in
[Yy]* ) create_vhost break;;
[Nn]* ) echo "${red}Fermeture du script${reset}" && exit;;
* ) echo "Merci de sélectionner yes ou no";;
esac
else
create_vhost
fi
## 1ere analyse
# A priori utiliser avec domain=$IPFSNODEID ip=local port=10101 ssl=no
# [[ ! $(ipfs p2p ls | grep '/x/10101') ]] && ipfs p2p listen /x/10101 /ip4/127.0.0.1/tcp/10101
# Chaque station publie ses services/API sur un port numéroté /x/10101 relayé en 127.0.0.1/tcp/20101
# Elle publie cette information aux bootstrap (gateway) qui prennent en charge le relai https "ipfs p2p"
# [[ ! $(ipfs p2p ls | grep '/x/10101') ]] && ipfs --timeout=5s ping -n 1 /p2p/$IPFSNODEID && ipfs p2p forward /x/10101 /ip4/127.0.0.1/tcp/20101 /p2p/$IPFSNODEID
# A l'autre boût on sort domain=tata.toto.com ip=local port=20101 ssl=yes
## PAR défaut tous publient ~/.zen/astrXbian/www/boris sur leur port 80 / 443 (pour éxécuter l'API PHP)
# Ca ressemble au fonctionnement du ln -s ;)
# ipfs p2p ln -s /p2p/$IPFSNODEID/tcp/10101 /ip4/127.0.0.1/tcp/20101
## Dédier Le canal star1 pour le flux m3u8 webcam activable.
# Utiliser les canaux stars pour publier ses ports à ceux de ses amis du niveau choisi.
# Publier en json !
exit 0

View File

@ -0,0 +1,12 @@
server {
listen 80;
server_name $domain;
include includes/letsencrypt.conf;
if ($host = $domain) {
return 301 https://$host$request_uri;
}
return 404;
}

35
.install/nvh/vhost.txt Normal file
View File

@ -0,0 +1,35 @@
upstream $domain {
server 192.168.9.$ipvm:$port; #Production
#server 192.168.9.9; #Redirection maintenance
}
server {
server_name $domain;
listen 80;
include includes/errors.conf;
location / {
proxy_pass http://$domain;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location /ipfs {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /ipns {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
error_log /var/log/nginx/$domain_error.log;
access_log /var/log/nginx/$domain_access.log;
}

View File

@ -0,0 +1,45 @@
upstream $domain {
server 192.168.9.$ipvm:$port; #Production
#server 192.168.9.9; #Redirection maintenance
}
server {
server_name $domain;
listen 80;
include includes/errors.conf;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files \$uri \$uri/ =404;
}
index index.php;
# pass PHP scripts to FastCGI server
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php-fpm.sock; # Faites le ln -s qui va bien
# With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
}
location /ipfs {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /ipns {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
error_log /var/log/nginx/$domain_error.log;
access_log /var/log/nginx/$domain_access.log;
}

View File

@ -9,13 +9,13 @@ server {
# IPFS GATEWAY PROXY
location /ipfs {
proxy_pass http://127.0.0.1:8181;
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /ipns {
proxy_pass http://127.0.0.1:8181;
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}

View File

@ -13,7 +13,7 @@ server {
index index.php index.html index.htm;
location ~ \.php {
try_files $uri index.php =404;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include /etc/nginx/fastcgi_params;
@ -28,13 +28,13 @@ server {
# IPFS GATEWAY PROXY
location /ipfs {
proxy_pass http://127.0.0.1:8181;
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /ipns {
proxy_pass http://127.0.0.1:8181;
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,8 @@
########################################################################
# update_bashrc.sh
# Add $YOU $IPFSNODEID $G1PUB to ~/.bashrc
## TODO REMOVE... Not so good idea since Astroport.One switch identities between captains
XZUID="$1"
source ~/.bashrc
@ -17,9 +19,9 @@ newIPFSNODEID=$(ipfs id -f='<id>\n') || er+=" ipfs id problem"
if [[ $YOU != "" && $IPFSNODEID != "" && $G1PUB != "" ]]; then
# UPDATE
sed -i "s/YOU=$YOU/YOU=$newYOU/g" ~/.bashrc
sed -i "s/$G1PUB/$newG1PUB/g" ~/.bashrc
sed -i "s/$IPFSNODEID/$newIPFSNODEID/g" ~/.bashrc
sed -i "s/YOU=$YOU/YOU=$newYOU/g" ~/.bashrc
sed -i "s/$G1PUB/$newG1PUB/g" ~/.bashrc
sed -i "s/$IPFSNODEID/$newIPFSNODEID/g" ~/.bashrc
if [[ $IPNSKEY == "_IPNSKEY_" ]]; then
ipfs key rm xbian
@ -28,12 +30,12 @@ if [[ $YOU != "" && $IPFSNODEID != "" && $G1PUB != "" ]]; then
fi
else
# CREATE
echo "### ASTROPORT IDENTITY ###" >> ~/.bashrc
echo "export YOU=$newYOU" >> ~/.bashrc
echo "export G1PUB=$newG1PUB" >> ~/.bashrc
echo "export IPFSNODEID=$newIPFSNODEID" >> ~/.bashrc
echo "export IPNSKEY=_IPNSKEY_" >> ~/.bashrc
[[ "$XZUID" != "" ]] && echo "export XZUID=$XZUID" >> ~/.bashrc
echo "### ASTROPORT IDENTITY ###" >> ~/.bashrc
echo "export YOU=$newYOU" >> ~/.bashrc
echo "export G1PUB=$newG1PUB" >> ~/.bashrc
echo "export IPFSNODEID=$newIPFSNODEID" >> ~/.bashrc
echo "export IPNSKEY=_IPNSKEY_" >> ~/.bashrc
[[ "$XZUID" != "" ]] && echo "export XZUID=$XZUID" >> ~/.bashrc
fi
source ~/.bashrc

BIN
.install/youtube-dl Executable file

Binary file not shown.

View File

@ -1,8 +1,22 @@
#!/bin/bash
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
######## YOUTUBE-DL ##########
if [[ ! $(which youtube-dl) ]]; then
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl || exit 1
sudo chmod a+rx /usr/local/bin/youtube-dl
sudo chown $USER /usr/local/bin/youtube-dl
## NOW INSTALL yt-dlp AND LINK TO youtube-dl
if [[ ! -f /usr/local/bin/yt-dlp ]]; then
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp && \
sudo chmod a+rx /usr/local/bin/yt-dlp && sudo chown $USER /usr/local/bin/yt-dlp
ytdl=$(which youtube-dl) # modify old
[[ -f ${ytdl} && ! -f ${ytdl}.old ]] &&\
sudo cp ${ytdl} ${ytdl}.old && \
sudo rm ${ytdl}
sudo ln -s /usr/local/bin/yt-dlp /usr/local/bin/youtube-dl ## NOW youtube-dl is linked to yt-dlp (COMMANDS ARE THE SAME ?)
fi
## UPGRADE TO LATEST
ls -al /usr/local/bin/youtube-dl

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

5
A_boostrap_public.txt Normal file
View File

@ -0,0 +1,5 @@
/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN
/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa
/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb
/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ

2
DEFCON
View File

@ -1 +1 @@
4
5

View File

@ -9,7 +9,7 @@ IPFSNODEID=$(ipfs id -f='<id>\n')
isIPFSRunning=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
[[ ! ${IPFSNODEID} ]] && echo "IPFS MUST BE INSTALLED" && exit 1
########################################################################
# Create secret key files
# Create STATION IPFS/G1 IDENTITY & secret key files
# ~/.zen/secret.june
# ~/.zen/secret.dunikey
# ~/.zen/secret.ipfs & /tmp/config.ipfs
@ -23,16 +23,16 @@ rm -f /tmp/A_booting_log.txt
ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` 2>&1>/dev/null && echo "CONNEXION OK" || exit 1
## TEST BOOTSTRAP IP CONNECTIVITY
IPTEST=$(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#" | cut -d '/' -f 3 | shuf | head -n 1)
ping -q -w 1 -c 1 $IPTEST 2>&1>/dev/null && echo "CONNEXION BOOTSTRAP OK" || echo "VERIFIER CONNEXION INTERNET" && exit 1
ping -q -w 1 -c 1 $IPTEST 2>&1>/dev/null && echo "CONNEXION BOOTSTRAP OK" || (echo "VERIFIER CONNEXION INTERNET" && exit 1)
# GIT PULL astrXbian code
mkdir -p ~/.zen/astrXbian && cd ~/.zen/astrXbian && git pull || exit 1
# MAJ astrXbian code
[[ -d ~/.zen/astrXbian ]] && cd ~/.zen/astrXbian && git pull || ( echo "astrXbian ERROR" && exit 1 )
# CHECK IF CONFIG ALREADY DONE !!
# ~/.zen/ipfs ~/.zen/secret ~/.zen/ipfs.sync
if [[ -f ~/.zen/ipfs.sync ]]; then
echo "CONFIG ALREADY DONE.... logging init in /tmp/A_booting_log.txt"
source ~/.zen/ipfs.sync
source ~/.zen/ipfs.sync; echo "CAPTAIN is $CAPTAIN"
# Wait for IPFS to connect SWARM
sleep 20
~/.zen/astrXbian/zen/gchange_INIT.sh >> /tmp/A_booting_log.txt
@ -47,13 +47,14 @@ fi
echo "CREATING Gchange credentials"
########################################################################
salt="$(~/.zen/astrXbian/zen/tools/diceware.sh 3 | xargs)"
salto="$salt"
[[ $salt == "" ]] && echo "ERROR" && exit 1
pepper="$(~/.zen/astrXbian/zen/tools/diceware.sh 3 | xargs)"
XZUID=$(~/.zen/astrXbian/zen/tools/diceware.sh 1 | xargs)${RANDOM:0:2}$(~/.zen/astrXbian/zen/tools/diceware.sh 1 | xargs)
[[ "$USER" != "xbian" ]] && echo "Modifier identifiant (passphrase 1)? $salt" && read salty && [[ $salty ]] && salt="$salty"
[[ "$USER" != "xbian" ]] && echo "Modifier mot de passe (passphrase 2)? $pepper" && read peppery && [[ $peppery ]] && pepper="$peppery"
# [[ "$USER" != "xbian" ]] && echo "Modifier Pseudo? $XZUID" && read XZUIDy && [[ $XZUIDy ]] && XZUID="$XZUIDy"
[[ "$USER" != "xbian" ]] && echo "Gardez ou modifiez cet identifiant (passphrase 1)? $salt" && read salty && [[ $salty ]] && salt="$salty"
[[ "$USER" != "xbian" ]] && echo "Gardez ou modifiez cet mot de passe (passphrase 2)? $pepper" && read peppery && [[ $peppery ]] && pepper="$peppery"
[[ "$USER" != "xbian" && "$salt" != "$salto" ]] && echo "Gardez ou modifiez ce Pseudo? $XZUID" && read XZUIDy && [[ $XZUIDy ]] && XZUID="$XZUIDy"
g1_salt="$salt"
g1_pepper="$pepper"
@ -119,7 +120,7 @@ mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/G1SSB
# Give $XZUID to your (gchange friends)
########################################################################
echo "SETTING ASTRXBIAN PROFILE NAME = $XZUID"
echo "$XZUID" > ~/.zen/ipfs/.${IPFSNODEID}/_xbian.zuid
echo "$XZUID" > ~/.zen/ipfs/.${IPFSNODEID}/.player
########################################################################
echo "CREATING GCHANGE+ PROFILE"
@ -164,9 +165,9 @@ echo ".... ACTUAL SWARM PEERS ..."
ipfs swarm peers
########################################################################
echo 'UPDATING ~/.bashrc'
# echo 'UPDATING ~/.bashrc'
########################################################################
~/.zen/astrXbian/.install/update_bashrc.sh "$XZUID"
# ~/.zen/astrXbian/.install/update_bashrc.sh "$XZUID"
## CREATE RAMDISK permanent
#sudo mkdir /mnt/ramdisk
@ -216,19 +217,13 @@ fi
done
########################################################################
echo "Synchronize GCHANGE+ with IPFS SWARM"
########################################################################
~/.zen/astrXbian/zen/gchange_IPFS_swarm.sh
~/.zen/astrXbian/zen/ipfs_SWARM_refresh.sh
########################################################################
echo 'Installing Astroport cron_MINUTE'
########################################################################
~/.zen/astrXbian/zen/cron_VRFY.sh
########################################################################
#echo "CHANGE hostname"
#myname=$(cat ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid)
#myname=$(cat ~/.zen/ipfs/.$IPFSNODEID/.player)
#echo "$(hostname). Changez votre HOSTNAME ($myname)?" && read mynamey && [[ $mynamey ]] && myname="$mynamey"
########################################################################
#sudo sed -i "s/$(hostname)/$myname/g" /etc/hostname
@ -286,7 +281,7 @@ do
done
# AVOID CONFLICT WITH KODI REMOTE
ipfs config Addresses.Gateway "/ip4/127.0.0.1/tcp/8181"
ipfs config Addresses.Gateway "/ip4/127.0.0.1/tcp/8080"
########################################################################
# SUDO permissions
@ -302,11 +297,20 @@ echo "$USER ALL=(ALL) NOPASSWD:/usr/bin/apt" | (sudo su -c 'EDITOR="tee" visudo
## USED FOR "systemctl restart ipfs"
echo "$USER ALL=(ALL) NOPASSWD:/bin/systemctl" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/systemctl')
## brother_ql_print
echo "$USER ALL=(ALL) NOPASSWD:/usr/local/bin/brother_ql_print" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/brother_ql_print')
## 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
########################################################################
# echo "Synchronize GCHANGE+ with IPFS SWARM"
########################################################################
# ~/.zen/astrXbian/zen/gchange_IPFS_swarm.sh
# ~/.zen/astrXbian/zen/ipfs_SWARM_refresh.sh
########################################################################
# echo 'ONLY XBIAN REBOOT NOW...' else SHOW CONFIG
########################################################################
[[ "$USER" == "xbian" ]] && sudo reboot

View File

@ -1,11 +1,30 @@
-include $(if $(MYOS),$(MYOS),../myos)/make/include.mk
MYOS ?= ../myos
-include $(MYOS)/make/include.mk
.PHONY: all default install shellcheck shellcheck-% shellspec shellspec-% tests uninstall
tests: ~/.zen/secret.june shellcheck-specs shellspec-specs
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 $*/*
shellcheck $*/*.sh
shellspec: shellspec-specs
shellspec-%:
shellspec -f tap $*
~/.zen/secret.june:
uninstall:

121
README.md
View File

@ -1,4 +1,79 @@
# ASTROPORT/KODI (astrXbian)
# Astroport répare ton internet
## Tout ce qui t'emmerde dans internet
Youtube :
- les suggestions te font perdre un temps fou, mais regarder toutes ces vidéos ne t'apportent que rarement de la valeur, car elle te font tourner en boucle sur du contenu toujours similaire
- le contenu qui diverge de la norme se retrouve censuré. Ça ne dérange pas trop tant que tu es toi-même dans la norme, mais que se passe-t-il lorsque ta pensée devient minoritaire ? Tu ne peux plus partager ton opinion.
- tu es obligé de passer par la page d'accueil pour effectuer une recherche
- tu crées des playlists pour organiser toi-même le contenu, mais parfois une vidéo est supprimé, sans que Youtube te laisse même le titre de la vidéo
- les commentaires, t'exposent souvent à toute la haine d'inconnus, et sont souvent source de désespoir
Facebook :
- le contenu qui remonte est le contenu le plus consensuel : la photo de profil à 50 likes de Cindy
- tu te tapes une pub tous les 4-5 posts
9gag :
- tu y viens pour rire un peu, mais tu te retrouve face à beaucoup de posts à caractère politique, anxiogène ou source de colère
- l'humour des autres n'est pas forcément le tiens, et le contenu qui t'es proposé ne te fait pas forcément marrer
Netflix :
- un peu de contenu intéressant, mais il est noyé dans un océan de médiocrité
- tu n'as accès à rien si tu n'es pas connecté
Spotify :
- l'interface devient de plus en plus source de nuisances, en te proposant de recommander Spotify à des amis par exemple
## Astroport libère ton internet
Astroport remplace tous ces services, en apportant quelques degrés de liberté en plus :
Dans Astroport, le contenu n'est pas filtré par des algorithme, mais par les choix que tu fais de te nourir du contenu partagé par tel ou tel ami.
Si le contenu est trop abondant, tu peux choisir un algorithme pour le filtrer, mais tu restes toujours maître de la façon dont les choses te sont présentées ; tu peux choisir ton interface parmi une quantité d'interfaces déjà codées, ou coder ta propre interface.
Un contenu taggué comme "drôle" a plus de chances de l'être, car il t'es apporté par tes amis, et entre amis, on partage souvent le même sens de l'humour.
## C'est le moment idéal pour libérer internet
Le déploiement massif de la fibre nous fournit la possibilité de revenir au "vrai" internet : un internet pair-à-pair.
Du l'ADSL, avec son débit asymétrique (80ko/s en débit ascendant, en upload), on passe avec la fibre à 80Mo/s.
Il devient donc possible de regarder une vidéo en streaming directement depuis chez ses amis, plutôt que de la récupérer depuis un datacenter inconnu localisé à 400km.
L'apparition et la popularisation des Raspberry Pi rend possible à chacun de se créer son propre petit datacenter de 1 To pour mettre à la disposition de ses amis toute sa vidéothèque. Le Raspberry Pi peut rester allumer en permanence sans faire exploser ta facture électrique ni causer de catastrophe environnementale, puisqu'il a une puissance de l'ordre de 15W. Astroport peut aussi tourner sur un vieux PC de 2005 dont on pensait ne plus jamais pouvoir faire quoi que ce soit.
La France est par ailleurs le terrain idéal pour expérimenter cette façon de partager du contenu, grâce au droit à la copie privée, qui nous autorise à garder pour soi un contenu diffusé par d'autres (à l'époque : enregistrer sur K7 un contenu diffusé à la radio).
## Comment Astroport libère l'internet
Astroport utilise IPFS pour stocker les fichiers.
Ces fichiers sont partagés uniquement avec les gens que vous avez explicitement choisis, et vous recevez du contenu uniquement des personnes en qui vous avez confiance. Cette identification des "amis" se fait pour l'instant via Gchange, mais cela pourrait évoluer.
Les vidéos peuvent être affichées dans différentes interfaces. Astroport en propose pour l'instant deux :
1. Une interface web, personnalisable à loisir grâce aux thèmes
2. Kodi, qui peut s'installer sur une Android TV
## Un modèle économique pour les créateurs et le partage pair-à-pair
À chaque fichier, Astroport associe un porte-monnaie de monnaie libre G1.
Lors de la consultation d'un fichier, un peu de monnaie libre G1 est transmise au noeud qui sert le fichier (vous ou un ami, par exemple), et la monnaie récoltée sera à terme partagée entre le noeud et le créateur du contenu.
Le modèle pair-à-pair, en diminuant les coûts de diffusion, permet d'augmenter la part récupérée par le créateur.
D'un point de vue écologique, le modèle pair-à-pair diminue aussi l'électricité consommée, car le terminal de consultation devient aussi serveur de fichiers, et fait ainsi d'une pierre deux coups. S'ils souhaitent rejoindre ce modèle, les créateurs ne seront plus obligés d'utiliser les datacenters de Netflix pour diffuser leur contenu.
Grâce aux contrats, même Netflix pourra choisir de fermer ses datacenter, pour proposer à tout un chacun de participer à la diffusion de son catalogue, et le rémuner en conséquence.
**Découvrez l'[Internet des gens](https://astroport.com)**
@ -23,6 +98,9 @@ Ces "stargate" permettent de créer des espaces numériques public ou privés to
```bash <(wget -qO- https://git.p2p.legal/axiom-team/astrXbian/raw/branch/master/install.sh)```
### **IMPORTANT** Restez en contact avec l'équipe de développement!! [Groupe Framagenda en cours de création](https://framagenda.org/apps/contacts/circle/vUAH4ggf7DyfznqN9bJDHu3nitjL7K6)
---
## [INSTALLATION sur RaspberryPi (Xbian)](https://www.copylaradio.com/en_US/blog/blog-1/post/astrxbian-20)
@ -103,31 +181,31 @@ NB: Les films placés dans ~/astroport/film/$TMDBID/ sont automatiquement transf
-- Automate Astroport/KODI en demonstration pour Xbian.org --
## PRINCIPE DE FONCTIONNEMENT
## PRINCIPE DE FONCTIONNEMENT ([index des PAD astroport](https://pad.p2p.legal/s/astroport-index))
> Astroport/KODI vous permet de partager les vidéos que vous aimez avec les gens que vous aimez.
Le répertoire ~/astroport sert de sas de transfert de vos fichiers dans IPFS.
Le répertoire ~/astroport sert de sas de transfert de vos fichiers dans IPFS (vous pouvez en effacer les fichiers une fois importés).
Votre essaim de pairs connectés se dessine selon les "étoiles" échangées sur https://gchange.fr
Chaque noeud astXbian possède une identité (paire de clef ed25519) qui correspond à son identité sur https://gchange.fr et un portefeuille sur https://cesium.app
Lorsqu'une identité "like/étoile" un autre compte sur Gchange, elle lui expédie le message "ipfstryme" ```~/.zen/ipfs/.${IPFSNODEID}/tryme.addr``` qui contient les adresses IP/IPFS connues (amis d'ami).
Chaque fichier placé dans ```~/.zen/ipfs``` est partagé sur la clef IPNS "self" de chacun puis collecté dans ```~/.zen/ipfs_swarm``` régulièrement.
Chaque fichier placé dans ```~/.zen/ipfs``` est partagé sur la clef IPNS "self" de chacun puis collecté dans ```~/.zen/ipfs_swarm``` régulièrement (c'est la Balise de votre Station)
Chaque noeud conserve la mémoire de sa bibliothèque au travers du fichier ```~/.zen/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN```
et transmet à Kodi l'ensemble de des "film" de son swarm dans ```~/.zen/ipfs/.$IPFSNODEID/FASTRXBIAN``` (PREFIX = F), selon le format
et transmet à Kodi l'ensemble de des "film" dans ```~/.zen/ipfs/.$IPFSNODEID/FASTRXBIAN``` (PREFIX = F), selon le format
```
CAT;TMDB;YEAR;TITLE;SAISON;GENRES;GROUPES;RES;URLS
film;$TMDB;2013;Frequencies;;["Science fiction","Romance","Mystere"];$XZUID;480p;http://127.0.0.1:8181/ipfs/QmcXMAHbFH3gDwmxJRX7uh753oCbXAEajwQsAWFkvqbRY3/Frequencies.mp4
film;$TMDB;2013;Frequencies;;["Science fiction","Romance","Mystere"];$XZUID;480p;http://127.0.0.1:8080/ipfs/QmcXMAHbFH3gDwmxJRX7uh753oCbXAEajwQsAWFkvqbRY3/Frequencies.mp4
# FORMAT DU FICHIER : https://github.com/Kodi-vStream/venom-xbmc-addons/wiki/Voir-et-partager-sa-biblioth%C3%A8que-priv%C3%A9e#d%C3%A9clarer-des-films
```
* ```~/.zen/PIN``` memorise l'état des PIN du réseau
* ```~/.zen/ipfs/.${IPFSNODEID}/KEY``` attribue une clef MEDIAKEY IPNS à chaque SOURCE_ID et applique un contrat fixe ou dynamique (selon le chiffrage appliqué au Thunder Network)
* ```~/.zen/ipfs/.${IPFSNODEID}/index.html``` l'application par défaut de votre clef self est un TiddlyWiki
* ```~/.zen/ipfs/.${IPFSNODEID}/KEY``` attribue une clef MEDIAKEY IPNS à chaque SOURCE_ID et applique un contrat fixe ou dynamique (selon le chiffrage appliqué à votre Thunder Network)
* ```~/.zen/ipfs/.${IPFSNODEID}/index.html``` l'application par défaut de votre Station est [TiddlyWiki](https://tiddlywiki.com/languages/fr-FR/index.html)
L'essaim se restructure toutes les minutes (code: ```cron_MINUTE.sh```) et active l'automate Astroport/BLOB.
@ -151,10 +229,10 @@ En cas de conflit (quand le swarm est trop grand ou désynchronisé), une procé
~/.zen/astrXbian/zen/ssh_forward2onelove.sh
# Obtenir la liste de tous ses amis (gchange+)
cat ~/.zen/ipfs_swarm/.12D*/G1SSB/_g1.gchange_title
cat ~/.zen/ipfs_swarm/.12D*/.player
# Noms des stations astroport de son swarm
for peer in $(ipfs swarm peers); do ipfsnodeid=${peer##*/}; echo "$(ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/G1SSB/_g1.gchange_title) => $(ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/_xbian.zuid)"; done
# Scan des stations IPFS de son swarm
for peer in $(ipfs swarm peers); do ipfsnodeid=${peer##*/}; echo $ipfsnodeid; echo "$(ipfs --timeout=2s cat /ipns/$ipfsnodeid/.$ipfsnodeid/G1SSB/_g1.gchange_title) => $(ipfs --timeout=1s cat /ipns/$ipfsnodeid/.$ipfsnodeid/.player)"; ipfs --timeout=1s ls /ipns/$ipfsnodeid/; done
# Obtenir le nom des fichiers contenus dans PIN IPFS
for ID in $( ls ~/.zen/PIN/ | cut -d '/' -f 6); do ipfs ls $ID; done
@ -176,8 +254,8 @@ do
ipfsnodeid=$(echo $CODE | cut -d '.' -f 3 | cut -d '/' -f 1 );
code=$(cat $CODE);
IPNSCODE=$(ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/.mycode)
zuid=$(cat ~/.zen/ipfs_swarm/.$ipfsnodeid/_xbian.zuid);
# zuid=$(ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/_xbian.zuid)
zuid=$(cat ~/.zen/ipfs_swarm/.$ipfsnodeid/.player);
# zuid=$(ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/.player)
g1name=$(cat ~/.zen/ipfs_swarm/.$ipfsnodeid/G1SSB/_g1.gchange_title)
# g1name=$(ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/G1SSB/_g1.gchange_title)
echo "---> $zuid / $g1name : $IPNSCODE"
@ -187,7 +265,7 @@ do
done;
# Get your ipfs swarm peers station names (XZUID)
for ipfsnodeid in $(ipfs swarm peers | grep -o '[^/]*$'); do ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/_xbian.zuid; done
for ipfsnodeid in $(ipfs swarm peers | grep -o '[^/]*$'); do ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/.player; done
```
@ -242,16 +320,13 @@ https://astroport.com
# Surcouche logicielle P2P à Debian (Essaim IPFS/Gchange+) + Interface média center KODI / IPFS
---
# OFFRES ENMPLOIS
Deux offres d'emplois ala TroporstA (only real GNU understand)
https://forum.monnaie-libre.fr/t/offres-emplois/16903?u=qoop
# NOUS RECRUTONS
**Et oui, on peut gagner jusqu'à 3 DU en sélectionnant, traduisant, les sources du Web qui vous plaisent !!**
**Activation de la Zen Economie Astroport.**
Pour rejoindre l'Astrocrew: Installez AstrXbian TestNET apprenez à programmer de votre automate cellulaire (BASH + multilanguage).
Des offres d'emploi et de stage en pagaille: visitez https://www.copylaradio.com/makers
- 1 DU par compte ouvert sur https://oasis.astroport.com
- 2 DU par article autour du DIY Raspberry Pi sur https://copylaradio.com (+ 1 DU pour l'ouverture du compte)
A la clef un concours des meilleurs articles par activation de la Zen Economie sur Astroport.
Pour rejoindre l'Astrocrew installez AstrXbian TestNET en cour s de développement et devenez programmateur de cette automate cellulaire (BASH + multilanguage).
Le nouveau JEu du LOVE peut commencer.

15
actions/check_my_wallet.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
########################################################################
# Author: Astrocrew
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
MYG1PUB=$(cat /home/$YOU/.zen/ipfs/.*/G1SSB/_g1.pubkey)
MYIPFSNODEID=$(cat /home/$YOU/.zen/ipfs/.*/.ipfsnodeid)
[[ $MYG1PUB == "" ]] && echo "$MYIPFSNODEID MISSING $MYG1PUB" && exit 1
echo $(/home/$YOU/.zen/astrXbian/zen/jaklis/jaklis.py balance -p $MYG1PUB)
exit 0

49
actions/p4n.data_evolution.sh Executable file
View File

@ -0,0 +1,49 @@
#!/bin/bash
########################################################################
# Author: Astrocrew
# Version: 0.1
# 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
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "NO ~/.zen/secret.dunikey EXIT" && exit 1
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n' 2>/dev/null) && [[ "$IPFSNODEID" == "" ]] && echo 'NO IPFS RUNNING. EXIT' && exit 1
[ ! -d ~/.zen/ipfs/.$IPFSNODEID/astroport ] && echo 'ASTROPORT NOT READY' && exit 1
###### MOVE MAP FROM SELF IPNS INDEX
if [ ! -d ~/.zen/ipfs/map ]; then
mv ~/.zen/ipfs/.$IPFSNODEID/astroport/map ~/.zen/
else
exit 0
fi
## TODO CREATE SPECIAL IPNS KEY FOR SHARING
##############################################################"
## DO NOT RECORD output.pdf, bu convert to jpg and link throug index.html REDIRECT
##############################################################"
for pdflink in $(ls ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/*/bulle.pdf); do
lid=$(echo $pdflink | cut -d '/' -f 11)
## PDF convert and crop to JPG / ipfs add / index.html for redirect
convert -density 200 -quality 80 $pdflink /tmp/bulle.jpg
convert -crop 1260x420+55+30 /tmp/bulle.jpg /tmp/$lid.jpg
IPFS=$(ipfs add -wq "/tmp/$lid.jpg") ## Add $lid.pdf to IPFS
IPFSREPFILEID=$(echo $IPFS | cut -d ' ' -f 2) ## Get repertory ipfs link
[[ "$IPFSREPFILEID" == "" ]] && echo "IPFS ADD TROUBLE. CONTINUE" && exit 1
## Create index.html with Redirect to /ipfs/$IPFSREPFILEID/$lid.jpg
echo "<html><head><meta http-equiv=\"Refresh\" content=\"0; URL=/ipfs/$IPFSREPFILEID/$lid.jpg\"></head></html>" > ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/index.html
# mv ./output.pdf ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/bulle.pdf
rm ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/bulle.pdf 2>/dev/null
echo "NOW LIEU redirect to http://127.0.0.1:8080/ipfs/$IPFSREPFILEID/$lid.jpg"
cat ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/index.html
done
exit 0

169
actions/p4n.swarmscraper.sh Executable file
View File

@ -0,0 +1,169 @@
#!/bin/bash
########################################################################
# Author: Astrocrew
# Version: 0.1
# 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
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "NO ~/.zen/secret.dunikey EXIT" && exit 1
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n' 2>/dev/null) && [[ $IPFSNODEID == "" ]] && echo 'NO IPFS RUNNING. EXIT' && exit 1
[ ! -d ~/.zen/ipfs/.$IPFSNODEID/astroport ] && echo 'ASTROPORT NOT READY' && exit 1
## INSTALL MISSING PACKAGES
if [[ -f /etc/sudoers.d/apt ]]; then
for i in chromium nmap httrack imagemagick; do
if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
sudo apt install -y $i
fi
done
else
echo "No sudo access for apt install... Please correct situation"
echo "PUT : $USER ALL=(ALL) NOPASSWD:/usr/bin/apt INTO /etc/sudoers.d/apt (use sudo visudo)"
exit 1
fi
##############################################################"
## Backing up europa p4n collected spots from collective intelligence ##
# SWARM is collectively PLAYing bataille navale
# Randomly get geaodata in south europe
# FOCUS on SOUTH EUROPE
# LON = -10 to 30
# LAT = 35 to 60
# https://fr.mapsofworld.com/lat_long/europe.html
##############################################################"
# initial first spot.
lon=0
lat=40
try=1
# Randomly choose spot from in RANGE $lat.$lon
while [[ $(ls ~/.zen/ipfs_swarm/.*/astroport/map/$lat.$lon/p4n/spot.json 2>/dev/null) ]]; do
echo "astroport/$lat.$lon geodata already swarm captured. CONTINUE"
FLOOR=-5; #-10;
CEILING=10; #30
RANGE=$(($CEILING-$FLOOR+1));
RESULT=$RANDOM;
let "RESULT %= $RANGE";
lon=$(($RESULT+$FLOOR));
#echo $lon
FLOOR=40; #35;
CEILING=50; #60;
RANGE=$(($CEILING-$FLOOR+1));
RESULT=$RANDOM;
let "RESULT %= $RANGE";
lat=$(($RESULT+$FLOOR));
#echo $lat
try=$(($try+1));
[ $try -eq 99 ] && break ## tirages aléatoire maximum
done
##############################################################"
## $lat.$lon GEODATA NOT SCRAPED YET ?
##############################################################"
if [ ! -d ~/.zen/ipfs/.$IPFSNODEID/astroport/map/$lat.$lon/p4n/ ]; then
### ADD Spot randomness
# Fuzzle geoloc
one=$(echo "000$RANDOM$RANDOM$RANDOM" | cut -b1-12)
latitude="$lat.$one"
two=$(echo "000$RANDOM$RANDOM$RANDOM" | cut -b1-12)
longitude="$lon.$two"
### SCRAPE P4N
## curl spot.json into /astroport/map/$lat.$lon/p4n/spot.json
echo "GETTING /astroport/map/$lat.$lon/p4n/spot.json"
mkdir -p ~/.zen/ipfs/.$IPFSNODEID/astroport/map/$lat.$lon/p4n/
echo "https://www.park4night.com/services/V3/getLieuxAroundMeLite.php?latitude=$latitude&longitude=$longitude"
curl -s "https://www.park4night.com/services/V3/getLieuxAroundMeLite.php?latitude=$latitude&longitude=$longitude" -o ~/.zen/ipfs/.$IPFSNODEID/astroport/map/$lat.$lon/p4n/spot.json
echo "SAVED ~/.zen/ipfs/.$IPFSNODEID/astroport/map/$lat.$lon/p4n/spot.json"
## TODO REFRESH OLD spot.json
fi
##############################################################"
## GEODATA. continue. Let's extract lieu pdf from my spot
##############################################################"
geosrc=$(ls ~/.zen/{ipfs,ipfs_swarm}/.*/astroport/map/$lat.$lon/p4n/spot.json 2>/dev/null)
geodata=$(echo "$geosrc" | tail -n 1)
ipfsnodeid=$(echo "$geodata" | cut -d '/' -f 6 | cut -d '.' -f 2)
if [[ "$ipfsnodeid" != "$IPFSNODEID" ]]; then
echo "This spot.json is managed by
$geosrc"
echo "getting geodata from one of mine"
geodata=$(ls ~/.zen/ipfs/.*/astroport/map/*.*/p4n/spot.json | shuf | tail -n 1)
fi
[[ $geodata ]] && ipfsnodeid=$(echo "$geodata" | cut -d '/' -f 6 | cut -d '.' -f 2) || exit 1
## SUB-SCRAPE SOME of my p4n/spot.json RANDOM "lieu"
echo "SUB-SCRAPING lieu FROM $geodata"
loop=1
while [ $loop -lt 21 ]; do
#{"id":"208264","latitude":"40.730727","longitude":"0.367303","hauteur_limite":"0.00","publique":"1","top_liste":"0","code":"APN","validation_admin":"1","distance":"97.341"}
# flatten json
lieu=$(cat $geodata | jq -r '.lieux[] | "\(.id),\(.latitude),\(.longitude),\(.hauteur_limite),\(.publique),\(.top_liste),\(.code),\(.validation_admin),\(.distance)"' | shuf | tail -n 1)
## GET RANDOM LIEU ID AND TRY MORE TO GET ( prefered APN)
lid=$(echo "$lieu" | cut -d ',' -f 1); code=$(echo "$lieu" | cut -d ',' -f 7)
[[ "$code" != "APN" ]] && [ -d ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid ] && lieu=$(cat $geodata | jq -r '.lieux[] | "\(.id),\(.latitude),\(.longitude),\(.hauteur_limite),\(.publique),\(.top_liste),\(.code),\(.validation_admin),\(.distance)"' | shuf | tail -n 1)
lid=$(echo "$lieu" | cut -d ',' -f 1); code=$(echo "$lieu" | cut -d ',' -f 7)
[[ "$code" != "APN" ]] && [ -d ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid ] && lieu=$(cat $geodata | jq -r '.lieux[] | "\(.id),\(.latitude),\(.longitude),\(.hauteur_limite),\(.publique),\(.top_liste),\(.code),\(.validation_admin),\(.distance)"' | shuf | tail -n 1)
lid=$(echo "$lieu" | cut -d ',' -f 1); code=$(echo "$lieu" | cut -d ',' -f 7)
[[ "$code" != "APN" ]] && [ -d ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid ] && lieu=$(cat $geodata | jq -r '.lieux[] | "\(.id),\(.latitude),\(.longitude),\(.hauteur_limite),\(.publique),\(.top_liste),\(.code),\(.validation_admin),\(.distance)"' | shuf | tail -n 1)
lid=$(echo "$lieu" | cut -d ',' -f 1); code=$(echo "$lieu" | cut -d ',' -f 7)
[ -d ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid ] && lieu=$(cat $geodata | jq -r '.lieux[] | "\(.id),\(.latitude),\(.longitude),\(.hauteur_limite),\(.publique),\(.top_liste),\(.code),\(.validation_admin),\(.distance)"' | shuf | tail -n 1)
lid=$(echo "$lieu" | cut -d ',' -f 1); code=$(echo "$lieu" | cut -d ',' -f 7)
[ -d ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid ] && lieu=$(cat $geodata | jq -r '.lieux[] | "\(.id),\(.latitude),\(.longitude),\(.hauteur_limite),\(.publique),\(.top_liste),\(.code),\(.validation_admin),\(.distance)"' | shuf | tail -n 1)
lid=$(echo "$lieu" | cut -d ',' -f 1); code=$(echo "$lieu" | cut -d ',' -f 7)
[[ "$lid" == "" ]] && echo "ERROR LIEU NO ID. CONTINUE" && loop=$(($loop+1)) && continue
mkdir -p /tmp/$lid && cd /tmp/$lid
echo "Downloading https://www.park4night.com/?page=lieu&id=$lid&bulle=YES"
mkdir -p ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/$code
echo "id,latitude,longitude,hauteur_limite,publique,top_liste,code,validation_admin,distance" > ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/$code/lieu.txt
echo "$lieu" >> ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/$code/lieu.txt
cat ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/$code/lieu.txt
# Get 1st copy bulle.pdf... Now converting to index.html redirect to $lid.jpg
[ -f ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/bulle.pdf ] && mv ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/bulle.pdf ./output.pdf && echo "ancien fichier bulle.pdf"
[ ! -f ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/index.html ] && echo "running chromium... " && chromium --timeout=10000 --headless --no-sandbox --disable-gpu --print-to-pdf=output.pdf "https://www.park4night.com/?page=lieu&id=$lid&bulle=YES" 2>/dev/null
[ ! -f ./output.pdf ] && rm -Rf ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid && echo "## CHROMIUM TIMEOUT, CANCEL MISSION" && loop=$(($loop+1)) && continue
## PDF convert and crop to JPG / ipfs add / index.html for redirect
if [ -f ./output.pdf ]; then
convert -density 200 -quality 80 ./output.pdf ./bulle.jpg
convert -crop 1260x420+55+30 ./bulle.jpg ./$lid.jpg
IPFS=$(ipfs add -wq "./$lid.jpg") && echo "## Added $lid.pdf to IPFS: $IPFS"
IPFSREPFILEID=$(echo $IPFS | cut -d ' ' -f 2) && echo "## Repertory $IPFSREPFILEID"
[[ "$IPFSREPFILEID" == "" ]] && echo "IPFS ADD TROUBLE. CONTINUE" && rm -Rf ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid && rm -Rf /tmp/$lid && loop=$(($loop+1)) && continue
## Create index.html with Redirect to /ipfs/$IPFSREPFILEID/$lid.jpg
echo "<html><head><meta http-equiv=\"Refresh\" content=\"0; URL=/ipfs/$IPFSREPFILEID/$lid.jpg\"></head></html>" > ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/index.html
# mv ./output.pdf ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/bulle.pdf
rm ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/bulle.pdf 2>/dev/null
echo "NOW LIEU redirect to http://127.0.0.1:8080/ipfs/$IPFSREPFILEID/$lid.jpg"
rm ./$lid.jpg
rm ./bulle.jpg
fi
cd -
sleep $((1 + RANDOM % 2))
rm -Rf /tmp/$lid
loop=$(($loop+1));
done
## CHECK SWARM GEODATA MAP
# ls -d ~/.zen/ipfs_swarm/.*/astroport/map/*/ | rev | cut -d '/' -f 2 | rev | sort
## NB OF lieu: ls -d ~/.zen/ipfs_swarm/.*/astroport/map/p4n/lieu/*/ | rev | cut -d '/' -f 2 | rev | sort | wc
# ipfs cat /ipns/$IPFSNODEID/.$IPFSNODEID/astroport/map/$lat.$lon/p4n/spot.json | jq
exit 0

View File

@ -0,0 +1,78 @@
#!/bin/bash
########################################################################
# Author: Astrocrew
# Version: 0.1
# 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
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "NO ~/.zen/secret.dunikey EXIT" && exit 1
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n') && [[ ! $IPFSNODEID ]] && echo 'NO IPFS RUNNING. EXIT' && exit 1
MEDIAKEYIPNS="$1"&& [[ ! $MEDIAKEYIPNS ]] && echo 'NO MEDIAKEY. Enter ipns/??? value. EXIT' && exit 1
OPENACCES="$2" && [[ ! $OPENACCES ]] && echo 'OPEN ACCES TO "$2=$G1PUB"'
tempdir=$(mktemp -d)
cd $tempdir
## GET CURRENT DHT PROPAGATED VERSION
ipfs --timeout=10s get --output="$tempdir" /ipns/$MEDIAKEYIPNS
[[ ! $? == 0 ]] && echo "CANNOT GET MEDIAKEY" && exit 1
## DO I OWN THE KEY, OR SHOUD I REQUEST IT
MEDIAKEY=$(cat ./*/.id | tail -n 1)
[[ ! $MEDIAKEY ]] && echo "MISSING MATCHING MEDIAKEY ID" && exit 1
if [[ ! $(ipfs key list -l | grep $MEDIAKEY) ]]; then
## SEND A MESSAGE ASKING FOR THE KEY (I am a bootstrap or http gateway)
for sharedowners in $(ls -d */ | cut -d '/' -f 1); do
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" send -d "$sharedowners" -t "MEDIAKEY ask for sharing contract" -m "I was wishing to increment $MEDIAKEY views, but not in your contracts yet. Please run ~/.zen/astrXbian/actions/view_counter_increment_or_allow.sh $MEDIAKEYIPNS $G1PUB to activate."
done
exit 1
fi
## INCREMENT COUNTER
## GO INTO $G1PUB EXCHANGE SPACE
[[ ! -d ./$G1PUB ]] && echo "MISSING RELATION WITH $G1PUB. EXIT" && exit 1
cd $G1PUB
count=$(cat .views.counter 2>/dev/null) || count=0
echo $((count+1)) > .views.counter
if [[ $OPENACCES ]]; then
echo "Creating ${OPENACCES}/.ipns.mediakey.encrypt and .ipfsid.encrypt"
## CREATE OFFICIAL RELATION DETECTED BY autoPINfriends.sh with ~/.zen/ipfs_swarm/.12D*/KEY/*/*/${G1PUB}/.ipfsid.encrypt
mkdir -p /home/$YOU/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${OPENACCES}/
key2send=$(/home/$YOU/.zen/astrXbian/zen/tools/give_me_keystore_filename.py $MEDIAKEY)
/home/$YOU/.zen/astrXbian/zen/tools/natools.py encrypt -p ${OPENACCES} -i /home/$YOU/.ipfs/keystore/$key2send -o /home/$YOU/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${OPENACCES}/.ipns.mediakey.encrypt
/home/$YOU/.zen/astrXbian/zen/tools/natools.py decrypt -f pubsec -k "/home/$YOU/.zen/secret.dunikey" -i "/home/$YOU/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipfsid.encrypt" -o "./ipfsid_$MEDIAKEY.txt"
/home/$YOU/.zen/astrXbian/zen/tools/natools.py encrypt -p ${OPENACCES} -i ./ipfsid_$MEDIAKEY.txt -o /home/$YOU/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${OPENACCES}/.ipfsid.encrypt
## Ask PIN to Bootstraps executed through autoPINfriends.sh
rm ./ipfsid_$MEDIAKEY.txt
## TODO COULD SEND JUNE FOR THAT?
syncronizedir="/home/$YOU/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}"
else
syncronizedir="$tempdir"
fi
echo "WE ARE in $syncronizedir"
cd $syncronizedir
## PUBLISH NEW STATE
I=$(ipfs add -qrH $syncronizedir | tail -n 1)
echo "CHAIN: $I"
echo "$(date -u +%s%N | cut -b1-13)" > .timestamp
echo $I > .chain
I=$(ipfs add -qrH $syncronizedir | tail -n 1)
echo "${MEDIAKEY} NAME PUBLISHING "
# MEDIAKEY IPNS name publish
J=$(ipfs --timeout=180s name publish --quieter -k ${MEDIAKEY} /ipfs/${I})
echo "$MEDIAKEY VIEW COUNTER UPDATED in https://tube.copylaradio.com/ipns/$J/$G1PUB/.views.counter"

View File

@ -6,27 +6,50 @@
########################################################################
# SCRIPT INTERACTIF POUR AJOUTER UN FICHIER à ASTROPORT/KODI
#
# 1. CAT: film, serie, anime
# 1. CAT: film, serie
# 2. TMDB: ID de la fiche sur https://www.themoviedb.org/
# 3. TITLE: Titre de la vidéo
# 4. YEAR: Année de la vidéo
# 5. RES: Résolution 1080p, 4K, SD, 720, HD
# 6. SAISON: Pour les séries et animes, c'est le numéro de saison.
# 6. SAISON: Pour les séries, c'est le numéro de saison.
# Pour un film, le champ SAISON est utilisé pour renseigner la Saga
# 7. GENRES: Action, Aventure, Fantastique, Animation, etc (choix multiple).
# 8. GROUPES: Permet de regrouper des films. (choix multiple)
# 8. GROUPES: Stocker la clef IPNS du MEDIAKEY.
#
# https://github.com/Kodi-vStream/venom-xbmc-addons/wiki/Voir-et-partager-sa-biblioth%C3%A8que-priv%C3%A9e#d%C3%A9clarer-des-films
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
########################################################################
[[ $(which ipfs) == "" ]] && echo "ERREUR! Installez ipfs" && echo "wget https://git.p2p.legal/axiom-team/astrXbian/raw/master/.install/ipfs_alone.sh -O /tmp/ipfs_install.sh && chmod +x /tmp/ipfs_install.sh && /tmp/ipfs_install.sh" && exit 1
[[ $(which zenity) == "" ]] && echo "ERREUR! Installez zenity" && echo "sudo apt install zenity" && exit 1
[[ $(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"
REVSOURCE="$(echo "$URL" | awk -F/ '{print $3}' | rev)_"
[ ! $2 ] && IMPORT=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Que copier depuis cette source ?" --entry-text="Video" MP3 Web) || IMPORT="Youtube"
[[ $IMPORT == "Video" ]] && IMPORT="Youtube"
CHOICE="$IMPORT"
fi
[[ $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
alias zenity='zenity 2> >(grep -v GtkDialog >&2)'
@ -39,14 +62,14 @@ large=$((width-300))
haut=$((height-200))
########################################################################
IPFSNODEID=$(ipfs id -f='<id>\n')
[[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title) || XZUID=$(cat /etc/hostname)
[[ -f ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid ]] && AXID=$(cat ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid)
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
[[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XGUID="$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title)" || XGUID="$(cat /etc/hostname)"
[[ -f ~/.zen/ipfs/.$IPFSNODEID/.player ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/.player)
zenity --warning --width 300 --text "Ajoutez une vidéo à ASTROPORT/KODI"
## CADRE EXCEPTION COPIE PRIVE # https://www.legifrance.gouv.fr/codes/article_lc/LEGIARTI000006278917/2008-12-11/
if [[ ! -f ~/.zen/legal ]]; then
########################################################################
## CADRE EXCEPTION COPIE PRIVE
# https://www.legifrance.gouv.fr/codes/article_lc/LEGIARTI000006278917/2008-12-11/
if [[ ! -f ~/.zen/game/players/.current/legal ]]; then
zenity --width ${large} --height=${haut} --text-info \
--title="Action conforme avec le Code de la propriété intellectuelle" \
--html \
@ -56,52 +79,108 @@ zenity --width ${large} --height=${haut} --text-info \
case $? in
0)
echo "AUTORISATION COPIE PRIVE ASTROPORT OK !"
echo "$G1PUB" > ~/.zen/legal
# next step
;;
echo "$G1PUB" > ~/.zen/game/players/.current/legal
# next step
;;
1)
echo "Refus conditions"
rm -f ~/.zen/legal
rm -f ~/.zen/game/players/.current/legal
exit 1
;;
;;
-1)
echo "Erreur."
exit 1
;;
;;
esac
fi
## CHECK IF ASTROPORT/CRON/IPFS IS RUNNING
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
[[ ! $YOU ]] && RUN=$(zenity --entry --width 300 --title="Astroport IPFS OFF" --text="Activer Astroport ?" --entry-text="OUI" NON) && [[ $RUN == "" || $RUN == "NON" ]] && exit 1
[[ $YOU && ! $1 ]] && RUN=$(zenity --entry --width 300 --title="Astroport IPFS ON" --text="Désactiver Astroport ? Non, vous voulez ajouter un Media?" --entry-text="OUI" NON)
## DES/ACTIVATION ASTROPORT
if [[ $RUN == "OUI" ]]; then
STRAP=$(ipfs bootstrap)
BOOT=$(zenity --entry --width 300 --title="Catégorie" --text="$STRAP Changez de Bootstrap" --entry-text="Aucun" astrXbian Public)
[[ $BOOT == "Aucun" ]] && ipfs bootstrap rm --all
[[ $BOOT == "astrXbian" ]] && for bootnode in $(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#"); do ipfs bootstrap add $bootnode; done
[[ $BOOT == "Public" ]] && for bootnode in $(cat ~/.zen/astrXbian/A_boostrap_public.txt | grep -Ev "#"); do ipfs bootstrap add $bootnode; done
REP=$(~/.zen/astrXbian/zen/cron_VRFY.sh) && zenity --warning --width 600 --text "$REP"
fi
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
[[ $YOU == "" ]] && echo "IPFS not running" && exit 1
########################################################################
# CHOOSE CATEGORY (remove anime, not working!)
CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Choisissez la catégorie de votre vidéo" --entry-text="Film" Anime Serie KODI Youtube MP3)
[[ $CHOICE == "" ]] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Choisissez la catégorie de votre ajout" --entry-text="Film" Serie Youtube Video Astronaute)
[[ $CHOICE == "" ]] && exit 1
# LOWER CARACTERS
CAT=$(echo "${CHOICE}" | awk '{print tolower($0)}')
PREFIX=$(echo "${CAT}" | head -c 1 | awk '{ print toupper($0) }' ) # ex: F, S, A, Y, M ...
# UPPER CARACTERS
CHOICE=$(echo "${CAT}" | awk '{print toupper($0)}')
PREFIX=$(echo "${CAT}" | head -c 1 | awk '{ print toupper($0) }' ) # ex: F, S, A, Y, M ... P W
[[ $PREFIX == "" ]] && exit 1
########################################################################
########################################################################
case ${CAT} in
########################################################################
# CASE ## YOUTUBE
# CASE ## ASTRONAUTE
# _ _
# __ _ ___| |_ _ __ ___ _ __ __ _ _ _| |_ ___
# / _` / __| __| '__/ _ \| '_ \ / _` | | | | __/ _ \
# | (_| \__ \ |_| | | (_) | | | | (_| | |_| | || __/
# \__,_|___/\__|_| \___/|_| |_|\__,_|\__,_|\__\___|
#
#
########################################################################
youtube)
astronaute)
zenity --warning --width ${large} --text 'ATTENTION ZONE EN TRAVAUX!!! ANNULER OU PROGRAMMEZ ASTROPORT'
# INSTASCAN G1PUB CAPTURE
~/.zen/Astroport.ONE/tools/instascan_login.sh "ONE"
YTURL=$(zenity --entry --width 300 --title "Lien ou identifiant à copier" --text "Indiquez le lien (URL) ou l'ID de la vidéo" --entry-text="")
if [[ $CAPTAIN == $PLAYER ]]; then
zenity --warning --width 300 --text "Bienvenue $PLAYER"
fi
exit 0
;;
########################################################################
# CASE ## YOUTUBE
# _ _
# _ _ ___ _ _| |_ _ _| |__ ___
#| | | |/ _ \| | | | __| | | | '_ \ / _ \
#| |_| | (_) | |_| | |_| |_| | |_) | __/
# \__, |\___/ \__,_|\__|\__,_|_.__/ \___|
# |___/
########################################################################
youtube)
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
REVSOURCE="$(echo "$YTURL" | awk -F/ '{print $3}' | rev)_"
# Create TEMP directory to copy $YID_$TITLE.$FILE_EXT
YTEMP="/tmp/$(date -u +%s%N | cut -b1-13)"
YTEMP="$HOME/astroport/tmp/$(date -u +%s%N | cut -b1-13)"
mkdir -p ${YTEMP}
# youtube-dl $YTURL
echo "VIDEO $YTURL"
/usr/local/bin/youtube-dl -f '[height=720]/best' \
--write-info-json --write-annotations \
if [[ ! -f /usr/local/bin/youtube-dl ]]; then
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
fi
/usr/local/bin/youtube-dl -f '[height=360]/best' \
--no-playlist --write-info-json \
--no-mtime -o "${YTEMP}/%(id)s&%(title)s.%(ext)s" $YTURL
# Get filename, extract ID, make destination dir and move copy.
YFILE=$(ls -t ${YTEMP} | head -n 1)
YFILE=$(ls -S ${YTEMP} | head -n 1)
FILE_NAME="$(basename "${YFILE}")"
FILE_EXT="${FILE_NAME##*.}"
@ -110,12 +189,12 @@ JSON_FILE=$(echo ${FILE_NAME} | sed "s/${FILE_EXT}/json/g")
YID=$(echo "${FILE_NAME}" | cut -d "&" -f 1)
YNAME=$(echo "${FILE_NAME}" | cut -d "&" -f 2- | sed "s/[(][^)]*[)]//g" | sed -e 's/[^A-Za-z0-9._-]/_/g' | sed -e 's/__/_/g' ) # Remove YoutubeID_ and (what is in perentheses)
[[ $(which detox) ]] && YNAME=$(echo "${FILE_NAME}" | cut -d "&" -f 2- | detox --inline)
TMDB="${YID}"
MEDIAID="$REVSOURCE${YID}"
TITLE="${YNAME%.*}"
MEDIAKEY="YOUTUBE_${MEDIAID}"
## CORRECT PARAMETERS to Make Kodi compatible YASTRXBIAN FILE
GENRES=$(zenity --list --checklist --title="GENRE" --height=${haut} \
[ ! $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" \
@ -132,11 +211,11 @@ GENRES=$(zenity --list --checklist --title="GENRE" --height=${haut} \
FALSE Humain \
FALSE Animal \
TRUE Eveil \
TRUE ${AXID// /-})
TRUE ${XZUID// /-}) || GENRES="${XZUID// /-}"
# FORMAT GENRES genre1|genre2|genre3
FILE_PATH="$HOME/astroport/youtube/$YID"
FILE_PATH="$HOME/astroport/youtube/$MEDIAID"
mkdir -p ${FILE_PATH} && mv -f ${YTEMP}/* ${FILE_PATH}/
# rename FILE_NAME to YNAME (URL clean)
mv "${FILE_PATH}/${FILE_NAME}" "${FILE_PATH}/${YNAME}" && FILE_NAME="${YNAME}"
@ -144,30 +223,79 @@ mv "${FILE_PATH}/${FILE_NAME}" "${FILE_PATH}/${YNAME}" && FILE_NAME="${YNAME}"
jsonfile=$(ls ${FILE_PATH}/*.json)
mv "${jsonfile}" "${FILE_PATH}/video.json"
GROUPES="_IPNSKEY_" # USE GROUPS TO RECORD IPNS MEDIAKEY
FILE_RES=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "${FILE_PATH}/${FILE_NAME}" | cut -d "x" -f 2)
RES=${FILE_RES%?}0p
## CREATE "~/astroport/${CAT}/${TMDB}/ajouter_video.txt" and video.json
## CREATE "~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt" and video.json
URLENCODE_FILE_NAME=$(echo ${FILE_NAME} | jq -Rr @uri)
echo "youtube;${TMDB};${YEAR};${TITLE};${SAISON};${GENRES};${GROUPES};${RES};/ipfs/_IPFSREPFILEID_/$URLENCODE_FILE_NAME" > ~/astroport/${CAT}/${TMDB}/ajouter_video.txt
echo "youtube;${MEDIAID};$(date -u +%s%N | cut -b1-13);${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/ipfs/_IPFSREPFILEID_/$URLENCODE_FILE_NAME" > ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt
# _IPFSREPFILEID_ is replaced later
rm -Rf ${YTEMP}
;;
;;
########################################################################
# CASE ## WEB
web)
## wget current URL -> index.html ## TEST ## TEST httrack ??
[[ ! $(which httrack) ]] && zenity --warning --width ${large} --text "Utilitaire de copie de site web absent.. Lancez la commande 'sudo apt install httrack'" && exit 1
echo "httrack --mirror $URL"
FILE_NAME="index.html"
REVSOURCE="$(echo "$URL" | rev | sha256sum | cut -d ' ' -f 1)_"; echo $REVSOURCE # URL="https://discuss.ipfs.io/t/limit-ipfs-get-command/3573/6"
MEDIAID="$REVSOURCE" # MEDIAID=1252ff59950395070a0cc56bb058cbb1ccfd2f8d8a32476acaf472f62b14d97d_
MEDIAKEY="WWW_${MEDIAID}" # MEDIAKEY=PAGE_1252ff59950395070a0cc56bb058cbb1ccfd2f8d8a32476acaf472f62b14d97d_
FILE_PATH="$HOME/astroport/web/$MEDIAID";
mkdir -p $FILE_PATH
wget -mpck --user-agent="" -e robots=off --wait 1 "$URL" > ${FILE_PATH}/
echo "web;${MEDIAID};$(date -u +%s%N | cut -b1-13);${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/ipfs/_IPFSREPFILEID_/$FILE_NAME" > ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt
zenity --warning --width ${large} --text "Vérifiez que la copie de votre site se trouve bien dans ${FILE_PATH}/"
;;
########################################################################
# CASE ## PAGE
page)
## record one page to PDF
[[ ! $(which chromium) ]] && zenity --warning --width ${large} --text "Utilitaire de copie de page web absent.. Lancez la commande 'sudo apt install chromium'" && exit 1
cd /tmp/ && rm -f output.pdf
chromium --headless --no-sandbox --print-to-pdf $URL
TITLE=$(zenity --entry --width 480 --title "Titre" --text "Quel nom de fichier à donner à cette page ? " --entry-text="${URL}")
[[ $TITLE == "" ]] && exit 1
FILE_NAME="$(echo "${TITLE}" | detox --inline).pdf" ## TODO make it better
MEDIAID="$REVSOURCE$(echo "${TITLE}" | detox --inline)"
MEDIAKEY="PAGE_${MEDIAID}"
FILE_PATH="$HOME/astroport/page/$MEDIAID"
mkdir -p ${FILE_PATH} && mv output.pdf ${FILE_PATH}/${FILE_NAME}
echo "page;${MEDIAID};$(date -u +%s%N | cut -b1-13);${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/ipfs/_IPFSREPFILEID_/$FILE_NAME" > ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt
;;
########################################################################
# CASE ## MP3
# _____
# _ __ ___ _ __|___ /
#| '_ ` _ \| '_ \ |_ \
#| | | | | | |_) |__) |
#|_| |_| |_| .__/____/
# |_|
########################################################################
mp3)
mp3)
zenity --warning --width ${large} --text 'ATTENTION ZONE EN TRAVAUX!!! ANNULER OU PROGRAMMEZ ASTROPORT'
zenity --warning --width 600 --text 'DEV ZONE . Please Participate https://git.p2p.legal'
# Create TEMP directory
YTEMP="/tmp/$(date -u +%s%N | cut -b1-13)"
YTEMP="$HOME/astroport/tmp/$(date -u +%s%N | cut -b1-13)"
mkdir -p ${YTEMP}
artist=$(zenity --entry --width 400 --title "Extraction MP3 depuis Youtube" --text "Artiste recherché ou Lien Youtube" --entry-text="")
@ -178,12 +306,12 @@ length=${#artist}
islink=$(echo "$artist" | grep "http")
if [[ ! $islink && $length != 11 ]]
then
# Ask for song name
song=$(zenity --entry --width 300 --title "Titre à chercher sur Youtube" --text "Titre recherché" --entry-text="")
[[ $song == "" ]] && exit 1
# Ask for song name
song=$(zenity --entry --width 300 --title "Titre à chercher sur Youtube" --text "Titre recherché" --entry-text="")
[[ $song == "" ]] && exit 1
else
song=$(zenity --entry --width 300 --title "Confirmer ID" --text "Titre recherché (ou confirmer la saisie précédente)" --entry-text="$artist")
[[ "$song" == "$artist" ]] && song=""
song=$(zenity --entry --width 300 --title "Confirmer ID" --text "Titre recherché (ou confirmer la saisie précédente)" --entry-text="$artist")
[[ "$song" == "$artist" ]] && song=""
fi
# Download mp3 from 1st youtube search video result (--write-info-json)
@ -200,7 +328,7 @@ FILE_EXT="${FILE_NAME##*.}"
YID=$(echo "${FILE_NAME}" | cut -d "&" -f 1)
YNAME=$(echo "${FILE_NAME}" | cut -d "&" -f 2- | sed "s/[(][^)]*[)]//g" | sed -e 's/[^A-Za-z0-9._-]/_/g' | sed -e 's/__/_/g') # Remove YoutubeID_ and (what is in perentheses)
[[ $(which detox) ]] && YNAME=$(echo "${FILE_NAME}" | cut -d "&" -f 2- | detox --inline)
[[ $(which detox) ]] && YNAME="$(echo "${FILE_NAME}" | cut -d "&" -f 2- | detox --inline)"
[[ ! $islink && "$song" != "" ]] && FILE_PATH="$HOME/astroport/$CAT/$artist/_o-o_" \
|| FILE_PATH="$HOME/astroport/$CAT/${YID}"
@ -209,26 +337,32 @@ mkdir -p "${FILE_PATH}" && mv -f ${YTEMP}/* "${FILE_PATH}/"
# Remove "&" from FILE_NAME rename to YNAME
mv "${FILE_PATH}/${FILE_NAME}" "${FILE_PATH}/${YNAME}" && FILE_NAME="${YNAME}"
TMDB="${YID}"
MEDIAID="${YID}"
TITLE="${YNAME%.*}"
GENRES="[\"$AXID\"]"
GENRES="[\"$XZUID\"]"
GROUPES="_IPNSKEY_" # USE GROUPS TO RECORD IPNS MEDIAKEY
MEDIAKEY="MP3_$MEDIAID"
rm -Rf ${YTEMP}
# zenity --warning --width ${large} --text "MP3 copié"
echo "~/.zen/astrXbian/zen/new_mp3_in_astroport.sh \"${FILE_PATH}/\" \"${FILE_NAME}\""
~/.zen/astrXbian/zen/new_mp3_in_astroport.sh "${FILE_PATH}/" "${FILE_NAME}" > /tmp/${CAT}_${TMDB}.log 2>&1
~/.zen/astrXbian/zen/new_mp3_in_astroport.sh "${FILE_PATH}/" "${FILE_NAME}" > /tmp/${CHOICE}_${MEDIAID}.log 2>&1
cat /tmp/${CAT}_${TMDB}.log
cat /tmp/${CHOICE}_${MEDIAID}.log
exit 0
;;
;;
########################################################################
# CASE ## film serie anime
# __ _ _
# / _(_) |_ __ ___
#| |_| | | '_ ` _ \
#| _| | | | | | | |
#|_| |_|_|_| |_| |_| THE MOVIE DATABASE INDEX
#
########################################################################
film | serie | anime)
film | serie)
# SELECT FILE TO ADD TO ASTROPORT/KODI
FILE=$(zenity --file-selection --title="Sélectionner le fichier à ajouter")
@ -242,16 +376,20 @@ FILE_EXT="${FILE_NAME##*.}"
FILE_TITLE="${FILE_NAME%.*}"
# OPEN default browser and search TMDB
zenity --question --width 300 --text "IMPORTANT! Nous allons ouvrir le site themoviedb pour y récuperer le numéro d'identification de votre vidéo"
[ $? == 1 ] && exit 1
xdg-open "https://www.themoviedb.org/search?query=$(echo ${FILE_TITLE} | sed 's/_/%20/g')"
zenity --question --width 300 --text "Ouvrir https://www.themoviedb.org pou récupérer le numéro d'identification de $(echo ${FILE_TITLE} | sed 's/_/%20/g') ?"
[ $? == 0 ] && xdg-open "https://www.themoviedb.org/search?query=$(echo ${FILE_TITLE} | sed 's/_/%20/g')"
TMDB=$(zenity --entry --title="Identification TMDB" --text="Indiquez le numéro de la fiche du film. Exemple: 301528 (à extraire du lien https://www.themoviedb.org/movie/301528-toy-story-4)" --entry-text="")
[[ $TMDB == "" ]] && exit 1
if ! [[ "$TMDB" =~ ^[0-9]+$ ]]
MEDIAID=$(zenity --entry --title="Identification TMDB" --text="Copiez le nom de la page du film. Ex: 301528-toy-story-4 pour une adresse https://www.themoviedb.org/movie/301528-toy-story-4)" --entry-text="")
[[ $MEDIAID == "" ]] && exit 1
CMED=$(echo $MEDIAID | cut -d '-' -f 1)
TMTL=$(echo $MEDIAID | cut -d '-' -f 2-) # contient la fin du nom de fichier tmdb (peut servir?)
if ! [[ "$CMED" =~ ^[0-9]+$ ]]
then
zenity --warning --width ${large} --text "Vous devez renseigner un numéro! Merci de recommencer... Seules les vidéos référencées sur The Movie Database sont acceptées." && exit 1
fi
MEDIAID=$CMED
MEDIAKEY="TMDB_$MEDIAID"
# VIDEO TITLE
TITLE=$(zenity --entry --width 300 --title "Titre" --text "Indiquez le titre de la vidéo" --entry-text="${FILE_TITLE}")
@ -267,7 +405,7 @@ RES=${FILE_RES%?}0p # Rounding. Replace last digit with 0
#RES=$(zenity --entry --width 300 --title="Résolution" --text="Résolution de la vidéo" --entry-text="${FILE_RES}" SD HD 4K 360p 480p 720p 1080p)
# VIDEO SEASON or SAGA
[[ "${CAT}" == "serie" || "${CAT}" == "anime" ]] && SAISON=$(zenity --entry --width 300 --title "${CHOICE} Saison" --text "Indiquez SAISON et EPISODE. Exemple: S02E05" --entry-text="")
[[ "${CAT}" == "serie" ]] && SAISON=$(zenity --entry --width 300 --title "${CHOICE} Saison" --text "Indiquez SAISON et EPISODE. Exemple: S02E05" --entry-text="")
[[ "${CAT}" == "film" ]] && SAISON=$(zenity --entry --width 300 --title "${CHOICE} Saga" --text "Indiquez une SAGA (optionnel). Exemple: James Bond" --entry-text="")
# VIDEO GENRES
@ -314,70 +452,196 @@ FILM_GENRES=$(zenity --list --checklist --title="GENRE" --height=${haut}\
FALSE Telefilm\
FALSE Thriller\
FALSE Western\
TRUE ${AXID// /-})
TRUE ${XZUID// /-})
# FORMAT GENRES ["genre1","genre2"]
GENRES="[\"$(echo ${FILM_GENRES} | sed s/\|/\",\"/g)\"]"
# VIDEO GROUP
# GROUPES=$(zenity --entry --width 300 --title "Groupe" --text "Associez la vidéo à un groupe (optionnel). Exemple: PIXAR" --entry-text="${AXID}")
GROUPES="_IPNSKEY_" # USE GROUPES TO RECORD MEDIAKEY
# DEBUG VERIFICATION
# zenity --question --width ${large} --title "EMBARQUEMENT ASTROPORT! OK?"\
# --text "${FILE_NAME} (${CAT};${TMDB};${YEAR};${TITLE};${SAISON};${GENRES};${GROUPES};${RES})"
# --text "${FILE_NAME} (${CAT};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};${GROUPES};${RES})"
# [ $? == 1 ] && echo "ANNULATION." && exit 1
### OK MOVING FILE TO ASTROPORT ####
mkdir -p ~/astroport/${CAT}/${TMDB}/
########################################################################
# Screen capture is used as thumbnail
########################################################################
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
mv -f "${FILE_PATH}/${FILE_NAME}" "$HOME/astroport/${CAT}/${TMDB}/${TITLE}.${FILE_EXT}" && zenity --warning --width ${large} --text "Votre fichier ~/astroport/${CAT}/${TMDB}/${TITLE}.${FILE_EXT} est prêt à embarquer. Cliquez sur OK puis patientez quelques minutes..."
###################################
### MOVING FILE TO ~/astroport ####
###################################
mkdir -p ~/astroport/${CAT}/${MEDIAID}/
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
zenity --warning --width ${large} --text "Impossible de déplacer votre fichier ${FILE_PATH}/${FILE_NAME} vers ~/astroport - EXIT -"
exit 1
fi
FILE_NAME="${TITLE}.${FILE_EXT}"
## CREATE "~/astroport/${CAT}/${TMDB}/ajouter_video.txt"
## CREATE "~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt"
URLENCODE_FILE_NAME=$(echo ${FILE_NAME} | jq -Rr @uri)
echo "${CAT};${TMDB};${YEAR};${TITLE};${SAISON};${GENRES};${GROUPES};${RES};/ipfs/_IPFSREPFILEID_/$URLENCODE_FILE_NAME" > ~/astroport/${CAT}/${TMDB}/ajouter_video.txt
echo "${CAT};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/ipfs/_IPFSREPFILEID_/$URLENCODE_FILE_NAME" > ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt
# _IPFSREPFILEID_ is replaced later
;;
;;
# _ _
#__ _(_) __| | ___ ___
#\ \ / / |/ _` |/ _ \/ _ \
# \ V /| | (_| | __/ (_) |
# \_/ |_|\__,_|\___|\___/
# TIMESTAMP INDEX
kodi)
video)
if [[ ! -f $HOME/.local/bin/uqload_downloader ]]; then
cd /tmp
git clone https://github.com/papiche/uqload_downloader.git
cd uqload_downloader/cli
./download_from_kodi_log.sh
[[ -f $HOME/.local/bin/uqload_downloader ]] && zenity --warning --width ${large} --text "INSTALLATION download_from_kodi_log.sh OK"
cp download_from_kodi_log.sh $HOME/.local/bin/
else
## CREATE NEW SHORTCUT
zenity --warning --width ${large} --text "UTILISEZ $HOME/.local/bin/download_from_kodi_log.sh en ligne de commande !!"
exit 0
fi
zenity --warning --width 600 --text 'DEVELOPPEMENT. SVP. Inscrivez-vous sur https://git.p2p.legal'
## GENERAL MEDIAKEY for uploaded video. Title + Decription + hashtag + hashipfs
# SELECT FILE TO ADD TO ASTROPORT/KODI
FILE=$(zenity --file-selection --title="Sélectionner le fichier vidéo à ajouter")
echo "${FILE}"
[[ $FILE == "" ]] && exit 1
;;
# Remove file extension to get file name => STITLE
FILE_PATH="$(dirname "${FILE}")"
FILE_NAME="$(basename "${FILE}")"
FILE_EXT="${FILE_NAME##*.}"
FILE_TITLE="${FILE_NAME%.*}"
# VIDEO TITLE
TITLE=$(zenity --entry --width 300 --title "Titre" --text "Indiquez le titre de la vidéo" --entry-text="${FILE_TITLE}")
[[ $TITLE == "" ]] && exit 1
TITLE=$(echo "${TITLE}" | sed "s/[(][^)]*[)]//g" | sed -e 's/;/_/g' ) # Clean TITLE (NO ;)
OUTPUT=$(zenity --forms --width ${large} --title="METADATA" --text="Ajouter des métadonnées" --separator=";" --add-entry="Sous titres" --add-entry="Hashtag(s)")
[[ $? != 0 ]] && echo "FAIL" && exit 1
DESCRIPTION=$(awk -F ';' '{print $1}' <<<$OUTPUT)
HASHTAG=$(awk -F ';' '{print $2}' <<<$OUTPUT)
## video_timestamp INDEX
MEDIAID="$(date -u +%s%N | cut -b1-13)"
mkdir -p ~/astroport/${CAT}/${MEDIAID}/
MEDIAKEY="VIDEO_${MEDIAID}"
## CREATE SIMPLE JSON
jq -n --arg ts "$MEDIAID" --arg title "$TITLE" --arg desc "$DESCRIPTION" --arg htag "$HASHTAG" '{"timestamp":$ts,"ipfs":"_IPFSREPFILEID_","ipns":"_IPNSKEY_","title":$title,"desc":$desc,"htag":$htag}' > ~/astroport/${CAT}/${MEDIAID}/video.json
## MOVE FILE TO IMPORT ZONE
mv -f "${FILE_PATH}/${FILE_NAME}" "$HOME/astroport/${CAT}/${MEDIAID}/${TITLE}.${FILE_EXT}"
FILE_NAME="${TITLE}.${FILE_EXT}"
;;
########################################################################
# CASE ## DEFAULT
########################################################################
*)
*)
zenity --warning --width ${large} --text "Impossible d'interpréter votre commande $CAT"
exit 1
zenity --warning --width ${large} --text "Impossible d'interpréter votre commande $CAT"
exit 1
;;
;;
esac
## Extract thumbnail
MIME=$(file --mime-type $HOME/astroport/${CAT}/${MEDIAID}/${TITLE}.${FILE_EXT} | cut -d ' ' -f 2)
[[ $(echo $MIME | grep video) ]] && ffmpeg -i $HOME/astroport/${CAT}/${MEDIAID}/${TITLE}.${FILE_EXT} -r 1/300 -vf scale=-1:120 -vcodec png $HOME/astroport/${CAT}/${MEDIAID}/${CAT}.png
[[ ! -f /astroport/${CAT}/${MEDIAID}/${CAT}.png ]] && echo "DEFAULT THUMBNAIL NEEDED"
########################################################################
# ADD $FILE to IPFS / ASTROPORT / KODI
echo "new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${TMDB}/\" \"${FILE_NAME}\""
cat ~/astroport/${CAT}/${TMDB}/ajouter_video.txt
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
########################################################################
~/.zen/astrXbian/zen/new_file_in_astroport.sh "$HOME/astroport/${CAT}/${TMDB}/" "${FILE_NAME}" > /tmp/${CAT}_${TMDB}.log 2>&1
## CREATION DU FICHIER ajouter_video.txt OK
########################################################################
### AJOUT DANS IPFS #######################################################
########################################################################
####################################new_file_in_astroport.sh##################
########################################################################
[[ "$CAT" == "film" || "$CAT" == "serie" ]] && CHOICE="TMDB"
timestamp=$(date -u +%s%N | cut -b1-13)
## 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
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
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
# ~/.zen/astrXbian/zen/new_file_in_astroport.sh "$HOME/astroport/${CAT}/${MEDIAID}/" "${FILE_NAME}" > /tmp/${MEDIAKEY}.log 2>&1
# [ ! $? == 0 ] && zenity --warning --width 300 --text "Désolé une erreur est survenue... Signalez ce log /tmp/${MEDIAKEY}.log sur https://git.p2p.legal/axiom-team/astrXbian" && exit 1
########################################################################
########################################################################
[ $? == 0 ] && zenity --warning --width 300 --text "OK! Votre vidéo a été transférée dans Astroport (/tmp/${CAT}_${TMDB}.log)" && exit 0 \
|| zenity --warning --width ${large} --height=${haut} --text "Désolé une erreur est survenue... LOG: cat /tmp/${CAT}_${TMDB}.log" && exit 1
########################################################################
########################################################################
########################################################################
MEDIAPUBKEY=$(cat $HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/MEDIAPUBKEY)
#[ ! $2 ] && zenity --width=500 --height=500 --text-info \
# --title="QR CODE MEDIA ${MEDIAKEY} (PASS=$(cat /tmp/${MEDIAKEY}.pass))" \
# --html \
# --url="http://127.0.0.1:8080/ipns/${IPFSNODEID}/.${IPFSNODEID}/KEY/${MEDIAKEY}/QR.png" \
# --checkbox="Je m'engage à respecter les auteurs et promet d'offrir la Monnaie Libre collectée à qui de droit."
########################################################################
echo "# ZENBALANCE for ${MEDIAKEY} , WALLET $MEDIAPUBKEY"
########################################################################
FILE_BSIZE=$(du -b "$HOME/astroport/${CAT}/${MEDIAID}/${FILE_NAME}" | awk '{print $1}')
FILE_SIZE=$(echo "${FILE_BSIZE}" | awk '{ split( "B KB MB GB TB PB" , v ); s=1; while( $1>1024 ){ $1/=1024; s++ } printf "%.2f %s", $1, v[s] }')
#G1BALANCE=$(~/.zen/astrXbian/zen/jaklis/jaklis.py balance -p $G1PUB) && [[ "$G1BALANCE" == "null" ]] && G1BALANCE=0 || G1BALANCE=$(echo "$G1BALANCE" | cut -d '.' -f 1)
#if [[ $G1BALANCE -gt 0 ]]; then
# [ ! $2 ] && G1AMOUNT=$(zenity --entry --width 400 --title "VIRER DE LA MONNAIE LIBRE AU MEDIAKEY (MAX $G1BALANCE)" --text "Combien de JUNE (G1) souhaitez-vous offrir à ce MEDIA ($FILE_SIZE)" --entry-text="")
# [[ ! "$G1AMOUNT" =~ ^[0-9]+$ ]] && G1AMOUNT=0
# ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey pay -p ${MEDIAPUBKEY} -a $G1AMOUNT -c "#ASTROPORT:${MEDIAKEY} DON"
# ZENBALANCE=$(echo "100 * $G1AMOUNT" | bc -l | cut -d '.' -f 1)
#else
ZENBALANCE=0
#fi
########################################################################
########################################################################
if [ $1 ]; then
bash ~/astroport/Add_${MEDIAKEY}_script.sh "noh265"
[ $? == 0 ] && echo "${MEDIAKEY} is RECORDED in ASTROPORT. GOOD." && exit 0
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

@ -18,16 +18,51 @@ source $HOME/.profile
[[ ! $(echo $PATH | grep "$HOME/.local/bin") ]] && export PATH="$PATH:$HOME/.local/bin"
[[ ! $(echo $PATH | grep "/usr/games") ]] && export PATH="$PATH:/usr/games"
#### INIT STATION PARAMETERS
[[ $IPFSNODEID ]] && export IPFSNODEID=$IPFSNODEID || export IPFSNODEID=$(ipfs id -f='<id>\n')
#### CONTROL STATION IPFS DAEMON
## timeout is fixing ipfs minimum response time, before considering stuck process
IPFSNODEID=$(ipfs id --timeout=1s | jq -r .ID)
howmany=$(cat /tmp/ipfs.timeout)
if [[ ! $IPFSNODEID ]]; then
## wait a howmany timeout before restarting ipfs
howmany=$((howmany + 1)) && echo $howmany > /tmp/ipfs.timeout
[ $howmany -gt 3 ] && [[ "${USER}" == "xbian" ]] && echo "IPFS NOT RUNNING" && rm /tmp/ipfs.timeout && rm /config/ipfs/repo.lock && sudo service ipfs restart && exit 1
[ $howmany -gt 3 ] && [[ -f /etc/sudoers.d/systemctl ]] && echo "IPFS NOT RUNNING $(date)" && rm /tmp/ipfs.timeout && rm /config/ipfs/repo.lock && sudo systemctl restart ipfs
rm ~/.zen/restart.txt
exit 1
else
echo 0 > /tmp/ipfs.timeout
fi
## CONTROL IPFS IS RUNNING OR RESTART
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
if [[ ! ${YOU} ]]; then
# Refresh Peering.Peers
ipfs config --json Peering.Peers '[]'
# DHT PUBSUB mode
ipfs config Pubsub.Router gossipsub
# MAXSTORAGE = 1/2 available
availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}')
diskSize="$((availableDiskSize / 2))"
ipfs config Datastore.StorageMax $diskSize
## Activate Rapid "ipfs p2p"
ipfs config --json Experimental.Libp2pStreamMounting true
ipfs config --json Experimental.P2pHttpProxy true
# control water levels for swarm
ipfs config --json Swarm.ConnMgr.LowWater 50
ipfs config --json Swarm.ConnMgr.HighWater 100
[ $howmany -gt 3 ] && [[ "${USER}" == "xbian" ]] && sudo service ipfs restart || sudo systemctl restart ipfs
echo "ERROR! ipfs daemon was not running. RELAUNCHING."
exit 1
fi
########################################################################
# CORRECT VSTREAM ASTROPORT SITE/ART REMOVED AFTER PLUGIN UPDATE
# CORRECT VSTREAM ASTROPORT SITE/ART REMOVED AFTER PLUGIN UPDATE : TODO DEBUG KODI PLUGIN !!! TODO MAKE PLAYER ROTATION
[[ ! -f ~/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py ]] && [[ -f ~/.zen/astroport.py ]] && cp -f ~/.zen/astroport.py ~/.kodi/addons/plugin.video.vstream/resources/sites/
[[ ! -f ~/.kodi/addons/plugin.video.vstream/resources/art/astroport.png ]] && cp ~/.zen/astrXbian/.install/.kodi/addons/plugin.video.vstream/resources/art/astroport.png ~/.kodi/addons/plugin.video.vstream/resources/art/
[[ ! -f ~/.kodi/addons/plugin.video.vstream/resources/art/astroport.png ]] && cp ~/.zen/astrXbian/.install/.kodi/addons/plugin.video.vstream/resources/art/astroport.png ~/.kodi/addons/plugin.video.vstream/resources/art/ 2>/dev/null
########################################################################
### NO IP GATEWAY : EXIT
### NO IP GATEWAY : EXIT (COULD BE Astroport.ONE Ambassy Alone !!)
ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` 2>&1>/dev/null && echo "LAN OK" || exit 1
########################################################################
@ -80,68 +115,96 @@ else
total_old_minutes=$((10#$old_hour*60 + 10#$old_min))
total_minutes=$((10#$hour*60 + 10#$min))
runtime=$((total_minutes - total_old_minutes))
runtime=${runtime#-}
fi
# RUN TIME $runtime
echo "RUNTIME $runtime mn ($timebar)"
if [[ $(($runtime % 4)) == 0 ]]; then
## PING ALL MY FRIENDS TO ENHANCE SWARM CONNECTIVITY
echo "## FRIENDS IPFS PINGing"
for g1pub in $(ls -t ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/); do
[[ $g1pub ]] && latency=$(ipfs ping --timeout=1s -n 1 /p2p/$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) 2>/dev/null | grep "Average" | cut -d ':' -f 2);
[[ $latency ]] && echo $latency > ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/ping.average.txt
## AVERAGE PING cat ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/*/ping.average.txt
# for line in $(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/*/ping.average.txt); do g1friend=$(echo $line | cut -d '/' -f 8); ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1friend); cat ~/.zen/ipfs_swarm/.$ipfsnodeid/.player; cat $line; done
done
fi
########################################################################
## CHECK & (RE)ACTIVATE ipfs p2p tunnels
########################################################################
# NextCloud FROM taurus TO oasis (https://taurus.copylaradio.com)
~/.zen/astrXbian/zen/ipfs_P2P_forward.sh
########## SUPPORT : OPEN OR CLOSE SSH ACCESS #################
# [[ "$(ipfs p2p ls | grep $G1PUB-ssh)" == "" ]] && sleep $((1 + RANDOM % 10)) && ~/.zen/astrXbian/zen/ssh_forward2onelove.sh # OPEN-SSH
# [[ "$(ipfs p2p ls | grep $G1PUB-ssh)" != "" ]] && sleep $((1 + RANDOM % 10)) && ~/.zen/astrXbian/zen/ssh_forward2onelove.sh # CLOSE-SSH
########################################################################
# DEFCON
########################################################################
# STATION CAN MODIFY DEFCON (cool 5 to 1 war) - only 5 and 4 (fail2ban) are ready to use.
[[ -f ~/.zen/DEFCON ]] && export DEFCON=$(cat ~/.zen/DEFCON) || export DEFCON=$(cat ~/.zen/astrXbian/DEFCON) # ADAPT $DEFCON scenario
## DEFCON SYSTEM ACTIVATED
########################################################################
# SMARM SYNCRONISATION
########################################################################
# ____ _______ __ __
# / __ \/ ____/ | / / ____ ___ ____ ____/ /__
# / / / / __/ | | / / / __ `__ \/ __ \/ __ / _ \
# / /_/ / /___ | |/ / / / / / / / /_/ / /_/ / __/
# /_____/_____/ |___/ /_/ /_/ /_/\____/\__,_/\___/
# _ ____
# / | | ___| _ __ ___ _ __
# | | |___ \ | '_ ` _ \| '_ \
# | | ___) | | | | | | | | | |
# |_| |____/ |_| |_| |_|_| |_|
#
# astrXbian TestNET
########################################################################
# ACTIVATE 15-17 MN "git pull" update
if [[ $(($minute % 15)) == 0 ]]; then
# SMARM MAINTENANCE / 15 mn
########################################################################
# astrXbian TestNET (git pull) -> desactivate in release ipfs get codeID
########################################################################
# ACTIVATE 15 MN "git pull" update
if [[ $(($runtime % 15)) == 0 ]]; then
########## DESYNCH SWARM NODE REQUESTS #################
sleep $((1 + RANDOM % 120))
[[ ! -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
git pull
cd $MY_PATH
sleep $((1 + RANDOM % 3)) && git pull
[[ ! $? == 0 ]] && echo "GIT.P2P.LEGAL IS UNREACHABLE"
# if [[ $(diff ~/.zen/astrXbian/.install/.kodi/userdata/addon_data/plugin.video.vstream/settings.xml ~/.kodi/userdata/addon_data/plugin.video.vstream/settings.xml) ]]; then
# cp ~/.zen/astrXbian/.install/.kodi/userdata/addon_data/plugin.video.vstream/settings.xml ~/.kodi/userdata/addon_data/plugin.video.vstream/settings.xml
# echo "MAJ Vstream settings"
# fi
# CLEAN AND REMOVE BAD DIRECTORIES
## IN CASE OF jaklis UPGRADE ACTIVATE AND REMOVE
## cd ~/.zen/astrXbian/zen/jaklis; ./setup.sh; cd -
# CLEAN AND REMOVE BAD DIRECTORIES should be in .$IPFSNODEID to avoid Station collision.
## BYPASS index.html DELETION
[[ -f ~/.zen/ipfs/index.html ]] && cp ~/.zen/ipfs/index.html /tmp/ipfsindex.html
[[ -d ~/.zen/ipfs/astroport ]] && rm -Rf ~/.zen/ipfs/astroport
[[ -d ~/.zen/ipfs_swarm/astroport ]] && rm -Rf ~/.zen/ipfs_swarm/astroport
[[ -d ~/.zen/ipfs/xbian ]] && rm -Rf ~/.zen/ipfs/xbian
[[ -d ~/.zen/ipfs_swarm/xbian ]] && rm -Rf ~/.zen/ipfs_swarm/xbian
[[ -d ~/.zen/ipfs/PIN ]] && rm -Rf ~/.zen/ipfs/PIN
[[ -d ~/.zen/ipfs_swarm/PIN ]] && rm -Rf ~/.zen/ipfs_swarm/PIN
## CLEANING OLD BAD FILES
rm ~/.zen/ipfs/*
## CLEANING PARASITE BAD FILES
rm -Rf ~/.zen/ipfs/*
rm ~/.zen/ipfs/.*
rm ~/.zen/ipfs_swarm/*
rm -Rf ~/.zen/ipfs_swarm/*
rm ~/.zen/ipfs_swarm/.*
## RESTORE index.html from /tmp/ipfsindex.html
[[ -f /tmp/ipfsindex.html ]] && mv /tmp/ipfsindex.html ~/.zen/ipfs/index.html
isIPFSRunning=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
if [[ ! $isIPFSRunning ]]; then
[[ -f /etc/sudoers.d/systemctl && -f ~/.zen/ipfs/.$IPFSNODEID/.switch ]] && sudo systemctl restart ipfs
echo "ERROR! ipfs daemon is not running. EXIT"
exit 1
fi
## (RE)ACTIVATE ipfs p2p tunnels
# NextCloud FROM taurus TO oasis (https://taurus.copylaradio.com)
$MY_PATH/zen/ipfs_P2P_forward.sh
########## CHATON : OPEN OR CLOSE SSH ACCESS #################
# [[ "$(ipfs p2p ls | grep $G1PUB-ssh)" == "" ]] && sleep $((1 + RANDOM % 10)) && ~/.zen/astrXbian/zen/ssh_forward2onelove.sh # OPEN-SSH
# [[ "$(ipfs p2p ls | grep $G1PUB-ssh)" != "" ]] && sleep $((1 + RANDOM % 10)) && ~/.zen/astrXbian/zen/ssh_forward2onelove.sh # CLOSE-SSH
fi
# __ __ _____ ____
@ -152,13 +215,55 @@ fi
#
##################################################################
# TODO: IDEA make gchange/ipfs/ipns refresh speed depending on ipfs swarm size and DEFCON level !
# SYNC GCHANGE EVERY 1 hour runtime
[[ $(($runtime % 60)) == 0 ]] && $MY_PATH/zen/gchange_INIT.sh && $MY_PATH/zen/gchange_IPFS_swarm.sh &
## 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
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
echo "onheure=$heure; onminute=$minute; ontimebar=$timebar" > /tmp/A_Station_ON
cp ~/.ipfs/config.new ~/.ipfs/config
[[ -f /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && exit 0
[[ ${YOU} == "xbian" ]] && sudo service ipfs restart && exit 0
fi
# QUICK SYNC SWARM EVERY 20 minutes +/- 1 minute
# [[ $(($runtime % 20)) == 0 ]] && $MY_PATH/zen/ipfs_SWARM_refresh.sh "quick" &
## RESHAPE IPFS FRIENDS SWARM
if [[ $(($runtime % 370)) == 0 || "$runtime" == "10" ]]; then
kill -9 $(ps auxf --sort=+utime | grep -w gchange_IPFS_swarm.sh | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}') && echo "KILLING gchange_IPFS_swarm.sh"
$MY_PATH/zen/gchange_IPFS_swarm.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.gchange_IPFS_swarm.txt
fi
# SYNC IPFS FRIENDS SWARM
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
fi
# ACTIVATE ~/astroport directory monitoring
##################################################################
#
# _________ ______
# ____ ___ ____ /_ __/ | / ____/
# /_ / / _ \/ __ \ / / / /| |/ / __
# / /_/ __/ / / / / / / ___ / /_/ /
# /___/\___/_/ /_/ /_/ /_/ |_\____/
#
# REFRESHing MEDIAKEY / ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
### IMPORTANT !!!!!!! IMPORTANT !!!!!! Maintains MEDIAKEY alive
################################################
if [[ $(($runtime % 7)) == 0 ]]; then
#### Refresh & publish MEDIAKEYs
$MY_PATH/zen/ipns_TAG_refresh.sh > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.ipns_TAG_refresh.txt
## REINIT dead swarm STATIONS
rm -f ~/.zen/A_dead_swarm.txt
fi
## TODO ACTIVATE/DESACTIVATE LOG
########################################################################
# ACTIVATE ~/astroport directory monitoring (xbian only)
########################################################################
###
# _ _
# __ _| |__ (_) __ _ _ __
@ -168,8 +273,9 @@ fi
#
# ON Rpi/xbian files added in ~/astroport are monitored to activate "new_file_in_astroport.sh"
# Transfert ~/astroport/*/files to IPFS and make Astroport/KODI indexes in IPNS
## TEST AUTOMATIC NEW FILE IMPORT. xbian only.
if [[ "$USER" == "xbian" ]]; then
[[ ! -e /home/$USER/astroport ]] && mkdir -p /home/$USER/astroport
[[ ! -e $HOME/astroport ]] && mkdir -p $HOME/astroport
# VERIFY LAUNCH inotifywait ?!
inotifywaitRunning=$(ps auxf --sort=+utime | grep -w inotifywait | grep -w astroport | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
if [[ "$inotifywaitRunning" != "xbian" ]]
@ -180,35 +286,13 @@ fi
##########################################################
##################################################################
#
# _________ ______
# ____ ___ ____ /_ __/ | / ____/
# /_ / / _ \/ __ \ / / / /| |/ / __
# / /_/ __/ / / / / / / ___ / /_/ /
# /___/\___/_/ /_/ /_/ /_/ |_\____/
#
# REFRESHing MEDIAKEY ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || $(($runtime % 720)) == 0 ]]; then
# Restarting IPFS daemon
[[ -f /etc/sudoers.d/systemctl || "$USER" == "xbian" ]] && sudo systemctl restart ipfs
#### timebar DESYNC
sleep $((12 + RANDOM % 5))
#### Refresh & publish MEDIAKEYs
$MY_PATH/zen/ipns_TAG_refresh.sh
## REINIT dead swarm
rm -f ~/.zen/A_dead_swarm.txt
fi
##################################################################
##################################################################
# MIDNIGHT:01 : CLEANING & UPDATE
# 5 mn / 24h REBOOT & MIDNIGHT:01 : CLEANING & UPDATE
##################################################################
##################################################################
if [[ "$timebar" == "00:01" || "$runtime" == "5" || $(($runtime % 1380)) == 0 ]]; then
if [[ "$timebar" == "00:01" || "$runtime" == "30" || $(($runtime % 1380)) == 0 ]]; then
echo '
# ____ ____ ____ ___
# / __ \/ __ \ _ / __ < /
@ -218,16 +302,20 @@ echo '
#
# MAINTENANCE
'
sleep $((1 + RANDOM % 15)) ### Be careful if random sleep is not activated...
sleep $((1 + RANDOM % 12)) ### Be careful if random sleep is not activated...
############################## That swarm could become an aggressive blob !!
### PEACE & LOVE software is processing... We are HyperWeb people here.
# DEFCON 5 quiet behaviour so Please keep cool, take care and be zen.
# GOOD BYE GOOGLE, AMAZON, FACEBOOK, APPLE, MICROSOFT. LIBRE WE ARE.
####################################################################
# REFRESH & UPGRADE youtube-dl
$MY_PATH/.install/youtube-dl.sh ## LET IT A WHILE FOR ALL SWARM EXECUTE ACTION... AND REMOVE.
youtube-dl --rm-cache-dir
youtube-dl -U
### INDEX DATA MIGRATION SCRIPTS
# $MY_PATH/actions/p4n.data_evolution.sh &
## LET IT A WHILE FOR ALL SWARM EXECUTE ACTION... AND REMOVE.
##################################################################
if [[ $dayoftheweek == 1 ]]; then
@ -248,9 +336,10 @@ echo '
# New full test review in gchange_INIT.sh
rm -f ~/.ipfs/test.disk
rm -f /tmp/instascan.log
# LOG ROTATE
[[ -f /tmp/astroport.log ]] && tar cvzf ~/.zen/astroport.$weeknumber.log.tgz /tmp/astroport.log && echo "" > /tmp/astroport.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
fi
@ -269,6 +358,20 @@ echo '
# RENEW & SEND STARS TO FRIENDS ~/.zen/astrXbian/zen/manage_stargates.sh
$MY_PATH/zen/manage_stargates.sh
########################################################################
# ACTIVATE TO CONTROL SWARM STATION SAME CODE VERSION
########################################################################
## myCODE is a SECURITY about code SIMILARITY
## EACH NODE CAN CHECK IF ANOTHER HAS SAME IPFS CODE HASH
MyCODE=$(ipfs add -rq --ignore="__pycache__" ~/.zen/astrXbian/ | tail -n 1)
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/.mycode ]] && echo $MyCODE > ~/.zen/ipfs/.${IPFSNODEID}/.mycode
[[ "$(cat ~/.zen/ipfs/.${IPFSNODEID}/.mycode)" != "$MyCODE" ]] && echo $MyCODE > ~/.zen/ipfs/.${IPFSNODEID}/.mycode
echo "MyCODE = $MyCODE CODE is ready to be published"
########################################################################
# MEAN CONTROL SWARM STATION HAVE SAME CODE VERSION
########################################################################
fi
### DISAPEAR ONE HOUR FROM IPFS SWARM ZOMBIES > 300 peers in swarm
@ -279,3 +382,4 @@ fi
# echo "1" > ~/.zen/ipfs/.$IPFSNODEID/.switch
#fi
#fi
## BETTER ACTIVATING DEFCON 3 / swarm.key MODE

View File

@ -32,3 +32,15 @@
## LINKING ME PEOPLE
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" stars | jq -r '.likes[].issuer'
```
# EXEMPLES DE COMMANDES BALISES
```
## CHECK SWARM STATIONS TIMESTAMPS
for g1id in $(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS); do echo $g1id; [[ "$g1id" == "index.html" ]] && continue; ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1id); ts=$(ipfs --timeout=10s cat /ipns/$ipfsnodeid/.$ipfsnodeid/.timestamp); echo $(date -ud @$ts); done
for ts in $(cat ~/.zen/ipfs_swarm/.*/.timestamp); do echo $(date -ud @$ts); done
```

View File

@ -1,22 +1,79 @@
#!/bin/sh
#!/bin/bash
[ "${DEBUG}" ] && set -x
check_requirements() {
[[ ! $(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 ; echo "mise à jour des dépots de votre distribution..."
sudo apt-get update
sudo apt-get install git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev -y
sudo apt-get install build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox httrack sudo -y
[[ ! $(which kodi) && "$USER" != "xbian" ]] && sudo apt-get install kodi -y
[[ "$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
for i in git fail2ban netcat-traditional 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
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
[[ ! $(which kodi) && "$user" != "xbian" ]] &&\
echo ">>> installation kodi + vstream = votre videotheque ! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";\
sudo apt-get install kodi -y;\
${MY_PATH}/.install/kodi_uqload_downloader.sh
echo "## INSTALLATION AstroGEEK OpenCV = 'Intelligence Amie' "
sudo apt-get install python3-opencv -y
[[ "$USER" != "xbian" ]] && sudo apt-get install x11-utils zenity handbrake* -y
## INSTALL PYTHON CRYPTO LAYER
echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc && source ~/.bashrc
## 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
python3 -m pip install -U cryptography Ed25519 base58 google duniterpy pynacl pgpy
python3 -m pip install -U nicotine-plus silkaj
python3 -m pip install -U 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
}
i_am() {
echo 'v0.4'
echo 'v0.5.0'
}
i_am_root() {
@ -28,34 +85,45 @@ i_am_xbian() {
}
i_should_install() {
[[ ! -f ~/.zen/secret.june ]]
[[ ! -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
git clone https://git.p2p.legal/axiom-team/astrXbian.git
git clone https://git.p2p.legal/qo-op/Astroport.ONE.git
}
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() {
echo "=== IMPORT configuration ASTROPORT dans ~/.kodi"
cp -Rf ~/.zen/astrXbian/.install/.kodi ~/
}
iso_config() {
~/.zen/astrXbian/ISOconfig.sh
}
prepare_next_boot() {
## 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

View File

@ -1,38 +1,37 @@
#!/bin/bash
set -x
. ./include.sh
########################################################################
# Version: 0.4
# Version: 0.5.0
# 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##*/}"
i_am_root && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1
# MAIN #
# MAIN # SI AUCUNE CLEF DE STATION...
if i_should_install;
then
# Check requirements
echo "AstrXbian installateur pour XBIAN (https://xbian.org) et ditributions DEBIAN et dérivées (https://www.linuxmint.com/)"
# Install requirements
check_requirements
########################################################################
echo "Clonage git astrXbian depuis https://git.p2p.legal"
# Clone astrXbian and Astroport.One
import_astrXbian
########################################################################
echo "IMPORT configuration ASTROPORT dans ~/.kodi"
import_kodi
########################################################################
echo "Installation de IPFS https://ipfs.io"
# Init ipfs
import_ipfs
########################################################################
echo "Configuration jaklis: Centre de communication GCHANGE+"
# Copy astroport config in kodi
import_kodi
# Jaklis setup
import_jaklis
########################################################################
echo "Sécurisation DEFCON SUDOERS FAIL2BAN"
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
i_am_xbian && sudo sed -i "s/auth.log/faillog/g" /etc/fail2ban/paths-common.conf
@ -66,16 +65,25 @@ fi
mkdir -p ~/astroport/film
mkdir -p ~/astroport/serie
mkdir -p ~/astroport/anime
echo '${TYPE};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/ipfs/_IPFSREPFILEID_/$URLENCODE_FILE_NAME' > ~/astroport/ajouter_video.modele.txt
#######################################################################
echo "## INSTALL open_with_linux.py ##
## https://darktrojan.github.io/openwith/webextension.html"
~/.zen/astrXbian/open_with_linux.py install
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 ! i_am_xbian
then
## Desktop install
echo "INITIALISATIOn Astroport/KODI"
echo "Appuyez sur la touche ENTREE pour créer votre nouvelle identité"
echo "sinon interrompez ici l'installation pour copier la restauration d'une sauvegarde"
read
iso_config
import_astroport
else
## Rpi Xbian install.
prepare_next_boot
echo "STOP!! Redémarrer Xbian pour continuer la configuration de votre station Astroport/KODI"
@ -86,7 +94,7 @@ fi
# MAIN # -f ~/.zen/secret.june (ISOConfig déjà lancé) ##
else
echo "Installation déjà faite !!
echo "Installation existante !!
========================
Astroport/KODI (Gchange)
========================

View File

@ -2,13 +2,18 @@
echo "Installation Astroport/RompR et activation du mode JUKEBOX mp3"
if [[ "$jukebox" == "oui" ]] then
sudo apt-get install mariadb-server nginx libnginx-mod-rtmp lsof python3-certbot-nginx certbot ssl-cert php-imap php-cli php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-gettext php-mysql php-fpm -y
sudo apt-get install mariadb-server nginx libnginx-mod-rtmp lsof python3-certbot-nginx certbot ssl-cert php-imap php-cli php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-gettext php-mysql php-fpm -y
fi
# Add user to be able to modify nginx directories
sudo usermod -a -G "$USER" www-data
sudo chmod g+rw /var/www/html
## TODO ## INSTALLER SITE PROXY NGINX QUI REDIRIGE VERS https://127.0.0.1:8181/ipns/$IPFSNODEID/.$IPFSNODEID
## TODO ## INSTALLER SITE PROXY NGINX QUI REDIRIGE VERS https://127.0.0.1:8080/ipns/$IPFSNODEID/.$IPFSNODEID
# STRUCTURE DE DONNEE SITUE DANS ~/.zen/ipfs/ PUBLIEE PAR IPNS SELF
## AJOUT ADDONS NAVIGATEUR https://askubuntu.com/questions/73474/how-to-install-firefox-addon-from-command-line-in-scripts
# OpenWith #
# https://chrome.google.com/webstore/detail/open-with/cogjlncmljjnjpbgppagklanlcbchlno
# https://addons.mozilla.org/firefox/downloads/file/3831723/open_with-7.2.6-fx.xpi

257
ipfs4astroport.sh Executable file
View File

@ -0,0 +1,257 @@
#!/bin/bash
########################################################################
{ # this ensures the entire script is downloaded #
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
# CHECK not root user !!
if [ "$EUID" -eq 0 ]
then echo -e "DO NOT EXECUTE AS root. Choose a user for your Astroport Station (we like pi)"
exit 1
else echo -e "OK $USER, let's go!";
fi
echo "Hello,
This script (you could read and modify as it is open source software) is about to transform your computer into an astroport station.
This process involve different upgrades to be made on your system.
1. install IPFS, the interplanetary file system (https://ipfs.io)
2. install python cryptographic libraries to run natools, your key wizard companion
3. download 'astroport' code release you have choosen.
~/.zen directory and datastructure will emerge
~/.zen/ipfs & ~/.zen/ipfs_swarm contains all meshed media index from you and your friends.
ASTROPORT is activated by cron every minute it maintains the connection with your friends.
It is the vessel that gives you avvess to your p2p AVATAR.
You carry and share your data around your friends through a confidence network
established through 1 to 5 'hearts' exchanged, opening 5 stargates where any can push/pull data.
TODO
Just indicate which is the directory assigned to each star.
Then any of your friends from such star level can replicate (modify) those data with you.
Your station is publishing its index every time it changes and every 6 hours for all MEDIAKEY from PIN station.
Following that principle add new directory into ~/.zen/ipfs and index any dataset, it will be published on your IPFS semaphore.
Now you need to enter your password to obtain sudo access.
Please.
"
# Ask user password on start
sudo true
## Error funciton
err() {
echo -e "ERREUR: $1"
exit 1
}
# CHECK if daemon is already running
if [[ $(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) ]]; then
ipfs id && echo "ipfs swarm peers: " && ipfs swarm peers
echo "ipfs bootstrap list: " && ipfs bootstrap list
echo "ipfs daemon already running...! Must STOP ipfs AND remove ~/.ipfs to install again !!"
echo "Please RUN : sudo service ipfs stop"
exit 1
fi
[[ -d ~/.ipfs ]] && echo "IPFS install exist! Please remove or backup before executing this script EXIT" && exit 1
echo -e "Check and install python curl, git and tools."
[[ $(which pip3) ]] && python3 -m pip install -U pip && python3 -m pip install -U wheel cryptography Ed25519 base58 google protobuf duniterpy==0.62.0 termcolor python-dotenv gql==3.0.0a5 requests pybase64 || (echo "python3 pip3 is missing on your device. EXIT" && exit 1)
[[ ! $(which curl) ]] && sudo apt-get install curl -y
[[ ! $(which git) ]] && sudo apt-get install git -y
[[ ! -d ~/.zen ]] && mkdir ~/.zen
# CHECK node IP isLAN?
myIP=$(hostname -I | awk '{print $1}')
echo "Your IP is $myIP"
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 ]] && echo "You are located in a LAN" || echo "You have a public IP address"
MACHINE_TYPE=`uname -m`
echo "You are running $MACHINE_TYPE CPU"
echo "Downloading ipfs binaries"
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
curl -s https://dist.ipfs.io/ipfs-update/v1.6.0/ipfs-update_v1.6.0_linux-amd64.tar.gz -o $MY_PATH/ipfs-update.tar.gz
elif [ ${MACHINE_TYPE:0:3} == 'arm' ]; then
curl -s https://dist.ipfs.io/ipfs-update/v1.6.0/ipfs-update_v1.6.0_linux-arm.tar.gz -o $MY_PATH/ipfs-update.tar.gz
elif [ ${MACHINE_TYPE} == 'aarch64' ]; then
curl -s https://dist.ipfs.io/go-ipfs/v0.9.1/go-ipfs_v0.9.1_linux-arm64.tar.gz -o /tmp/ipfs_aarch64_v0.9.1.tar.gz
else
echo "Your $MACHINE_TYPE is not supported yet... Please add an issue." && exit 1
fi
if [ -f $MY_PATH/ipfs-update.tar.gz ]; then
echo "INSTALL ipfs-update >>>>>>>>>>>>>>>>>>>>>>>>>>"
sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err "Untar ipfs-update"
rm $MY_PATH/ipfs-update.tar.gz
cd /usr/src/ipfs-update/
sudo ./install.sh || err "Install ipfs-update"
cd $MY_PATH
echo "INSTALL ipfs 0.9.1 >>>>>>>>>>>>>>>>>>>>>>>>>>"
sudo ipfs-update install 0.9.1 || err "Install IPFS"
else
## TERRAPI4 aarch64 install ipfs_aarch64_v0.9.1
echo "INSTALL ipfs 0.9.1 >>>>>>>>>>>>>>>>>>>>>>>>>> arm64"
sudo tar -xvzf /tmp/ipfs_aarch64_v0.9.1.tar.gz -C /usr/src/ || err "Untar ipfs_aarch64"
rm /tmp/ipfs_aarch64_v0.9.1.tar.gz
cd /usr/src/go-ipfs/
sudo ./install.sh || err "Install ipfs_aarch64"
cd $MY_PATH
fi
# INIT ipfs
[[ $isLAN ]] && ipfs init -p lowpower \
|| ipfs init -p server
## Special Xbian init.d config
## DEBIAN SYSTEMCTL
echo "SYSTEMD ipfs SERVICE >>>>>>>>>>>>>>>> ON"
cat > /tmp/ipfs.service <<EOF
[Unit]
Description=IPFS daemon
After=network.target
[Service]
User=_USER_
ExecStart=/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub --enable-gc
Restart=on-failure
CPUAccounting=true
CPUQuota=60%
[Install]
WantedBy=multi-user.target
EOF
sudo cp -f /tmp/ipfs.service /etc/systemd/system/
sudo sed -i "s/_USER_/$USER/g" /etc/systemd/system/ipfs.service
echo "Activating ipfs daemon >>>>>>>>>>>>>>>>>> "
# echo "Vous pouvez régler la ressouce CPU maximum (60%)?" && read cpuy
[[ -d ~/.ipfs ]] && sudo chown -R $USER:$USER ~/.ipfs
sudo systemctl daemon-reload
sudo systemctl enable ipfs
###########################################
echo "# ACTIVATE IPFS OPTIONS: #swarm0 INIT"
###########################################
### IMPORTANT !!!!!!! IMPORTANT !!!!!!
###########################################
# DHT PUBSUB mode
ipfs config Pubsub.Router gossipsub
# MAXSTORAGE = 1/2 available
availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}')
diskSize="$((availableDiskSize / 2))"
ipfs config Datastore.StorageMax $diskSize
## Activate Rapid "ipfs p2p"
ipfs config --json Experimental.Libp2pStreamMounting true
ipfs config --json Experimental.P2pHttpProxy true
ipfs config --json Swarm.ConnMgr.LowWater 50
ipfs config --json Swarm.ConnMgr.HighWater 100
## Install gateway on 8181 port
ipfs config Addresses.Gateway "/ip4/127.0.0.1/tcp/8181"
########################################################################
# GET IPFS KEYS & CONVERSIONS
########################################################################
IPFSNODEID=$(ipfs config Identity.PeerID)
## TODO convert to secret.dunikey
########################################################################
echo "CREATION IDENTITE BALISE IPFS ~/.zen/ipfs/.${IPFSNODEID} /G1SSB"
########################################################################
rm -Rf ~/.zen/ipfs
mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/G1SSB
########################################################################
# Give $XZUID to your (gchange friends)
########################################################################
XZUID="$(hostname)-$RANDOM$RANDOM"
echo "SETTING .player PROFILE NAME = $XZUID"
echo "$XZUID" > ~/.zen/ipfs/.${IPFSNODEID}/.player
echo 'balise /ipns/$IPFSNODEID/.$IPFSNODEID/.player'
########################################################################
########################################################################
echo "Getting tryme.addr & .mycode from OASIS
-- Change oasis address to fork your Astroport Code Universe --"
########################################################################
ipfs bootstrap rm --all
OASIS=12D3KooWBYme2BsNUrtx4mEdNX6Yioa9AV7opWzQp6nrPs6ZKabN
# aries=12D3KooWSQYTxeoZZ39SNosEKxi7RUdGTtAQAqpKeZJxjzqqrZTx
for bootnode in $(curl -s https://tube.copylaradio.com/ipns/$OASIS/.$OASIS/tryme.addr)
do
## ADD $bootnode TO BOOTSTRAP
ipfs bootstrap add $bootnode
done
codesign=$(curl -s https://tube.copylaradio.com/ipns/$OASIS/.$OASIS/.mycode)
## ADD NETWORK EXPLORATION FROM LIKES
########################################################################
echo "RESTARTING ipfs"
########################################################################
sudo service ipfs restart
echo ".... WAIT for SWARM to connect ..."
sleep 10
echo ".... ACTUAL SWARM PEERS ..."
ipfs swarm peers
echo "IPFS DONE
====================
Station Astroport INSTALL
Activation ~/.zen/astrXbian/zen/cron_VRFY.sh
Récupération CODE /ipfs/$codesign
"
## GETTING SAME SOURCE CODE AS OASIS
mkdir -p /home/$USER/.zen/astrXbian/
ipfs get --output=/home/$USER/.zen/astrXbian/ /ipfs/$codesign
## Make scripts executable
find /home/$USER/.zen/astrXbian/ -name "*.sh" -exec chmod u+x '{}' \;
find /home/$USER/.zen/astrXbian/ -name "*.py" -exec chmod u+x '{}' \;
########################################################################
echo "# Setting $USER SUDO permissions ON fail2ban mount umount apt-get apt systemctl"
########################################################################
## USED FOR fail2ban-client (DEFCON)
echo "$USER ALL=(ALL) NOPASSWD:/usr/bin/fail2ban-client" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/fail2ban-client')
## USED FOR RAMDISK (video live streaming)
echo "$USER ALL=(ALL) NOPASSWD:/bin/mount" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/mount')
echo "$USER ALL=(ALL) NOPASSWD:/bin/umount" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/umount')
## USED FOR SYSTEM UPGRADE
echo "$USER ALL=(ALL) NOPASSWD:/usr/bin/apt-get" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/apt-get')
echo "$USER ALL=(ALL) NOPASSWD:/usr/bin/apt" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/apt')
## USED FOR "systemctl restart ipfs"
echo "$USER ALL=(ALL) NOPASSWD:/bin/systemctl" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/systemctl')
## TODO G1SSB CONFIG
echo "## INSTALL TiddlyWiki /ipns/${IPFSNODEID}/.${IPFSNODEID}/index.html"
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/index.html ]] && mkdir -p ~/.zen/ipfs/.${IPFSNODEID} && cp ~/.zen/astrXbian/.install/templates/tiddlywiki/index.html ~/.zen/ipfs/.${IPFSNODEID}/index.html
echo "Congratulation ! You are part of the astroport interplanetary fleet.
New. Activate your station offline storage.
Install ipfs companion : https://docs.ipfs.io/install/ipfs-companion/
FR : https://translate.google.com/translate?sl=auto&tl=fr&u=https://docs.ipfs.io/install/ipfs-companion/
"
echo "FIND AND CONNECT WITH YOUR FRIENDS
https://tube.copylaradio.com/ipns/$OASIS/.$OASIS/"
## OPEN https://translate.google.com/translate?sl=auto&tl=fr&u=https://docs.ipfs.io/install/ipfs-companion/
} # this ensures the entire script is downloaded #
# IPFS CONFIG documentation: https://github.com/ipfs/go-ipfs/blob/master/docs/config.md#addressesswarm

1
minetest/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
minetest.conf

BIN
minetest/map.sqlite Normal file

Binary file not shown.

View File

@ -0,0 +1,107 @@
enable_damage = false
enable_pvp = false
creative_mode = true
enable_build_where_you_stand = true
# Controls length of day/night cycle.
# Examples:
# 72 = 20min, 360 = 4min, 1 = 24hour, 0 = day/night/whatever stays unchanged.
# type: int
time_speed = 1
# Name of map generator to be used when creating a new world.
# Creating a world in the main menu will override this.
# Current mapgens in a highly unstable state:
# - The optional floatlands of v7 (disabled by default).
# type: enum values: v7, valleys, carpathian, v5, flat, fractal, singlenode, v6
# mg_name = v7
mg_name = singlenode
# singlenode = que de l'air ; le mod "startanode" permet d'ajouter un cube au spawn
# Player is able to fly without being affected by gravity.
# This requires the "fly" privilege on the server.
# type: bool
free_move = true
# Fast movement (via the "special" key).
# This requires the "fast" privilege on the server.
# type: bool
fast_move = false
# The privileges that new users automatically get.
# See /privs in game for a full list on your server and mod configuration.
# type: string
default_privs = interact, shout, fly, fast
# Privileges that players with basic_privs can grant
# type: string
basic_privs = interact, shout, fly, fast
# Where the map generator stops.
# Please note:
# - Limited to 31000 (setting above has no effect)
# - The map generator works in groups of 80x80x80 nodes (5x5x5 MapBlocks).
# - Those groups have an offset of -32, -32 nodes from the origin.
# - Only groups which are within the map_generation_limit are generated
# type: int min: 0 max: 31000
#mapgen_limit = 216
mapgen_limit = 31000
# If this is set, players will always (re)spawn at the given position.
# type: string
static_spawnpoint = (0, 0, 0)
# magpen flags
mg_flags = trees,decorations
# mapgen v6
mgv6_spflags = jungles,biomeblend,mudflow,snowbiomes,noflat,trees
mgv6_freq_desert = 0.05
mgv6_freq_beach = 0.95
# Humidity variation for biomes.
# type: noise_params_2d
mgv6_np_humidity = {
offset = 0.5,
scale = 0.5,
spread = (2, 3, 2),
seed = 72384,
octaves = 3,
persistence = 0.50,
lacunarity = 2.0,
flags = eased
}
# Defines tree areas and tree density.
# type: noise_params_2d
mgv6_np_trees = {
offset = 0,
scale = 1,
spread = (2, 3, 2),
seed = 2,
octaves = 4,
persistence = 0.66,
lacunarity = 2.0,
flags = eased
}
# Defines areas with sandy beaches.
# type: noise_params_2d
mgv6_np_beach = {
offset = 0,
scale = 1,
spread = (50, 50, 50),
seed = 59420,
octaves = 3,
persistence = 0.50,
lacunarity = 2.0,
flags = eased
}
secure.trusted_mods = wiki

259
minetest/recreate_world.sh Executable file
View File

@ -0,0 +1,259 @@
#!/bin/sh
MINETEST_PATH=/home/pi/.minetest
WORLD_NAME=astroport
WORLD_PATH=$MINETEST_PATH/worlds/$WORLD_NAME
rm -rf $WORLD_PATH
mkdir $WORLD_PATH
cp map.sqlite $WORLD_PATH/
echo "
gameid = minetest
auth_backend = sqlite3
player_backend = sqlite3
backend = sqlite3
" > $WORLD_PATH/world.mt
cd ~/.zen/astrXbian/minetest
cat ./minetest-common.conf > /home/pi/.minetest/worlds/astroport/minetest.conf
echo "
server_name = Astroport "$XZUID"
# Message of the day displayed to players connecting.
# type: string
motd = Bienvenue sur l'Astroport \""$XZUID"\". Un petit cube auto-hébergé par son heureux propriétaire.
server_description = Astroport
# Domain name of server, to be displayed in the serverlist.
# type: string
#server_address = astroport.com
# Homepage of server, to be displayed in the serverlist.
# type: string
#server_url = https://astroport.com
# Automatically report to the serverlist.
# type: bool
server_announce = false
# Network port to listen (UDP).
# This value will be overridden when starting from the main menu.
# type: int
port = 30001
# The network interface that the server listens on.
# type: string
# bind_address =
" >> /home/pi/.minetest/worlds/astroport/minetest.conf
#########################################################################################
#
# SystemD
#
#########################################################################################
MINETEST_LOG_FILE=/var/log/minetest/minetest-astroport.log
sudo touch $MINETEST_LOG_FILE
sudo chown pi:games $MINETEST_LOG_FILE
chmod 664 $MINETEST_LOG_FILE
echo "
[Unit]
Description=Minetest multiplayer server minetest.conf server config
Documentation=man:minetestserver(6)
After=network.target
RequiresMountsFor=/var/games/minetest-server
[Service]
Restart=on-failure
User=pi
Group=games
ExecStart=/usr/lib/minetest/minetestserver --port 30001 --world /home/pi/.minetest/worlds/astroport --config /home/pi/.minetest/worlds/astroport/minetest.conf --logfile /var/log/minetest/minetest-astroport.log
StandardOutput=null
[Install]
WantedBy=multi-user.target
" >> $WORLD_PATH/systemd.service
sudo systemctl enable $WORLD_PATH/systemd.service
sudo systemctl start astroport-minetest.service
#########################################################################################
#
# MODS
#
#########################################################################################
mkdir $WORLD_PATH/worldmods
if [ ! -d $MINETEST_PATH/mods ]; then
mkdir $MINETEST_PATH/mods
fi
# ## mg - Experimental Mapgen for Minetest
#
# if [ ! -d $MINETEST_PATH/mods/mg-master ]; then
#
# if [ ! -f $MINETEST_PATH/mods/mg.zip ]; then
# wget https://github.com/minetest-mods/mg/archive/refs/heads/master.zip -O $MINETEST_PATH/mods/mg.zip
# fi
#
# unzip $MINETEST_PATH/mods/mg.zip -d $MINETEST_PATH/mods
# fi
#
# cp -r $MINETEST_PATH/mods/mg-master $WORLD_PATH/worldmods
## startanode
#
# if [ ! -d $MINETEST_PATH/mods/startanode-master ]; then
#
# if [ ! -f $MINETEST_PATH/mods/startanode.zip ]; then
# wget https://github.com/minetest-mods/startanode/archive/refs/heads/master.zip -O $MINETEST_PATH/mods/startanode.zip
# fi
#
# unzip $MINETEST_PATH/mods/startanode.zip -d $MINETEST_PATH/mods
# fi
#
# cp -r $MINETEST_PATH/mods/startanode-master $WORLD_PATH/worldmods
## Spawnbuilder
#
# spawnBuilderLocation=`find $MINETEST_PATH/mods -type d -name spawnbuilder`
# if [ -z $spawnBuilderLocation ]; then
#
# if [ ! -f $MINETEST_PATH/mods/spawnbuilder.zip ]; then
# wget https://repo.or.cz/minetest_spawnbuilder.git/snapshot/1.1.0.zip -O $MINETEST_PATH/mods/spawnbuilder.zip
# fi
#
# unzip $MINETEST_PATH/mods/spawnbuilder.zip -d $MINETEST_PATH/mods/spawnbuilder/
# fi
#
# mkdir $WORLD_PATH/worldmods/spawnbuilder
# cp -r $MINETEST_PATH/mods/spawnbuilder/minetest_spawnbuilder-*/* $WORLD_PATH/worldmods/spawnbuilder
#
# echo "
# #Side length of the surface area of the spawn platform
# #If the number is odd, the platform will be centered at spawn.
# #Using a width lower than 3 is not recommended.
# spawnbuilder_width (Spawn platform width) int 5 1
# " > $WORLD_PATH/worldmods/spawnbuilder/mod.conf
## Unified inventory mod
if [ ! -d $MINETEST_PATH/mods/unified_inventory-master ]; then
if [ ! -f $MINETEST_PATH/mods/unified_inventory.zip ]; then
wget https://github.com/minetest-mods/unified_inventory/archive/master.zip -O $MINETEST_PATH/mods/unified_inventory.zip
fi
unzip $MINETEST_PATH/mods/unified_inventory.zip -d $MINETEST_PATH/mods
fi
cp -r $MINETEST_PATH/mods/unified_inventory-master $WORLD_PATH/worldmods
## Spawn mod
if [ ! -d $MINETEST_PATH/mods/spawn_command-master ]; then
if [ ! -f $MINETEST_PATH/mods/spawn_command.zip ]; then
wget https://github.com/minetest-mods/spawn_command/archive/refs/heads/master.zip -O $MINETEST_PATH/mods/spawn_command.zip
fi
unzip $MINETEST_PATH/mods/spawn_command.zip -d $MINETEST_PATH/mods
fi
cp -r $MINETEST_PATH/mods/spawn_command-master $WORLD_PATH/worldmods
## Jukebok mod
if [ ! -d $MINETEST_PATH/mods/jukebox-master ]; then
if [ ! -f $MINETEST_PATH/mods/jukebox.zip ]; then
wget https://github.com/minetest-mods/jukebox/archive/refs/heads/master.zip -O $MINETEST_PATH/mods/jukebox.zip
fi
unzip $MINETEST_PATH/mods/jukebox.zip -d $MINETEST_PATH/mods
fi
cp -r $MINETEST_PATH/mods/jukebox-master $WORLD_PATH/worldmods
## xdecor mod
if [ ! -d $MINETEST_PATH/mods/xdecor-master ]; then
if [ ! -f $MINETEST_PATH/mods/xdecor.zip ]; then
wget https://github.com/minetest-mods/xdecor/archive/refs/heads/master.zip -O $MINETEST_PATH/mods/xdecor.zip
fi
unzip $MINETEST_PATH/mods/xdecor.zip -d $MINETEST_PATH/mods
fi
cp -r $MINETEST_PATH/mods/xdecor-master $WORLD_PATH/worldmods
## Display modpack
if [ ! -d $MINETEST_PATH/mods/display_modpack-master ]; then
if [ ! -f $MINETEST_PATH/mods/display_modpack.zip ]; then
wget https://github.com/pyrollo/display_modpack/archive/refs/heads/master.zip -O $MINETEST_PATH/mods/display_modpack.zip
fi
unzip $MINETEST_PATH/mods/display_modpack.zip -d $MINETEST_PATH/mods
fi
cp -r $MINETEST_PATH/mods/display_modpack-master $WORLD_PATH/worldmods
## Letters
if [ ! -d $MINETEST_PATH/mods/letters-master ]; then
if [ ! -f $MINETEST_PATH/mods/letters.zip ]; then
wget https://github.com/minetest-mods/letters/archive/refs/heads/master.zip -O $MINETEST_PATH/mods/letters.zip
fi
unzip $MINETEST_PATH/mods/letters.zip -d $MINETEST_PATH/mods
fi
cp -r $MINETEST_PATH/mods/letters-master $WORLD_PATH/worldmods
## mydoors
if [ ! -d $MINETEST_PATH/mods/mydoors-master ]; then
if [ ! -f $MINETEST_PATH/mods/mydoors.zip ]; then
wget https://github.com/minetest-mods/mydoors/archive/refs/heads/master.zip -O $MINETEST_PATH/mods/mydoors.zip
fi
unzip $MINETEST_PATH/mods/mydoors.zip -d $MINETEST_PATH/mods
fi
cp -r $MINETEST_PATH/mods/mydoors-master $WORLD_PATH/worldmods

3
minetest/start_server.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
/usr/lib/minetest/minetestserver --port 30001 --world /home/pi/.minetest/worlds/astroport --config /home/pi/.minetest/worlds/astroport/minetest.conf

39
nginx.conf Normal file
View File

@ -0,0 +1,39 @@
server {
root /home/pi/.zen/astrXbian/www/boris;
listen 80 default_server;
server_name _;
# This section can be copied into an existing default setup
location / {
allow all;
index index.php index.html index.htm;
location ~ \.php {
try_files $uri index.php =404;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include /etc/nginx/fastcgi_params;
fastcgi_read_timeout 1800;
}
error_page 404 = /error/404.html;
try_files $uri $uri/ =404;
location ~ /albumart/* {
expires -1s;
}
}
location /ipfs {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /ipns {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}

184
open_with_linux.py Executable file
View File

@ -0,0 +1,184 @@
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import json
import struct
import subprocess
VERSION = '7.1b2'
try:
sys.stdin.buffer
# Python 3.x version
# Read a message from stdin and decode it.
def getMessage():
rawLength = sys.stdin.buffer.read(4)
if len(rawLength) == 0:
sys.exit(0)
messageLength = struct.unpack('@I', rawLength)[0]
message = sys.stdin.buffer.read(messageLength).decode('utf-8')
return json.loads(message)
# Send an encoded message to stdout
def sendMessage(messageContent):
encodedContent = json.dumps(messageContent).encode('utf-8')
encodedLength = struct.pack('@I', len(encodedContent))
sys.stdout.buffer.write(encodedLength)
sys.stdout.buffer.write(encodedContent)
sys.stdout.buffer.flush()
except AttributeError:
# Python 2.x version (if sys.stdin.buffer is not defined)
# Read a message from stdin and decode it.
def getMessage():
rawLength = sys.stdin.read(4)
if len(rawLength) == 0:
sys.exit(0)
messageLength = struct.unpack('@I', rawLength)[0]
message = sys.stdin.read(messageLength)
return json.loads(message)
# Send an encoded message to stdout
def sendMessage(messageContent):
encodedContent = json.dumps(messageContent)
encodedLength = struct.pack('@I', len(encodedContent))
sys.stdout.write(encodedLength)
sys.stdout.write(encodedContent)
sys.stdout.flush()
def install():
home_path = os.getenv('HOME')
manifest = {
'name': 'open_with',
'description': 'Open With native host',
'path': os.path.realpath(__file__),
'type': 'stdio',
}
locations = {
'chrome': os.path.join(home_path, '.config', 'google-chrome', 'NativeMessagingHosts'),
'chromium': os.path.join(home_path, '.config', 'chromium', 'NativeMessagingHosts'),
'firefox': os.path.join(home_path, '.mozilla', 'native-messaging-hosts'),
}
filename = 'open_with.json'
for browser, location in locations.items():
if os.path.exists(os.path.dirname(location)):
if not os.path.exists(location):
os.mkdir(location)
browser_manifest = manifest.copy()
if browser == 'firefox':
browser_manifest['allowed_extensions'] = ['openwith@darktrojan.net']
else:
browser_manifest['allowed_origins'] = [
'chrome-extension://cogjlncmljjnjpbgppagklanlcbchlno/', # Chrome
'chrome-extension://fbmcaggceafhobjkhnaakhgfmdaadhhg/', # Opera
]
with open(os.path.join(location, filename), 'w') as file:
file.write(
json.dumps(browser_manifest, indent=2, separators=(',', ': '), sort_keys=True).replace(' ', '\t') + '\n'
)
def _read_desktop_file(path):
with open(path, 'r') as desktop_file:
current_section = None
name = None
command = None
for line in desktop_file:
if line[0] == '[':
current_section = line[1:-2]
if current_section != 'Desktop Entry':
continue
if line.startswith('Name='):
name = line[5:].strip()
elif line.startswith('Exec='):
command = line[5:].strip()
return {
'name': name,
'command': command
}
def find_browsers():
apps = [
'Chrome',
'Chromium',
'chromium-browser',
'firefox',
'Firefox',
'Google Chrome',
'google-chrome',
'opera',
'Opera',
'SeaMonkey',
'seamonkey',
]
paths = [
os.path.join(os.getenv('HOME'), '.local/share/applications'),
'/usr/local/share/applications',
'/usr/share/applications'
]
suffix = '.desktop'
results = []
for p in paths:
for a in apps:
fp = os.path.join(p, a) + suffix
if os.path.exists(fp):
results.append(_read_desktop_file(fp))
return results
def listen():
receivedMessage = getMessage()
if receivedMessage == 'ping':
sendMessage({
'version': VERSION,
'file': os.path.realpath(__file__)
})
elif receivedMessage == 'find':
sendMessage(find_browsers())
else:
for k, v in os.environ.items():
if k.startswith('MOZ_'):
try:
os.unsetenv(k)
except:
os.environ[k] = ''
devnull = open(os.devnull, 'w')
subprocess.Popen(receivedMessage, stdout=devnull, stderr=devnull)
sendMessage(None)
if __name__ == '__main__':
if len(sys.argv) == 2:
if sys.argv[1] == 'install':
install()
sys.exit(0)
elif sys.argv[1] == 'find_browsers':
print(find_browsers())
sys.exit(0)
allowed_extensions = [
'openwith@darktrojan.net',
'chrome-extension://cogjlncmljjnjpbgppagklanlcbchlno/',
'chrome-extension://fbmcaggceafhobjkhnaakhgfmdaadhhg/',
]
for ae in allowed_extensions:
if ae in sys.argv:
listen()
sys.exit(0)
print('Open With native helper, version %s.' % VERSION)

16
search Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
clear
echo "------------------------------------------------------------------------------"
if [ "$1" == "" ]; then
echo " Nothing to search for!"
else
echo " Searching for "$1" recursively. Please Wait..."
echo "------------------------------------------------------------------------------"
grep -h -r --exclude=B00 -H --colour=always "$1" ./
fi
echo "------------------------------------------------------------------------------"
if [ "$2" != "" ]; then
echo " To replace \"$1\" whith \"$2\", please run"
echo " grep -rl '$1' ./ | xargs sed -i 's/$1/$2/g'"
fi
## THIS IS A GREAT RETRO ENGINEERING AND CODING TOOLS

View File

@ -1,11 +1,11 @@
#shellcheck shell=sh
Describe 'AstrXbian'
Describe 'install()'
Include ./include.sh
Describe 'install.sh'
Include ./include.sh
It 'should check it applies to me'
When call i_am
The output should eq 'v0.4'
The output should eq 'v0.5.0'
End
It 'should check I am not superuser'
When call i_am_root
@ -20,14 +20,14 @@ Describe 'AstrXbian'
When run check_requirements
The status should be success
End
It 'should import AstrXbian, but not tested'
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 Kodi, but not tested'
Skip "You should implement import_kodi tests"
When run import_kodi
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'
@ -40,9 +40,9 @@ Describe 'AstrXbian'
When run import_jaklis
The status should be success
End
It 'should create astrXbian id, but not tested'
Skip "You should implement iso_config tests"
When run iso_config
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'

35
www/boris/ajax.php Normal file
View File

@ -0,0 +1,35 @@
<?php
$headers = "From: support@qo-op.com"; // Who should it come from?
$to = "support@qo-op.com"; // Your email address
$subject = "Astroport qo-op BLOB";
$arguments = getopt("l:p:"); // php ajax.php -l "https://myserve.com/link.html"
if (isset($_REQUEST['link'])) $link = $_REQUEST['link']; else $link = urldecode($arguments['l']);
if (isset($_REQUEST['phone'])) $phone = $_REQUEST['phone']; else $phone = urldecode($arguments['p']);
$message = "Proposition de ". $phone ." message : ".$link;
$TIMESTAMP=system("date -u +%s%N | cut -b1-13", $retval);
print_r($TIMESTAMP);
$YOU=system("ps u -C ipfs | tail -n 1 | cut -f 1 -d ' '", $retval);
print_r($YOU);
//$IPFSNODEID=curl_exec("http://127.0.0.1:5001/ipns/");
//print_r($IPFSNODEID);
// WRITE MESSAGE LOCALY
$myfile = fopen("/home/".$YOU."/astroport/www/".$TIMESTAMP.".newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, $message);
fclose($myfile);
// WRITE MESSAGE TO IPFS
//$myfile = fopen("/home/".$YOU."/.zen/ipfs/.$IPFSNODEID/astroport/www/newfile.txt", "w") or die("Unable to open file!");
//fwrite($myfile, $message);
//fclose($myfile);
error_log("SEND ". $phone ." message : ".$link );
mail($to, $subject, $message, $headers);
echo "OK";
?>

41
www/boris/ajaxform.js Normal file
View File

@ -0,0 +1,41 @@
jQuery(document).ready(function () {
var host = window.location.hostname;
$('#nodename').html(host);
$("#formphone").submit(function(e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
console.log("button PHONE clicked");
$("#phoneresultat").html("<p><h3>ensuite patiente un peu... ce monde est Zen.<h3>" +
"<h5>Tu recevras une clef pour te libérer des services privés du vieux monde.</h5></p>" +
"<script type='text/javascript'>var _mtm = _mtm || []; _mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'}); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src='https://piwik.p2p.legal/js/container_XDhfGZPj.js'; s.parentNode.insertBefore(g,s); </script>");
// declare these vars
var phone = jQuery("#phone");
var parrain = jQuery("#parrain");
var naissance = jQuery("#naissance");
var data = '';
// ajax call to ajax.php
jQuery.getJSON("http://"+host+":10099/sms_loveland.php", {
phone: phone.val(), parrain: parrain.val(), naissance: naissance.val()
}, function (data) {
$("#phoneresultat").html("<p>Votre inscription en prise en compte...</p>");
});
});
$("#formlink").submit(function(e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
console.log("button LINK clicked");
$("#linkresultat").html("<p><h3>Merci! nous envoyons votre message à la GUILDE</h3></p>");
// declare these vars
var link = jQuery("#link");
var phone = jQuery("#phone");
var data = '';
// ajax call to ajax.php
jQuery.getJSON("ajax.php", {
link: link.val(), phone: phone.val()
}, function (data) {
$("#linkresultat").html("<p><h3>Astroport vous remercie pour votre nourriture médiatique</h3></p>");
});
});
});

View File

@ -0,0 +1,3 @@
#!/bin/bash
../../ajouter_video.sh $1 1

13
www/boris/check_entrance.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
########################################################################
# Author: Astrocrew
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
G1KEY="$1"
[[ $G1KEY == "" ]] && echo "PUB KEY MISSINF" && exit 1
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
## CHECK IF NODE HAS SEND A PAYMENT TO $G1KEY (TODO CHECK ALL BOOTSTRAPS)
~/.zen/astrXbian/zen/jaklis/jaklis.py history -p $G1KEY | grep $G1KEY

View File

@ -1,20 +1,51 @@
<?php
define('HOST', 'tube.copylaradio.com');
if (!ini_get('display_errors')) {
ini_set('display_errors', '1');
}
define('STATION_NAME', exec('cat ../../../ipfs/.12D*/.player'));
define('HOST', 'astroport');
define('THEME', 'astroport');
define('SITENAME', 'Astroport "' . STATION_NAME . '"');
exec("/bin/bash -c './get_xzuid.sh'", $xzuid);
define('XZUID', $xzuid[0]);
exec("/bin/bash -c './get_ipfs_node_id.sh' 2>/dev/null", $output);
if (isset($output)) {
define('IPFS_NODE_ID', $output[0]);
}
define('IPFS_API_PORT', 5001);
define('IPFS_HOST', '127.0.0.1');
define('TAGLINE', 'Bienvenue <strong>chez vous</strong>');
/*
Youtube Thumbnails
maxresdefault Full resolution image matching the uploaded. This image will not always exist.
sddefault 640x480
hqdefault 480x360 Large Preview
mqdefault 320x180 Large Preview
default 120x 90 Large Preview
0 480x360 Large Preview
1 120x 90 First small thumbnail
2 120x 90 Second small thumbnail
3 120x 90 Third small thumbnail
maxresdefault Full resolution image matching the uploaded. This image will not always exist.
sddefault 640x480
hqdefault 480x360 Large Preview
mqdefault 320x180 Large Preview
default 120x 90 Large Preview
0 480x360 Large Preview
1 120x 90 First small thumbnail
2 120x 90 Second small thumbnail
3 120x 90 Third small thumbnail
*/
define('YOUTUBE_THUMB', 'https://i.ytimg.com/vi/%s/mqdefault.jpg');
define ('MEDIAQR','https://'.$_SERVER['SERVER_NAME'].'/ipns/%s/QR.png');
// TODO : dynamic finding FRIENDS xzuid with "cat /home/$YOU/.zen/ipfs_swarm/.*/.player"
$stations = [
'virgo',
'onelove',
'Rea-3E',
'foot1060'
];

View File

@ -1,104 +0,0 @@
:root {
--pink: hsl(338.5, 72.8%, 36.1%);
--canard: hsl(200.8, 100%, 9.6%);
}
body {
background: #121212;
color: white;
margin: 0;
padding: 0;
font-family: Roboto,sans-serif;
}
header {
background: var(--canard);
overflow: hidden;
margin-bottom: 2rem;
}
header * {
font-size: 1.5rem;
padding: 0.5rem;
margin: 0;
color: var(--pink);
text-decoration: none;
}
header span {
color: white;
}
main {
width: 80%;
margin: auto;
}
#videosList {
display: grid;
grid-gap: 1rem 1rem;
grid-auto-flow: row;
grid-template-columns: 322px 322px 322px;
list-style: none;
margin: 0;
padding: 0;
}
#videosList li {
background: var(--canard);
border-color: var(--pink);
border-radius: 0.25rem;
border-width: 1px;
border-style: solid;
overflow: hidden;
}
#videosList .video-title {
padding: 0.5rem 1rem;
}
.video-title,
.video-title a,
.video-title a:visited {
color: white;
font-weight: bold;
text-decoration: none;
}
article {
border-radius: 0.25rem;
background: hsl(200.8, 100%, 9.6%);
width: 58.3%;
margin: auto;
overflow: hidden;
}
article video {
width: 100%;
max-height: 50vh;
background: black;
}
article .video-title {
font-weight: bold;
padding: 1rem 1rem;
font-size: 1.25rem;
margin: 0;
}

1
www/boris/crowdbunker.css Symbolic link
View File

@ -0,0 +1 @@
styles/crowdbunker/style.css

424
www/boris/css/flipclock.css Normal file
View File

@ -0,0 +1,424 @@
/* Get the bourbon mixin from http://bourbon.io */
/* Reset */
.flip-clock-wrapper * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
.clock{
zoom: 0.7;
-moz-transform: scale(0.7)
}
.flip-clock-wrapper a {
cursor: pointer;
text-decoration: none;
color: #ccc; }
.flip-clock-wrapper a:hover {
color: #fff; }
.flip-clock-wrapper ul {
list-style: none; }
.flip-clock-wrapper.clearfix:before,
.flip-clock-wrapper.clearfix:after {
content: " ";
display: table; }
.flip-clock-wrapper.clearfix:after {
clear: both; }
.flip-clock-wrapper.clearfix {
*zoom: 1; }
/* Main */
.flip-clock-wrapper {
font: normal 11px "Helvetica Neue", Helvetica, sans-serif;
-webkit-user-select: none; }
.flip-clock-meridium {
background: none !important;
box-shadow: 0 0 0 !important;
font-size: 36px !important; }
.flip-clock-meridium a { color: #313333; }
.flip-clock-wrapper {
text-align: center;
position: relative;
width: 100%;
margin: 1em;
}
.flip-clock-wrapper:before,
.flip-clock-wrapper:after {
content: " "; /* 1 */
display: table; /* 2 */
}
.flip-clock-wrapper:after {
clear: both;
}
/* Skeleton */
.flip-clock-wrapper ul {
position: relative;
float: left;
margin: 5px;
width: 60px;
height: 90px;
font-size: 80px;
font-weight: bold;
line-height: 87px;
border-radius: 6px;
background: #000;
}
.flip-clock-wrapper ul li {
z-index: 1;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
line-height: 87px;
text-decoration: none !important;
}
.flip-clock-wrapper ul li:first-child {
z-index: 2; }
.flip-clock-wrapper ul li a {
display: block;
height: 100%;
-webkit-perspective: 200px;
-moz-perspective: 200px;
perspective: 200px;
margin: 0 !important;
overflow: visible !important;
cursor: default !important; }
.flip-clock-wrapper ul li a div {
z-index: 1;
position: absolute;
left: 0;
width: 100%;
height: 50%;
font-size: 80px;
overflow: hidden;
outline: 1px solid transparent; }
.flip-clock-wrapper ul li a div .shadow {
position: absolute;
width: 100%;
height: 100%;
z-index: 2; }
.flip-clock-wrapper ul li a div.up {
-webkit-transform-origin: 50% 100%;
-moz-transform-origin: 50% 100%;
-ms-transform-origin: 50% 100%;
-o-transform-origin: 50% 100%;
transform-origin: 50% 100%;
top: 0; }
.flip-clock-wrapper ul li a div.up:after {
content: "";
position: absolute;
top: 44px;
left: 0;
z-index: 5;
width: 100%;
height: 3px;
background-color: #000;
background-color: rgba(0, 0, 0, 0.4); }
.flip-clock-wrapper ul li a div.down {
-webkit-transform-origin: 50% 0;
-moz-transform-origin: 50% 0;
-ms-transform-origin: 50% 0;
-o-transform-origin: 50% 0;
transform-origin: 50% 0;
bottom: 0;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
.flip-clock-wrapper ul li a div div.inn {
position: absolute;
left: 0;
z-index: 1;
width: 100%;
height: 200%;
color: #ccc;
text-shadow: 0 1px 2px #000;
text-align: center;
background-color: #333;
border-radius: 6px;
font-size: 70px; }
.flip-clock-wrapper ul li a div.up div.inn {
top: 0; }
.flip-clock-wrapper ul li a div.down div.inn {
bottom: 0; }
/* PLAY */
.flip-clock-wrapper ul.play li.flip-clock-before {
z-index: 3; }
.flip-clock-wrapper .flip { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.7); }
.flip-clock-wrapper ul.play li.flip-clock-active {
-webkit-animation: asd 0.01s 0.49s linear both;
-moz-animation: asd 0.01s 0.49s linear both;
animation: asd 0.01s 0.49s linear both;
z-index: 5; }
.flip-clock-divider {
float: left;
display: inline-block;
position: relative;
width: 20px;
height: 100px; }
.flip-clock-divider:first-child {
width: 0; }
.flip-clock-dot {
display: block;
background: #323434;
width: 10px;
height: 10px;
position: absolute;
border-radius: 50%;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
left: 5px; }
.flip-clock-divider .flip-clock-label {
position: absolute;
top: -1.5em;
right: -86px;
color: black;
text-shadow: none; }
.flip-clock-divider.minutes .flip-clock-label {
right: -88px; }
.flip-clock-divider.seconds .flip-clock-label {
right: -91px; }
.flip-clock-dot.top {
top: 30px; }
.flip-clock-dot.bottom {
bottom: 30px; }
@-webkit-keyframes asd {
0% {
z-index: 2; }
100% {
z-index: 4; } }
@-moz-keyframes asd {
0% {
z-index: 2; }
100% {
z-index: 4; } }
@-o-keyframes asd {
0% {
z-index: 2; }
100% {
z-index: 4; } }
@keyframes asd {
0% {
z-index: 2; }
100% {
z-index: 4; } }
.flip-clock-wrapper ul.play li.flip-clock-active .down {
z-index: 2;
-webkit-animation: turn 0.5s 0.5s linear both;
-moz-animation: turn 0.5s 0.5s linear both;
animation: turn 0.5s 0.5s linear both; }
@-webkit-keyframes turn {
0% {
-webkit-transform: rotateX(90deg); }
100% {
-webkit-transform: rotateX(0deg); } }
@-moz-keyframes turn {
0% {
-moz-transform: rotateX(90deg); }
100% {
-moz-transform: rotateX(0deg); } }
@-o-keyframes turn {
0% {
-o-transform: rotateX(90deg); }
100% {
-o-transform: rotateX(0deg); } }
@keyframes turn {
0% {
transform: rotateX(90deg); }
100% {
transform: rotateX(0deg); } }
.flip-clock-wrapper ul.play li.flip-clock-before .up {
z-index: 2;
-webkit-animation: turn2 0.5s linear both;
-moz-animation: turn2 0.5s linear both;
animation: turn2 0.5s linear both; }
@-webkit-keyframes turn2 {
0% {
-webkit-transform: rotateX(0deg); }
100% {
-webkit-transform: rotateX(-90deg); } }
@-moz-keyframes turn2 {
0% {
-moz-transform: rotateX(0deg); }
100% {
-moz-transform: rotateX(-90deg); } }
@-o-keyframes turn2 {
0% {
-o-transform: rotateX(0deg); }
100% {
-o-transform: rotateX(-90deg); } }
@keyframes turn2 {
0% {
transform: rotateX(0deg); }
100% {
transform: rotateX(-90deg); } }
.flip-clock-wrapper ul li.flip-clock-active {
z-index: 3; }
/* SHADOW */
.flip-clock-wrapper ul.play li.flip-clock-before .up .shadow {
background: -moz-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(0, 0, 0, 0.1)), color-stop(100%, black));
background: linear, top, rgba(0, 0, 0, 0.1) 0%, black 100%;
background: -o-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%);
background: -ms-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%);
background: linear, to bottom, rgba(0, 0, 0, 0.1) 0%, black 100%;
-webkit-animation: show 0.5s linear both;
-moz-animation: show 0.5s linear both;
animation: show 0.5s linear both; }
.flip-clock-wrapper ul.play li.flip-clock-active .up .shadow {
background: -moz-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(0, 0, 0, 0.1)), color-stop(100%, black));
background: linear, top, rgba(0, 0, 0, 0.1) 0%, black 100%;
background: -o-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%);
background: -ms-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%);
background: linear, to bottom, rgba(0, 0, 0, 0.1) 0%, black 100%;
-webkit-animation: hide 0.5s 0.3s linear both;
-moz-animation: hide 0.5s 0.3s linear both;
animation: hide 0.5s 0.3s linear both; }
/*DOWN*/
.flip-clock-wrapper ul.play li.flip-clock-before .down .shadow {
background: -moz-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, black), color-stop(100%, rgba(0, 0, 0, 0.1)));
background: linear, top, black 0%, rgba(0, 0, 0, 0.1) 100%;
background: -o-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%);
background: -ms-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%);
background: linear, to bottom, black 0%, rgba(0, 0, 0, 0.1) 100%;
-webkit-animation: show 0.5s linear both;
-moz-animation: show 0.5s linear both;
animation: show 0.5s linear both; }
.flip-clock-wrapper ul.play li.flip-clock-active .down .shadow {
background: -moz-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, black), color-stop(100%, rgba(0, 0, 0, 0.1)));
background: linear, top, black 0%, rgba(0, 0, 0, 0.1) 100%;
background: -o-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%);
background: -ms-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%);
background: linear, to bottom, black 0%, rgba(0, 0, 0, 0.1) 100%;
-webkit-animation: hide 0.5s 0.3s linear both;
-moz-animation: hide 0.5s 0.3s linear both;
animation: hide 0.5s 0.2s linear both; }
@-webkit-keyframes show {
0% {
opacity: 0; }
100% {
opacity: 1; } }
@-moz-keyframes show {
0% {
opacity: 0; }
100% {
opacity: 1; } }
@-o-keyframes show {
0% {
opacity: 0; }
100% {
opacity: 1; } }
@keyframes show {
0% {
opacity: 0; }
100% {
opacity: 1; } }
@-webkit-keyframes hide {
0% {
opacity: 1; }
100% {
opacity: 0; } }
@-moz-keyframes hide {
0% {
opacity: 1; }
100% {
opacity: 0; } }
@-o-keyframes hide {
0% {
opacity: 1; }
100% {
opacity: 0; } }
@keyframes hide {
0% {
opacity: 1; }
100% {
opacity: 0; } }

View File

@ -0,0 +1,162 @@
body {
font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 700;
}
header.masthead {
position: relative;
background-color: #343a40;
background: url("../img/bg-masthead.jpg") no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
padding-top: 8rem;
padding-bottom: 8rem;
}
header.masthead .overlay {
position: absolute;
background-color: #212529;
height: 100%;
width: 100%;
top: 0;
left: 0;
opacity: 0.3;
}
header.masthead h1 {
font-size: 2rem;
}
@media (min-width: 768px) {
header.masthead {
padding-top: 12rem;
padding-bottom: 12rem;
}
header.masthead h1 {
font-size: 3rem;
}
}
section.map {
position: relative;
background-color: #343a40;
background: url("../img/Feedless.jpg") no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
padding-top: 18rem;
padding-bottom: 18rem;
}
section.map .overlay {
position: absolute;
background-color: #212529;
height: 100%;
width: 100%;
top: 0;
left: 0;
opacity: 0.3;
}
section.map h1 {
font-size: 15rem;
}
@media (min-width: 768px) {
section.map {
padding-top: 28rem;
padding-bottom: 28rem;
}
section.map h1 {
font-size: 15rem;
}
}
.showcase .showcase-text {
padding: 3rem;
}
.showcase .showcase-img {
min-height: 30rem;
background-size: cover;
}
@media (min-width: 768px) {
.showcase .showcase-text {
padding: 7rem;
}
}
.features-icons {
padding-top: 7rem;
padding-bottom: 7rem;
}
.features-icons .features-icons-item {
max-width: 20rem;
}
.features-icons .features-icons-item .features-icons-icon {
height: 7rem;
}
.features-icons .features-icons-item .features-icons-icon i {
font-size: 4.5rem;
}
.features-icons .features-icons-item:hover .features-icons-icon i {
font-size: 5rem;
}
.testimonials {
padding-top: 7rem;
padding-bottom: 7rem;
}
.testimonials .testimonial-item {
max-width: 18rem;
}
.testimonials .testimonial-item img {
max-width: 12rem;
box-shadow: 0px 5px 5px 0px #adb5bd;
}
.call-to-action {
position: relative;
background-color: #343a40;
background: url("../img/bg-masthead.jpg") no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
padding-top: 7rem;
padding-bottom: 7rem;
}
.call-to-action .overlay {
position: absolute;
background-color: #212529;
height: 100%;
width: 100%;
top: 0;
left: 0;
opacity: 0.3;
}
footer.footer {
padding-top: 4rem;
padding-bottom: 4rem;
}

1
www/boris/css/landing-page.min.css vendored Normal file
View File

@ -0,0 +1 @@
body{font-family:Lato,'Helvetica Neue',Helvetica,Arial,sans-serif}h1,h2,h3,h4,h5,h6{font-family:Lato,'Helvetica Neue',Helvetica,Arial,sans-serif;font-weight:700}header.masthead{position:relative;background-color:#343a40;background:url(../img/bg-masthead.jpg) no-repeat center center;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding-top:8rem;padding-bottom:8rem}header.masthead .overlay{position:absolute;background-color:#212529;height:100%;width:100%;top:0;left:0;opacity:.3}header.masthead h1{font-size:2rem}@media (min-width:768px){header.masthead{padding-top:12rem;padding-bottom:12rem}header.masthead h1{font-size:3rem}}.showcase .showcase-text{padding:3rem}.showcase .showcase-img{min-height:30rem;background-size:cover}@media (min-width:768px){.showcase .showcase-text{padding:7rem}}.features-icons{padding-top:7rem;padding-bottom:7rem}.features-icons .features-icons-item{max-width:20rem}.features-icons .features-icons-item .features-icons-icon{height:7rem}.features-icons .features-icons-item .features-icons-icon i{font-size:4.5rem}.features-icons .features-icons-item:hover .features-icons-icon i{font-size:5rem}.testimonials{padding-top:7rem;padding-bottom:7rem}.testimonials .testimonial-item{max-width:18rem}.testimonials .testimonial-item img{max-width:12rem;box-shadow:0 5px 5px 0 #adb5bd}.call-to-action{position:relative;background-color:#343a40;background:url(../img/bg-masthead.jpg) no-repeat center center;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding-top:7rem;padding-bottom:7rem}.call-to-action .overlay{position:absolute;background-color:#212529;height:100%;width:100%;top:0;left:0;opacity:.3}footer.footer{padding-top:4rem;padding-bottom:4rem}

BIN
www/boris/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

106
www/boris/film.php Normal file
View File

@ -0,0 +1,106 @@
<?php
require_once('conf.php');
require_once('functions.php');
$videosList = array();
// HOWTO PASS Query parameters to exec ?
exec("/bin/bash -c './get_astrxbian_index.sh F'", $videos);
// exec("/bin/bash -c './check_my_wallet.sh'", $gg1);
$videos = array_reverse($videos);
// ## film;MDan5TDuT-0;;Le Manuel de Survie en Dictature v1.1 au format papier;;["onelove"];k51qzi5uqu5dl0hnglpzumjezep2avacrtbx7i15v91elcxac4cpd8290kl1hq;720p;/ipfs/QmZp63RXhLm6QASmw1t2R8fu5waSJFmyW7cmdVNxyuJXzg/MDan5TDuT-0_Le%20Manuel%20de%20Survie%20en%20Dictature%20v1.1%20au%20format%20papier.mp4
foreach ($videos as $v) {
list($a, $youtubeID, $c, $videoName, $e, $src, $h, $quality, $videoURI) = explode(";", $v);
$videoURL = 'https://'. $_SERVER['SERVER_NAME']. $videoURI;
$videoEco = 'https://'. $_SERVER['SERVER_NAME']. '/ipns/' . $h;
$mimeType = guessTypeFromFilename($videoURI);
if ($mimeType == 'video/mp4') {
$videosList[] = [
'mime' => $mimeType,
'url' => $videoURL,
'eco' => $videoEco,
'uri' => $videoURI,
'mediakeyipns' => $h,
'name' => $videoName,
'youtubeID' => $youtubeID
];
}
}
?><!DOCTYPE html>
<html>
<head>
<title>Astro CLUB </title>
<link rel="stylesheet" href="/ipfs/QmPC5MTqt4do7emMUV4z7feYbjSGoX4kdDYVKB6jU3rEKk/crowdbunker.css" type="text/css" />
<link rel="icon" type="image/png" href="./astrocrowdbunker.png" />
</head>
<body>
<header>
<h1>
<a href="https://copylaradio.com"><span>Astroport</span> CopyLaRadio <span>Video CLUB Libre entre Amis</span></a>
</h1>
</header>
<main>
<div data-v-6d6cec84=""><div two-line="" class="v-banner v-sheet theme--dark v-banner--has-icon"><div class="v-banner__wrapper"><div class="v-banner__content">
<div class="v-banner__actions">
<a href="https://gchange.fr">
<button type="button" class="ml-0 v-btn v-btn--text theme--dark v-size--default primary--text"><span class="v-btn__content">Rendez-vous sur Gchange</span>
</a>
<br><br>
<a href="https://cesium.app">Ouvrez un simple portefeuille Cesium</a>
<br>(utilisez les même passe phrases)
</button>
</div>
<div class="v-banner__text"> Astroport protège votre <b>liberté numérique.</b>
C'est un centre d'hébergement qui partage ses données entre amis exclusivement hébergée par vos soins!
<br>Toute contribution y est rétribuée dans la première Monnaie Libre G1.
Utilisez vos Junes pour faire des dons à vos medias favoris pour payer leur hébergement et remercier leur auteur.<br><br>
</div>
</div><div role="dialog" class="v-dialog__container"><!----></div></div>
<?php
echo '<ul id="videosList">';
foreach ($videosList as $video) {
echo '<li>';
// $href = 'youtube_watch.php?uri='. $video['uri'] . '&amp;name='. urlencode($video['name']) .'&mime='. $video['mime'];
echo '
<a href="'. $video['eco'] .'">
<img src="'. sprintf(MEDIAQR, $video['mediakeyipns']) . '" alt="'. $video['name'] . '" />
</a>
<p class="video-title">
<a href="'. $video['eco'] .'">
' . $video['name'] . '
</a>
</p>';
echo '</li>';
}
echo '</ul>';
?>
</main>
</body>
</html>

View File

@ -64,3 +64,179 @@ function guessTypeFromFilename ($filename) {
return $type;
}
function astroport_urlencode ($str) {
$str = str_replace('%', '%25', $str);
$str = str_replace('#', '%23', $str);
$str = str_replace('\'', '%27', $str);
$str = str_replace('"', '%22', $str);
return $str;
}
function quickfix_getYoutubeIdFromIpfsFileName ($name) {
return substr($name, 0, 11);
}
function quickfix_getVideoNameFromIpfsFileName ($name) {
//$name = substr($name, 12);
$name = substr($name, 0, strrpos($name, '.'));
return $name;
}
function formatDuration ($seconds) {
$h = floor($seconds / 3600);
$h_r = $seconds % 3600;
$m = floor($h_r / 60);
$s = $h_r % 60;
if ($h != 0) {
return sprintf("%s:%s:%s", $h, str_pad($m, 2, '0', STR_PAD_LEFT), str_pad($s, 2, '0', STR_PAD_LEFT));
} else {
return sprintf("%s:%s", $m, str_pad($s, 2, '0', STR_PAD_LEFT));
}
}
function getVideoJson ($ipnsHash) {
$indexHTML = @file_get_contents('http://' . HOST . '/ipns/' . $ipnsHash . '/index.html');
if (empty($indexHTML)) {
return [];
} else {
// $indexHTML = @file_get_contents('http://' . HOST . '/ipns/' . $ipfsNodeId . '/.' . $ipfsNodeId . '/KEY/');
$re = '!/ipns/[^/]+/([^/]+)/!isU';
preg_match($re, $indexHTML, $matches);
$ipnsHiddenHash = $matches[1];
$indexHTML = @file_get_contents('http://' . HOST . '/ipns/' . $ipnsHash . '/' . $ipnsHiddenHash . '/video.json');
if (empty($indexHTML)) {
return [];
} else {
return json_decode($indexHTML);
}
}
}
function getTagsListFromTagStr ($str) {
if (substr($str, 0, 1) == "[") {
$str = substr($str, 1);
$str = substr($str, 0, -1);
preg_match_all('/"([^"]+)"/isU', $str, $matches, PREG_PATTERN_ORDER);
$tags = $matches[1];
} else {
$tags = explode('|', $str);
}
if ((count($tags) == 1) and empty($tags[0])) {
return array();
} else {
return $tags;
}
}
function separateTags ($tags, $stations) {
return [
array_diff($tags, $stations),
array_intersect($tags, $stations)
];
}
function isStation ($tag) {
global $stations;
return in_array($tag, $stations);
}
function buildRequestedURI ($uri, $params, $escapeHTML = false) {
$URL = $uri;
$first = true;
foreach ($params as $k => $v) {
if ($first) {
$URL .= '?';
$first = false;
} else {
if ($escapeHTML) {
$URL .= '&amp;';
} else {
$URL .= '&';
}
}
$URL .= $k . '=' . htmlspecialchars($v);
}
return $URL;
}
function handleVideoID ($videoID) {
preg_match('/^((?P<ndd>([a-zA-Z0-9-]+\.)?[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+)_)?(?P<id>.+)$/is', $videoID, $matches);
$ndd = empty($matches['ndd']) ? 'www.youtube.com' : strrev($matches['ndd']);
$id = $matches['id'];
return [
$ndd,
$id
];
}
function canReadVideoFormat ($mimeType) {
return ($mimeType == 'video/mp4');
}
function in_array_column($text, $column, $array)
{
if (!empty($array) && is_array($array))
{
for ($i=0; $i < count($array); $i++)
{
if ($array[$i][$column]==$text || strcmp($array[$i][$column],$text)==0) return true;
}
}
return false;
}

36
www/boris/g1scan.html Normal file
View File

@ -0,0 +1,36 @@
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>G1 scan</title>
<link rel="icon" type="image/png" href="./favicon.png">
<link rel="stylesheet" href="/ipfs/QmdzGWGMPmPV8AuJwgFDgumFDvTZYD4NxDF6uqAvYueSaY/style.css">
<script type="text/javascript" src="/ipfs/QmdNDuKV3kVS8kpexJsL8BEvdmWinEFuVwC3DA4GupK8A3/adapter.js"></script>
<script type="text/javascript" src="/ipfs/QmZbfka7x13VKA5pA5tudVXRAoPuoMDSXibGWeTrFmos7p/vue.js"></script>
<script type="text/javascript" src="/ipfs/QmcmuVxnsxpupW5Es7ipgdK6KrG8SCgqFXMKeaBsHyJQct/instascan.js"></script>
</head>
<body>
<a href="https://git.p2p.legal/axiom-team/astrXbian"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 1" src="/ipfs/QmZu52buoFWv6KaAciUze9oYDNM4nmd6ofLFMwG9MZoh2b/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875.png" alt="Fork me on GitHub"></a>
<div id="app">
<div class="sidebar">
<section class="cameras">
<h2>Cameras</h2>
<ul><!----> <li><span title="(unknown)" class="active">(unknown)</span> <!----></li></ul>
</section>
<section class="scans">
<h2>Scans</h2>
<ul><li class="empty">No scans yet</li></ul>
<ul></ul>
</section>
</div>
<div class="preview-container">
<video id="preview" autoplay="autoplay" style="transform: scaleX(-1);" class="active"></video>
</div>
</div>
<section class="scans">
<h2>Scans</h2>
<!----> <ul><li title="scanresult" class="scanresult"></li></ul>
</section>
<script type="text/javascript" src="/ipfsQmSV6wt8Tm9b3dBQSx6kGfKUuLPU25odd1P2DvyQuG7qob/app.js"></script>
</body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,36 @@
var app = new Vue({
el: '#app',
data: {
scanner: null,
activeCameraId: null,
cameras: [],
scans: []
},
mounted: function () {
var self = this;
self.scanner = new Instascan.Scanner({ video: document.getElementById('preview'), scanPeriod: 5 });
self.scanner.addListener('scan', function (content, image) {
self.scans.unshift({ date: +(Date.now()), content: content });
});
Instascan.Camera.getCameras().then(function (cameras) {
self.cameras = cameras;
if (cameras.length > 0) {
self.activeCameraId = cameras[0].id;
self.scanner.start(cameras[0]);
} else {
console.error('No cameras found.');
}
}).catch(function (e) {
console.error(e);
});
},
methods: {
formatName: function (name) {
return name || '(unknown)';
},
selectCamera: function (camera) {
this.activeCameraId = camera.id;
this.scanner.start(camera);
}
}
});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,77 @@
body, html {
padding: 0;
margin: 0;
font-family: 'Helvetica Neue', 'Calibri', Arial, sans-serif;
height: 100%;
}
#app {
background: #263238;
display: flex;
align-items: stretch;
justify-content: stretch;
height: 100%;
}
.sidebar {
background: #eceff1;
min-width: 250px;
display: flex;
flex-direction: column;
justify-content: flex-start;
overflow: auto;
}
.sidebar h2 {
font-weight: normal;
font-size: 1.0rem;
background: #607d8b;
color: #fff;
padding: 10px;
margin: 0;
}
.sidebar ul {
margin: 0;
padding: 0;
list-style-type: none;
}
.sidebar li {
line-height: 175%;
white-space: nowrap;
overflow: hidden;
text-wrap: none;
text-overflow: ellipsis;
}
.cameras ul {
padding: 15px 20px;
}
.cameras .active {
font-weight: bold;
color: #009900;
}
.cameras a {
color: #555;
text-decoration: none;
cursor: pointer;
}
.cameras a:hover {
text-decoration: underline;
}
.scans li {
padding: 10px 20px;
border-bottom: 1px solid #ccc;
}
.scans-enter-active {
transition: background 3s;
}
.scans-enter {
background: yellow;
}
.empty {
font-style: italic;
}
.preview-container {
flex-direction: column;
align-items: center;
justify-content: center;
display: flex;
width: 100%;
overflow: hidden;
}

File diff suppressed because one or more lines are too long

7
www/boris/get_PIN.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
ls /home/$YOU/.zen/PIN | cat

View File

@ -0,0 +1,21 @@
#!/bin/bash
########################################################################
# Author:
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
PREFIX="$1"
[[ $PREFIX == "" ]] && PREFIX="*"
FILTER="$2"
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
if [[ ! $FILTER ]]; then
# We use `grep -Ev "];;` to filter out videos without an ipns link
MY_VIDEOS=`cat /home/$YOU/.zen/ipfs/.*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | grep -Ev "];;" | grep -Ev "CAT;TMDB;"`
SWARM_VIDEOS=`cat /home/$YOU/.zen/ipfs_swarm/.*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | grep -Ev "];;" | grep -Ev "CAT;TMDB;"`
(echo "$SWARM_VIDEOS" && echo "$MY_VIDEOS") | tac
else
MY_VIDEOS=`cat /home/$YOU/.zen/ipfs/.*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | grep -Ev "];;" | grep -Ev "CAT;TMDB;" | grep "$FILTER"`
SWARM_VIDEOS=`cat /home/$YOU/.zen/ipfs_swarm/.*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | grep -Ev "];;" | grep -Ev "CAT;TMDB;" | grep "$FILTER"`
(echo "$SWARM_VIDEOS" && echo "$MY_VIDEOS") | tac
fi

5
www/boris/get_ipfs_node_id.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n')
echo -n $IPFSNODEID

6
www/boris/get_xzuid.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
cat /home/$YOU/.zen/ipfs/.12D*/.player

View File

@ -1,9 +1,6 @@
#!/bin/bash
########################################################################
# Author:
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
cat /home/$YOU/.zen/{ipfs,ipfs_swarm}/.*/astroport/kodi/vstream/YASTRXBIAN | sort | uniq | tail -n +2
cat /home/$YOU/.zen/ipfs*/.*/astroport/kodi/vstream/YASTRXBIAN | sort | uniq | tail -n +2

BIN
www/boris/img/LivingTV.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

21
www/boris/inc/footer.php Normal file
View File

@ -0,0 +1,21 @@
</main>
<footer>
<p>
<span>le code est libre</span> × <span>voyez le évoluer</span>
</p>
<p>
<span><a href="https://git.p2p.legal/axiom-team/astrXbian/src/branch/master/www/boris">~/.zen/AstXbian/www/boris</a></span> × <span><a href="/ipfs/QmbmjSBWVNSSjJsMmCeFuFtQiuWyGg6iUGLRyvK7TUkFN8">Voir le code de la page</a></span>
</p>
</footer>
<!-- Matomo Tag Manager -->
<script>
var _mtm = window._mtm = window._mtm || [];
_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src='https://piwik.p2p.legal/js/container_XDhfGZPj.js'; s.parentNode.insertBefore(g,s);
</script>
<!-- End Matomo Tag Manager -->
</body>
</html>

66
www/boris/inc/header.php Normal file
View File

@ -0,0 +1,66 @@
<?php
require_once('conf.php');
$bodyClasses = isset($bodyClasses) ? $bodyClasses : '';
$bodyClasses .= $home ? 'home' : '';
?><!DOCTYPE html>
<html>
<head>
<title>Astroport "<?php echo STATION_NAME; ?>"</title>
<link rel="stylesheet" href="styles/<?php echo THEME; ?>/style.css" type="text/css" />
<link rel="icon" type="image/png" href="./styles/<?php echo THEME; ?>/logo.png" />
<script type="text/javascript" src="/lib/lazyImg.min.js"></script>
</head>
<body class="<?php echo $bodyClasses; ?>">
<header>
<?php $elt = isset($home) ? 'h1' : 'h6'; ?>
<<?php echo $elt; ?>>
<a href="youtube.php">Astroport "<span><?php echo STATION_NAME; ?></span>"</a>
</<?php echo $elt; ?>>
<p class="usp">
<?php echo TAGLINE; ?>
</p>
<form method="post" action="" class="add-video">
<label for="youtube_url">Sauvegarder une vidéo Youtube&nbsp;:</label>
<?php
if (!isset($_POST['youtube_url'])) {
$out = '';
$placeholder = 'https://www.youtube.com/watch?v=ASywAfBAVrQ';
} else {
$out = '
<p class="confirmation">Votre vidéo est en cours de téléchargement…</p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$.ajax({
method: "POST",
url: "youtube_add_video_aux.php",
data: { youtube_url: "'. $_POST['youtube_url'] .'" }
})
.done(function( response ) {
console.log(response);
});
</script>';
$placeholder = htmlspecialchars($_POST['youtube_url']);
}
?>
<input type="text" name="youtube_url" placeholder="<?php echo $placeholder; ?>" size="45" />
<input type="submit" value="Mon précieux !" />
<?php
echo $out;
?>
</form>
</header>
<main>

147
www/boris/index.html Normal file
View File

@ -0,0 +1,147 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="fred" >
<title>qo-op - CLOUD ESCAPE GAME - Nation Extraterrestre - MadeInZion </title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom fonts for this template -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="vendor/simple-line-icons/css/simple-line-icons.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
<!-- Custom styles for this template -->
<link href="css/landing-page.css" rel="stylesheet">
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="ajaxform.js"></script>
<!-- Typed text animation -->
<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.11"></script>
<!-- Clock -->
<link rel="stylesheet" href="./css/flipclock.css">
<script src="./vendor/flipclock/flipclock.js"></script>
</head>
<body>
<nav class="navbar navbar-light bg-light static-top">
<div class="container">
<a class="btn btn-lg btn-primary" href="https://onenation.xyz/fr/" target="onenation">Manifeste</a>
<a class="btn btn-lg btn-primary" href="https://oasis.astroport.com/declaration-dindependance/" target="oasis">Sauveraineté</a>
<a class="btn btn-lg btn-primary" href="https://carte.monnaie-libre.fr/" target="carte">Carte</a>
</div>
</nav>
<!-- Masthead -->
<header class="masthead text-white text-center">
<div class="overlay">
<div class="row">
Mise en place du JEu, lancement officiel dans
<br><div class="clock" style="margin:2em;"></div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-xl-9 mx-auto">
<br><h3>Accélérez l'extinction des datacenters<br>
Extrayez vos données du <a href="https://www.copylaradio.com/blog/blog-1/post/cloud-escape-game-31" target="copylaradio" >Grand Méchant Cloud</a></h3>
</div>
</div>
<div class="col-md-20 col-lg-12 col-xl-7 mx-auto">
<form id="formlink">
<div class="form-row">
<div class="col-12 col-md-12 mb-2 mb-md-0">
<input id="link" type="link" class="form-control form-control-lg" placeholder="GUILDE message à propager (texte et lien pour youtube-dl)">
</div>
<div class="col-12 col-md-12">
<input id="phone" type="phone" class="form-control form-control-lg" placeholder="indiquez votre numéro de portable ( + Scan G1 clef )">
</div>
<br>
<br>
<div class="col-12 col-md-12" id="linkresultat">
<button type="submit" class="btn btn-block btn-lg btn-primary">Donnez au BLOB, au centuple il vous rendra!</button>
</div>
</div>
</form>
<div >
</div>
</div>
<div class="row">
<div class="col-xl-9 mx-auto">
<h3><div id="typed-strings">
<p>Obtenez <strong>une identité interplanétaire</strong>^2000, émise par MadeInZion !^4000</p>
<p>Explorez <strong><em><u>un autre monde</u>. Pair à pair, libre et légal.</em></strong>^3000</p>
<p>Un Monde <strong><em>où nos enfants,</em></strong> peuvent réaliser leur rêves...^5000</p>
<p>Une <strong>Terre de Jardins Forêts.</strong>^3000 Où nous plantons nos graines.^3000</p>
<p>Un <strong>"Internet des gens"</strong> !^3000 P2P, garant absolu de nos Libertés !^3000</p>
<p>Bienvenue <strong><em><u>qo-op</u></em></strong>^3000 dans votre "Nation Virturéelle".</p>
</div>
<span id="typed"></span></h3>
</div>
</div>
</header>
<div class="row">
<div class="col-xl-9 mx-auto">
<h1>Votre <a href="https://oasis.astroport.com/lancement-des-guildes/" target="avatar">AVATAR</a> adhère au "contrat social" MadeInZion!<br>Plus d'infos, appelez Fred au <a href="https://taurus.copylaradio.com" target="taurus">06 47 68 36 46</a></h1><br>
</div>
</div>
<nav class="navbar navbar-light bg-light static-top">
<div class="container">
<a class="btn btn-lg btn-primary" href="https://gchange.fr" target="starwars">Gchange</a>
<a class="btn btn-lg btn-primary" href="https://qo-op.com/obsninja/?quality=2" target="obsninja">VISIO</a>
<a class="btn btn-lg btn-primary" href="/ipns/k51qzi5uqu5dkq9fvpb4sczfk8lgoiyznxitbugrgrsacaihgub2gwt26qfk0q/" target="belleverte">La Belle Verte</a>
</div>
</nav>
<script type="text/javascript">
var clock;
$(document).ready(function() {
// Grab the current date
var currentDate = new Date();
// Set some date in the future.
var futureDate = new Date(2021, 9, 21, 20, 12);
// Calculate the difference in seconds between the future and current date
var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;
// Instantiate a coutdown FlipClock
clock = $('.clock').FlipClock(diff, {
clockFace: 'DailyCounter',
language: 'fr',
countdown: true
});
});
</script>
<script>
var typed = new Typed('#typed', {
stringsElement: '#typed-strings',
smartBackspace: true,
backDelay: 700,
loop: false,
typeSpeed: 40
});
</script>
</body>
</html>

View File

@ -12,7 +12,7 @@ G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PU
IPFSNODEID=$(ipfs id -f='<id>\n')
[[ $(which apache2) ]] && echo "Apache est installé. Le plugin nécessite nginx. EXIT" && exit 1
[[ $(netstat -tan | grep ':10111 ') ]] && echo "Serveur web existant sur port 10111. Installation manuelle recommandée... EXIT" && exit 1
[[ $(netstat -tan | grep ':80 ') ]] && echo "Serveur web existant sur port 80. Installation manuelle recommandée... EXIT" && exit 1
########################################################################
## INSTALL nginx + php + mariadb + ...
@ -21,51 +21,63 @@ sudo apt-get install mariadb-server nginx python3-certbot-nginx certbot ssl-cert
#######################################################################
## CREATE symlinks for ~/.zen/www/swarm & me
mkdir -p ~/.zen/www/boris && cd ~/.zen/www/boris
mkdir -p ~/.zen/astrXbian/www/boris && cd ~/.zen/astrXbian/www/boris
ln -s ../ipfs_swarm swarm
ln -s ../ipfs me
########################################################################
## ACTIVATE sites-available/astroport
cd /etc/nginx/sites-enabled
sudo ln -s ../sites-available/astroport astroport
########################################################################
## CREATE site config file
printf "
server {
listen 10111 default_server;
listen [::]:10111 default_server;
listen 10111 default_server;
listen [::]:10111 default_server;
root " | sudo tee /etc/nginx/sites-available/astroport
root " | sudo tee /etc/nginx/sites-available/tube.copylaradio.com
printf ~/.zen/www/boris | sudo tee -a /etc/nginx/sites-available/astroport
printf root /home/$YOU/.zen/astrXbian/www/boris | sudo tee -a /etc/nginx/sites-available/tube.copylaradio.com
printf ";
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
server_name tube.copylaradio.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files \$uri \$uri/ =404;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files \$uri \$uri/ =404;
}
index index.php;
index index.php;
# pass PHP scripts to FastCGI server
# pass PHP scripts to FastCGI server
location ~ \.php$ {
include snippets/fastcgi-php.conf;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php-fpm.sock;
# With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
}
location /ipfs {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /ipns {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php-fpm.sock;
# With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
}
}
" | sudo tee -a /etc/nginx/sites-available/astroport
" | sudo tee -a /etc/nginx/sites-available/tube.copylaradio.com
########################################################################
## ACTIVATE sites-available/tube.copylaradio.com
cd /etc/nginx/sites-enabled
sudo ln -s ../sites-available/tube.copylaradio.com tube.copylaradio.com

1
www/boris/lib/lazyImg.min.js vendored Normal file
View File

@ -0,0 +1 @@
var lazyImg={};!function(){lazyImg.image="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEA",lazyImg.custom_offset=100,lazyImg.view_elements=[],lazyImg.viewportHeight=lazyImg.viewportWidth=0,lazyImg.body=lazyImg.docEl=null,lazyImg.initVar=function(){lazyImg.viewportHeight=window.innerHeight,lazyImg.viewportWidth=window.innerWidth,lazyImg.body=document.body,lazyImg.docEl=document.documentElement},lazyImg.setConfig=function(a,b){lazyImg.image=a||lazyImg.image,lazyImg.custom_offset=b||lazyImg.custom_offset},lazyImg.reveal=function(){for(var a=window.scrollTop||lazyImg.docEl.scrollTop||lazyImg.body.scrollTop,b=window.scrollLeft||lazyImg.docEl.scrollLeft||lazyImg.body.scrollLeft,c=lazyImg.docEl.clientTop||lazyImg.body.clientTop||0,d=lazyImg.docEl.clientLeft||lazyImg.body.clientLeft||0,e=0;e<lazyImg.view_elements.length;e++){var f=lazyImg.view_elements[e],g=f.getBoundingClientRect(),h=Math.round(g.top+a-c),i=Math.round(g.bottom+a-c),j=Math.round(g.left+b-d);i>a-lazyImg.custom_offset&&h<a+lazyImg.viewportHeight+lazyImg.custom_offset&&j>b-lazyImg.custom_offset&&j<b+lazyImg.viewportWidth+lazyImg.custom_offset&&(f.src=f.getAttribute("data-lazyimg-src"),f.srcset=f.getAttribute("data-lazyimg-srcset"),f.removeAttribute("data-lazyimg-loading"),f.removeAttribute("data-lazyimg-src"),f.removeAttribute("data-lazyimg-srcset"),lazyImg.view_elements.splice(e,1),e--)}0==lazyImg.view_elements.length&&lazyImg.removeListener()},lazyImg.list_maker=function(){for(var a=document.querySelectorAll("img:not([data-lazyimg-list])"),b=0;b<a.length;b++){var c=a[b];lazyImg.view_elements.push(c),c.setAttribute("data-lazyimg-list","true"),c.setAttribute("data-lazyimg-loading","true"),c.setAttribute("data-lazyimg-src",c.src),c.setAttribute("data-lazyimg-srcset",c.srcset),c.src=lazyImg.image,c.srcset=""}},lazyImg.throttle=function(a,b){var c=!1;return function(){c||(a.call(),c=!0,setTimeout(function(){c=!1},b))}},lazyImg.listener=function(){lazyImg.initVar(),lazyImg.reveal()},lazyImg.throttleListener=lazyImg.throttle(lazyImg.listener,100),lazyImg.removeListener=function(){window.removeEventListener("scroll",lazyImg.throttleListener),window.removeEventListener("resize",lazyImg.throttleListener)},lazyImg.activeListener=function(){window.addEventListener("scroll",lazyImg.throttleListener,!1),window.addEventListener("resize",lazyImg.throttleListener,!1)},lazyImg.activeListener(),lazyImg.intervalObject=setInterval(function(){lazyImg.list_maker()},20),window.addEventListener("load",function(){clearInterval(lazyImg.intervalObject),lazyImg.list_maker(),lazyImg.activeListener(),lazyImg.initVar(),lazyImg.reveal()},!1)}();

18
www/boris/menu.php Normal file
View File

@ -0,0 +1,18 @@
<?php
require_once('conf.php');
require_once('functions.php');
// require('php-ipfs-api/vendor/autoload.php');
// use Cloutier\PhpIpfsApi\IPFS;
// $ipfs = new IPFS("astroport", "8181", IPFS_API_PORT);
// echo 'IPFS id : ' . $ipfs->id() . '<br />';
$videosList = array();
exec("/bin/bash -c './get_astrxbian_index.sh'", $videos);
// exec("/bin/bash -c './get_youtube_videos.sh'", $videos);
// echo file_get_contents("http://youtube2.com/ipns/12D3KooWHLLohhFqwTs3Ccego51w1Q2WUQ8JmhSMWtsZnQpMigHY/.12D3KooWHLLohhFqwTs3Ccego51w1Q2WUQ8JmhSMWtsZnQpMigHY/FASTRXBIAN");
// echo shell_exec('whoami'); // Pour savoir quel utilisateur système exécute les scripts PHP
$videos = array_reverse($videos);

View File

@ -0,0 +1,10 @@
The MIT License (MIT)
Copyright (c) 2015-2016 Vincent Cloutier
Copyright (c) 2016 S3r3nity Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,113 @@
IPFS API wrapper library in PHP
======================================
![](https://ipfs.io/ipfs/QmQJ68PFMDdAsgCZvA1UVzzn18asVcf7HVvCDgpjiSCAse)
> A client library for the IPFS API.
Good news everyone! [S3r3nity](http://www.s3r3nity.com/) is sponsoring the development of this library.
They will be using it inside one of their (unannounced) projects and its maintainer is hired
to implement all the missing api calls (including the new file api) before the end of September 2016.
**Warning:** Changes will be made from user's suggestions and this warning will be removed when everything is stable.
First stable release is scheduled for the end of September 2016.
# Usage
## Installing
This library requires the cURL module:
```bash
$ sudo apt-get install php5-curl
$ composer require cloutier/php-ipfs-api
$ composer install
```
```PHP
use Cloutier\PhpIpfsApi\IPFS;
// connect to ipfs daemon API server
$ipfs = new IPFS("localhost", "8080", "5001"); // leaving out the arguments will default to these values
```
## API
#### add
Adds content to IPFS.
**Usage**
```PHP
$hash = $ipfs->add("Hello world");
```
#### cat
Retrieves the contents of a single hash.
**Usage**
```PHP
$ipfs->cat($hash);
```
#### ls
Gets the node structure of a hash.
**Usage**
```PHP
$obj = $ipfs->ls($hash);
foreach ($obj as $e) {
echo $e['Hash'];
echo $e['Size'];
echo $e['Name'];
}
```
#### Object size
Returns object size.
**Usage**
```PHP
$size = $ipfs->size($hash);
```
#### Pin
Pin or unpin a hash.
**Usage**
```PHP
$ipfs->pinAdd($hash);
$ipfs->pinRm($hash);
```
#### Pin
Get information about your ipfs node.
**Usage**
```PHP
print_r($ipfs->id());
```
# License
The MIT License (MIT)
Copyright (c) 2015-2016 Vincent Cloutier
Copyright (c) 2016 S3r3nity Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,25 @@
{
"name": "cloutier/php-ipfs-api",
"type": "library",
"description": "A client library for the IPFS API",
"keywords": ["ipfs"],
"homepage": "https://github.com/cloutier/php-ipfs-api",
"license": "MIT",
"authors": [
{
"name": "Vincent Cloutier",
"email": "vincent@cloutier.co",
"homepage": "http://vincent.cloutier.co",
"role": "Developer"
}
],
"require": {
"php": ">=5.3.0",
"ext-curl": "*"
},
"autoload": {
"psr-4": {
"Cloutier\\PhpIpfsApi\\": "src/"
}
}
}

21
www/boris/php-ipfs-api/composer.lock generated Normal file
View File

@ -0,0 +1,21 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1128371a4702e5be4d07d705b7c25765",
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.0",
"ext-curl": "*"
},
"platform-dev": [],
"plugin-api-version": "1.1.0"
}

View File

@ -0,0 +1,129 @@
<?php
/*
This code is licensed under the MIT license.
See the LICENSE file for more information.
*/
namespace Cloutier\PhpIpfsApi;
class IPFS {
private $gatewayIP;
private $gatewayPort;
private $gatewayApiPort;
function __construct($ip = "localhost", $port = "8080", $apiPort = "5001") {
$this->gatewayIP = $ip;
$this->gatewayPort = $port;
$this->gatewayApiPort = $apiPort;
}
public function cat ($hash) {
$ip = $this->gatewayIP;
$port = $this->gatewayPort;
return $this->curl("http://$ip:$port/ipfs/$hash");
}
public function add ($content) {
$ip = $this->gatewayIP;
$port = $this->gatewayApiPort;
$req = $this->curl("http://$ip:$port/api/v0/add?stream-channels=true", $content);
$req = json_decode($req, TRUE);
return $req['Hash'];
}
public function ls ($hash) {
$ip = $this->gatewayIP;
$port = $this->gatewayApiPort;
$response = $this->curl("http://$ip:$port/api/v0/ls/$hash");
$data = json_decode($response, TRUE);
return $data['Objects'][0]['Links'];
}
public function size ($hash) {
$ip = $this->gatewayIP;
$port = $this->gatewayApiPort;
$response = $this->curl("http://$ip:$port/api/v0/object/stat/$hash");
$data = json_decode($response, TRUE);
return $data['CumulativeSize'];
}
public function pinAdd ($hash) {
$ip = $this->gatewayIP;
$port = $this->gatewayApiPort;
$response = $this->curl("http://$ip:$port/api/v0/pin/add/$hash");
$data = json_decode($response, TRUE);
return $data;
}
public function pinRm ($hash) {
$ip = $this->gatewayIP;
$port = $this->gatewayApiPort;
$response = $this->curl("http://$ip:$port/api/v0/pin/rm/$hash");
$data = json_decode($response, TRUE);
return $data;
}
public function version () {
$ip = $this->gatewayIP;
$port = $this->gatewayApiPort;
$response = $this->curl("http://$ip:$port/api/v0/version");
$data = json_decode($response, TRUE);
return $data['Version'];
}
public function id () {
$ip = $this->gatewayIP;
$port = $this->gatewayApiPort;
$response = $this->curl("http://$ip:$port/api/v0/id");
$data = json_decode($response, TRUE);
return $data;
}
private function curl ($url, $data = "") {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
if ($data != "") {
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data; boundary=a831rwxi1a3gzaorw1w2z49dlsor'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "--a831rwxi1a3gzaorw1w2z49dlsor\r\nContent-Type: application/octet-stream\r\nContent-Disposition: file; \r\n\r\n" . $data . "\r\n--a831rwxi1a3gzaorw1w2z49dlsor");
}
$output = curl_exec($ch);
if ($output == FALSE) {
//todo: when ipfs doesn't answer
}
curl_close($ch);
return $output;
}
}

View File

@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitfb20af428fb50fc34b2be451caca0aba::getLoader();

View File

@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

View File

@ -0,0 +1,19 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Some files were not shown because too many files have changed in this diff Show More