List Tox users on the mesh
This commit is contained in:
parent
d498247e3d
commit
8c0ce3e25f
|
@ -48,6 +48,7 @@ fi
|
||||||
BOOTSTRAP_FILE=$ZERONET_INSTALL/bootstrap
|
BOOTSTRAP_FILE=$ZERONET_INSTALL/bootstrap
|
||||||
BLOGS_FILE=$ZERONET_INSTALL/freedombone-blogs
|
BLOGS_FILE=$ZERONET_INSTALL/freedombone-blogs
|
||||||
FORUM_FILE=$ZERONET_INSTALL/freedombone-fora
|
FORUM_FILE=$ZERONET_INSTALL/freedombone-fora
|
||||||
|
TOX_USERS_FILE=$ZERONET_INSTALL/freedombone-tox-users
|
||||||
ZERONET_INDEX=/home/$MY_USERNAME/mesh.html
|
ZERONET_INDEX=/home/$MY_USERNAME/mesh.html
|
||||||
|
|
||||||
function create_index {
|
function create_index {
|
||||||
|
@ -74,6 +75,7 @@ function create_index {
|
||||||
echo '<ol type="square">' >> $ZERONET_INDEX
|
echo '<ol type="square">' >> $ZERONET_INDEX
|
||||||
echo " <li><a href=\"${BLOGS_FILE}.html\">Blogs</a></li>" >> $ZERONET_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=\"${FORUM_FILE}.html\">Fora</a></li>" >> $ZERONET_INDEX
|
||||||
|
echo " <li><a href=\"${TOX_USERS_FILE}.html\">Tox Users</a></li>" >> $ZERONET_INDEX
|
||||||
echo '</ol>' >> $ZERONET_INDEX
|
echo '</ol>' >> $ZERONET_INDEX
|
||||||
echo '' >> $ZERONET_INDEX
|
echo '' >> $ZERONET_INDEX
|
||||||
echo '</body>' >> $ZERONET_INDEX
|
echo '</body>' >> $ZERONET_INDEX
|
||||||
|
@ -217,6 +219,22 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||||
done < "$TEMPFILE"
|
done < "$TEMPFILE"
|
||||||
echo '<ol>' >> $FORUM_FILE.new
|
echo '<ol>' >> $FORUM_FILE.new
|
||||||
|
|
||||||
|
# detect Tox users
|
||||||
|
lstox > $TEMPFILE
|
||||||
|
toxctr=0
|
||||||
|
echo '<ol type="square">' >> $TOX_USERS_FILE.new
|
||||||
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line != "Failed*" ]]; then
|
||||||
|
echo " <li>$line</li>" >> $TOX_USERS_FILE.new
|
||||||
|
toxctr=$((toxctr + 1))
|
||||||
|
fi
|
||||||
|
done < "$TEMPFILE"
|
||||||
|
if [ $toxctr -eq "0" ]; then
|
||||||
|
echo " <li>No users found</li>" >> $TOX_USERS_FILE.new
|
||||||
|
fi
|
||||||
|
echo '<ol>' >> $TOX_USERS_FILE.new
|
||||||
|
|
||||||
|
|
||||||
rm -f $TEMPFILE_BASE
|
rm -f $TEMPFILE_BASE
|
||||||
rm -f $TEMPFILE
|
rm -f $TEMPFILE
|
||||||
|
|
||||||
|
@ -229,8 +247,10 @@ fi
|
||||||
# make some html headers and footers
|
# make some html headers and footers
|
||||||
create_header $BLOGS_FILE "Blogs"
|
create_header $BLOGS_FILE "Blogs"
|
||||||
create_header $FORUM_FILE "Fora"
|
create_header $FORUM_FILE "Fora"
|
||||||
|
create_header $TOX_USERS_FILE "Tox Users"
|
||||||
create_footer $BLOGS_FILE
|
create_footer $BLOGS_FILE
|
||||||
create_footer $FORUM_FILE
|
create_footer $FORUM_FILE
|
||||||
|
create_footer $TOX_USERS_FILE
|
||||||
|
|
||||||
# make the index page
|
# make the index page
|
||||||
create_index
|
create_index
|
||||||
|
@ -249,4 +269,11 @@ if [ -d $ZERONET_USER_HOME ]; then
|
||||||
sudo chown zeronet:zeronet $FORUM_FILE
|
sudo chown zeronet:zeronet $FORUM_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# create a web page showing Tox users
|
||||||
|
cat ${TOX_USERS_FILE}-header.html ${TOX_USERS_FILE}.new ${TOX_USERS_FILE}-footer.html > ${TOX_USERS_FILE}.html
|
||||||
|
rm -f ${TOX_USERS_FILE}.new
|
||||||
|
if [ -d $ZERONET_USER_HOME ]; then
|
||||||
|
sudo chown zeronet:zeronet $TOX_USERS_FILE
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue