From c4f02011d56ca3804247c562d3b0a1687c3c57a3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 3 Jan 2016 11:24:10 +0000 Subject: [PATCH] about --- src/freedombone-controlpanel | 126 ++++++++++++++++++++++++++++++----- 1 file changed, 110 insertions(+), 16 deletions(-) diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index 1d9fd353..6d87c44b 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -114,23 +114,117 @@ function add_user { fi } -function show_sip_extensions { - if [ ! -f $SIP_CONFIG_FILE ]; then - return; +function show_domains { + echo 'Domains' + echo '=======' + echo '' + if grep -q "Email onion domain" $COMPLETION_FILE; then + echo -n -e 'Email \t' + echo "$(cat ${COMPLETION_FILE} | grep 'Email onion domain' | awk -F ':' '{print $2}')" fi - clear - echo $"SIP phone extensions:" - echo " " - while read ext; do - if [[ $ext == *"user id"* ]]; then - echo -n " " - echo -n $(echo "$ext" | awk -F '"' '{print $2}' | awk -F '"' '{print $1}') - echo -n " " + if grep -q "Wiki domain" $COMPLETION_FILE; then + echo -n -e 'Wiki \t' + echo -n "$(cat ${COMPLETION_FILE} | grep 'Wiki domain' | awk -F ':' '{print $2}')" + echo -n -e '\t' + if [ -d /var/lib/tor/hidden_service_wiki ]; then + echo -n "$(cat /var/lib/tor/hidden_service_wiki/hostname)" fi - if [[ $ext == *"extension"* ]]; then - echo $(echo "$ext" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}') + echo '' + fi + if grep -q "Hubzilla domain" $COMPLETION_FILE; then + echo -n -e 'Hubzilla \t' + echo -n "$(cat ${COMPLETION_FILE} | grep 'Hubzilla domain' | awk -F ':' '{print $2}')" + echo -n -e '\t' + if [ -d /var/lib/tor/hidden_service_hubzilla ]; then + echo -n "$(cat /var/lib/tor/hidden_service_hubzilla/hostname)" fi - done < $SIP_CONFIG_FILE + echo '' + fi + if grep -q "Blog domain" $COMPLETION_FILE; then + echo -n -e 'Blog \t' + echo -n "$(cat ${COMPLETION_FILE} | grep 'Blog domain' | awk -F ':' '{print $2}')" + echo -n -e '\t' + if [ -d /var/lib/tor/hidden_service_blog ]; then + echo -n "$(cat /var/lib/tor/hidden_service_blog/hostname)" + fi + echo '' + fi + if grep -q "GNU Social domain" $COMPLETION_FILE; then + echo -n -e 'GNU Social\t' + echo -n "$(cat ${COMPLETION_FILE} | grep 'GNU Social domain' | awk -F ':' '{print $2}')" + echo -n -e '\t' + if [ -d /var/lib/tor/hidden_service_microblog ]; then + echo -n "$(cat /var/lib/tor/hidden_service_microblog/hostname)" + fi + echo '' + fi + if grep -q "Owncloud domain" $COMPLETION_FILE; then + echo -n -e 'Owncloud \t' + echo -n "$(cat ${COMPLETION_FILE} | grep 'Owncloud domain' | awk -F ':' '{print $2}')" + echo -n -e '\t' + if [ -d /var/lib/tor/hidden_service_owncloud ]; then + echo -n "$(cat /var/lib/tor/hidden_service_owncloud/hostname)" + fi + echo '' + fi + if grep -q "Gogs domain" $COMPLETION_FILE; then + echo -n -e 'Gogs \t' + echo -n "$(cat ${COMPLETION_FILE} | grep 'Gogs domain' | awk -F ':' '{print $2}')" + echo -n -e '\t' + if [ -d /var/lib/tor/hidden_service_git ]; then + echo -n "$(cat /var/lib/tor/hidden_service_gogs/hostname)" + fi + echo '' + fi + if grep -q "XMPP domain" $COMPLETION_FILE; then + echo -n -e 'XMPP \t' + echo -n "$(cat ${COMPLETION_FILE} | grep 'XMPP domain' | awk -F ':' '{print $2}')" + echo -n -e '\t' + if [ -d /var/lib/tor/hidden_service_xmpp ]; then + echo -n "$(cat /var/lib/tor/hidden_service_xmpp/hostname)" + fi + echo '' + fi + echo '' +} + +function show_users { + echo 'Users' + echo '=====' + echo '' + for d in /home/*/ ; do + USRNAME=$(echo "$d" | awk -F '/' '{print $3}') + if [[ $USRNAME != "git" ]]; then + echo -n "$USERNAME" + # get the SIP extension + SIPEXT= + while read ext; do + if [[ $ext == *"user id"* ]]; then + CURR_UID=$(echo "$ext" | awk -F '"' '{print $2}' | awk -F '"' '{print $1}') + fi + if [[ $ext == *"extension"* ]]; then + if [[ $CURR_UID == $USRNAME ]]; then + SIPEXT=$(echo "$ext" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}') + fi + fi + done < $SIP_CONFIG_FILE + echo -e -n '\t' + if [ $SIPEXT ]; then + echo -n "SIP:${SIPEXT}" + fi + + # size of the home directory + echo -e -n '\t' + echo -n "$(du -s -h /home/${USRNAME} | awk -F ' ' '{print $1}')" + + echo '' + fi + done +} + +function show_about { + show_domains + show_users any_key } @@ -1242,7 +1336,7 @@ function menu_top_level { --title $"Control Panel" \ --radiolist $"Choose an operation:" 25 70 18 \ 1 $"Backup and Restore" off \ - 2 $"Show SIP Phone Extensions" off \ + 2 $"About this system" off \ 3 $"Reset Tripwire" off \ 4 $"Logging on/off" off \ 5 $"Ping enable/disable" off \ @@ -1266,7 +1360,7 @@ function menu_top_level { esac case $(cat $data) in 1) menu_backup_restore;; - 2) show_sip_extensions;; + 2) show_about;; 3) reset_tripwire;; 4) logging_on_off;; 5) ping_enable_disable;;