Command line web browser

This commit is contained in:
Bob Mottram 2016-03-21 14:48:42 +00:00
parent e406b52cb3
commit 8501c7ae30
2 changed files with 58 additions and 30 deletions

View File

@ -49,6 +49,9 @@ PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
# Contact details
PROJECT_BITMESSAGE="BM-2cWuhmBvVdfrHhLoZTdspCkKeiTorUesSL"
# default search engine for command line browser
DEFAULT_SEARCH='https://searx.laquadrature.net'
# Are we installing on a Beaglebone Black (BBB) or some other system?
INSTALLING_ON_BBB="no"
@ -1063,6 +1066,9 @@ function read_configuration {
if [[ $CONFIGURATION_FILE != "/root/${PROJECT_NAME}.cfg" ]]; then
cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg
fi
if grep -q "DEFAULT_SEARCH" $CONFIGURATION_FILE; then
DEFAULT_SEARCH=$(grep "DEFAULT_SEARCH" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE; then
SEARCH_ENGINE_PASSWORD=$(grep "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
@ -4322,6 +4328,25 @@ function configure_internet_protocol {
echo 'configure_internet_protocol' >> $COMPLETION_FILE
}
function install_command_line_browser {
if grep -Fxq "install_command_line_browser" $COMPLETION_FILE; then
return
fi
apt-get -y install elinks
# set the home page
if ! grep -q "WWW_HOME" /home/$MY_USERNAME/.bashrc; then
if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
echo "export WWW_HOME=$DEFAULT_SEARCH" >> /home/$MY_USERNAME/.bashrc
else
sed -i "/control/i export WWW_HOME=$DEFAULT_SEARCH" /home/$MY_USERNAME/.bashrc
fi
fi
echo 'install_command_line_browser' >> $COMPLETION_FILE
}
function configure_email {
if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
return
@ -10340,6 +10365,7 @@ configure_dns
initial_setup
install_tor
resolve_dns_via_tor
install_command_line_browser
enable_ssh_via_onion
check_date
install_dynamicdns

View File

@ -130,11 +130,11 @@ function add_to_mailing_list {
dialog --backtitle $"Freedombone User Control Panel" \
--title $"Subscribe to a mailing list" \
--form $"You can either enter a subject or an email address\n" 11 68 4 \
$"List folder name:" 1 1 "" 1 35 26 25 \
$"Name between [] on subject line:" 2 1 "" 2 35 26 25 \
$"List email address:" 3 1 "" 3 35 26 25 \
$"Public:" 4 1 $"yes" 4 35 4 25 \
2> $data
$"List folder name:" 1 1 "" 1 35 26 25 \
$"Name between [] on subject line:" 2 1 "" 2 35 26 25 \
$"List email address:" 3 1 "" 3 35 26 25 \
$"Public:" 4 1 $"yes" 4 35 4 25 \
2> $data
sel=$?
case $sel in
1) return;;
@ -189,10 +189,10 @@ function email_rule_address {
dialog --backtitle $"Freedombone User Control Panel" \
--title $"Create an email rule" \
--form "\n" 9 65 4 \
$"When email arrives from address:" 1 1 "" 1 35 24 28 \
$"Move to folder:" 2 1 "" 2 35 24 28 \
$"Public:" 3 1 $"no" 3 35 4 25 \
2> $data
$"When email arrives from address:" 1 1 "" 1 35 24 28 \
$"Move to folder:" 2 1 "" 2 35 24 28 \
$"Public:" 3 1 $"no" 3 35 4 25 \
2> $data
sel=$?
case $sel in
1) return;;
@ -227,7 +227,7 @@ function email_rule_address {
fi
${PROJECT_NAME}-addemail -u $USER -e "$RULE_EMAIL" \
-g "$RULE_FOLDER" --public $RULE_PUBLIC
-g "$RULE_FOLDER" --public $RULE_PUBLIC
dialog --title $"Create an email rule" \
--msgbox $"Email rule for $RULE_EMAIL was added" 6 40
}
@ -238,10 +238,10 @@ function email_rule_subject {
dialog --backtitle $"Freedombone User Control Panel" \
--title $"Create an email rule" \
--form "\n" 9 75 4 \
$"When email arrives with subject containing:" 1 1 "" 1 45 24 28 \
$"Move to folder:" 2 1 "" 2 45 24 28 \
$"Public:" 3 1 $"no" 3 45 4 25 \
2> $data
$"When email arrives with subject containing:" 1 1 "" 1 45 24 28 \
$"Move to folder:" 2 1 "" 2 45 24 28 \
$"Public:" 3 1 $"no" 3 45 4 25 \
2> $data
sel=$?
case $sel in
1) return;;
@ -271,7 +271,7 @@ function email_rule_subject {
fi
${PROJECT_NAME}-addemail -u $USER -s "$RULE_SUBJECT" \
-g "$RULE_FOLDER" --public $RULE_PUBLIC
-g "$RULE_FOLDER" --public $RULE_PUBLIC
dialog --title $"Create an email rule" \
--msgbox $"Email rule for subject '$RULE_SUBJECT' was added" 6 40
}
@ -283,9 +283,9 @@ function block_unblock_email {
dialog --backtitle $"Freedombone User Control Panel" \
--title "$blockstr" \
--form "\n" 8 65 3 \
$"When email arrives from address:" 1 1 "" 1 35 24 100 \
$"Block it:" 2 1 "yes" 2 35 4 4 \
2> $data
$"When email arrives from address:" 1 1 "" 1 35 24 100 \
$"Block it:" 2 1 "yes" 2 35 4 4 \
2> $data
sel=$?
case $sel in
1) return;;
@ -321,9 +321,9 @@ function block_unblock_subject {
dialog --backtitle $"Freedombone User Control Panel" \
--title "$blockstr" \
--form "\n" 8 70 3 \
$"When email arrives with subject text:" 1 1 "" 1 40 24 28 \
$"Block it:" 2 1 "yes" 2 40 4 4 \
2> $data
$"When email arrives with subject text:" 1 1 "" 1 40 24 28 \
$"Block it:" 2 1 "yes" 2 40 4 4 \
2> $data
sel=$?
case $sel in
1) return;;
@ -559,16 +559,17 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone User Control Panel" \
--title $"User Control Panel" \
--radiolist $"Choose an operation:" 16 50 9 \
--radiolist $"Choose an operation:" 17 50 10 \
1 $"Use Email" off \
2 $"Change Email Filtering Rules" off \
3 $"Use Tox Chat" off \
4 $"Use XMPP Chat" off \
5 $"Use IRC" off \
6 $"Your Encryption Keys" off \
7 $"Administrator controls" off \
8 $"Exit to the command line" off \
9 $"Log out" on 2> $data
6 $"Browse the Web" off \
7 $"Your Encryption Keys" off \
8 $"Administrator controls" off \
9 $"Exit to the command line" off \
10 $"Log out" on 2> $data
sel=$?
case $sel in
1) exit 1;;
@ -580,10 +581,11 @@ function menu_top_level {
3) toxic --force-tcp --SOCKS5-proxy 127.0.0.1 9050;;
4) torify profanity;;
5) torify irssi;;
6) menu_encryption_keys;;
7) menu_admin;;
8) break;;
9) kill -HUP `pgrep -s 0 -o`;;
6) torify elinks;;
7) menu_encryption_keys;;
8) menu_admin;;
9) break;;
10) kill -HUP `pgrep -s 0 -o`;;
esac
done
}