From 88a63ef16ae5b8382b7f0ae11938d9919a8e894c Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 11 Aug 2021 00:08:27 +0200 Subject: [PATCH] better stronger --- {www/boris => actions}/check_my_wallet.sh | 0 actions/defcon3.sh | 0 actions/view_count.sh | 44 +++++++++++++++++++++++ cron_MINUTE.sh | 8 ++--- www/boris/film.php | 2 +- zen/ipns_TAG_refresh.sh | 8 ++--- 6 files changed, 53 insertions(+), 9 deletions(-) rename {www/boris => actions}/check_my_wallet.sh (100%) delete mode 100644 actions/defcon3.sh create mode 100755 actions/view_count.sh diff --git a/www/boris/check_my_wallet.sh b/actions/check_my_wallet.sh similarity index 100% rename from www/boris/check_my_wallet.sh rename to actions/check_my_wallet.sh diff --git a/actions/defcon3.sh b/actions/defcon3.sh deleted file mode 100644 index e69de29..0000000 diff --git a/actions/view_count.sh b/actions/view_count.sh new file mode 100755 index 0000000..5d0e6d3 --- /dev/null +++ b/actions/view_count.sh @@ -0,0 +1,44 @@ +#!/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 + +MEDIAKEYIPNS="$1" + + +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 + +## GO INTO $G1PUB EXCHANGE SPACE +[[ ! -d ./$G1PUB ]] && mkdir $G1PUB +cd $G1PUB + +## DO I OWN THE KEY, OR SHOUD I REQUEST IT +mediakeyid=$(cat ./*/.id) +if [[ ! $(ipfs key list -l | grep $mediakeyid) ]]; 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 $mediakeyid views, but not in your contracts yet. Please send me your ./ipfs/keystore/$MEDIAKEYIPNS to activate." + done + exit 1 +fi + +## INCREMENT COUNTER +count=$(cat .views.counter 2>/dev/null) || count=0 +echo $((count+1)) > .views.counter + +## PUBLISH NEW STATE +I=$(ipfs add -qrH ./ | tail -n 1) +echo "CHAIN: $I" +echo $I > .chain +echo "${mediakeyid} NAME PUBLISHING " +# MEDIAKEY IPNS name publish +J=$(ipfs name publish --quieter -k ${mediakeyid} /ipfs/${I}) +echo "$id VIEW COUNTER UPDATED in https://tube.copylaradio.com/ipns/$J/$G1PUB/.views.counter" diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index 322b45b..52df6ab 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -185,12 +185,12 @@ fi ################################################################## # TODO: IDEA make gchange/ipfs/ipns refresh speed depending on ipfs swarm size and DEFCON level ! ## SYNC GCHANGE EVERY 2 hours runtime -[[ $(($runtime % 97)) == 0 ]] && $MY_PATH/zen/gchange_INIT.sh +[[ $(($runtime % 97)) == 0 ]] && $MY_PATH/zen/gchange_INIT.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.gchange_INIT.txt ## SYNC SWARM EVERY 20 mn runtime -[[ $(($runtime % 17)) == 0 ]] && $MY_PATH/zen/gchange_IPFS_swarm.sh +[[ $(($runtime % 17)) == 0 ]] && $MY_PATH/zen/gchange_IPFS_swarm.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.gchange_IPFS_swarm.txt # QUICK SYNC SWARM EVERY 12 minutes -[[ $(($runtime % 11)) == 0 ]] && $MY_PATH/zen/ipfs_FRIENDS_refresh.sh - +[[ $(($runtime % 11)) == 0 ]] && $MY_PATH/zen/ipfs_FRIENDS_refresh.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.ipfs_FRIENDS_refresh.txt +## TODO ACTIVATE/DESACTIVATE LOG ######################################################################## # ACTIVATE ~/astroport directory monitoring (xbian only) ######################################################################## diff --git a/www/boris/film.php b/www/boris/film.php index 363dae9..7116651 100644 --- a/www/boris/film.php +++ b/www/boris/film.php @@ -6,7 +6,7 @@ require_once('functions.php'); $videosList = array(); exec("/bin/bash -c './get_astrxbian_index.sh F'", $videos); -exec("/bin/bash -c './check_my_wallet.sh'", $gg1); +exec("/bin/bash -c '/home/fred/.zen/astrXbian/actions/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 diff --git a/zen/ipns_TAG_refresh.sh b/zen/ipns_TAG_refresh.sh index 85acda1..de88094 100755 --- a/zen/ipns_TAG_refresh.sh +++ b/zen/ipns_TAG_refresh.sh @@ -103,7 +103,6 @@ do $TITLE in Astroport - @@ -125,7 +124,7 @@ do
SCANNEZ LE QR CODE DE VOTRE G1 PORTEFEUILLE... Ouvrez un portefeuille
-

Bienvenue sur le Live TEstNET astrXbian démo de lecture vidéo dans 10s

+

Cliquez sur ce lien de lecture vidéo streaming depuis une Station Bootstrap


Service Video Club / Datacenter P2P Libre et Légal.
@@ -163,7 +162,7 @@ do echo " - $TITLE in Astroport + $TITLE in Astroport served by $G1PUB @@ -182,7 +181,8 @@ do <$HTMLTAG controls> -

$TITLE (lien station $MIMETYPE)

+

$TITLE (lien depuis Station locale $MIMETYPE)

+

Comment installer IPFS ?


Ce media possède un G1 portefeuille avec lequel il paye son hébergement.