Compare commits

...

30 Commits

Author SHA1 Message Date
fred 0a9151fad4 /G1SSB/_g1.astroport_title 2021-09-25 03:07:28 +02:00
fred 68b9fd99fc install multi CPU 2021-09-25 03:05:23 +02:00
fred 034e12fc70 alt=\"$(cat ~/.zen/ipfs_swarm/.$ipfsnodeid/_xbian.zuid) 2>dev/null)\" /> 2021-09-25 03:05:07 +02:00
fred cc25371f36 REMOVE SWARM EMPTY DIRECTORIES 2021-09-25 02:33:59 +02:00
fred 1cf80f7d52 xbian first 2021-09-25 02:09:30 +02:00
fred e38b4c24c1 ipfs swarm sync only friends stations with existing ping.average.txt 2021-09-25 02:03:33 +02:00
fred 6b5f84a6a7 automatic install browser plugins... TODO 2021-09-25 01:55:22 +02:00
fred aeaa479375 ping $ 2021-09-25 00:40:17 +02:00
fred 2817b63402 CONTROL *ASTRXBIAN ACCESS RIGHTS 2021-09-24 14:33:33 +02:00
fred 536395d79d publish informations 2021-09-24 14:24:56 +02:00
fred 968980cd97 Compte Gchange $zuid 2021-09-23 06:37:02 +02:00
fred 3bc3d47253 360s timeout 2021-09-23 05:41:22 +02:00
fred 83b80b55b7 cleaning tmp files 2021-09-23 04:50:47 +02:00
fred 110949861a log and warn ~/.zen/PIN/${ipfsrepidfile}/IPNSLINK - activate PIN refresh (no index.html update !!) 2021-09-23 04:42:40 +02:00
fred 64492a3053 "$PINnode" != "$G1PUB" 2021-09-23 04:04:34 +02:00
fred c20da1a995 get starsin/starsout from IPNS & correct friend_of_mine_count 2021-09-23 03:55:36 +02:00
fred 4195c15b5d Serveur web existant sur port 80 2021-09-23 03:38:17 +02:00
fred 2e50939e86 ipfs swarm connect $line 2>&1>/dev/null && swarmping="OK" || swarmping="NOK" 2021-09-23 03:37:51 +02:00
fred 9ad325e3d5 [[ "$sping" == "OK" ]] maybe too restrictive 2021-09-23 03:30:14 +02:00
fred 8d92aa42b6 echo "#### EXCECUTION TIME" 2021-09-23 03:21:48 +02:00
fred 4cb5df1775 NEW ~/.ipfs/config.new => restarting IPFS daemon (not too often as 6h) 2021-09-23 02:40:52 +02:00
fred f277c215d5 rm /config/ipfs/repo.lock 2021-09-23 02:14:19 +02:00
fred 1a1cfab4cc quicker ping 2021-09-23 01:01:57 +02:00
fred 0a96267577 libcurl4-openssl-dev 2021-09-23 00:58:05 +02:00
fred 9c8498e05b audit for ipfs restart cause 2021-09-23 00:57:30 +02:00
fred 52b616fb96 wait a howmany timeout before restarting ipfs 2021-09-22 23:38:04 +02:00
fred 09f5dae89a wait a howmany timeout before restarting ipfs 2021-09-22 23:35:37 +02:00
fred 6e77095ff5 LOG "IPFS NOT RUNNING $(date)" >> ~/.zen/restart.txt 2021-09-22 20:28:08 +02:00
qo-op 4552f89d93 Merge pull request '[FIX] Improvement of duplicate content detection and handling' (#36) from BorisPaing/astrXbian_UX-et-webUI:boris into master
Reviewed-on: axiom-team/astrXbian#36
2021-09-22 20:14:01 +02:00
Boris 23a6aad73c [FIX] Improvement of duplicate content detection and handling 2021-09-22 20:08:20 +02:00
14 changed files with 174 additions and 90 deletions

View File

@ -41,15 +41,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
curl -s https://dist.ipfs.io/go-ipfs/v0.9.1/go-ipfs_v0.9.1_linux-amd64.tar.gz -o /tmp/go_ipfs.tar.gz # BIN
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 # UPDATER
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
curl -s https://dist.ipfs.io/go-ipfs/v0.9.1/go-ipfs_v0.9.1_linux-arm.tar.gz -o /tmp/go_ipfs.tar.gz # BIN
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 # UPDATER
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
curl -s https://dist.ipfs.io/go-ipfs/v0.9.1/go-ipfs_v0.9.1_linux-arm64.tar.gz -o /tmp/go_ipfs.tar.gz # BIN
else
echo "Your $MACHINE_TYPE is not supported yet... Please add an issue." && exit 1
fi
# UPDATER
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"
@ -60,10 +63,11 @@ if [ -f $MY_PATH/ipfs-update.tar.gz ]; then
echo "INSTALL ipfs 0.9.1 >>>>>>>>>>>>>>>>>>>>>>>>>>"
sudo ipfs-update install 0.9.1 || err "Install IPFS"
else
fi
if [ -f /tmp/go_ipfs.tar.gz ]; then
## TERRAPI4 aarch64 install ipfs_aarch64_v0.9.1
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
sudo tar -xvzf /tmp/go_ipfs.tar.gz -C /usr/src/ || err "Error Untar go_ipfs binaries"
rm /tmp/go_ipfs.tar.gz
cd /usr/src/go-ipfs/
sudo ./install.sh || err "Install ipfs_aarch64"
cd $MY_PATH

View File

@ -151,10 +151,13 @@ echo "SUB-SCRAPING lieu FROM $geodata"
# 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:8181/ipfs/$IPFSREPFILEID/$lid.jpg"
rm ./$lid.jpg
rm ./bulle.jpg
fi
cd -
sleep $((1 + RANDOM % 2))
cd - && rm -Rf /tmp/$lid
rm -Rf /tmp/$lid
loop=$(($loop+1));
done

View File

@ -21,6 +21,8 @@
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
@ -51,8 +53,8 @@ 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)
[[ -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/_xbian.zuid ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid)
# zenity --warning --width 300 --text "Ajoutez un MEDIA dans ASTROPORT"
@ -160,7 +162,7 @@ MEDIAKEY="YOUTUBE_${MEDIAID}"
FALSE Humain \
FALSE Animal \
TRUE Eveil \
TRUE ${AXID// /-}) || GENRES="${AXID// /-}"
TRUE ${XZUID// /-}) || GENRES="${XZUID// /-}"
# FORMAT GENRES genre1|genre2|genre3
@ -289,7 +291,7 @@ mv "${FILE_PATH}/${FILE_NAME}" "${FILE_PATH}/${YNAME}" && FILE_NAME="${YNAME}"
MEDIAID="${YID}"
TITLE="${YNAME%.*}"
GENRES="[\"$AXID\"]"
GENRES="[\"$XZUID\"]"
GROUPES="_IPNSKEY_" # USE GROUPS TO RECORD IPNS MEDIAKEY
MEDIAKEY="MP3_$MEDIAID"
@ -398,7 +400,7 @@ 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)\"]"

View File

@ -20,16 +20,26 @@ source $HOME/.profile
#### CONTROL STATION IPFS DAEMON
## timeout is fixing ipfs minimum response time, before considering stuck process
IPFSNODEID=$(ipfs --timeout=30s id -f='<id>\n')
[[ ! $IPFSNODEID && -f /etc/sudoers.d/systemctl ]] && echo "IPFS NOT RUNNING" && sudo systemctl restart ipfs && exit 1
[[ ! $IPFSNODEID && "${USER}" == "xbian" ]] && echo "IPFS NOT RUNNING" && sudo service ipfs restart && exit 1
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n')
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
# reduice water levels for swarm
# control water levels for swarm
ipfs config --json Swarm.ConnMgr.LowWater 50
ipfs config --json Swarm.ConnMgr.HighWater 100
[[ "${USER}" == "xbian" ]] && sudo service ipfs restart || sudo systemctl restart ipfs
[ $howmany -gt 3 ] && [[ "${USER}" == "xbian" ]] && sudo service ipfs restart || sudo systemctl restart ipfs
echo "ERROR! ipfs daemon was not running. RELAUNCHING."
exit 1
fi
@ -79,7 +89,6 @@ weeknumber=$(date +%V)
# WAKEUP TIME
if [[ ! -f /tmp/A_Station_ON ]]; then
echo "onheure=$heure; onminute=$minute; ontimebar=$timebar" > /tmp/A_Station_ON
[[ -f /home/$YOU/.zen/A_Station_ON ]] && cp /home/$YOU/.zen/A_Station_ON /tmp/A_Station_ON && rm /home/$YOU/.zen/A_Station_ON
else
source /tmp/A_Station_ON
old=$ontimebar
@ -104,8 +113,10 @@ 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=2s -n 3 /p2p/$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) 2>/dev/null | grep "Average" | cut -d ':' -f 2);
[[ $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/_xbian.zuid; cat $line; done
done
fi
########################################################################
@ -195,8 +206,9 @@ 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
if [[ -f ~/.ipfs/config.new && $(diff ~/.ipfs/config.new ~/.ipfs/config) ]]; then
# 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

View File

@ -21,7 +21,7 @@ for i in git fail2ban inotify-tools curl net-tools libsodium* python3-dev python
done
#sudo apt-get install build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox httrack html2text ssmtp sudo -y
for i in build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox nmap httrack html2text ssmtp imagemagick ttf-mscorefonts-installer; do
for i in build-essential qrencode jq bc gawk 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
sudo apt install -y $i
fi

View File

@ -1,8 +1,8 @@
#!/bin/bash
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
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
fi
# Add user to be able to modify nginx directories
@ -12,3 +12,8 @@ sudo chmod g+rw /var/www/html
## TODO ## INSTALLER SITE PROXY NGINX QUI REDIRIGE VERS https://127.0.0.1:8181/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

View File

@ -228,3 +228,15 @@ 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;
}

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 + ...
@ -29,39 +29,39 @@ ln -s ../ipfs me
## 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/tube.copylaradio.com
root " | sudo tee /etc/nginx/sites-available/tube.copylaradio.com
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 tube.copylaradio.com;
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;
}
# 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:8181;
proxy_set_header Host $host;
@ -73,7 +73,7 @@ printf ";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
" | sudo tee -a /etc/nginx/sites-available/tube.copylaradio.com

