No separate ipfs peers page

This commit is contained in:
Bob Mottram 2015-09-30 22:25:01 +01:00
parent ab8ec8734d
commit 9049d5b436
1 changed files with 2 additions and 19 deletions

View File

@ -47,7 +47,6 @@ fi
BLOGS_FILE=$ZERONET_INSTALL/freedombone-blogs
FORUM_FILE=$ZERONET_INSTALL/freedombone-fora
IPFS_FILE=$ZERONET_INSTALL/freedombone-ipfs
TOX_USERS_FILE=$ZERONET_INSTALL/freedombone-tox-users
ZERONET_INDEX=/home/$MY_USERNAME/mesh.html
ZERONET_CONFIG=$ZERONET_INSTALL/bootstrap
@ -73,6 +72,7 @@ function create_index {
echo '<ol type="square">' >> $ZERONET_INDEX
echo " <li><a href=\"$(cat /home/$MY_USERNAME/.config/zeronet/myblog)\">My Blog</a></li>" >> $ZERONET_INDEX
echo " <li><a href=\"$(cat /home/$MY_USERNAME/.config/zeronet/myforum)\">My Forum</a></li>" >> $ZERONET_INDEX
echo " <li><a href=\"http://localhost:5001/ipfs/webui\">File Share</a></li>" >> $ZERONET_INDEX
echo '</ol>' >> $ZERONET_INDEX
echo '' >> $ZERONET_INDEX
echo "<H2>On the Mesh</H2>" >> $ZERONET_INDEX
@ -81,7 +81,6 @@ function create_index {
echo " <li><a href=\"${BLOGS_FILE}.html\">Blogs</a></li>" >> $ZERONET_INDEX
echo " <li><a href=\"${FORUM_FILE}.html\">Fora</a></li>" >> $ZERONET_INDEX
echo " <li><a href=\"${TOX_USERS_FILE}.html\">Tox Users</a></li>" >> $ZERONET_INDEX
echo " <li><a href=\"${IPFS_FILE}.html\">File shares</a></li>" >> $ZERONET_INDEX
echo '</ol>' >> $ZERONET_INDEX
echo '' >> $ZERONET_INDEX
echo '</body>' >> $ZERONET_INDEX
@ -228,23 +227,17 @@ done < "$TEMPFILE"
echo '<ol>' >> $FORUM_FILE.new
# detect IPFS file shares in the mesh
if [ -f $IPFS_FILE.new ]; then
rm -f $IPFS_FILE.new
fi
# IPFS bootstrap
cat $TEMPFILE_BASE | grep "IPFS\|hostname =\|address =\|port =\|txt =" > $TEMPFILE
state=0
address=""
peer=""
echo '<ol type="square">' >> $IPFS_FILE.new
while IFS='' read -r line || [[ -n "$line" ]]; do
if [ ${state} -eq "3" ]; then
if [[ $line == *"txt ="* ]]; then
ipfs_peer_id=$(echo $line | awk -F '[' '{print $2}' | awk -F ']' '{print $1}' | awk -F '"' '{print $2}')
ipfs bootstrap add /ip4/${address}/tcp/${IPFS_PORT}/ipfs/${ipfs_peer_id}
echo " <li><a href=\"http://localhost:5001/ipfs/${ipfs_peer_id}\">${peer}</a></li>" >> $IPFS_FILE.new
state=0
fi
fi
@ -264,7 +257,6 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
state=1
fi
done < "$TEMPFILE"
echo '<ol>' >> $FORUM_FILE.new
# detect Tox users
@ -302,10 +294,8 @@ fi
create_header $BLOGS_FILE "Blogs"
create_header $FORUM_FILE "Fora"
create_header $TOX_USERS_FILE "Tox Users"
create_header $IPFS_FILE "File Shares"
create_footer $BLOGS_FILE
create_footer $FORUM_FILE
create_footer $IPFS_FILE
create_footer $TOX_USERS_FILE
# make the index page
@ -332,11 +322,4 @@ if [ -d $ZERONET_USER_HOME ]; then
sudo chown zeronet:zeronet $TOX_USERS_FILE
fi
# create a web page showing the file shares
cat ${IPFS_FILE}-header.html ${IPFS_FILE}.new ${IPFS_FILE}-footer.html > ${IPFS_FILE}.html
rm -f ${IPFS_FILE}.new
if [ -d $ZERONET_USER_HOME ]; then
sudo chown zeronet:zeronet $IPFS_FILE
fi
exit 0