Beginning of ZeroMail integration
This commit is contained in:
parent
9edd637aa3
commit
3d52c309d9
133
src/freedombone
133
src/freedombone
|
@ -433,6 +433,8 @@ ZERONET_REPO='https://github.com/HelloZeroNet/ZeroNet.git'
|
|||
ZERONET_COMMIT='675bd462556c541d65e2d95f91f899146a373aad'
|
||||
ZERONET_BLOG_REPO='https://github.com/HelloZeroNet/ZeroBlog'
|
||||
ZERONET_BLOG_COMMIT='bbb0d6c36465fed2e6df71f1aab45fcc9c6ad609'
|
||||
ZERONET_MAIL_REPO='https://github.com/HelloZeroNet/ZeroMail'
|
||||
ZERONET_MAIL_COMMIT='955af09d643c72b02e4983d71eca5c0c93a6c131'
|
||||
ZERONET_FORUM_REPO='https://github.com/HelloZeroNet/ZeroTalk'
|
||||
ZERONET_FORUM_COMMIT='e2d2c9cb1cfbfef91b244935efb5c14c2ad95faa'
|
||||
ZERONET_URL=http://127.0.0.1:43110
|
||||
|
@ -440,6 +442,7 @@ ZERONET_PORT=15441
|
|||
TRACKER_PORT=6969
|
||||
ZERONET_DEFAULT_BLOG_TAGLINE="Blogging on the Mesh"
|
||||
ZERONET_DEFAULT_FORUM_TAGLINE="A decentralized discussion group"
|
||||
ZERONET_DEFAULT_MAIL_TAGLINE="Mail for the Mesh"
|
||||
|
||||
# https://github.com/ipfs/go-ipfs
|
||||
IPFS_GO_REPO="github.com/ipfs/go-ipfs/cmd/ipfs"
|
||||
|
@ -910,6 +913,9 @@ function read_configuration {
|
|||
if grep -q "ZERONET_BLOG_COMMIT" $CONFIGURATION_FILE; then
|
||||
ZERONET_BLOG_COMMIT=$(grep "ZERONET_BLOG_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "ZERONET_MAIL_COMMIT" $CONFIGURATION_FILE; then
|
||||
ZERONET_MAIL_COMMIT=$(grep "ZERONET_MAIL_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "ZERONET_FORUM_COMMIT" $CONFIGURATION_FILE; then
|
||||
ZERONET_FORUM_COMMIT=$(grep "ZERONET_FORUM_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
|
@ -1974,6 +1980,132 @@ function install_zeronet_blog {
|
|||
echo 'install_zeronet_blog' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
function install_zeronet_mail {
|
||||
if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -d /opt/zeronet/ZeroMail ]; then
|
||||
if grep -q "ZeroNet Mail commit" $COMPLETION_FILE; then
|
||||
CURRENT_ZERONET_MAIL_COMMIT=$(grep "ZeroNet Mail commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
|
||||
if [[ "$CURRENT_ZERONET_MAIL_COMMIT" != "$ZERONET_MAIL_COMMIT" ]]; then
|
||||
cd /opt/zeronet/ZeroMail
|
||||
git stash
|
||||
git checkout master
|
||||
git pull
|
||||
git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
|
||||
sed -i "s/ZeroNet Mail commit.*/ZeroNet Mail commit:$ZERONET_MAIL_COMMIT/g" $COMPLETION_FILE
|
||||
fi
|
||||
else
|
||||
echo "ZeroNet Mail commit:$ZERONET_MAIL_COMMIT" >> $COMPLETION_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -Fxq "install_zeronet_mail" $COMPLETION_FILE; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f /home/$MY_USERNAME/README ]; then
|
||||
touch /home/$MY_USERNAME/README
|
||||
fi
|
||||
|
||||
if grep -q "ZeroNet Mail address" /home/$MY_USERNAME/README; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -d /etc/avahi ]; then
|
||||
echo 'Avahi is not installed'
|
||||
exit 736
|
||||
fi
|
||||
|
||||
ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail"
|
||||
|
||||
cd /opt/zeronet
|
||||
python zeronet.py --batch siteCreate 2> /opt/zeronet/mail.txt
|
||||
if [ ! -f /opt/zeronet/mail.txt ]; then
|
||||
echo 'Unable to create mail'
|
||||
exit 479
|
||||
fi
|
||||
mail_address=$(cat mail.txt | grep "Site address" | awk -F ':' '{print $2}')
|
||||
mail_private_key=$(cat mail.txt | grep "Site private key" | awk -F ':' '{print $2}')
|
||||
ZERONET_MAIL_ADDRESS=${mail_address//[[:blank:]]/}
|
||||
ZERONET_MAIL_PRIVATE_KEY=${mail_private_key//[[:blank:]]/}
|
||||
|
||||
if [ ${#ZERONET_MAIL_ADDRESS} -lt 20 ]; then
|
||||
echo $"Address: $ZERONET_MAIL_ADDRESS"
|
||||
echo $"Public key: $ZERONET_MAIL_PRIVATE_KEY"
|
||||
echo $'Unable to create zeronet mail address'
|
||||
exit 7358
|
||||
fi
|
||||
|
||||
if [ ${#ZERONET_MAIL_PRIVATE_KEY} -lt 20 ]; then
|
||||
echo $"Address: $ZERONET_MAIL_ADDRESS"
|
||||
echo $"Public key: $ZERONET_MAIL_PRIVATE_KEY"
|
||||
echo $'Unable to create zeronet mail private key'
|
||||
exit 1639
|
||||
fi
|
||||
|
||||
if [ ! -d "/opt/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
|
||||
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_MAIL_ADDRESS"
|
||||
exit 7638
|
||||
fi
|
||||
|
||||
git clone $ZERONET_MAIL_REPO ZeroMail
|
||||
if [ ! -d /opt/zeronet/ZeroMail ]; then
|
||||
echo 'ZeroMail repo could not be cloned'
|
||||
exit 6739
|
||||
fi
|
||||
cd /opt/zeronet/ZeroMail
|
||||
git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
|
||||
if ! grep -q "ZeroNet Mail commit" $COMPLETION_FILE; then
|
||||
echo "ZeroNet Mail commit:$ZERONET_MAIL_COMMIT" >> $COMPLETION_FILE
|
||||
else
|
||||
sed -i "s/ZeroNet Mail commit.*/ZeroNet Mail commit:$ZERONET_MAIL_COMMIT/g" $COMPLETION_FILE
|
||||
fi
|
||||
|
||||
echo $"ZeroNet Mail address: $ZERONET_MAIL_ADDRESS"
|
||||
echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
|
||||
cp -r /opt/zeronet/ZeroMail/* /opt/zeronet/data/$ZERONET_MAIL_ADDRESS
|
||||
|
||||
if [ ! -d /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
|
||||
mkdir /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
|
||||
fi
|
||||
cp /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
|
||||
sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
|
||||
sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
|
||||
sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
|
||||
sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
|
||||
sed -i "s/Mailging platform Demo/Mailging platform/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
|
||||
python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
|
||||
|
||||
# Add an avahi service
|
||||
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /tmp/zeronet-mail.service
|
||||
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /tmp/zeronet-mail.service
|
||||
echo '<service-group>' >> /tmp/zeronet-mail.service
|
||||
echo ' <name replace-wildcards="yes">%h ZeroNet Mail</name>' >> /tmp/zeronet-mail.service
|
||||
echo ' <service>' >> /tmp/zeronet-mail.service
|
||||
echo ' <type>_zeronet._udp</type>' >> /tmp/zeronet-mail.service
|
||||
echo " <port>$ZERONET_PORT</port>" >> /tmp/zeronet-mail.service
|
||||
echo " <txt-record>$ZERONET_URL/$ZERONET_MAIL_ADDRESS</txt-record>" >> /tmp/zeronet-mail.service
|
||||
echo ' </service>' >> /tmp/zeronet-mail.service
|
||||
echo '</service-group>' >> /tmp/zeronet-mail.service
|
||||
cp /tmp/zeronet-mail.service /etc/avahi/services/zeronet-mail.service
|
||||
|
||||
if [ ! -d /home/$MY_USERNAME/.config/zeronet ]; then
|
||||
mkdir -p /home/$MY_USERNAME/.config/zeronet
|
||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
|
||||
fi
|
||||
echo "$ZERONET_URL/$ZERONET_MAIL_ADDRESS" > /home/$MY_USERNAME/.config/zeronet/mymail
|
||||
|
||||
if ! grep -q "ZeroNet Mail address" /home/$MY_USERNAME/README; then
|
||||
echo '' >> /home/$MY_USERNAME/README
|
||||
echo "ZeroNet Mail address: $ZERONET_MAIL_ADDRESS" >> /home/$MY_USERNAME/README
|
||||
echo "ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY" >> /home/$MY_USERNAME/README
|
||||
fi
|
||||
|
||||
echo 'install_zeronet_mail' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
function install_zeronet_forum {
|
||||
if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
|
||||
return
|
||||
|
@ -8826,6 +8958,7 @@ install_zeronet
|
|||
install_watchdog_script
|
||||
configure_avahi
|
||||
install_zeronet_blog
|
||||
install_zeronet_mail
|
||||
install_zeronet_forum
|
||||
#install_atheros_wifi
|
||||
configure_firewall_for_cjdns
|
||||
|
|
|
@ -16,6 +16,8 @@ PEERS_FILE=/tmp/meshwebstart
|
|||
ZERONET_REPO='https://github.com/HelloZeroNet/ZeroNet'
|
||||
ZERONET_BLOG_REPO='https://github.com/HelloZeroNet/ZeroBlog'
|
||||
ZERONET_FORUM_REPO='https://github.com/HelloZeroNet/ZeroTalk'
|
||||
ZERONET_MAIL_REPO='https://github.com/HelloZeroNet/ZeroMail'
|
||||
ZERONET_MAIL_COMMIT='955af09d643c72b02e4983d71eca5c0c93a6c131'
|
||||
ZERONET_URL=http://127.0.0.1:43110
|
||||
ZERONET_PORT=15441
|
||||
TRACKER_PORT=6969
|
||||
|
@ -24,6 +26,7 @@ ZERONET_DIR=/home/$MY_USERNAME/zeronet
|
|||
UPDATED="no"
|
||||
ZERONET_DEFAULT_BLOG_TAGLINE="Blogging on the Mesh"
|
||||
ZERONET_DEFAULT_FORUM_TAGLINE="A decentralized discussion group"
|
||||
ZERONET_DEFAULT_MAIL_TAGLINE="Mail for the Mesh"
|
||||
|
||||
IPFS_PORT=4001
|
||||
|
||||
|
@ -191,6 +194,101 @@ function install_zeronet_blog {
|
|||
echo $'Zeronet blog installed'
|
||||
}
|
||||
|
||||
function install_zeronet_mail {
|
||||
if [ ! -f /home/$MY_USERNAME/README ]; then
|
||||
touch /home/$MY_USERNAME/README
|
||||
fi
|
||||
|
||||
if grep -q "ZeroNet Mail address" /home/$MY_USERNAME/README; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -d /etc/avahi ]; then
|
||||
echo 'Avahi is not installed'
|
||||
exit 736
|
||||
fi
|
||||
|
||||
ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail"
|
||||
|
||||
cd /opt/zeronet
|
||||
python zeronet.py --batch siteCreate 2> /opt/zeronet/mail.txt
|
||||
if [ ! -f /opt/zeronet/mail.txt ]; then
|
||||
echo 'Unable to create mail'
|
||||
exit 479
|
||||
fi
|
||||
mail_address=$(cat mail.txt | grep "Site address" | awk -F ':' '{print $2}')
|
||||
mail_private_key=$(cat mail.txt | grep "Site private key" | awk -F ':' '{print $2}')
|
||||
ZERONET_MAIL_ADDRESS=${mail_address//[[:blank:]]/}
|
||||
ZERONET_MAIL_PRIVATE_KEY=${mail_private_key//[[:blank:]]/}
|
||||
|
||||
if [ ${#ZERONET_MAIL_ADDRESS} -lt 20 ]; then
|
||||
echo $"Address: $ZERONET_MAIL_ADDRESS"
|
||||
echo $"Public key: $ZERONET_MAIL_PRIVATE_KEY"
|
||||
echo $'Unable to create zeronet mail address'
|
||||
exit 7358
|
||||
fi
|
||||
|
||||
if [ ${#ZERONET_MAIL_PRIVATE_KEY} -lt 20 ]; then
|
||||
echo $"Address: $ZERONET_MAIL_ADDRESS"
|
||||
echo $"Public key: $ZERONET_MAIL_PRIVATE_KEY"
|
||||
echo $'Unable to create zeronet mail private key'
|
||||
exit 1639
|
||||
fi
|
||||
|
||||
if [ ! -d "/opt/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
|
||||
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_MAIL_ADDRESS"
|
||||
exit 7638
|
||||
fi
|
||||
|
||||
git clone $ZERONET_MAIL_REPO ZeroMail
|
||||
if [ ! -d /opt/zeronet/ZeroMail ]; then
|
||||
echo 'ZeroMail repo could not be cloned'
|
||||
exit 6739
|
||||
fi
|
||||
cd /opt/zeronet/ZeroMail
|
||||
git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
|
||||
|
||||
echo $"ZeroNet Mail address: $ZERONET_MAIL_ADDRESS"
|
||||
echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
|
||||
cp -r /opt/zeronet/ZeroMail/* /opt/zeronet/data/$ZERONET_MAIL_ADDRESS
|
||||
|
||||
if [ ! -d /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
|
||||
mkdir /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
|
||||
fi
|
||||
cp /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
|
||||
sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
|
||||
sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
|
||||
sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
|
||||
sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
|
||||
sed -i "s/Mailging platform Demo/Mailging platform/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
|
||||
python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
|
||||
|
||||
# Add an avahi service
|
||||
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /tmp/zeronet-mail.service
|
||||
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /tmp/zeronet-mail.service
|
||||
echo '<service-group>' >> /tmp/zeronet-mail.service
|
||||
echo ' <name replace-wildcards="yes">%h ZeroNet Mail</name>' >> /tmp/zeronet-mail.service
|
||||
echo ' <service>' >> /tmp/zeronet-mail.service
|
||||
echo ' <type>_zeronet._udp</type>' >> /tmp/zeronet-mail.service
|
||||
echo " <port>$ZERONET_PORT</port>" >> /tmp/zeronet-mail.service
|
||||
echo " <txt-record>$ZERONET_URL/$ZERONET_MAIL_ADDRESS</txt-record>" >> /tmp/zeronet-mail.service
|
||||
echo ' </service>' >> /tmp/zeronet-mail.service
|
||||
echo '</service-group>' >> /tmp/zeronet-mail.service
|
||||
cp /tmp/zeronet-mail.service /etc/avahi/services/zeronet-mail.service
|
||||
|
||||
if [ ! -d /home/$MY_USERNAME/.config/zeronet ]; then
|
||||
mkdir -p /home/$MY_USERNAME/.config/zeronet
|
||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
|
||||
fi
|
||||
echo "$ZERONET_URL/$ZERONET_MAIL_ADDRESS" > /home/$MY_USERNAME/.config/zeronet/mymail
|
||||
|
||||
if ! grep -q "ZeroNet Mail address" /home/$MY_USERNAME/README; then
|
||||
echo '' >> /home/$MY_USERNAME/README
|
||||
echo "ZeroNet Mail address: $ZERONET_MAIL_ADDRESS" >> /home/$MY_USERNAME/README
|
||||
echo "ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY" >> /home/$MY_USERNAME/README
|
||||
fi
|
||||
}
|
||||
|
||||
function install_zeronet_forum {
|
||||
if [ ! -f /home/$MY_USERNAME/README ]; then
|
||||
touch /home/$MY_USERNAME/README
|
||||
|
@ -350,6 +448,7 @@ if [[ $SERVER_INSTALLATION == "no" ]]; then
|
|||
install_web_server
|
||||
install_zeronet
|
||||
install_zeronet_blog
|
||||
install_zeronet_mail
|
||||
install_zeronet_forum
|
||||
install_ipfs
|
||||
sudo batman start
|
||||
|
|
|
@ -51,6 +51,7 @@ if [ ! -d $ZERONET_INSTALL ]; then
|
|||
fi
|
||||
|
||||
BLOGS_FILE=$ZERONET_INSTALL/${PROJECT_NAME}-blogs
|
||||
MAIL_FILE=$ZERONET_INSTALL/${PROJECT_NAME}-mail
|
||||
FORUM_FILE=$ZERONET_INSTALL/${PROJECT_NAME}-fora
|
||||
TOX_USERS_FILE=$ZERONET_INSTALL/${PROJECT_NAME}-tox-users
|
||||
ZERONET_INDEX=/home/$MY_USERNAME/mesh.html
|
||||
|
@ -61,6 +62,7 @@ IPFS_PORT=4001
|
|||
function create_index {
|
||||
if [ -f $ZERONET_INDEX ]; then
|
||||
sed -i "s|.*My Blog.*| <li><a href=\"$(cat /home/$MY_USERNAME/.config/zeronet/myblog)\">My Blog</a></li>|g" $ZERONET_INDEX
|
||||
sed -i "s|.*My Mail.*| <li><a href=\"$(cat /home/$MY_USERNAME/.config/zeronet/mymail)\">My Mail</a></li>|g" $ZERONET_INDEX
|
||||
sed -i "s|.*My Forum.*| <li><a href=\"$(cat /home/$MY_USERNAME/.config/zeronet/myforum)\">My Forum</a></li>|g" $ZERONET_INDEX
|
||||
return
|
||||
fi
|
||||
|
@ -76,6 +78,7 @@ function create_index {
|
|||
echo '' >> $ZERONET_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/mymail)\">My Mail</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/webui\">File Share</a></li>" >> $ZERONET_INDEX
|
||||
echo '</ol>' >> $ZERONET_INDEX
|
||||
|
@ -84,6 +87,7 @@ function create_index {
|
|||
echo '' >> $ZERONET_INDEX
|
||||
echo '<ol type="square">' >> $ZERONET_INDEX
|
||||
echo " <li><a href=\"${BLOGS_FILE}.html\">Blogs</a></li>" >> $ZERONET_INDEX
|
||||
echo " <li><a href=\"${MAIL_FILE}.html\">Mail</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
|
||||
|
@ -194,6 +198,45 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
|
|||
done < "$TEMPFILE"
|
||||
echo '</ol>' >> $BLOGS_FILE.new
|
||||
|
||||
|
||||
# detect mail in the mesh
|
||||
if [ -f $MAIL_FILE.new ]; then
|
||||
rm -f $MAIL_FILE.new
|
||||
fi
|
||||
|
||||
cat $TEMPFILE_BASE | grep "ZeroNet Mail\|hostname =\|address =\|port =\|txt =" > $TEMPFILE
|
||||
|
||||
state=0
|
||||
address=""
|
||||
peer=""
|
||||
echo '<ol type="square">' >> $MAIL_FILE.new
|
||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||
if [ ${state} -eq "3" ]; then
|
||||
if [[ $line == *"txt ="* ]]; then
|
||||
mail_url=$(echo $line | awk -F '[' '{print $2}' | awk -F ']' '{print $1}')
|
||||
echo " <li><a href=${mail_url}>${peer}</a></li>" >> $MAIL_FILE.new
|
||||
state=0
|
||||
fi
|
||||
fi
|
||||
if [ ${state} -eq "2" ]; then
|
||||
if [[ $line == *"address ="* ]]; then
|
||||
address=$(echo $line | awk -F '[' '{print $2}' | awk -F ']' '{print $1}')
|
||||
state=3
|
||||
fi
|
||||
fi
|
||||
if [ ${state} -eq "1" ]; then
|
||||
if [[ $line == *"hostname ="* ]]; then
|
||||
peer=$(echo $line | awk -F '[' '{print $2}' | awk -F ']' '{print $1}')
|
||||
state=2
|
||||
fi
|
||||
fi
|
||||
if [[ $line == *"ZeroNet Mail"* && $line == "= "* ]]; then
|
||||
state=1
|
||||
fi
|
||||
done < "$TEMPFILE"
|
||||
echo '</ol>' >> $MAIL_FILE.new
|
||||
|
||||
|
||||
# detect fora in the mesh
|
||||
if [ -f $FORUM_FILE.new ]; then
|
||||
rm -f $FORUM_FILE.new
|
||||
|
@ -297,9 +340,11 @@ fi
|
|||
|
||||
# make some html headers and footers
|
||||
create_header $BLOGS_FILE "Blogs"
|
||||
create_header $MAIL_FILE "Mail"
|
||||
create_header $FORUM_FILE "Fora"
|
||||
create_header $TOX_USERS_FILE "Tox Users"
|
||||
create_footer $BLOGS_FILE
|
||||
create_footer $MAIL_FILE
|
||||
create_footer $FORUM_FILE
|
||||
create_footer $TOX_USERS_FILE
|
||||
|
||||
|
@ -313,6 +358,13 @@ if [ -d $ZERONET_USER_HOME ]; then
|
|||
sudo chown zeronet:zeronet $BLOGS_FILE
|
||||
fi
|
||||
|
||||
# create a web page showing the available mail contacts
|
||||
cat ${MAIL_FILE}-header.html ${MAIL_FILE}.new ${MAIL_FILE}-footer.html > ${MAIL_FILE}.html
|
||||
rm -f ${MAIL_FILE}.new
|
||||
if [ -d $ZERONET_USER_HOME ]; then
|
||||
sudo chown zeronet:zeronet $MAIL_FILE
|
||||
fi
|
||||
|
||||
# create a web page showing the available fora
|
||||
cat ${FORUM_FILE}-header.html ${FORUM_FILE}.new ${FORUM_FILE}-footer.html > ${FORUM_FILE}.html
|
||||
rm -f ${FORUM_FILE}.new
|
||||
|
|
Loading…
Reference in New Issue