View File

@ -15,7 +15,7 @@ $videosList = array();
$search = isset($_GET['search']) ? urldecode($_GET['search']) : "";
exec("/bin/bash -c './get_astrxbian_index.sh \"*\" \"". $search . "\"'", $videos);
exec("/bin/bash -c './get_PIN.sh'", $pinnedVideos);
$videos = array_unique($videos);
// $videos = array_unique($videos);
// exec("/bin/bash -c './get_youtube_videos.sh'", $videos);
// echo file_get_contents("http://youtube2.com/ipns/12D3KooWHLLohhFqwTs3Ccego51w1Q2WUQ8JmhSMWtsZnQpMigHY/.12D3KooWHLLohhFqwTs3Ccego51w1Q2WUQ8JmhSMWtsZnQpMigHY/FASTRXBIAN");
@ -49,6 +49,11 @@ foreach ($videos as $v) {
list($contentType, $videoID, $year, $filename, $saison, $tagsStr, $ipnsHash, $definition, $videoURI) = explode(";", $v);
if (in_array_column($videoURI, 'uri', $videosList)) {
continue;
}
list($videoSource, $videoID) = handleVideoID($videoID);
$ipfsHash = preg_replace('!^/ipfs/([^/]+)/.*$!isU', '$1', $videoURI);

View File

@ -9,6 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
start=`date +%s`
# Retrieve Gchange profil data
# Sends "ipfstryme" messages to liked linking_me NODES
@ -40,18 +41,18 @@ cat ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
# ADD GCHANGE+ informations
########################################################################
GCHANGE="https://data.gchange.fr"
## GET LATEST GCHANGE PROFILE
echo"## GET LATEST GCHANGE PROFILE"
curl -s ${GCHANGE}/user/profile/${G1PUB} > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange.json
# UPDATE _g1.gchange_title
title=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange.json | jq -r '._source.title')
[[ $title ]] && echo "$title" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title
Gtitle=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange.json | jq -r '._source.title')
[[ $Gtitle ]] && echo "$Gtitle" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title
echo"# ACTUAL _g1.gchange_title=$Gtitle"
# UPDATE _g1.astroport_title with city
title="Station $YOU@$XZUID"
Atitle="Station $YOU@$XZUID"
city=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange.json | jq -r '._source.city')
[[ "$city" != "null" ]] && title="$title in $city"
echo "$title" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.astroport_title
[[ "$city" != "null" ]] && Atitle="$Atitle in $city"
echo "$Atitle" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.astroport_title
# UPDATE _g1.gchange_avatar.png
cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange.json | jq -r '._source.avatar._content' | base64 -d > "/home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_avatar.png"
@ -73,7 +74,6 @@ export LANG=C.UTF-8 #attipix
# _g1.pubkey
[[ ! ~/.zen/ipfs/.${IPFSNODEID}/G1SSB/_g1.pubkey ]] && echo "$G1PUB" > ~/.zen/ipfs/.${IPFSNODEID}/G1SSB/_g1.pubkey
# ipfsnodeid
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/.ipfsnodeid ]] && echo ${IPFSNODEID} > ~/.zen/ipfs/.${IPFSNODEID}/.ipfsnodeid
@ -124,12 +124,14 @@ sed -i "s/_UPDATED_/$updated/g" $wiki
# https:\/\/www.gchange.fr\/#\/app\/records\/wallet?q=$G1PUB
########################################################################
## PREPARE www EXCHANGE ZONE .$IPFSNODEID/astroport/www
## CREATING www EXCHANGE ZONE .$IPFSNODEID/astroport/www
if [[ ! -d /home/$YOU/astroport/www ]]; then
wwwuser=$(ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1) || wwuser="www-data"
mkdir -p /home/$YOU/astroport/www
chown -R $YOU:$wwwuser /home/$YOU/astroport/www
chmod -R g+rw /home/$YOU/astroport/www
else
echo ".$IPFSNODEID/astroport/www exchange zone OK"
fi
########################################################################
###
@ -170,6 +172,10 @@ do
sleep $((1 + RANDOM % 2)) # SLOW DOWN
~/.zen/astrXbian/zen/tools/timeout.sh -t 12 ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" stars -p $liking_me -n 1
sleep $((1 + RANDOM % 2)) # SLOW DOWN
## IF DISCONNECTED FROM GCHANGE - create FRIEND Space (Need Web UI session)
## touch ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/$liking_me/tryme.addr
## echo 1 > ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/$liking_me/stars.level
fi
fi
@ -267,5 +273,8 @@ done
# https://forum.monnaie-libre.fr/t/etude-commencer-a-la-moyenne/15231/34?u=qoop
# https://forum.monnaie-libre.fr/t/formules-en-referentiel-du-et-m-n/10417
echo "#### EXCECUTION TIME"
end=`date +%s`
echo Execution time was `expr $end - $start` seconds.
echo "########################################################################"
exit 0

