Compare commits

...

53 Commits

Author SHA1 Message Date
fred 9188290831 check_my_wallet.sh not working 2021-09-21 18:18:32 +02:00
fred d5ef6a13cc Add timestamp in YEAR field (ONLY film & serie contains YEAR) 2021-09-21 14:46:42 +02:00
fred f591f167c1 echo "Last Update : $(date -d @$TIMESTAMP)" 2021-09-21 13:03:08 +02:00
fred 9c8f268652 dynamic HOST 2021-09-21 03:19:28 +02:00
fred 769d7792c5 PDF restriction (missing sudo cp) 2021-09-21 02:52:59 +02:00
fred c6eff38460 simple ipfs add 2021-09-21 02:52:37 +02:00
fred a56adbc487 bug 2021-09-21 02:44:56 +02:00
fred 9734de08b5 Correct PDF restrictions for imagemagick 2021-09-21 02:42:55 +02:00
fred a3dfbe8bf5 $_SERVER['SERVER_NAME'] 2021-09-21 02:42:13 +02:00
fred 6702aba80e killing old same script... for a while... process are stuck 2021-09-21 01:38:38 +02:00
fred 450ac35d0e RUN INDEX DATA MIGRATION SCRIPT actions/p4n.data_evolution.sh & 2021-09-21 01:10:34 +02:00
fred db73d66cf1 loop increment 2021-09-21 00:57:08 +02:00
fred 1936c6f847 log ipfs add 2021-09-21 00:56:10 +02:00
fred 13820563c1 Youtube <=> URL="$1" no zenity if $2 not empty 2021-09-21 00:47:05 +02:00
fred e9c7219fd0 lieu jpg index.html redirection 2021-09-21 00:00:35 +02:00
fred 2a4eeb914a This spot.json is managed by $geosrc 2021-09-20 23:50:53 +02:00
fred 8661212506 p4n data index evolution pdf to index.html 2021-09-20 23:45:44 +02:00
fred d4b62d18d0 remove pdf after jpg + ipfs link into index.html convertion 2021-09-20 22:38:01 +02:00
fred 299e6d8362 empty IPFSREPFILEID = continue 2021-09-20 22:27:19 +02:00
fred 2c9b05e837 echo "Last Update : date -d @$TIMESTAMP" 2021-09-20 22:18:33 +02:00
fred 621da3e18c 10h = 36000000 ms 2021-09-20 22:04:51 +02:00
fred ff2b35dd30 refresh PIN every 12h 2021-09-20 22:02:44 +02:00
fred 1fd00748c1 missing XZUID 2021-09-20 21:18:30 +02:00
fred 2f30a168c5 YOU was missing 2021-09-20 20:53:53 +02:00
fred 0cf824a5f2 no debug 2021-09-20 20:52:00 +02:00
fred 0e1c331f72 KEY refresh index.html 2021-09-20 20:49:35 +02:00
fred 155d174e35 comment & log 2021-09-20 04:10:04 +02:00
fred e97b83848e php-fpm.sock; 2021-09-20 04:09:41 +02:00
fred b949ef6dbb timeout check 2021-09-20 03:16:14 +02:00
fred 1623b9a892 shutdown 2021-09-20 03:05:42 +02:00
fred ea1fd0a09d reshape 2021-09-20 03:05:04 +02:00
fred dba5dc516d convert -crop 1260x420+55+30 ./bulle.jpg ./$lid.jpg 2021-09-20 03:03:42 +02:00
fred 34e5862878 maximum 20s ipfs daemon response time OR restart 2021-09-20 02:53:47 +02:00
fred 4835b4831d We are legion 2021-09-20 02:48:58 +02:00
fred ea70e9fe3c youtube_watch_steps.... sed "s/\${IPFSNODEID}/$IPFSNODEID/g" 2021-09-19 21:41:32 +02:00
fred 9840c45a59 Addind Web(index.html) & Page(pdf) copy 2021-09-19 21:40:38 +02:00
fred 1845e377dd Templating KEY Welcome & G1PUB Contract pages 2021-09-19 20:44:15 +02:00
fred 731917b876 ONE BY ONE (cron_MINUTE.sh task every 7 mn) 2021-09-19 19:12:57 +02:00
fred ed8d25d01c IPFSNODEID 2021-09-19 19:08:49 +02:00
fred 64f9cce4f5 refreshed links 2021-09-19 19:02:42 +02:00
fred 8ba4d2df4d ## DO NOT REPUBLISH empty index.html 2021-09-19 18:57:38 +02:00
fred a877e12348 URLENCODE_FILE_NAME & IPFSREPFILEID are extracted from .ipfs.filelink.natools.encrypt 2021-09-19 13:59:24 +02:00
fred b3ca0400bb bug was blocking Bootstrap PIN refresh actions 2021-09-19 13:41:18 +02:00
fred e21fca1d07 convert http://astroport into / URL (keeps the actual http gateway in use) 2021-09-19 02:31:01 +02:00
fred 47671bbd21 LOG /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.ipns_TAG_refresh.txt 2021-09-19 02:19:01 +02:00
fred 5c193bfa86 more often ipns_TAG_refresh.sh IN one by one mode 2021-09-19 02:01:01 +02:00
fred d05c60d07d was missing REVSOURCE in MEDIAKEY name creation if desktop (NO $1) run 2021-09-19 01:34:34 +02:00
fred 294a6ae979 KEY refreshing based on TIMESTAMP 2021-09-19 01:29:33 +02:00
fred 7c71da2015 rm /tmp/${MEDIAKEY}.dunikey 2021-09-19 01:28:04 +02:00
fred 82f51a45ba restart ipfs daemon (if ~/.ipfs/config.new have changed) or "ipfs id" timeout 10s 2021-09-19 00:23:37 +02:00
fred 19892fa79c Merge branch 'master' of https://git.p2p.legal/axiom-team/astrXbian 2021-09-19 00:04:51 +02:00
qo-op 32447b4255 Merge pull request 'ENH: harmonisation CSS et récupération des titres via video.json' (#33) from BorisPaing/astrXbian_UX-et-webUI:master into master
Reviewed-on: axiom-team/astrXbian#33
2021-09-19 00:04:35 +02:00
fred 97ce9d0be6 put video.json to /ipns/$MEDIAKEY/ root 2021-09-18 20:57:28 +02:00
14 changed files with 343 additions and 181 deletions

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;

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

@ -0,0 +1,40 @@
#!/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
##############################################################"
## 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:8181/ipfs/$IPFSREPFILEID/$lid.jpg"
cat ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/index.html
done
exit 0

View File

@ -15,6 +15,19 @@ G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PU
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
@ -75,19 +88,21 @@ fi
##############################################################"
## GEODATA. continue. Let's extract lieu pdf from my spot
##############################################################"
geodata=$(ls ~/.zen/{ipfs,ipfs_swarm}/.*/astroport/map/$lat.$lon/p4n/spot.json 2>/dev/null | tail -n 1)
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 already managed by $ipfsnodeid"
echo "getting one for mine"
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 /astroport/map/$lat.$lon/p4n/spot.json"
echo "SUB-SCRAPING lieu FROM $geodata"
loop=1
while [ $loop -lt 21 ]; do
@ -108,28 +123,39 @@ echo "SUB-SCRAPING lieu FROM /astroport/map/$lat.$lon/p4n/spot.json"
[ -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" == "" ]] && continue
[[ "$lid" == "" ]] && echo "ERROR LIEU NO ID. CONTINUE" && continue
if [[ $(which chromium) ]]; then
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
[ ! -f ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/bulle.pdf ] && chromium --timeout=30000 --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
[ -f ./output.pdf ] && mv ./output.pdf ~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/bulle.pdf
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
echo "~/.zen/ipfs/.$IPFSNODEID/astroport/map/p4n/lieu/$lid/bulle.png"
sleep $((1 + RANDOM % 2))
cd - && rm -Rf /tmp/$lid
# 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" && continue
# TODO FUTURE BATCH to convert & crop to jpg image (imagemagick)
# convert -density 300 -depth 8 -quality 90 -trim ./output.pdf ./output.jpg
else
sudo apt-get install chromium -y
## 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:8181/ipfs/$IPFSREPFILEID/$lid.jpg"
fi
sleep $((1 + RANDOM % 2))
cd - && rm -Rf /tmp/$lid
loop=$(($loop+1));
done

View File

@ -28,12 +28,13 @@ ME="${0##*/}"
[[ $(which xdpyinfo) == "" ]] && echo "ERREUR! Installez x11-utils" && echo "sudo apt install x11-utils" && exit 1
URL="$1"
[ $URL ] && echo "URL: $URL" && REVSOURCE="$(echo "$URL" | awk -F/ '{print $3}' | rev)_"\
&& IMPORT=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Choisissez comment copier cette source" --entry-text="Video" MP3 Web) \
&& [[ $IMPORT == "Video" ]] && IMPORT="Youtube" \
&& CHOICE="$IMPORT"
if [ $URL ]; then
echo "URL: $URL"
REVSOURCE="$(echo "$URL" | awk -F/ '{print $3}' | rev)_"
[ ! $2 ] && IMPORT=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Choisissez comment copier cette source" --entry-text="Video" MP3 Web) || IMPORT="Youtube"
[[ $IMPORT == "Video" ]] && IMPORT="Youtube"
CHOICE="$IMPORT"
fi
[[ $CHOICE == "Web" ]] && CHOICE=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Cette source WEB est à enregistrer comme " --entry-text="Page" WebSite)
@ -115,6 +116,8 @@ 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)"
mkdir -p ${YTEMP}
@ -126,7 +129,7 @@ echo "VIDEO $YTURL"
--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##*.}"
@ -140,7 +143,7 @@ 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" \
@ -157,7 +160,7 @@ GENRES=$(zenity --list --checklist --title="GENRE" --height=${haut} \
FALSE Humain \
FALSE Animal \
TRUE Eveil \
TRUE ${AXID// /-})
TRUE ${AXID// /-}) || GENRES="${AXID// /-}"
# FORMAT GENRES genre1|genre2|genre3
@ -174,7 +177,7 @@ RES=${FILE_RES%?}0p
## CREATE "~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt" and video.json
URLENCODE_FILE_NAME=$(echo ${FILE_NAME} | jq -Rr @uri)
echo "youtube;${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/ipfs/_IPFSREPFILEID_/$URLENCODE_FILE_NAME" > ~/astroport/${CAT}/${MEDIAID}/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
@ -188,10 +191,19 @@ rm -Rf ${YTEMP}
zenity --warning --width 600 --text 'DEVELOPPEMENT . ZONE . Please Participate https://git.p2p.legal'
## httrack all web site
## 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"
exit 0
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="PAGE_${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}/${FILE_NAME}
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
;;
@ -201,7 +213,7 @@ rm -Rf ${YTEMP}
zenity --warning --width 600 --text 'DEVELOPPEMENT . ZONE . Please Participate https://git.p2p.legal'
## record one page only
## 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 output.pdf && chromium --headless --no-sandbox --print-to-pdf $URL
@ -211,11 +223,11 @@ rm -Rf ${YTEMP}
MEDIAID="$REVSOURCE$(echo "${TITLE}" | detox --inline)"
MEDIAKEY="PAGE_${MEDIAID}"
FILE_PATH="$HOME/astroport/youtube/$MEDIAID"
FILE_PATH="$HOME/astroport/page/$MEDIAID"
mkdir -p ${FILE_PATH} && mv -f output.pdf ${FILE_PATH}/${FILE_NAME}
echo "page;${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/ipfs/_IPFSREPFILEID_/$FILE_NAME" > ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt
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
;;
@ -521,7 +533,7 @@ echo "new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_N
########################################################################
MEDIAPUBKEY=$(cat $HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/MEDIAPUBKEY)
zenity --width=500 --height=500 --text-info \
[ ! $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:8181/ipns/${IPFSNODEID}/.${IPFSNODEID}/KEY/${MEDIAKEY}/QR.png" \
@ -535,7 +547,7 @@ FILE_SIZE=$(echo "${FILE_SIZE}" | awk '{ split( "B KB MB GB TB PB" , v ); s=1; w
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
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="")
[ ! $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)
@ -550,5 +562,7 @@ cat /tmp/${MEDIAKEY}.log
rm -f /tmp/${MEDIAKEY}.pass
rm -f /tmp/${MEDIAKEY}.dunikey ## REMOVE KEYS
[ $? == 0 ] && zenity --warning --width 300 --text "OK! MEDIA transféré ($ZENBALANCE ZEN). URL LOCALHOST prête à coller (/tmp/${MEDIAKEY}.log)" && exit 0 \
|| zenity --warning --width 300 --text "Désolé une erreur est survenue... LOG: cat /tmp/${MEDIAKEY}.log" && exit 1
if [ ! $2 ]; then
[ $? == 0 ] && zenity --warning --width 300 --text "OK! MEDIA transféré ($ZENBALANCE ZEN). URL LOCALHOST prête à coller (/tmp/${MEDIAKEY}.log)" && exit 0 \
|| zenity --warning --width 300 --text "Désolé une erreur est survenue... LOG: cat /tmp/${MEDIAKEY}.log" && exit 1
fi

View File

@ -20,7 +20,7 @@ source $HOME/.profile
#### CONTROL STATION IPFS DAEMON
## timeout is fixing ipfs minimum response time, before considering stuck process
IPFSNODEID=$(ipfs --timeout=10s id -f='<id>\n')
IPFSNODEID=$(ipfs --timeout=20s 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
## CONTROL IPFS IS RUNNING OR RESTART
@ -191,16 +191,47 @@ fi
##################################################################
# TODO: IDEA make gchange/ipfs/ipns refresh speed depending on ipfs swarm size and DEFCON level !
## SYNC GCHANGE EVERY 12 hours runtime
[[ $(($runtime % 725)) == 0 || "$runtime" == "5" ]] && $MY_PATH/zen/gchange_INIT.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.gchange_INIT.txt
## SYNC SWARM EVERY 6h runtime
[[ $(($runtime % 370)) == 0 || "$runtime" == "10" ]] && $MY_PATH/zen/gchange_IPFS_swarm.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.gchange_IPFS_swarm.txt
# QUICK SYNC SWARM EVERY 30 minutes
## CLEAN OLD SESSION
if [[ $(($runtime % 30)) == 0 ]]; then
kill -9 $(ps auxf --sort=+utime | grep -w p4n.swarmscraper.sh | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}')
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
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
## 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 % 25)) == 0 ]]; then
kill -9 $(ps auxf --sort=+utime | grep -w p4n.swarmscraper.sh | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}') && echo "KILLING p4n.swarmscraper.sh"
killall chromium
$MY_PATH/zen/ipfs_SWARM_refresh.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.ipfs_SWARM_refresh.txt
fi
##################################################################
#
# _________ ______
# ____ ___ ____ /_ __/ | / ____/
# /_ / / _ \/ __ \ / / / /| |/ / __
# / /_/ __/ / / / / / / ___ / /_/ /
# /___/\___/_/ /_/ /_/ /_/ |_\____/
#
# REFRESHing MEDIAKEY / ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
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)
@ -226,28 +257,6 @@ fi
##########################################################
##################################################################
#
# _________ ______
# ____ ___ ____ /_ __/ | / ____/
# /_ / / _ \/ __ \ / / / /| |/ / __
# / /_/ __/ / / / / / / ___ / /_/ /
# /___/\___/_/ /_/ /_/ /_/ |_\____/
#
# REFRESHing MEDIAKEY / ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || "$timebar" == "03:03" || $(($runtime % 720)) == 0 || $runtime == 12 ]]; then
#### Refresh & publish MEDIAKEYs
$MY_PATH/zen/ipns_TAG_refresh.sh
## REINIT dead swarm STATIONS
rm -f ~/.zen/A_dead_swarm.txt
fi
# At 03:03 and every 6h runtime restarting IPFS daemon
[[ "$timebar" == "03:03" || $(($runtime % 363)) == 0 ]] && [[ -f ~/.ipfs/config.new ]] && cp ~/.ipfs/config.new ~/.ipfs/config
[[ "$timebar" == "03:03" || $(($runtime % 363)) == 0 ]] && [[ -f /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && exit 0
[[ "$timebar" == "03:03" || $(($runtime % 363)) == 0 ]] && [[ ${YOU} == "xbian" ]] && sudo service ipfs restart && exit 0
##################################################################
##################################################################
@ -275,6 +284,10 @@ echo '
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
# EVERY MONDAY

View File

@ -27,6 +27,12 @@ for i in build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vl
fi
done
## Correct PDF restrictions for 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
[[ ! $(which kodi) && "$USER" != "xbian" ]] && sudo apt-get install kodi -y
sudo apt-get install python3-opencv -y ## INSTALLATION IA par reconnaissance d'images
[[ "$USER" != "xbian" ]] && sudo apt-get install x11-utils xclip zenity handbrake* -y

View File

@ -26,4 +26,4 @@ default 120x 90 Large Preview
*/
define('YOUTUBE_THUMB', 'https://i.ytimg.com/vi/%s/mqdefault.jpg');
define ('MEDIAQR','https://'.HOST.'/ipns/%s/QR.png');
define ('MEDIAQR','https://'.$_SERVER['SERVER_NAME'].'/ipns/%s/QR.png');

View File

@ -7,7 +7,7 @@ $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);
// 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
@ -17,8 +17,8 @@ foreach ($videos as $v) {
list($a, $youtubeID, $c, $videoName, $e, $src, $h, $quality, $videoURI) = explode(";", $v);
$videoURL = 'https://'. HOST. $videoURI;
$videoEco = 'https://'. HOST. '/ipns/' . $h;
$videoURL = 'https://'. $_SERVER['SERVER_NAME']. $videoURI;
$videoEco = 'https://'. $_SERVER['SERVER_NAME']. '/ipns/' . $h;
$mimeType = guessTypeFromFilename($videoURI);
@ -41,7 +41,7 @@ foreach ($videos as $v) {
?><!DOCTYPE html>
<html>
<head>
<title>Astro CLUB - <?php echo $gg1[0]; ?> JUNE</title>
<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>

View File

@ -1,52 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<title>${TITLE} in Astroport</title>
<meta charset="UTF-8">
<meta http-equiv="Refresh" content="7;URL=http://astroport/ipns/${IPNSLINK}/${G1PUB}/">
<link rel='stylesheet' href='/styles/astroport/style.css' type='text/css' />
<link rel='icon' type='image/png' href='/styles/astroport/logo.png' />
<title>${TITLE} in Astroport</title>
<meta charset="UTF-8">
<meta http-equiv="Refresh" content="7;URL=/ipns/${IPNSLINK}/${G1PUB}/">
<link rel='stylesheet' href='/styles/astroport/style.css' type='text/css' />
<link rel='icon' type='image/png' href='/styles/astroport/logo.png' />
</head>
<body>
<header>
<h6>
<a href='/'><span>ASTROPORT</span> <q>${XZUID}</q></a>
</h6>
<h6>
<a href='/'><span>ASTROPORT</span> <q>${XZUID}</q></a>
</h6>
</header>
<main>
<article>
<h1>${TITLE}</h1>
<p>Lancement de la video dans 7 secondes...</p>
<p class="pubkey-and-copy-button">
Ce fichier vous est servi par une station amie. Faites lui un don pour la remercier&nbsp;:
<input type="text" id="pubkey" readonly value="${G1PUB}" />
<button id="copy">Tip !</button>
</p>
<p id="successMsg">
La clef de la station amie est maintenant copiée dans le presse-papier. Vous pouvez la coller dans le client Ğ1 de votre choix (Cesium par exemple) afin de faire votre don 😉
</p>
<script>
function copy() {
var copyText = document.querySelector("input#pubkey");
copyText.select();
document.execCommand("copy");
<h1>${TITLE}</h1>
var successMsg = document.querySelector("#successMsg");
successMsg.style.opacity = "1";
<p>Lancement de la video dans 7 secondes...</p>
var copyButton = document.querySelector("button#copy");
copyButton.style.animation = "none";
}
<p class="pubkey-and-copy-button">
Ce fichier vous est servi par une station amie. Faites lui un don pour la remercier&nbsp;:
<input type="text" id="pubkey" readonly value="${G1PUB}" />
<button id="copy">Tip !</button>
</p>
<p id="successMsg">
La clef de la station amie est maintenant copiée dans le presse-papier. Vous pouvez la coller dans le client Ğ1 de votre choix (Cesium par exemple) afin de faire votre don 😉
</p>
<script>
function copy() {
var copyText = document.querySelector("input#pubkey");
copyText.select();
document.execCommand("copy");
var successMsg = document.querySelector("#successMsg");
successMsg.style.opacity = "1";
var copyButton = document.querySelector("button#copy");
copyButton.style.animation = "none";
}
document.querySelector("button#copy").addEventListener("click", copy);
</script>
document.querySelector("button#copy").addEventListener("click", copy);
</script>
</article>
</main>
</body>

View File

@ -1,29 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<title>${TITLE} in Astroport</title>
<meta charset="UTF-8">
<link rel='stylesheet' href='/styles/astroport/style.css' type='text/css' />
<link rel='icon' type='image/png' href='/styles/astroport/logo.png' />
<title>${TITLE} in Astroport</title>
<meta charset="UTF-8">
<link rel='stylesheet' href='/styles/astroport/style.css' type='text/css' />
<link rel='icon' type='image/png' href='/styles/astroport/logo.png' />
</head>
<body>
<header>
<h6>
<a href='http://astroport/'><span>ASTROPORT</span> <q>${XZUID}</q></a>
</h6>
<h6>
<a href='/ipns/${IPFSNODEID}/.${IPFSNODEID}/'><span>ASTROPORT</span> <q>${XZUID}</q></a>
</h6>
</header>
<main>
<article>
<video autoplay="autoplay" controls>
<source src="/ipfs/${IPFSREPFILEID}/${URLENCODE_FILE_NAME}">
<a href="/ipfs/${IPFSREPFILEID}/${URLENCODE_FILE_NAME}">${TITLE}</a>
</video>
<article>
<video autoplay="autoplay" controls>
<source src="/ipfs/${IPFSREPFILEID}/${URLENCODE_FILE_NAME}">
<a href="/ipfs/${IPFSREPFILEID}/${URLENCODE_FILE_NAME}">${TITLE}</a>
</video>
<h1 class="video-title">
${TITLE}
</h1>
</article>
<h1 class="video-title">
${TITLE}
</h1>
</article>
</main>
</body>

View File

@ -125,7 +125,7 @@ do
find /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/ -empty -type d -delete;
################################################################
echo "OK Friend SWARM REFRESH /ipns/$ipfsnodeid INTO ~/.zen/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
################################################################
if [ $? != 0 ];
then

View File

@ -7,6 +7,8 @@
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
########################################################################
# \\///
@ -14,11 +16,9 @@ ME="${0##*/}"
############# '$MY_PATH/$ME'
########################################################################
# ex: ./'$ME'
# SYNC IPFS SWARM PEERS SHARED DATA .12D3KooW****
########################################################################'
########################################################################
# ENVIRONEMENT DETECTION + IPFS ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_info
########################################################################
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n')
[[ ! $IPFSNODEID ]] && echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1
@ -26,9 +26,12 @@ IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n')
[[ ! -f ~/.zen/secret.dunikey ]] && exit 1
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
########################################################################
echo "## FRIENDS IPFS PINGing"
for g1pub in $(ls -t ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/); do [[ $g1pub ]] && ipfs ping --timeout=3s -n 3 /ipfs/$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) 2>/dev/null; done
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
########################################################################
XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid)
# echo "## FRIENDS IPFS PINGing"
# for g1pub in $(ls -t ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/); do [[ $g1pub ]] && ipfs ping --timeout=3s -n 3 /ipfs/$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) 2>/dev/null; done
echo "
@ -43,39 +46,53 @@ echo "I am /ipns/$IPFSNODEID controling and refreshing my MEDIAKEY IPNS"
########################################################################
# REFRESH IPNS SELF PUBLISH
########################################################################
~/.zen/astrXbian/zen/ipns_self_publish.sh
# ~/.zen/astrXbian/zen/ipns_self_publish.sh
########################################################################
count=0
[[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/KEY/ ]] && exit 0
# [[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/KEY/ ]] && exit 0
## TAKE CARE OF MY KEY
for mediakey in $(ls ~/.zen/ipfs/.${IPFSNODEID}/KEY/); # Alternative search
for mediakey in $(ls ~/.zen/ipfs/.${IPFSNODEID}/KEY/ 2>/dev/null | shuf ); # Alternative search
do
[[ "${mediakey}" == "" ]] && continue ## prevent empty mediakey
[[ ! $(echo "${mediakey}" | grep "TMDB_") ]] && continue ## REFRESH ONLY TMDB (level 1), youtube is level 0
# [[ ! $(echo "${mediakey}" | grep "TMDB_") ]] && continue ## REFRESH ONLY TMDB (level 1), youtube is level 0
IPNSLINK=$(ipfs key list -l | grep ${mediakey} | cut -d ' ' -f 1)
[[ "${IPNSLINK}" == "" ]] && continue ## prevent empty IPNSLINK
echo "We are refreshing http://127.0.0.1:8181/ipns/${IPNSLINK}"
count=$((count+1)) && echo "$count) "
FILE_NAME=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.ipfs.filename)
TITLE=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.title)
## REFRESH MORE THAN 6 HOURS TIMESTAMP KEY
TIMESTAMP=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.timestamp) # INITIAL TIMESTAMP
[[ -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/.timestamp ]] && TIMESTAMP=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/.timestamp) # LAST REFRESH
timestamp=$(date -u +%s%N | cut -b1-13)
STAMPDIFF=$((timestamp - TIMESTAMP))
echo "Last Update : $(date -d @$TIMESTAMP)"
echo "${mediakey} LAST UPDATED $STAMPDIFF milliseconds AGO"
[ $STAMPDIFF -lt 21600000 ] && continue # 6h = 21600000 ms , 10h = 36000000 ms
source=$(echo $mediakey | cut -d '_' -f 1)
ANNONCE=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.gchange.ad)
ANNONCE=$(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.gchange.ad 2>/dev/null)
## Use natools to decrypt "/tmp/${mediakey}_filelink.txt
[[ -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.ipfs.filelink.natools.encrypt ]] && $MY_PATH/tools/natools.py decrypt -f pubsec -k "$HOME/.zen/secret.dunikey" -i "$HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/.ipfs.filelink.natools.encrypt" -o "/tmp/${mediakey}_filelink.txt"
# file=$(cat /tmp/${mediakey}_filelink.txt | rev | cut -d '/' -f 1 | rev)
URLENCODE_FILE_NAME=$(cat /tmp/${mediakey}_filelink.txt | rev | cut -d '/' -f 1 | rev | jq -Rr @uri)
IPFSREPFILEID=$(cat /tmp/${mediakey}_filelink.txt | rev | cut -d '/' -f 2- | rev | cut -d '/' -f 3)
echo "IPFS MEDIA link : /ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME"
## TREAT OLD DATA from new_file_in_astroport.sh (LATER can be removed)
if [[ ! -f $HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/MEDIAPUBKEY ]]; then
if [[ ! -f $HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/content.json && -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/video.json ]]; then
mediakeyfile=$($MY_PATH/tools/give_me_keystore_filename.py $mediakey)
$MY_PATH/tools/natools.py privkey -f ipfs-keystore -k $HOME/.ipfs/keystore/$mediakeyfile -F pubsec -o /tmp/${mediakey}.dunikey
# PubFromDunikey=$(cat /tmp/${mediakey}.dunikey | grep "sec" | cut -d ' ' -f2 | base58 -d | tail -c+33 | base58)
PubFromDunikey=$(cat /tmp/${mediakey}.dunikey | grep "pub" | cut -d ' ' -f2)
echo "$PubFromDunikey" > $HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/MEDIAPUBKEY
fi
MEDIAPUBKEY=$(cat $HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/MEDIAPUBKEY)
echo "MEDIA G1 WALLET = $MEDIAPUBKEY"
BALANCE=$(~/.zen/astrXbian/zen/jaklis/jaklis.py balance -p ${MEDIAPUBKEY}) && [[ $BALANCE == null || "$BALANCE" == "" ]] && BALANCE=0
@ -84,15 +101,24 @@ do
TUBELINK="https://tube.copylaradio.com$(cat /tmp/${mediakey}_filelink.txt)"
LOCALTUBELINK="http://127.0.0.1:8181$(cat /tmp/${mediakey}_filelink.txt)"
### IPNS LINK CAN EVOLVE (REFRESH EVERY 12 H TO MAINTAIN ALIVE IN THE SWARM) # TODO : Use templating
### This index.html is ipns link root, 1st welcome page for MEDIAKEY -> *** Redirect to CONTRACTS processing HERE ***
### IPNS LINK CAN EVOLVE (REFRESH EVERY 12 H TO MAINTAIN ALIVE IN THE SWARM)
### This index.html is ipns link root, 1st welcome page for MEDIAKEY -> *** Redirect to CONTRACTS or LOGIN processing HERE ***
echo "=======> Mediakey Welcome index.html
IPNSLINK=$IPNSLINK
IPFSNODEID=$IPFSNODEID
XZUID=$XZUID
G1PUB=$G1PUB
TITLE=$TITLE"
cat /home/$YOU/.zen/astrXbian/www/boris/youtube_watch_step2.html \
| sed "s/\${IPNSLINK}/$IPNSLINK/g" \
| sed "s/\${IPFSNODEID}/$IPFSNODEID/g" \
| sed "s/\${XZUID}/$XZUID/g" \
| sed "s/\${G1PUB}/$G1PUB/g" \
| sed "s/\${TITLE}/$TITLE/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/index.html
[ ! -s ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/index.html ] && echo "Problem creating ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/index.html. EXIT" && exit 1
########################################################################
### Scenario are G1PUB subdivized. Thus each friend can establish own contract
@ -115,12 +141,14 @@ do
[[ "$FILETYPE" == "mkv" ]] && MIMETYPE="video/x-matroska"
[[ "$FILETYPE" == "mp3" ]] && MIMETYPE="audio/mpeg" && HTMLTAG="audio"
echo "=======> Mediakey Contract index.html "
cat /home/$YOU/.zen/astrXbian/www/boris/youtube_watch_step3.html \
| sed "s/\${TITLE}/$TITLE/g" \
| sed "s/\${XZUID}/$XZUID/g" \
| sed "s/\${IPFSREPFILEID}/$IPFSREPFILEID/g" \
| sed "s/\${URLENCODE_FILE_NAME}/$URLENCODE_FILE_NAME/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
| sed "s/\${TITLE}/$TITLE/g" \
| sed "s/\${IPFSNODEID}/$IPFSNODEID/g" \
| sed "s/\${XZUID}/$XZUID/g" \
| sed "s/\${IPFSREPFILEID}/$IPFSREPFILEID/g" \
| sed "s/\${URLENCODE_FILE_NAME}/$URLENCODE_FILE_NAME/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/index.html
if [[ "$source" == "YOUTUBE" ]]
@ -166,10 +194,12 @@ do
# KEY ZenTag IPNS name publish
J=$(ipfs name publish --quieter -k ${mediakey} /ipfs/${I})
echo "$id REFRESHED https://tube.copylaradio.com/ipns/$J"
echo "$id REFRESHED ${I}
https://tube.copylaradio.com/ipns/$J
http://127.0.0.1:8181/ipns/$J"
########################################################################
########################################################################
break ## ONE BY ONE (cron_MINUTE.sh task every 7 mn)
done
########################################################################
@ -178,12 +208,12 @@ done
## Then refresh MEDIAKEY IPNS/IPFS RELATION
## CORRECT ISSUE : https://git.p2p.legal/axiom-team/astrXbian/issues/25
########################################################################
for ipnslink in $(ls ~/.zen/PIN/*/IPNSLINK); do
for ipnslink in $(ls ~/.zen/PIN/*/IPNSLINK 2>/dev/null | shuf ); do
ipnsid=$(cat $ipnslink)
ipfsid=$(echo $ipnslink | cut -d '/' -f 6)
mediakey=$(cat ~/.zen/PIN/${ipfsid}/MEDIAKEY)
[[ ! $(echo "${mediakey}" | grep "TMDB_") ]] && continue ## REFRESH ONLY TMDB (level 1), youtube is level 0
# [[ ! $(echo "${mediakey}" | grep "TMDB_") ]] && continue ## REFRESH ONLY TMDB (level 1), youtube is level 0
[[ ! $(ipfs key list | grep ${mediakey}) ]] && echo "ERROR MISSING MEDIAKEY" && continue
@ -192,13 +222,30 @@ for ipnslink in $(ls ~/.zen/PIN/*/IPNSLINK); do
echo "${mediakey} GET IPNS"
ipfs get -o /tmp/${mediakey} /ipns/$ipnsid
[ $? -ne 0 ] && continue
echo "ADD TO IPFS"
[ ! -s /tmp/${mediakey}/index.html ] && continue ## DO NOT REPUBLISH empty index.html
## REFRESH MORE THAN 6 HOURS TIMESTAMP KEY
TIMESTAMP=$(cat /tmp/${mediakey}/.timestamp 2>/dev/null) # LAST REFRESH
[[ ! $TIMESTAMP ]] && TIMESTAMP=$(cat /tmp/${mediakey}/*/.timestamp 2>/dev/null | tail -n 1 ) # INITIAL TIMESTAMP
timestamp=$(date -u +%s%N | cut -b1-13)
STAMPDIFF=$((timestamp - TIMESTAMP))
echo "Last Update : $(date -d @$TIMESTAMP)"
echo "PIN WAS LAST UPDATED $STAMPDIFF milliseconds AGO"
[ $STAMPDIFF -lt 39600000 ] && continue # 11h = 39600000 ms / 12h = 43200000 ms
echo "Refresh MEDIAKEY PIN"
NEWIPFS=$(ipfs add -rHq /tmp/${mediakey}/ | tail -n 1)
## PUBLISH IT
ipfs name publish -k ${mediakey} --quieter /ipfs/$NEWIPFS
echo "ECHO PUBLISHING https://tube.copylaradio.com/ipns/$ipnsid TO /ipfs/$NEWIPFS"
echo "$id PIN PUBLISH REFRESHED /ipfs/$NEWIPFS
https://tube.copylaradio.com/ipns/$ipnsid
http://127.0.0.1:8181/ipns/$ipnsid"
rm -Rf /tmp/${mediakey}
break ## DO ONE BY ONE
done
########################################################################

