forked from STI/Astroport.ONE
Upgrade TW to latest version when moving PLAYER
This commit is contained in:
parent
62aa6cd563
commit
bbbc4174f6
@ -55,60 +55,66 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
|||||||
|
|
||||||
echo "SCANNING /ipns/${ASTRONAUTENS} for 180s"
|
echo "SCANNING /ipns/${ASTRONAUTENS} for 180s"
|
||||||
## GETTING LAST TW via IPFS or HTTP GW
|
## GETTING LAST TW via IPFS or HTTP GW
|
||||||
[[ $YOU ]] \
|
ipfs --timeout 180s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/${MOATS}/TW/index.html
|
||||||
&& ipfs --timeout 180s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/${MOATS}/TW/index.html
|
|
||||||
|
|
||||||
[[ $XDG_SESSION_TYPE == 'x11' || $XDG_SESSION_TYPE == 'wayland' ]] \
|
|
||||||
&& [[ -s ~/.zen/tmp/${MOATS}/TW/index.html ]] \
|
|
||||||
&& echo "TW FOUND ENTER 'yes' TO RESET TW. HIT ENTER TO KEEP IT." \
|
|
||||||
&& read ENTER
|
|
||||||
|
|
||||||
if [[ $ENTER != "" ]]; then
|
|
||||||
|
|
||||||
|
if [[ -s ~/.zen/tmp/${MOATS}/TW/index.html ]]; then
|
||||||
|
echo "TW FOUND... BACKUP TIDDLERS"
|
||||||
# BACKUP tiddlers
|
# BACKUP tiddlers
|
||||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp \
|
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} \
|
||||||
--render '.' 'backup.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[!is[system]]'
|
--render '.' 'backup.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[!is[system]]'
|
||||||
rm ~/.zen/tmp/${MOATS}/TW/index.html
|
|
||||||
echo ">> Tiddlers Backup : ~/.zen/tmp/backup.json"
|
[[ -s ~/.zen/tmp/${MOATS}/backup.json ]] \
|
||||||
|
&& rm ~/.zen/tmp/${MOATS}/TW/index.html \
|
||||||
|
&& echo ">> Tiddlers Backup : ~/.zen/tmp/${MOATS}/backup.json" \
|
||||||
|
|| echo "ERROR EXTRACTING TIDDLERS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
## AUCUN RESULTAT
|
## CREATE NEW TW FROM TEMPLATE
|
||||||
if [ ! -s ~/.zen/tmp/${MOATS}/TW/index.html ]; then
|
cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||||
|
|
||||||
cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
#### REFILL WITH BACKUP
|
||||||
|
if [[ -s ~/.zen/tmp/${MOATS}/backup.json ]]; then
|
||||||
|
|
||||||
else
|
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html \
|
||||||
|
--import ~/.zen/tmp/backup.json "application/json" \
|
||||||
|
--output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "tw.html" "text/plain"
|
||||||
|
|
||||||
|
[[ -s ~/.zen/tmp/${MOATS}/tw.html ]] \
|
||||||
|
&& cp -f ~/.zen/tmp/${MOATS}/tw.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||||
|
|
||||||
|
echo "BACKUP RESTORED"
|
||||||
|
fi
|
||||||
#############################################
|
#############################################
|
||||||
# EXISTING TW : DATA TESTING & CACHE
|
# EXISTING TW : DATA TESTING & CACHE
|
||||||
rm -f ~/.zen/tmp/${MOATS}/Astroport.json
|
rm -f ~/.zen/tmp/${MOATS}/Astroport.json
|
||||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
|
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
|
||||||
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].astroport)
|
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].astroport)
|
||||||
HPass=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].HPASS)
|
HPass=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].HPASS)
|
||||||
echo "ASTROPORT=${ASTROPORT}"
|
echo "ASTROPORT=${ASTROPORT}"
|
||||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'AstroID.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'AstroID'
|
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'AstroID.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'AstroID'
|
||||||
AstroID=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[]._canonical_uri) ## Can be deleted
|
AstroID=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[]._canonical_uri) ## Can be deleted
|
||||||
[[ -z $HPass ]] && HPass=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[].HPASS) ## Double HPASS
|
[[ -z $HPass ]] && HPass=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[].HPASS) ## Double HPASS
|
||||||
echo "AstroID=$AstroID ($HPass)"
|
echo "AstroID=$AstroID ($HPass)"
|
||||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'ZenCard.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'ZenCard'
|
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'ZenCard.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'ZenCard'
|
||||||
ZenCard=$(cat ~/.zen/tmp/${MOATS}/ZenCard.json | jq -r .[]._canonical_uri)
|
ZenCard=$(cat ~/.zen/tmp/${MOATS}/ZenCard.json | jq -r .[]._canonical_uri)
|
||||||
echo "ZenCard=$ZenCard"
|
echo "ZenCard=$ZenCard"
|
||||||
|
|
||||||
if [[ ${ASTROPORT} != "" && ${ASTROPORT} != "null" ]]; then
|
if [[ ${ASTROPORT} != "" && ${ASTROPORT} != "null" ]]; then
|
||||||
|
|
||||||
IPNSTAIL=$(echo ${ASTROPORT} | rev | cut -f 1 -d '/' | rev) # Remove "/ipns/" part
|
IPNSTAIL=$(echo ${ASTROPORT} | rev | cut -f 1 -d '/' | rev) # Remove "/ipns/" part
|
||||||
echo "TW ASTROPORT GATEWAY : ${ASTROPORT}"
|
echo "TW ASTROPORT GATEWAY : ${ASTROPORT}"
|
||||||
echo "---> CONNECTING PLAYER $(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].pseudo) TW NOW with $IPFSNODEID"
|
echo "---> CONNECTING PLAYER $(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].pseudo) TW NOW with $IPFSNODEID"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
echo ">> NO ACTIVE TW - CREATING FRESH NEW ONE"
|
echo ">> NO ACTIVE TW - CREATING FRESH NEW ONE"
|
||||||
cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ipfs key rm ${MOATS} 2>/dev/null ## CLEANING MOATS KEY
|
ipfs key rm ${MOATS} 2>/dev/null ## CLEANING MOATS KEY
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user