Show domains style
This commit is contained in:
parent
9cd23b51fe
commit
c742ce3362
|
@ -203,9 +203,114 @@ function pad_string {
|
|||
echo -n -e "$1" | sed -e :a -e 's/^.\{1,25\}$/& /;ta'
|
||||
}
|
||||
|
||||
function show_tor_bridges {
|
||||
if ! grep -q "#BridgeRelay" /etc/tor/torrc; then
|
||||
if grep -q "BridgeRelay 1" /etc/tor/torrc; then
|
||||
read_config_param 'TOR_BRIDGE_PORT'
|
||||
read_config_param 'TOR_BRIDGE_NICKNAME'
|
||||
if [ ${#TOR_BRIDGE_NICKNAME} -gt 0 ]; then
|
||||
W+=($"Your Tor Bridge" "$(get_ipv4_address):${TOR_BRIDGE_PORT} ${TOR_BRIDGE_NICKNAME}")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
bridges_list=$(grep "Bridge " /etc/tor/torrc | grep -v '##')
|
||||
if [ ${#bridges_list} -gt 0 ]; then
|
||||
for i in "${bridges_list[@]}"
|
||||
do
|
||||
bridgestr=$(i//Bridge /)
|
||||
W+=($"Tor Bridge" "$bridgestr")
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function show_domains {
|
||||
read_config_param "DEFAULT_DOMAIN_NAME"
|
||||
|
||||
W=()
|
||||
|
||||
if grep -q "ssh onion domain" "$COMPLETION_FILE"; then
|
||||
domain_onion=$(grep 'ssh onion domain' "${COMPLETION_FILE}" | awk -F ':' '{print $2}')
|
||||
W+=("ssh" "${DEFAULT_DOMAIN_NAME} / ${domain_onion}")
|
||||
fi
|
||||
if grep -q "email onion domain" "$COMPLETION_FILE"; then
|
||||
domain_onion=$(grep 'email onion domain' "${COMPLETION_FILE}" | awk -F ':' '{print $2}')
|
||||
W+=("Email" "${DEFAULT_DOMAIN_NAME} / ${domain_onion}")
|
||||
fi
|
||||
if grep -q "sks onion domain" "$COMPLETION_FILE"; then
|
||||
read_config_param "KEYSERVER_DOMAIN_NAME"
|
||||
domain_onion=$(grep 'sks onion domain' "${COMPLETION_FILE}" | awk -F ':' '{print $2}')
|
||||
W+=("SKS" "${KEYSERVER_DOMAIN_NAME} / ${domain_onion}")
|
||||
fi
|
||||
|
||||
INTRODUCER_FILENAME=/home/tahoelafs/data/private/introducer.furl
|
||||
if [ -f $INTRODUCER_FILENAME ]; then
|
||||
W+=("Tahoe-LAFS" "$(cat $INTRODUCER_FILENAME)")
|
||||
fi
|
||||
|
||||
show_tor_bridges
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
for app_name in ${APPS_INSTALLED_NAMES[@]}
|
||||
do
|
||||
if ! grep -q "SHOW_ON_ABOUT=1" "/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# handle the foibles of capitalisation
|
||||
if ! grep -q "${app_name} domain" "$COMPLETION_FILE"; then
|
||||
app_name_upper=$(echo "${app_name}" | awk '{print toupper($0)}')
|
||||
if grep -q "${app_name_upper} domain" "$COMPLETION_FILE"; then
|
||||
app_name=${app_name_upper}
|
||||
else
|
||||
app_name_first_upper="$(tr '[:lower:]' '[:upper:]' <<< "${app_name:0:1}")${app_name:1}"
|
||||
if grep -q "${app_name_first_upper} domain" "$COMPLETION_FILE"; then
|
||||
app_name=${app_name_first_upper}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ${#app_name} -gt 0 ]; then
|
||||
icann_address=$(get_app_icann_address "$app_name")
|
||||
if grep -q "SHOW_ICANN_ADDRESS_ON_ABOUT=0" "/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}"; then
|
||||
icann_address='-'
|
||||
fi
|
||||
if [[ "$ONION_ONLY" != 'no' ]]; then
|
||||
if [[ "${icann_address}" != "${LOCAL_NAME}.local" ]]; then
|
||||
icann_address='-'
|
||||
fi
|
||||
fi
|
||||
onion_address=$(get_app_onion_address "$app_name")
|
||||
if [ ${#onion_address} -eq 0 ]; then
|
||||
onion_address="-"
|
||||
fi
|
||||
|
||||
W+=("${app_name}" "${icann_address} / ${onion_address}")
|
||||
|
||||
if grep -q "mobile${app_name} onion domain" "$COMPLETION_FILE"; then
|
||||
onion_address=$(get_app_onion_address "${app_name}" "mobile")
|
||||
W+=("${app_name} (mobile)" "${icann_address} / ${onion_address}")
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if grep -q "rss reader domain" "$COMPLETION_FILE"; then
|
||||
if [ -d /var/lib/tor/hidden_service_ttrss ]; then
|
||||
domain_onion=$(cat /var/lib/tor/hidden_service_ttrss/hostname)
|
||||
W+=("RSS Reader" "${domain_onion}")
|
||||
fi
|
||||
if [ -d /var/lib/tor/hidden_service_mobilerss ]; then
|
||||
domain_onion=$(cat /var/lib/tor/hidden_service_mobilerss/hostname)
|
||||
W+=("RSS mobile" "${domain_onion}")
|
||||
fi
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
dialog --backtitle $"Freedombone Control Panel" --title $"Domains" --menu $"You can use shift+cursors to select text" 28 78 28 ${W[@]} 3>&2 2>&1 1>&3
|
||||
}
|
||||
|
||||
function show_domains_old {
|
||||
read_config_param "DEFAULT_DOMAIN_NAME"
|
||||
|
||||
echo 'Domains'
|
||||
echo '======='
|
||||
echo ''
|
||||
|
@ -345,34 +450,6 @@ function show_ip_addresses {
|
|||
echo ''
|
||||
}
|
||||
|
||||
function show_tor_bridges {
|
||||
bridges_list=$(grep "Bridge " /etc/tor/torrc | grep -v '##')
|
||||
if [ ${#bridges_list} -gt 0 ]; then
|
||||
echo $'Tor Bridges'
|
||||
echo '==========='
|
||||
echo ''
|
||||
echo "${bridges_list}"
|
||||
echo ''
|
||||
echo ''
|
||||
fi
|
||||
if ! grep -q "#BridgeRelay" /etc/tor/torrc; then
|
||||
if grep -q "BridgeRelay 1" /etc/tor/torrc; then
|
||||
read_config_param 'TOR_BRIDGE_PORT'
|
||||
read_config_param 'TOR_BRIDGE_NICKNAME'
|
||||
if [ ${#TOR_BRIDGE_NICKNAME} -gt 0 ]; then
|
||||
echo "Tor bridge on this system"
|
||||
echo '========================='
|
||||
echo ''
|
||||
echo "IP Address: $(get_ipv4_address)"
|
||||
echo "Port: ${TOR_BRIDGE_PORT}"
|
||||
echo "Nickname: ${TOR_BRIDGE_NICKNAME}"
|
||||
echo ''
|
||||
echo ''
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function show_ssh_public_key {
|
||||
echo $'SSH Public Keys'
|
||||
echo '==============='
|
||||
|
@ -382,33 +459,18 @@ function show_ssh_public_key {
|
|||
echo ''
|
||||
}
|
||||
|
||||
function show_tahoelafs_introducer {
|
||||
INTRODUCER_FILENAME=/home/tahoelafs/data/private/introducer.furl
|
||||
if [ ! -f $INTRODUCER_FILENAME ]; then
|
||||
return
|
||||
fi
|
||||
echo $'Tahoe-LAFS introducer'
|
||||
echo '====================='
|
||||
echo ''
|
||||
cat $INTRODUCER_FILENAME
|
||||
echo ''
|
||||
echo ''
|
||||
}
|
||||
|
||||
function show_about {
|
||||
detect_apps
|
||||
get_apps_installed_names
|
||||
|
||||
clear
|
||||
echo "==== ${PROJECT_NAME} version ${VERSION} ($DEBIAN_VERSION) ===="
|
||||
echo ''
|
||||
show_ip_addresses
|
||||
show_tor_bridges
|
||||
show_ssh_public_key
|
||||
#clear
|
||||
#echo "==== ${PROJECT_NAME} version ${VERSION} ($DEBIAN_VERSION) ===="
|
||||
#echo ''
|
||||
#show_ip_addresses
|
||||
#show_ssh_public_key
|
||||
show_domains
|
||||
show_tahoelafs
|
||||
show_users
|
||||
any_key
|
||||
#show_users
|
||||
#any_key
|
||||
}
|
||||
|
||||
function select_user {
|
||||
|
|
Loading…
Reference in New Issue