diff --git a/README.md b/README.md index 2128a98..d07158a 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,22 @@ https://ipfs.io/ipns/k51qzi5uqu5djt17zonkpg1cb8hrxhahpesybusz8q57j4ocqm0qlc6s99z 3. Ajoute le lecteur videojs dans index.html et met à jour history.json 4. Publie localement, sur la clef IPNS 'qo-op' ou au travers du TestNet 'astrXbian' - Pour revenir en mode "debug", effacez le fichier ~/.zen/bunkerbox/choice -# +# Participation + +**IPFS est encore vierge. Venez y tracer vos chaines vidéos!** + +- Familier avec les outils en ligne de commande? +Ce sont principalement curl, jq, sed, cut et ipfs qui sont mis à l'oeuvre. +La méthode employée dans ce programme est extensible à l'infini !! + +Les média sont "encapsulés" avec une page de présentation (html, js, css, json) puis utilise jQuery pour créer l'interface. +Le tout est inscrit dans IPFS, la mémoire de ces inscriptions est conservées au travers de fichiers history.json statiques et/ou dynamiques (mode 'qo-op' et publication IPNS). + +Des connaissances en html, css, jQuery, ou d'autres bibliothèques javascript que je ne connais pas (vue.js?) vous permettra de prendre en main ce code. + +Forkez moi. +**Envoyez un email à support@qo-op.com pour obtenir de l'aide** + + diff --git a/crowdbunker.sh b/crowdbunker.sh index d95886c..3f69bb8 100755 --- a/crowdbunker.sh +++ b/crowdbunker.sh @@ -50,7 +50,8 @@ for VUID in $(tac /tmp/vuid.list); do LIVE=$(cat ~/.zen/bunkerbox/$VUID/media/$VUID.json | jq -r .video.isLiveActive) && [[ "$LIVE" == "true" ]] && echo "STREAMING... Bypassing..." && echo && continue DURATION=$(cat ~/.zen/bunkerbox/$VUID/media/$VUID.json | jq -r .video.duration) && [[ $DURATION == 0 ]] && echo "NOT STARTED YET" && echo && continue TITLE=$(cat ~/.zen/bunkerbox/$VUID/media/$VUID.json | jq -r .video.title | sed "s/'/ /g" | sed 's/"/ /g') # Remove quote - CHANNEL=$(cat ~/.zen/bunkerbox/$VUID/media/$VUID.json | jq -r .channel.name) + CHANNEL=$(cat ~/.zen/bunkerbox/$VUID/media/$VUID.json | jq -r .channel.organization.uid) + ## GET MORE DATA... CORRECT IT for each JSON ORGUID=$(cat ~/.zen/bunkerbox/$VUID/media/$VUID.json | jq -r .organization.uid) ORGNAME=$(cat ~/.zen/bunkerbox/$VUID/media/$VUID.json | jq -r .organization.name) ORGBANNER=$(cat ~/.zen/bunkerbox/$VUID/media/$VUID.json | jq -r .organization.banner.url) @@ -135,6 +136,9 @@ echo "########################################################################## IPNSL="./" fi + # Add previous CHANNEL History + [[ -f ~/.zen/bunkerbox/history.${CHANNEL}.json ]] && cp ~/.zen/bunkerbox/history.${CHANNEL}.json ~/.zen/bunkerbox/$VUID/media/ + # Add current/latest reversed history to media echo '{ "Videos":' > ~/.zen/bunkerbox/$VUID/media/history.json cat ~/.zen/bunkerbox/history.json | jq '.[] | reverse' >> ~/.zen/bunkerbox/$VUID/media/history.json @@ -150,8 +154,33 @@ echo "########################################################################## echo ">>>>> ADDING MEDIA TO IPFS : ipfs add -rwH ~/.zen/bunkerbox/$VUID/media/* " echo + +################################################################# +# IPFS WRITING. All that is prepared above in ~/.zen/bunkerbox/$VUID/media/ will become permanent ! +################################################################# IPFSROOT=$(ipfs add -rwHq ~/.zen/bunkerbox/$VUID/media/* | tail -n 1) INDEX="/ipfs/$IPFSROOT" +################################################################# +# IPFS WRITING DONE. Doing after is to UPDATE local history(s).json in ~/.zen/bunkerbox/ +# Then publishing on IPNS 'qo-op' all dynamic data needed by above 'index.html' +################################################################# + + # Take care about CHANNEL history + echo "++ MANAGE $CHANNEL HISTORY" + [[ ! -f ~/.zen/bunkerbox/history.${CHANNEL}.json || $(cat ~/.zen/bunkerbox/history.${CHANNEL}.json 2>/dev/null) == "" ]] && cp ${MY_PATH}/templates/data/history.json ~/.zen/bunkerbox/history.${CHANNEL}.json + if [[ ! $(cat ~/.zen/bunkerbox/history.${CHANNEL}.json | jq .Videos[].link | grep $VUID) ]]; then + echo "ADD ~/.zen/bunkerbox/history.${CHANNEL}.json" + # Bad characters breaks this command !! # cat ~/.zen/bunkerbox/history.${CHANNEL}.json | jq --arg INDEX "$INDEX" --arg TITLE "$TITLE" --arg VUID "$VUID" --arg TSVUID "TSVUID" '.Videos += [{"link": "
'''$TITLE''' "}]' > ~/.zen/tmp/history.${CHANNEL}.json + cat ~/.zen/bunkerbox/history.${CHANNEL}.json | jq '.Videos += [{"link": "
'"'_TITLE_'"'"}]' > ~/.zen/bunkerbox/$VUID/media/history.${CHANNEL}.json + sed -i "s~_INDEX_~$INDEX~g" ~/.zen/bunkerbox/$VUID/media/history.${CHANNEL}.json + sed -i "s~_VUID_~$VUID~g" ~/.zen/bunkerbox/$VUID/media/history.${CHANNEL}.json + sed -i "s~_TITLE_~$TITLE~g" ~/.zen/bunkerbox/$VUID/media/history.${CHANNEL}.json + + [[ "$(cat ~/.zen/bunkerbox/$VUID/media/history.${CHANNEL}.json)" == "" ]] && echo "NO history.${CHANNEL}.json FATAL ERROR" && exit 1 + + cp ~/.zen/bunkerbox/$VUID/media/history.${CHANNEL}.json ~/.zen/bunkerbox/history.${CHANNEL}.json + fi + VMAIN="/ipfs/$IPFSROOT/$VUID.m3u8" # UPDATING original JSON - TODO inform crowdbunker that IPFS copy is available. @@ -172,7 +201,7 @@ echo "########################################################################## # COULD BE DONE LIKE THAT # cat ~/.zen/bunkerbox/$VUID/media/history.json | jq --arg INDEX "$INDEX" --arg TITLE "$TITLE" '.Videos += [{"link": "'''$TITLE'''"}]' > ~/.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 "NO $VUID/media/history.json FATAL ERROR" && exit 1 # Upgrade local history.json with reverse new one if [[ -f ~/.zen/bunkerbox/$VUID/media/history.json ]]; then echo '{ "Videos":' > ~/.zen/bunkerbox/history.json @@ -197,7 +226,7 @@ echo "########################################################################## continue ;; "astrXbian") - echo "MODE 'astrXbian'" + echo "MODE 'astrXbian' (DEV ZONE)" [[ ! -d ~/.zen/astrXbian ]] && echo "DEV ZONE - Installez astrXbian SVP ... P2P VideoClub DEMO - DEV ZONE !" && exit 1 [[ ! $IPFSNODEID ]] && echo "Missing IPFSNODEID. Exit" && exit 1 echo 'astrXbian' > ~/.zen/bunkerbox/choice @@ -220,24 +249,27 @@ echo "########################################################################## echo "Envoyez un email pour obtenir assistance. (Contact support@qo-op.com) ? HELP !" sleep 1 echo - echo "Utiliser la clef 'qo-op' de DEV ? ENTRER pour OUI. Saisissez un caractère avant si NON." + echo "Utiliser la clef 'qo-op' par défaut ? ENTRER pour OUI. Saisissez un caractère avant si NON." read KDEV if [[ "$KDEV" != "" ]]; then echo "La confiance est dans la CLEF (Confidence is in the KEY)." - echo "Voici la votre (here is yours): " + echo "Génération de la votre (here is yours): " publishkey=$(ipfs key gen qo-op) echo "~/.ipfs/keystore/key_ofxs233q" - echo "Partagez cette clef avec vos amis pour créer une chaine video en commun..." + echo "Partagez cette clef avec vos amis pour créer votre chaine video en commun..." echo "$IPFSNGW/ipns/$publishkey" + echo echo "$publishkey" > ~/.zen/bunkerbox/qo-op echo 'qo-op' > ~/.zen/bunkerbox/choice else ## USE DEV KEY + echo "Activation clef 'qo-op' par défaut." echo "k51qzi5uqu5djt17zonkpg1cb8hrxhahpesybusz8q57j4ocqm0qlc6s99z60x" > ~/.zen/bunkerbox/qo-op cp ${MY_PATH}/key_ofxs233q ~/.ipfs/keystore/ fi else ## qo-op KEY IS ALREADY THERE. WRITE 'qo-op' IPNS key + # Refreshing actual 'qo-op' key ipfs key list -l | grep 'qo-op' | cut -f 1 -d ' ' > ~/.zen/bunkerbox/qo-op fi echo 'qo-op' > ~/.zen/bunkerbox/choice @@ -248,28 +280,28 @@ echo "########################################################################## InHere=$(cat ~/.zen/bunkerbox/history.qo-op.json | jq .Videos[].link | grep $VUID) if [[ ! $InHere ]]; then - echo "BunkerBOX - NOUVELLE VIDEO - Mise à jour homepage.html & history.json" - mkdir -p /tmp/$VUID + echo "BunkerBOX - NOUVELLE VIDEO - Mise à jour homepage & dynamic history(s).json" + mkdir -p ~/.zen/bunkerbox/qo-op/ ## This is the welcome page of your qo-op channel. # Could be redirect, or ... Your homepage is introduced there !! - # echo "" > /tmp/$VUID/index.html - # echo "" > /tmp/$VUID/index.html - cp -R ${MY_PATH}/templates/styles /tmp/$VUID/ - cp -R ${MY_PATH}/templates/js /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 + # echo "" > ~/.zen/bunkerbox/qo-op/index.html + # echo "" > ~/.zen/bunkerbox/qo-op/index.html + cp -R ${MY_PATH}/templates/styles ~/.zen/bunkerbox/qo-op/ + cp -R ${MY_PATH}/templates/js ~/.zen/bunkerbox/qo-op/ + cp ${MY_PATH}/templates/homepage.html ~/.zen/bunkerbox/qo-op/index.html + cp ${MY_PATH}/templates/crowbunkerbox.png ~/.zen/bunkerbox/qo-op/ + sed -i "s~_IPNSL_~$IPNSL~g" ~/.zen/bunkerbox/qo-op/index.html - cp ~/.zen/bunkerbox/history.json /tmp/$VUID/history.json - echo "$TS" > /tmp/$VUID/ts # TimeStamping - echo "Adding /tmp/$VUID/* to IPFS " - VROOT=$(ipfs add -rwHq /tmp/$VUID/* | tail -n 1) + cp ~/.zen/bunkerbox/history.json ~/.zen/bunkerbox/qo-op/history.json + cp ~/.zen/bunkerbox/history.${CHANNEL}.json ~/.zen/bunkerbox/qo-op/history.${CHANNEL}.json + echo "$TS" > ~/.zen/bunkerbox/qo-op/ts # TimeStamping + echo "Adding ~/.zen/bunkerbox/qo-op/* to IPFS " + VROOT=$(ipfs add -rwHq ~/.zen/bunkerbox/qo-op/* | tail -n 1) echo "'qo-op' update with /ipfs/$VROOT" ipfs name publish --key=qo-op /ipfs/$VROOT echo "HOME : $IPFSNGW/ipns/$IPNS/" echo "HISTORY : $IPFSNGW/ipns/$IPNS/history.json" fi - [[ $VUID != "" ]] && rm -Rf /tmp/$VUID # Cleaning continue ;; "debug") diff --git a/templates/videojs.html b/templates/videojs.html index 9b9c606..c430cb1 100644 --- a/templates/videojs.html +++ b/templates/videojs.html @@ -37,7 +37,7 @@

- _CHANNEL_ : _TITLE_ + __TITLE_

@@ -45,6 +45,10 @@
+
+
+
+
_\/_ powered by "Astroport" @@ -60,25 +64,36 @@