View File

@ -9,6 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
start=`date +%s`
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
@ -59,7 +60,7 @@ do
ipfs --timeout=30s cat /ipns/$ipfsnodeid/.$ipfsnodeid/tryme.addr > /tmp/ipfstryme.$liking_me
if [[ ! -f /tmp/ipfstryme.$liking_me ]]; then
echo ": READING 'ipfstryme' message from $liking_me"
echo "TIMEOUT : READING 'ipfstryme' message from $liking_me" ## GCHANGE ACCESS
## Get "/tmp/ipfstryme.$liking_me" from Gchange "ipfstryme" message
~/.zen/astrXbian/zen/tools/timeout.sh -t 12 ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" read -n300 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content' > /tmp/ipfstryme.$liking_me
fi
@ -72,8 +73,12 @@ do
for line in $(cat /tmp/ipfstryme.$liking_me | shuf);
do
ipfsnodeid=$(echo $line | rev | cut -d '/' -f 1 | rev)
stationip=$(echo $line | cut -d '/' -f 3)
ping -c 1 -W 1 $stationip 2>&1>/dev/null && sping="OK" || sping="NOK"
ipfs swarm connect $line 2>&1>/dev/null && swarmping="OK" || swarmping="NOK"
echo "## ping $stationip : $sping / STATION $ipfsnodeid ($swarmping)"
[[ $ipfsnodeid == "" ]] && break
[[ ! $(cat /tmp/ipfstryme.clean | grep $ipfsnodeid) ]] && echo $line >> /tmp/ipfstryme.clean
[[ ! $(cat /tmp/ipfstryme.clean | grep $ipfsnodeid) ]] && [[ "$swarmping" == "OK" ]] && echo $line >> /tmp/ipfstryme.clean
done
cat /tmp/ipfstryme.clean | sort | uniq > /tmp/ipfstryme.$liking_me
@ -105,9 +110,9 @@ do
[[ $nbmessage == 0 ]] && echo "NO ipfstryme MESSAGE from $whoisg1" && echo "$ipfsnodeid" >> ~/.zen/A_dead_swarm.txt && continue
# SEND MESSAGE ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" send -d $whoisg1 -t 'Astroport' -m 'Aucun message de ta part https://copylaradio.com'"
## CHECKING VALUE CAPSULE
starsin=$(ipfs --timeout=10s cat /ipns/$ipfsnodeid/.$ipfsnodeid/FRIENDS/$G1PUB/stars.level)
starsout=$(ipfs --timeout=10s cat /ipns/$IPFSNODEID/.$IPFSNODEID/FRIENDS/$whoisg1/stars.level)
## CHECKING STARS FROM IPNS
starsin=$(ipfs --timeout=10s cat /ipns/$ipfsnodeid/.$ipfsnodeid/FRIENDS/$G1PUB/stars.level || echo 0)
starsout=$(ipfs --timeout=10s cat /ipns/$IPFSNODEID/.$IPFSNODEID/FRIENDS/$whoisg1/stars.level || echo 0)
# REFRESH A_swarm_map.txt
echo $peerline >> ~/.zen/A_swarm_map.txt
@ -116,17 +121,18 @@ do
# FRIEND ADDRESS DISCOVERY
echo "Am I friend with my FRIEND friend $whoisg1 ?"
echo "starsin=$starsin * starsout=$starsout *"
# ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/FRIENDS/$G1PUB/tryme.addr # IS my own /ipns/$IPFSNODEID/.$IPFSNODEID/tryme.addr
# GCHANGE : friend_of_mine=$(~/.zen/astrXbian/zen/tools/timeout.sh -t 12 ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" stars -p $whoisg1 | jq -r '.yours.pseudo'); # must contains my XZUID
## LOOKING IN SWARM CACHE
friend_of_mine=$(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/$whoisg1 2>/dev/null)
if [[ $friend_of_mine ]]; then
# COUNTING MY FRIENDS
friend_of_mine_count=$((friend_of_mine_count+1))
if [[ ! $(grep "$ipfsnodeid" ~/.zen/A_my_swarm.txt) ]]
then
echo "OK FRIEND"
# COUNT UNIQ FRIENDS
friend_of_mine_count=$((friend_of_mine_count+1))
echo "$peerline" >> ~/.zen/A_my_swarm.txt
# ipfs bootstrap add "$peerline"
## NOW WILL BE USING Peering.Peers config
@ -134,21 +140,21 @@ do
echo "ALREADY RECORDED FRIEND"
fi
## Sync ipfs_swarm
ipfs --timeout=60s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
ipfs --timeout=120s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
else
## REMOVE FRIENDS DIRECTORY (should be removed from Astroport App)
echo "NOT FULL FRIEND $ipfsnodeid / $whoisg1"
[[ "$liking_me" != "" ]] && rm -Rf ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/$liking_me
[[ "$liking_me" != "" ]] && rm -Rf ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/$liking_me && rm -Rf ~/.zen/ipfs_swarm/.$ipfsnodeid && echo "REMOVING SWARM SYNC"
# SEND ME A MESSAGE TO DECIDE WHAT TO DO ?
# SEND MESSAGE ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" send -d $whoisg1 -t 'Astroport' -m 'Rejoins mon #Swarm0 https://copylaradio.com'"
fi
done;
# UNIQ file
cat ~/.zen/A_my_swarm.txt | sort | uniq > /tmp/A_my_swarm.txt
cat ~/.zen/A_my_swarm.txt | rev | sort | uniq | rev > /tmp/A_my_swarm.txt
cp -f /tmp/A_my_swarm.txt ~/.zen/A_my_swarm.txt
cat ~/.zen/A_Qm_swarm.txt | sort | uniq > /tmp/A_Qm_swarm.txt
cat ~/.zen/A_Qm_swarm.txt | rev | sort | uniq | rev > /tmp/A_Qm_swarm.txt
cp -f /tmp/A_Qm_swarm.txt ~/.zen/A_Qm_swarm.txt
echo "####################################################
@ -195,3 +201,8 @@ done
cat ~/.zen/A_my_swarm.txt | sort | uniq > /tmp/A_my_swarm.txt
cp -f /tmp/A_my_swarm.txt ~/.zen/A_my_swarm.txt
cp -f ~/.zen/A_my_swarm.txt ~/.zen/A_swarm_map.txt
echo "#### EXCECUTION TIME"
end=`date +%s`
echo Execution time was `expr $end - $start` seconds.
echo "########################################################################"