View File

@ -6,24 +6,24 @@ ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
########################################################################
IPFSNODEID=$(ipfs --timeout=30s id -f='<id>\n')
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n')
[[ $IPFSNODEID == "" ]] && echo "ipfs TIMEOUT" && exit 1
########################################################################
## TESSERACT DOUBLE ACTION
########################################################################
echo "Adding ~/.zen/ipfs to IPFS"
MIPFS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
OLDCHAIN=$(cat ~/.zen/ipfs/.${IPFSNODEID}/.chain)
echo "OLD: $OLDCHAIN != NEW:$MIPFS ?"
if [[ "$OLDCHAIN" != "$MIPFS" ]] # MODIFY CHAIN only if something was changed
then
# MIPFS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
# OLDCHAIN=$(cat ~/.zen/ipfs/.${IPFSNODEID}/.chain)
# echo "OLD: $OLDCHAIN != NEW:$MIPFS ?"
# if [[ "$OLDCHAIN" != "$MIPFS" ]] # MODIFY CHAIN only if something was changed
# then
echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/ipfs/.${IPFSNODEID}/.timestamp
echo $MIPFS > ~/.zen/ipfs/.${IPFSNODEID}/.chain
MIPFS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
NODEIPNS=$(ipfs --timeout=180s name publish --quieter /ipfs/$MIPFS)
echo "$NODEIPNS:TIME:$(cat ~/.zen/ipfs/.${IPFSNODEID}/.timestamp):CHAIN:$(cat ~/.zen/ipfs/.${IPFSNODEID}/.chain)"
fi
# fi
echo "PUBLISHED ~/.zen/ipfs TO http://127.0.0.1:8181/ipns/$IPFSNODEID"
########################################################################
## READ BLOCK CHAIN ##

