forked from qo-op/bunkerbox
make static homepage going into calendar.json archiving history.json
This commit is contained in:
parent
915c7614a3
commit
538e65c5a9
|
@ -29,6 +29,22 @@ IPFSNGW="http://127.0.0.1:8080"
|
||||||
[[ ! $isLAN ]] && IPFSNGW="https://$(hostname)"
|
[[ ! $isLAN ]] && IPFSNGW="https://$(hostname)"
|
||||||
echo "IPFS GATEWAY $IPFSNGW"
|
echo "IPFS GATEWAY $IPFSNGW"
|
||||||
|
|
||||||
|
## History Rotation
|
||||||
|
hier=$(date --date="yesterday" +"%Y-%m-%d")
|
||||||
|
# New day! 00:00 is passed...
|
||||||
|
if [[ ! -f ~/.zen/bunkerbox/history_${hier}.json && -f ~/.zen/bunkerbox/homepage/chain ]]; then
|
||||||
|
NUMBER=$(cat ~/.zen/bunkerbox/history.json | jq '.Videos[].link' | wc -l) && echo ".ROTATION. Hier historique de $NUMBER Videos."
|
||||||
|
[[ -f ~/.zen/bunkerbox/history.json ]] && mv ~/.zen/bunkerbox/history.json ~/.zen/bunkerbox/history_${hier}.json
|
||||||
|
## CREATE/UPDATE calendar.json
|
||||||
|
[[ ! -f ~/.zen/bunkerbox/calendar.json || $(cat ~/.zen/bunkerbox/calendar.json 2>/dev/null) == "" ]] && cp ${MY_PATH}/templates/data/calendar.json ~/.zen/bunkerbox/calendar.json
|
||||||
|
cat ~/.zen/bunkerbox/calendar.json | jq '.History += [{"link": "<a href='"'_INDEX_'"'>_HIER_</a>"}]' > ~/.zen/tmp/calendar.json
|
||||||
|
sed -i "s~_INDEX_~/ipfs/$(cat ~/.zen/bunkerbox/homepage/chain)~g" ~/.zen/tmp/calendar.json
|
||||||
|
sed -i "s~_HIER_~${hier} ($NUMBER)~g" ~/.zen/tmp/calendar.json
|
||||||
|
|
||||||
|
[[ "$(cat ~/.zen/tmp/calendar.json)" == "" ]] && echo "NO calendar.json FATAL ERROR" && exit 1
|
||||||
|
cp ~/.zen/tmp/calendar.json ~/.zen/bunkerbox/calendar.json
|
||||||
|
fi
|
||||||
|
|
||||||
## GET LATEST VIDEOS
|
## GET LATEST VIDEOS
|
||||||
VWALLURL="https://api.crowdbunker.com/post/all"
|
VWALLURL="https://api.crowdbunker.com/post/all"
|
||||||
curl -s $VWALLURL -H "Accept: application/json" > ~/.zen/bunkerbox/crowd.json
|
curl -s $VWALLURL -H "Accept: application/json" > ~/.zen/bunkerbox/crowd.json
|
||||||
|
@ -300,12 +316,14 @@ echo "##########################################################################
|
||||||
sed -i "s~_IPNSL_~$IPNSL~g" ~/.zen/bunkerbox/homepage/index.html
|
sed -i "s~_IPNSL_~$IPNSL~g" ~/.zen/bunkerbox/homepage/index.html
|
||||||
|
|
||||||
cp ~/.zen/bunkerbox/history.json ~/.zen/bunkerbox/homepage/history.json
|
cp ~/.zen/bunkerbox/history.json ~/.zen/bunkerbox/homepage/history.json
|
||||||
|
cp ~/.zen/bunkerbox/calendar.json ~/.zen/bunkerbox/homepage/calendar.json
|
||||||
cp ~/.zen/bunkerbox/history.${CHANNEL}.json ~/.zen/bunkerbox/homepage/history.${CHANNEL}.json
|
cp ~/.zen/bunkerbox/history.${CHANNEL}.json ~/.zen/bunkerbox/homepage/history.${CHANNEL}.json
|
||||||
echo "$TS" > ~/.zen/bunkerbox/homepage/ts # TimeStamping
|
echo "$TS" > ~/.zen/bunkerbox/homepage/ts # TimeStamping
|
||||||
echo "Adding ~/.zen/bunkerbox/homepage/* to IPFS "
|
echo "Adding ~/.zen/bunkerbox/homepage/* to IPFS "
|
||||||
VROOT=$(ipfs add -rwHq ~/.zen/bunkerbox/homepage/* | tail -n 1)
|
VROOT=$(ipfs add -rwHq ~/.zen/bunkerbox/homepage/* | tail -n 1)
|
||||||
echo "'qo-op' update with /ipfs/$VROOT"
|
echo "'qo-op' update with /ipfs/$VROOT"
|
||||||
ipfs name publish --key=qo-op /ipfs/$VROOT
|
ipfs name publish --key=qo-op /ipfs/$VROOT
|
||||||
|
echo "$VROOT" > ~/.zen/bunkerbox/homepage/chain # Memorize chain ipfs reference
|
||||||
echo "HOME : $IPFSNGW/ipns/$IPNS/"
|
echo "HOME : $IPFSNGW/ipns/$IPNS/"
|
||||||
echo "HISTORY : $IPFSNGW/ipns/$IPNS/history.json"
|
echo "HISTORY : $IPFSNGW/ipns/$IPNS/history.json"
|
||||||
fi
|
fi
|
||||||
|
@ -321,3 +339,5 @@ echo "##########################################################################
|
||||||
end=`date +%s`; echo ___Duration `expr $end - $start` seconds___
|
end=`date +%s`; echo ___Duration `expr $end - $start` seconds___
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
<!-- #$-:Please do not edit lines starting with "#$" -->
|
<!-- #$-:Please do not edit lines starting with "#$" -->
|
||||||
<!-- #$VERSION:2.3 -->
|
<!-- #$VERSION:2.3 -->
|
||||||
<!-- #$AUTHOR:fred -->
|
<!-- #$AUTHOR:fred -->
|
||||||
<area shape="rect" coords="0,0,330,62" href="http://crowdbunker.com" />
|
<area shape="rect" coords="0,0,330,62" target="crowdbunker" href="http://crowdbunker.com" />
|
||||||
<area shape="rect" coords="421,3,876,57" href="http://crowdbunker.com/search?q=Astroport" />
|
<area shape="rect" coords="421,3,876,57" target="crowdbunker" href="http://crowdbunker.com/search?q=Astroport" />
|
||||||
<area shape="rect" coords="1002,0,1264,61" target="code" href="https://qo-op.com" />
|
<area shape="rect" coords="1002,0,1264,61" target="code" href="https://qo-op.com" />
|
||||||
<area shape="rect" coords="3,64,1260,205" target="code" href="http://opencollective.com/monnaie-libre/projects/bunker-box" />
|
<area shape="rect" coords="3,64,1260,205" target="code" href="http://opencollective.com/monnaie-libre/projects/bunker-box" />
|
||||||
</map>
|
</map>
|
||||||
|
@ -54,6 +54,8 @@
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
<div id="calendarList"><div class="wrapper"></div></div>
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
<h6>
|
<h6>
|
||||||
<a href="_IPNSL_"> _\/_ </a> powered by <a href="https://astroport.com"><span>"</span>Astroport<span>"</span></a>
|
<a href="_IPNSL_"> _\/_ </a> powered by <a href="https://astroport.com"><span>"</span>Astroport<span>"</span></a>
|
||||||
|
@ -68,7 +70,7 @@
|
||||||
<link rel="stylesheet" href="styles/pagination.css" />
|
<link rel="stylesheet" href="styles/pagination.css" />
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$.getJSON('_IPNSL_/history.json', function (json) {
|
$.getJSON('./history.json', function (json) {
|
||||||
$('#videosList').pagination({
|
$('#videosList').pagination({
|
||||||
dataSource: json.Videos,
|
dataSource: json.Videos,
|
||||||
pageSize: 1,
|
pageSize: 1,
|
||||||
|
@ -80,6 +82,20 @@ $.getJSON('_IPNSL_/history.json', function (json) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$.getJSON('./calendar.json', function (json) {
|
||||||
|
$('#calendarList').pagination({
|
||||||
|
dataSource: json.History,
|
||||||
|
pageSize: 1,
|
||||||
|
callback: function(data, pagination) {
|
||||||
|
var wrapper = $('#calendarList .wrapper').empty();
|
||||||
|
$.each(data, function (i, f) {
|
||||||
|
$('#calendarList .wrapper').append('<ul><li>' + f.link + '</li></ul>');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
var arrTimes = [];
|
var arrTimes = [];
|
||||||
var i = 0; // start
|
var i = 0; // start
|
||||||
var timesToTest = 5;
|
var timesToTest = 5;
|
||||||
|
|
Loading…
Reference in New Issue