View File

@ -9,6 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
start=`date +%s`
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
@ -50,6 +51,9 @@ do
ls -d ~/.zen/ipfs_swarm/.$ipfsnodeid/FRIENDS/$G1PUB/ 2>/dev/null | rev | cut -d '/' -f 2 | rev
done
echo "#### EXCECUTION TIME"
end=`date +%s`
echo Execution time was `expr $end - $start` seconds.
echo "########################################################################"
exit 0

View File

@ -9,6 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
start=`date +%s`
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
@ -113,19 +114,21 @@ do
continue
fi
fi
################################################################
## Refresh bootstrap if XID exists
if [[ "$XID" != "" ]]; then
echo "Removing 8 days older data from ~/.zen/ipfs_swarm/.$ipfsnodeid/"
find /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/ -type f -mtime +8 -exec rm '{}' \;
find /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/ -empty -type d -delete;
################################################################
## Refresh bootstrap if XID exists AND PING not null
if [[ "$XID" != "" && "$(cat ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/$whoisg1/ping.average.txt 2>dev/null)" != "" ]]; then
ipfs bootstrap rm "/ipfs/$ipfsnodeid" && ipfs bootstrap add "$peerline" || ipfs bootstrap rm "$peerline"
################################################################
################################################################
echo "Removing 8 days older data from ~/.zen/ipfs_swarm/.$ipfsnodeid/"
find /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/ -type f -mtime +8 -exec rm '{}' \;
find /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/ -empty -type d -delete;
################################################################
echo "OK Friend SWARM REFRESH /ipns/$ipfsnodeid INTO ~/.zen/ipfs_swarm/"
ipfs --timeout=120s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
ipfs --timeout=360s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
################################################################
if [ $? != 0 ];
then
@ -211,7 +214,9 @@ do
done
########################################################################
## REMOVE SWARM EMPTY DIRECTORIES
find /home/$YOU/.zen/ipfs_swarm/ -empty -type d -delete
########################################################################
## FIND LOCAL IPFS NODE - SERACH FOR FOAF stargate replications
########################################################################
@ -279,7 +284,9 @@ do
cat ~/.zen/ipfs_swarm/.12D*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | sed "s/anime;/film;/g" | sed '/^[[:space:]]*$/d' | grep -Ev "CAT;TMDB" | sort | uniq >> ~/.zen/ipfs/.${IPFSNODEID}/${PREFIX}ASTRXBIAN
done
## ACCESS TO www-data FOR www/boris ACCESS
## CORRECT ACCESS RIGHTS
chmod 664 ~/.zen/ipfs_swarm/.*/astroport/kodi/vstream/*ASTRXBIAN
## www-data FOR www ACCESS
chown $YOU:www-data ~/.zen/ipfs/.$IPFSNODEID/*ASTRXBIAN
chmod 664 ~/.zen/ipfs/.$IPFSNODEID/*ASTRXBIAN
@ -307,7 +314,7 @@ echo "<html>
</head>
<body><header>
<h1>
<a href='https://astroport.com'><span>Astroport</span> × <span>WIKI des Amis de $zuid $updated</span></a>
<a href=\"https://www.gchange.fr/#/app/user/$G1PUB/\"><span>$zuid (gchange)</span> x <span>, Amis Astroport ($updated)</span></a>
</h1>
</header>
@ -318,13 +325,18 @@ for wiki in $(ls ~/.zen/ipfs_swarm/.12D*/index.html | grep -Ev "${IPFSNODEID}" 2
whoisg1=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $ipfsnodeid)
echo "<li>
<a target=\"gchange\" href=\"https://www.gchange.fr/#/app/user/$whoisg1/\">
<img src=\"https://tube.copylaradio.com/ipns/$ipfsnodeid/.$ipfsnodeid/QR.png\" alt=\"$whoisg1\" />
<img src=\"https://tube.copylaradio.com/ipns/$ipfsnodeid/.$ipfsnodeid/QR.png\" alt=\"$(cat ~/.zen/ipfs_swarm/.$ipfsnodeid/_xbian.zuid 2>dev/null)\" />
</a>
<p class='video-title'>
<a href=\"https://tube.copylaradio.com/ipns/$ipfsnodeid/.$ipfsnodeid/FRIENDS/index.html\">
$(cat ~/.zen/ipfs_swarm/.$ipfsnodeid/G1SSB/_g1.astroport_title 2>dev/null) <br>
$ipfsnodeid
</a>
</p>
<p class='video-title'>
Disk :: $(cat ~/.zen/ipfs_swarm/.$ipfsnodeid/disk.perf) :: $(cat ~/.zen/ipfs_swarm/.$ipfsnodeid/disk.bytes) octets
<br>Ping :: $(cat ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/$whoisg1/ping.average.txt)
</p>
<iframe id=\"$ipfsnodeid\"
title='tiddlywiki $whoisg1'
width='600'
@ -347,5 +359,8 @@ echo "</main></body></html>" >> ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/index.html
########################################################################
~/.zen/astrXbian/zen/ipns_self_publish.sh
########################################################################
echo "#### EXCECUTION TIME"
end=`date +%s`
echo Execution time was `expr $end - $start` seconds.
echo "########################################################################"
exit 0

