forked from qo-op/bunkerbox
correct list reversing
This commit is contained in:
parent
c27df6262d
commit
df31f3bfb5
|
@ -148,7 +148,7 @@ echo "##########################################################################
|
||||||
sed -i "s~_CHANNEL_~$CHANNEL~g" ~/.zen/bunkerbox/$VUID/media/index.html
|
sed -i "s~_CHANNEL_~$CHANNEL~g" ~/.zen/bunkerbox/$VUID/media/index.html
|
||||||
sed -i "s~_IPNSL_~$IPNSL~g" ~/.zen/bunkerbox/$VUID/media/index.html #MAJ IPNS link
|
sed -i "s~_IPNSL_~$IPNSL~g" ~/.zen/bunkerbox/$VUID/media/index.html #MAJ IPNS link
|
||||||
|
|
||||||
echo ">>>>> ADDING TO IPFS : ipfs add -rwH ~/.zen/bunkerbox/$VUID/media/* "
|
echo ">>>>> ADDING MEDIA TO IPFS : ipfs add -rwH ~/.zen/bunkerbox/$VUID/media/* "
|
||||||
echo
|
echo
|
||||||
IPFSROOT=$(ipfs add -rwHq ~/.zen/bunkerbox/$VUID/media/* | tail -n 1)
|
IPFSROOT=$(ipfs add -rwHq ~/.zen/bunkerbox/$VUID/media/* | tail -n 1)
|
||||||
INDEX="/ipfs/$IPFSROOT"
|
INDEX="/ipfs/$IPFSROOT"
|
||||||
|
@ -172,10 +172,15 @@ echo "##########################################################################
|
||||||
sed -i "s~_TITLE_~$TITLE~g" ~/.zen/bunkerbox/$VUID/media/history.json
|
sed -i "s~_TITLE_~$TITLE~g" ~/.zen/bunkerbox/$VUID/media/history.json
|
||||||
# COULD BE DONE LIKE THAT
|
# COULD BE DONE LIKE THAT
|
||||||
# cat ~/.zen/bunkerbox/$VUID/media/history.json | jq --arg INDEX "$INDEX" --arg TITLE "$TITLE" '.Videos += [{"link": "<a href='''$INDEX''' >'''$TITLE'''</a>"}]' > ~/.zen/bunkerbox/history.json
|
# cat ~/.zen/bunkerbox/$VUID/media/history.json | jq --arg INDEX "$INDEX" --arg TITLE "$TITLE" '.Videos += [{"link": "<a href='''$INDEX''' >'''$TITLE'''</a>"}]' > ~/.zen/bunkerbox/history.json
|
||||||
echo "Mise à jour ~/.zen/bunkerbox/history.json"
|
echo "MISE A JOUR ~/.zen/bunkerbox/history.json"
|
||||||
[[ "$(cat ~/.zen/bunkerbox/$VUID/media/history.json)" == "" ]] && echo "FATAL ERROR" && exit 1
|
[[ "$(cat ~/.zen/bunkerbox/$VUID/media/history.json)" == "" ]] && echo "FATAL ERROR" && exit 1
|
||||||
# Upgrade local history.json with latest one
|
# Upgrade local history.json with reverse current one
|
||||||
[[ -f ~/.zen/bunkerbox/$VUID/media/history.json ]] && cp -f ~/.zen/bunkerbox/$VUID/media/history.json ~/.zen/bunkerbox/history.json
|
[[ -f ~/.zen/bunkerbox/$VUID/media/history.json ]]; then
|
||||||
|
echo '{
|
||||||
|
"Videos":' > ~/.zen/bunkerbox/history.json
|
||||||
|
cat ~/.zen/bunkerbox/$VUID/media/history.json | jq '.[] | reverse' >> ~/.zen/bunkerbox/history.json
|
||||||
|
echo '}' >> ~/.zen/bunkerbox/history.json
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create local index.html redirecting to current latest IPFS video
|
# Create local index.html redirecting to current latest IPFS video
|
||||||
|
@ -183,17 +188,18 @@ echo "##########################################################################
|
||||||
echo "===== INDEX ===== $IPFSNGW/ipfs/$IPFSROOT"
|
echo "===== INDEX ===== $IPFSNGW/ipfs/$IPFSROOT"
|
||||||
echo "HISTORY : $IPFSNGW/ipfs/$IPFSROOT/history.json"
|
echo "HISTORY : $IPFSNGW/ipfs/$IPFSROOT/history.json"
|
||||||
|
|
||||||
PS3="Comment voulez-vous continuer et publier votre collecte ? "
|
PS3="Comment voulez-vous publier votre collecte ? "
|
||||||
choices=("debug" "local" "qo-op" "astrXbian")
|
choices=("debug" "local" "qo-op" "astrXbian")
|
||||||
fav=$(cat ~/.zen/bunkerbox/choice 2>/dev/null)
|
fav=$(cat ~/.zen/bunkerbox/choice 2>/dev/null)
|
||||||
[[ ! $fav ]] && select fav in "${choices[@]}"; do [[ $fav ]] && break; done
|
[[ ! $fav ]] && select fav in "${choices[@]}"; do [[ $fav ]] && break; done
|
||||||
case $fav in
|
case $fav in
|
||||||
"local")
|
"local")
|
||||||
echo 'local' > ~/.zen/bunkerbox/choice
|
echo 'local' > ~/.zen/bunkerbox/choice
|
||||||
echo "MODE LOCAL Historique = ~/.zen/bunkerbox/history.json"
|
echo "MODE 'local'"
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
"astrXbian")
|
"astrXbian")
|
||||||
|
echo "MODE 'astrXbian'"
|
||||||
[[ ! -d ~/.zen/astrXbian ]] && echo "DEV ZONE - Installez astrXbian SVP ... P2P VideoClub DEMO - DEV ZONE !" && exit 1
|
[[ ! -d ~/.zen/astrXbian ]] && echo "DEV ZONE - Installez astrXbian SVP ... P2P VideoClub DEMO - DEV ZONE !" && exit 1
|
||||||
[[ ! $IPFSNODEID ]] && echo "Missing IPFSNODEID. Exit" && exit 1
|
[[ ! $IPFSNODEID ]] && echo "Missing IPFSNODEID. Exit" && exit 1
|
||||||
echo 'astrXbian' > ~/.zen/bunkerbox/choice
|
echo 'astrXbian' > ~/.zen/bunkerbox/choice
|
||||||
|
@ -205,7 +211,7 @@ echo "##########################################################################
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
"qo-op")
|
"qo-op")
|
||||||
echo "ACTIVATION qo-op"
|
echo "MODE 'qo-op'"
|
||||||
if [[ ! $(ipfs key list | grep 'qo-op') ]]; then
|
if [[ ! $(ipfs key list | grep 'qo-op') ]]; then
|
||||||
|
|
||||||
echo "Clef qo-op manquante! (Missing qo-op key!)"
|
echo "Clef qo-op manquante! (Missing qo-op key!)"
|
||||||
|
@ -232,31 +238,19 @@ echo "##########################################################################
|
||||||
echo "k51qzi5uqu5djt17zonkpg1cb8hrxhahpesybusz8q57j4ocqm0qlc6s99z60x" > ~/.zen/bunkerbox/qo-op
|
echo "k51qzi5uqu5djt17zonkpg1cb8hrxhahpesybusz8q57j4ocqm0qlc6s99z60x" > ~/.zen/bunkerbox/qo-op
|
||||||
cp ${MY_PATH}/key_ofxs233q ~/.ipfs/keystore/
|
cp ${MY_PATH}/key_ofxs233q ~/.ipfs/keystore/
|
||||||
fi
|
fi
|
||||||
############################################
|
|
||||||
## FIRST PUBLISH index.html (REDIRECT) + history.json + ts
|
|
||||||
mkdir -p /tmp/$VUID
|
|
||||||
|
|
||||||
cp ${MY_PATH}/templates/homepage.html /tmp/$VUID/index.html
|
|
||||||
cp ${MY_PATH}/templates/crowbunkerbox.png /tmp/$VUID/
|
|
||||||
sed -i "s~_IPNSL_~$IPNSL~g" /tmp/$VUID/index.html
|
|
||||||
cp ~/.zen/bunkerbox/history.json /tmp/$VUID/history.json
|
|
||||||
echo "$TS" > /tmp/$VUID/ts # TimeStamping
|
|
||||||
|
|
||||||
VROOT=$(ipfs add -wHq /tmp/$VUID/* | tail -n 1)
|
|
||||||
ipfs name publish --key=qo-op /ipfs/$VROOT
|
|
||||||
echo "qo-op : $IPFSNGW/ipns/$IPNS/history.json REDIRECT TO /ipfs/$VROOT"
|
|
||||||
else
|
else
|
||||||
## qo-op KEY IS ALREADY THERE. WRITE qo-op IPNS key
|
## qo-op KEY IS ALREADY THERE. WRITE 'qo-op' IPNS key
|
||||||
ipfs key list -l | grep 'qo-op' | cut -f 1 -d ' ' > ~/.zen/bunkerbox/qo-op
|
ipfs key list -l | grep 'qo-op' | cut -f 1 -d ' ' > ~/.zen/bunkerbox/qo-op
|
||||||
fi
|
fi
|
||||||
echo 'qo-op' > ~/.zen/bunkerbox/choice
|
echo 'qo-op' > ~/.zen/bunkerbox/choice
|
||||||
IPNS=$(cat ~/.zen/bunkerbox/qo-op)
|
IPNS=$(cat ~/.zen/bunkerbox/qo-op)
|
||||||
echo "Votre chaine vidéo qo-op /ipns/$IPNS"
|
echo
|
||||||
|
echo "Chaine Vidéo 'qo-op' => $IPFSNGW/ipns/$IPNS"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
InHere=$(cat ~/.zen/bunkerbox/history.qo-op.json | jq .Videos[].link | grep $VUID)
|
InHere=$(cat ~/.zen/bunkerbox/history.qo-op.json | jq .Videos[].link | grep $VUID)
|
||||||
if [[ ! $InHere ]]; then
|
if [[ ! $InHere ]]; then
|
||||||
echo "NOUVELLE VIDEO."
|
echo "BunkerBOX - NOUVELLE VIDEO - Mise à jour homepage.html & history.json"
|
||||||
mkdir -p /tmp/$VUID
|
mkdir -p /tmp/$VUID
|
||||||
## This is the welcome page of your qo-op channel.
|
## This is the welcome page of your qo-op channel.
|
||||||
# Could be redirect, or ... Your homepage is introduced there !!
|
# Could be redirect, or ... Your homepage is introduced there !!
|
||||||
|
@ -268,16 +262,16 @@ echo "##########################################################################
|
||||||
cp ${MY_PATH}/templates/crowbunkerbox.png /tmp/$VUID/
|
cp ${MY_PATH}/templates/crowbunkerbox.png /tmp/$VUID/
|
||||||
sed -i "s~_IPNSL_~$IPNSL~g" /tmp/$VUID/index.html
|
sed -i "s~_IPNSL_~$IPNSL~g" /tmp/$VUID/index.html
|
||||||
|
|
||||||
|
|
||||||
cp ~/.zen/bunkerbox/history.json /tmp/$VUID/history.json
|
cp ~/.zen/bunkerbox/history.json /tmp/$VUID/history.json
|
||||||
echo "$TS" > /tmp/$VUID/ts # TimeStamping
|
echo "$TS" > /tmp/$VUID/ts # TimeStamping
|
||||||
|
echo "Adding /tmp/$VUID/* to IPFS "
|
||||||
VROOT=$(ipfs add -rwHq /tmp/$VUID/* | tail -n 1)
|
VROOT=$(ipfs add -rwHq /tmp/$VUID/* | tail -n 1)
|
||||||
|
echo "'qo-op' update with /ipfs/$VROOT"
|
||||||
ipfs name publish --key=qo-op /ipfs/$VROOT
|
ipfs name publish --key=qo-op /ipfs/$VROOT
|
||||||
echo "qo-op : $IPFSNGW/ipns/$IPNS/"
|
echo "HOME : $IPFSNGW/ipns/$IPNS/"
|
||||||
echo "qo-op : $IPFSNGW/ipns/$IPNS/history.json"
|
echo "HISTORY : $IPFSNGW/ipns/$IPNS/history.json"
|
||||||
fi
|
fi
|
||||||
#[[ $VUID != "" ]] && rm -Rf /tmp/$VUID # Cleaning
|
[[ $VUID != "" ]] && rm -Rf /tmp/$VUID # Cleaning
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
"debug")
|
"debug")
|
||||||
|
|
Loading…
Reference in New Issue