View File

@ -24,6 +24,10 @@ G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
# mkdir -p ~/astroport/mp3
########################################################################
path="$1"
if [[ "$path" == "" ]]; then
echo "## BATCH RUN. READ FIFO FILE."
fi
# Add trailing / if needed
length=${#path}
last_char=${path:length-1:1}
@ -216,7 +220,7 @@ $MY_PATH/tools/natools.py encrypt -p $PINnode -i /tmp/.ipfsid -o "~/.zen/ipfs/.$
########################################################################
# CREATING QRCODE
$MY_PATH/tools/natools.py privkey -f ipfs-keystore -k $HOME/.ipfs/keystore/$KEYFILE -F pubsec -o /tmp/${MEDIAKEY}.dunikey
# PubFromDunikey=$(cat /tmp/${MEDIAKEY}.dunikey | grep "sec" | cut -d ' ' -f2 | base58 -d | tail -c+33 | base58)
# PubFromDunikey=$(cat /tmp/${MEDIAKEY}.dunikey | grep "sec" | cut -d ' ' -f2 | base58 -d | tail -c+33 | base58) ## HOWTO EXTRACT PUBKEY FROM SECKEY
PubFromDunikey=$(cat /tmp/${MEDIAKEY}.dunikey | grep "pub" | cut -d ' ' -f2)
qrencode -s 6 -o "$HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/QR.png" "$PubFromDunikey"
echo "$PubFromDunikey" > $HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/MEDIAPUBKEY
@ -234,6 +238,7 @@ $MY_PATH/tools/natools.py encrypt -p $PINnode -i /tmp/${MEDIAKEY}.pass -o $HOME/
## DECODE MEDIAKEY.dunikey ##
# ~/.zen/astrXbian/zen/tools/natools.py decrypt -f pubsec -k "$HOME/.zen/secret.dunikey" -i "$HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.pass.encrypt" -o "/tmp/${MEDIAKEY}.pass"
# openssl enc -aes-256-cbc -d -in "$HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/dunikey.enc" -out "/tmp/${MEDIAKEY}.dunikey" -k $(cat "/tmp/${MEDIAKEY}.pass")
rm /tmp/${MEDIAKEY}.dunikey
########################################################################
## GET .ipfs/keystore file MAHE .ipns.mediakey.encrypt
@ -264,7 +269,7 @@ rm /tmp/.ipfsid
## ADD "ajouter_video.txt" and "video.json" will be SELF IPNS publish data
## ENCRYPT TO STOP CLEAR DATA LEAKING
[[ -f ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/ajouter_video.txt ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
[[ -f ~/astroport/${TYPE}/${REFERENCE}/video.json ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/video.json ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
[[ -f ~/astroport/${TYPE}/${REFERENCE}/video.json ]] && cp -f ~/astroport/${TYPE}/${REFERENCE}/video.json ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/ && cp -f ~/astroport/${TYPE}/${REFERENCE}/video.json ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/
########################################################################
########################################################################
@ -296,24 +301,28 @@ IPNSLINK=$(ipfs key list -l | grep ${MEDIAKEY} | cut -d ' ' -f 1)
# https://tube.copylaradio.com/ipns/$IPNSLINK
#envsubst < ./www/boris/youtube_watch_step2.html > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
cat /home/$YOU/.zen/astrXbian/www/boris/youtube_watch_step2.html \
| sed "s/\${IPNSLINK}/$IPNSLINK/g" \
| sed "s/\${XZUID}/$XZUID/g" \
| sed "s/\${G1PUB}/$G1PUB/g" \
| sed "s/\${TITLE}/$TITLE/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
echo "=======> Mediakey Welcome index.html "
cat /home/$YOU/.zen/astrXbian/www/boris/youtube_watch_step2.html \
| sed "s/\${IPNSLINK}/$IPNSLINK/g" \
| sed "s/\${IPFSNODEID}/$IPFSNODEID/g" \
| sed "s/\${XZUID}/$XZUID/g" \
| sed "s/\${G1PUB}/$G1PUB/g" \
| sed "s/\${TITLE}/$TITLE/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/index.html
## SECOND REDIRECT PAGE ${MEDIAKEY}/${G1PUB}/index.html
# https://tube.copylaradio.com/ipns/$IPNSLINK/${G1PUB}/
#envsubst < ../www/boris/youtube_watch_step3.html > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
cat /home/$YOU/.zen/astrXbian/www/boris/youtube_watch_step3.html \
| sed "s/\${TITLE}/$TITLE/g" \
| sed "s/\${XZUID}/$XZUID/g" \
| sed "s/\${IPFSREPFILEID}/$IPFSREPFILEID/g" \
| sed "s/\${URLENCODE_FILE_NAME}/$URLENCODE_FILE_NAME/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
echo "=======> Mediakey Contract index.html "
cat /home/$YOU/.zen/astrXbian/www/boris/youtube_watch_step3.html \
| sed "s/\${TITLE}/$TITLE/g" \
| sed "s/\${IPFSNODEID}/$IPFSNODEID/g" \
| sed "s/\${XZUID}/$XZUID/g" \
| sed "s/\${IPFSREPFILEID}/$IPFSREPFILEID/g" \
| sed "s/\${URLENCODE_FILE_NAME}/$URLENCODE_FILE_NAME/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/index.html
# echo "<meta http-equiv=\"Refresh\" content=\"0;URL=http://127.0.0.1:8181/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
@ -328,12 +337,16 @@ cat /home/$YOU/.zen/astrXbian/www/boris/youtube_watch_step3.html \
########################################################################
## PUBLISH new IPNS
########################################################################
NEWIPFS=$(ipfs add -rHq ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ | tail -n 1 )
## ADD CHAIN BLOCK ZERO
echo $NEWIPFS > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/.chain
echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/.timestamp
NEWIPFS=$(ipfs add -rHq ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ | tail -n 1 )
[[ "$NEWIPFS" == "" ]] && echo "~~~ FAILURE ~~~ ipfs add -rHq ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ | tail -n 1" && exit 1
## ADD CHAIN BLOCK ZERO (will be updated by ipns_TAG_refresh.sh)
echo $NEWIPFS > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/.chain
IPNS=$(ipfs name publish --quieter --key="${MEDIAKEY}" $NEWIPFS)
[[ "$IPNS" == "" ]] && echo "~~~ PROBLEM ~~~ ipfs name publish --quieter --key=${MEDIAKEY} $NEWIPFS"
########################################################################
########################################################################
@ -347,15 +360,18 @@ then
## CREATE GCHANGE AD
if [[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.gchange.ad && "${CAT}" != "youtube" ]]
then
GOFFER=$(~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" setoffer -t "${TITLE} #astroport #${MEDIAKEY}" -d "${TITLE} https://tube.copylaradio.com/ipns/$IPNS/ Faites un don à son portefeuille pour le conserver dans le Mediacenter des Amis - https://CopyLaRadio.com - https://astroport.com" -p $HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/QR.png)
echo $GOFFER > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.gchange.ad
NEWIPFS=$(ipfs add -rHq ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ | tail -n 1 )
IPNS=$(ipfs name publish --quieter --key="${MEDIAKEY}" $NEWIPFS)
echo "Annonce gchange : $(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.gchange.ad)"
fi
echo "Annonce gchange : $(cat ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.gchange.ad)"
########################################################################
# ${PREFIX}ASTRXBIAN FILE : Add Header
# CREATION DU FICHIER ${PREFIX}ASTRXBIAN FILE : Add Header
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN ]] \
&& echo "CAT;TMDB;YEAR;TITLE;SAISON;GENRES;GROUPES;RES;URLS=http://127.0.0.1:8181" > ~/.zen/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/${PREFIX}ASTRXBIAN