View File

@ -141,7 +141,7 @@ IPFSREPFILEID=$(echo $IPFS | cut -d ' ' -f 2)
IPFSID=$(echo $IPFS | cut -d ' ' -f 1)
[[ $IPFSREPFILEID == "" ]] && echo "ipfs add ERROR" && exit 1
echo "-----------------------------------------------------------------"
echo "IPFS $file DIRECTORY: ipfs ls /ipfs/$IPFSID"
echo "IPFS $file DIRECTORY: ipfs ls /ipfs/$IPFSREPFILEID"
echo "-----------------------------------------------------------------"
echo "New $TYPE INDEX ~/.zen/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN "
@ -175,9 +175,9 @@ if [[ $KEY ]]; then
# > STARGATE 1 - 2 - 3 - 4 - 5 !!
################ ENCRYPT keystore/$KEYFILE
else
## OLD IPNS KEY
KEY=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.link)
KEYFILE=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.key.keystore_filename)
echo "## ALREADY EXISTING IPNS KEY $KEYFILE ($KEY)"
fi
[[ ! $KEY ]] && echo "FATAL ERROR" && exit 1
@ -209,12 +209,13 @@ PINnode=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $nodeid)
echo "ASK AUTOPIN to $PINnode"
## CREATE $PINnode IPFS communication directory
[[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode} ]] && mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}
## ENCRYPT .ipfsid & .ipfs.filelink (THESE FILES ARE
$MY_PATH/tools/natools.py encrypt -p $PINnode -i /tmp/.ipfs.filelink -o "~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfs.filelink.encrypt"
$MY_PATH/tools/natools.py encrypt -p $PINnode -i /tmp/.ipfsid -o "~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfsid.encrypt"
# .ipfsid.encrypt is searched by each Station running ./zen/tools/autoPINfriends.sh
if [[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode} && "$PINnode" != "$G1PUB" ]]; then
mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}
## ENCRYPT .ipfsid & .ipfs.filelink (THESE FILES ARE
$MY_PATH/tools/natools.py encrypt -p $PINnode -i /tmp/.ipfs.filelink -o "~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfs.filelink.encrypt"
$MY_PATH/tools/natools.py encrypt -p $PINnode -i /tmp/.ipfsid -o "~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfsid.encrypt"
# .ipfsid.encrypt is searched by each Station running ./zen/tools/autoPINfriends.sh
fi
########################################################################
## GREAT natools can convert IPNS MEDIAKEY into .dunikey file
########################################################################
@ -255,6 +256,7 @@ echo "anonymous" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode
# MEMORIZE my PIN
mkdir -p ~/.zen/PIN/${IPFSREPFILEID}/
touch ~/.zen/PIN/${IPFSREPFILEID}/${G1PUB}
# echo "$(ipfs key list -l | grep ${MEDIAKEY} | cut -d ' ' -f 1)" > ~/.zen/PIN/${ipfsrepidfile}/IPNSLINK # NO!! Would let PINing nodes change index.html///
########################################################################
## encrypt links for myself