diff --git a/src/zeronetavahi b/src/zeronetavahi index bb1a7f0e..f3c2dc47 100755 --- a/src/zeronetavahi +++ b/src/zeronetavahi @@ -48,6 +48,7 @@ fi BOOTSTRAP_FILE=$ZERONET_INSTALL/bootstrap BLOGS_FILE=$ZERONET_INSTALL/freedombone-blogs FORUM_FILE=$ZERONET_INSTALL/freedombone-fora +TOX_USERS_FILE=$ZERONET_INSTALL/freedombone-tox-users ZERONET_INDEX=/home/$MY_USERNAME/mesh.html function create_index { @@ -74,6 +75,7 @@ function create_index { echo '
    ' >> $ZERONET_INDEX echo "
  1. Blogs
  2. " >> $ZERONET_INDEX echo "
  3. Fora
  4. " >> $ZERONET_INDEX + echo "
  5. Tox Users
  6. " >> $ZERONET_INDEX echo '
' >> $ZERONET_INDEX echo '' >> $ZERONET_INDEX echo '' >> $ZERONET_INDEX @@ -217,6 +219,22 @@ while IFS='' read -r line || [[ -n "$line" ]]; do done < "$TEMPFILE" echo '
    ' >> $FORUM_FILE.new +# detect Tox users +lstox > $TEMPFILE +toxctr=0 +echo '
      ' >> $TOX_USERS_FILE.new +while IFS='' read -r line || [[ -n "$line" ]]; do + if [[ $line != "Failed*" ]]; then + echo "
    1. $line
    2. " >> $TOX_USERS_FILE.new + toxctr=$((toxctr + 1)) + fi +done < "$TEMPFILE" +if [ $toxctr -eq "0" ]; then + echo "
    3. No users found
    4. " >> $TOX_USERS_FILE.new +fi +echo '
        ' >> $TOX_USERS_FILE.new + + rm -f $TEMPFILE_BASE rm -f $TEMPFILE @@ -229,8 +247,10 @@ fi # make some html headers and footers create_header $BLOGS_FILE "Blogs" create_header $FORUM_FILE "Fora" +create_header $TOX_USERS_FILE "Tox Users" create_footer $BLOGS_FILE create_footer $FORUM_FILE +create_footer $TOX_USERS_FILE # make the index page create_index @@ -249,4 +269,11 @@ if [ -d $ZERONET_USER_HOME ]; then sudo chown zeronet:zeronet $FORUM_FILE 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