From 7cd03120962d9615dc233f4c1b10cad5bc24c16e Mon Sep 17 00:00:00 2001 From: fred Date: Thu, 5 Aug 2021 04:09:35 +0200 Subject: [PATCH] () --- zen/tools/autoPINfriends.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/zen/tools/autoPINfriends.sh b/zen/tools/autoPINfriends.sh index 4292025..e0e8767 100755 --- a/zen/tools/autoPINfriends.sh +++ b/zen/tools/autoPINfriends.sh @@ -1,6 +1,6 @@ #!/bin/bash ######################################################################## -# Author: +# Author: # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ######################################################################## @@ -14,7 +14,7 @@ G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) # This script is called to manage SWARM autoPIN # Actual behaviour is to accept anything from # SOURCE: ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/${PINnode}/.ipfsid.encrypt (new_file_in_astroport.sh) -# MEDIAKEY: ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/${PINnode}/.ipns.mediakey.encrypt +# MEDIAKEY: ~/.zen/ipfs/.${IPFSNODEID}/KEY/${INDEXPREFIX}${REFERENCE}/${G1PUB}/${PINnode}/.ipns.mediakey.encrypt ## AUTO PIN FRIENDS ACTIVATION for astrofile in $(ls -dt ~/.zen/ipfs_swarm/.12D*/KEY/*/*/${G1PUB}/.ipfsid.encrypt | shuf); @@ -23,7 +23,7 @@ do mediakey=$(echo "$astrofile" | cut -d '/' -f 8 ) keytype=$(echo "$mediakey" | cut -d '_' -f 1 ) mediaid=$(echo "$mediakey" | cut -d '_' -f 2 ) - + g1source=$(echo "$astrofile" | cut -d '/' -f 9 ) ipfsnodesource=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1source) @@ -31,7 +31,7 @@ do ## VERIFY CONTRACT... TODO $MY_PATH/natools.py decrypt -f pubsec -k "$HOME/.zen/secret.dunikey" -i "$astrofile" -o "/tmp/ipfslink.txt" astrofile=$(cat /tmp/ipfslink.txt) - # PINNING NEW FILE + # PINNING NEW FILE echo "SHOULD I PIN ~/.zen/PIN/${astrofile} ??" if [[ ! -d ~/.zen/PIN/${astrofile} ]]; then @@ -39,23 +39,23 @@ do ipfs pin add /ipfs/$astrofile && mkdir -p ~/.zen/PIN/${astrofile}/ echo "RECORDING MY PIN ~/.zen/PIN/" [[ -d ~/.zen/PIN/${astrofile} ]] && echo "0" > ~/.zen/PIN/${astrofile}/$G1PUB - + echo "ADD ${mediakey} to my local keystore (SO I CAN UPDATE IPNS LINK LATER with ipns_TAG_refresh.sh)" if [[ -f $HOME/.zen/ipfs_swarm/.${ipfsnodesource}/KEY/${mediakey}/${g1source}/${G1PUB}/.ipns.mediakey.encrypt ]]; then $MY_PATH/natools.py decrypt -f pubsec -k "$HOME/.zen/secret.dunikey" -i "$HOME/.zen/ipfs_swarm/.${ipfsnodesource}/KEY/${mediakey}/${g1source}/${G1PUB}/.ipns.mediakey.encrypt" -o "/tmp/ipns.mediakey" - if [[ -f /tmp/ipns.mediakey ]]; then + if [[ -f /tmp/ipns.mediakey ]]; then KEYFILE=$($MY_PATH/give_me_keystore_filename.py "${mediakey}") - [[ ! -f ~/.ipfs/keystore/$KEYFILE ]] && mv /tmp/ipns.mediakey ~/.ipfs/keystore/$KEYFILE || echo "KEYSTORE EXISTING. EXIT" && continue + [[ ! -f ~/.ipfs/keystore/$KEYFILE ]] && mv /tmp/ipns.mediakey ~/.ipfs/keystore/$KEYFILE || ( echo "KEYSTORE EXISTING. EXIT" && continue ) echo "${mediakey}" > ~/.zen/PIN/${astrofile}/MEDIAKEY echo "$(ipfs key list -l | grep ${mediakey} | cut -d ' ' -f 1)" > ~/.zen/PIN/${astrofile}/IPNSLINK ## USED BY BOOTSTRAP IN ipns_TAG_refresh.sh TO REFRESH MEDIAKEY publishing fi fi else - echo "ALREADY PINNED" - continue + echo "ALREADY PINNED" + continue fi - + ## TOOD : DECIDE TO ACTIVATE THIS BEHAVIOUR OR NOT ? ## Copy FASTRXBIAN index (makes movies available for ALL) [[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/FASTRXBIAN ]] && echo "CAT;TMDB;YEAR;TITLE;SAISON;GENRES;GROUPES;RES;URLS=http://127.0.0.1:8181" > ~/.zen/ipfs/.${IPFSNODEID}/astroport/kodi/vstream/FASTRXBIAN