Browse Source

Command line web browser

Bob Mottram 9 years ago
parent
commit
8501c7ae30
2 changed files with 58 additions and 30 deletions
  1. 26
    0
      src/freedombone
  2. 32
    30
      src/freedombone-controlpanel-user

+ 26
- 0
src/freedombone View File

@@ -49,6 +49,9 @@ PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
49 49
 # Contact details
50 50
 PROJECT_BITMESSAGE="BM-2cWuhmBvVdfrHhLoZTdspCkKeiTorUesSL"
51 51
 
52
+# default search engine for command line browser
53
+DEFAULT_SEARCH='https://searx.laquadrature.net'
54
+
52 55
 # Are we installing on a Beaglebone Black (BBB) or some other system?
53 56
 INSTALLING_ON_BBB="no"
54 57
 
@@ -1063,6 +1066,9 @@ function read_configuration {
1063 1066
         if [[ $CONFIGURATION_FILE != "/root/${PROJECT_NAME}.cfg" ]]; then
1064 1067
             cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg
1065 1068
         fi
1069
+        if grep -q "DEFAULT_SEARCH" $CONFIGURATION_FILE; then
1070
+            DEFAULT_SEARCH=$(grep "DEFAULT_SEARCH" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
1071
+        fi
1066 1072
         if grep -q "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE; then
1067 1073
             SEARCH_ENGINE_PASSWORD=$(grep "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
1068 1074
         fi
@@ -4322,6 +4328,25 @@ function configure_internet_protocol {
4322 4328
     echo 'configure_internet_protocol' >> $COMPLETION_FILE
4323 4329
 }
4324 4330
 
4331
+function install_command_line_browser {
4332
+    if grep -Fxq "install_command_line_browser" $COMPLETION_FILE; then
4333
+        return
4334
+    fi
4335
+    apt-get -y install elinks
4336
+
4337
+    # set the home page
4338
+    if ! grep -q "WWW_HOME" /home/$MY_USERNAME/.bashrc; then
4339
+        if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
4340
+            echo "export WWW_HOME=$DEFAULT_SEARCH" >> /home/$MY_USERNAME/.bashrc
4341
+        else
4342
+            sed -i "/control/i export WWW_HOME=$DEFAULT_SEARCH" /home/$MY_USERNAME/.bashrc
4343
+        fi
4344
+    fi
4345
+
4346
+    echo 'install_command_line_browser' >> $COMPLETION_FILE
4347
+}
4348
+
4349
+
4325 4350
 function configure_email {
4326 4351
     if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
4327 4352
         return
@@ -10340,6 +10365,7 @@ configure_dns
10340 10365
 initial_setup
10341 10366
 install_tor
10342 10367
 resolve_dns_via_tor
10368
+install_command_line_browser
10343 10369
 enable_ssh_via_onion
10344 10370
 check_date
10345 10371
 install_dynamicdns

+ 32
- 30
src/freedombone-controlpanel-user View File

@@ -130,11 +130,11 @@ function add_to_mailing_list {
130 130
     dialog --backtitle $"Freedombone User Control Panel" \
131 131
            --title $"Subscribe to a mailing list" \
132 132
            --form $"You can either enter a subject or an email address\n" 11 68 4 \
133
-              $"List folder name:" 1 1 "" 1 35 26 25 \
134
-              $"Name between [] on subject line:" 2 1 "" 2 35 26 25 \
135
-              $"List email address:" 3 1 "" 3 35 26 25 \
136
-              $"Public:" 4 1 $"yes" 4 35 4 25 \
137
-              2> $data
133
+           $"List folder name:" 1 1 "" 1 35 26 25 \
134
+           $"Name between [] on subject line:" 2 1 "" 2 35 26 25 \
135
+           $"List email address:" 3 1 "" 3 35 26 25 \
136
+           $"Public:" 4 1 $"yes" 4 35 4 25 \
137
+           2> $data
138 138
     sel=$?
139 139
     case $sel in
140 140
         1) return;;
@@ -189,10 +189,10 @@ function email_rule_address {
189 189
     dialog --backtitle $"Freedombone User Control Panel" \
190 190
            --title $"Create an email rule" \
191 191
            --form "\n" 9 65 4 \
192
-              $"When email arrives from address:" 1 1 "" 1 35 24 28 \
193
-              $"Move to folder:" 2 1 "" 2 35 24 28 \
194
-              $"Public:" 3 1 $"no" 3 35 4 25 \
195
-              2> $data
192
+           $"When email arrives from address:" 1 1 "" 1 35 24 28 \
193
+           $"Move to folder:" 2 1 "" 2 35 24 28 \
194
+           $"Public:" 3 1 $"no" 3 35 4 25 \
195
+           2> $data
196 196
     sel=$?
197 197
     case $sel in
198 198
         1) return;;
@@ -227,7 +227,7 @@ function email_rule_address {
227 227
     fi
228 228
 
229 229
     ${PROJECT_NAME}-addemail -u $USER -e "$RULE_EMAIL" \
230
-                         -g "$RULE_FOLDER" --public $RULE_PUBLIC
230
+                   -g "$RULE_FOLDER" --public $RULE_PUBLIC
231 231
     dialog --title $"Create an email rule" \
232 232
            --msgbox $"Email rule for $RULE_EMAIL was added" 6 40
233 233
 }
@@ -238,10 +238,10 @@ function email_rule_subject {
238 238
     dialog --backtitle $"Freedombone User Control Panel" \
239 239
            --title $"Create an email rule" \
240 240
            --form "\n" 9 75 4 \
241
-              $"When email arrives with subject containing:" 1 1 "" 1 45 24 28 \
242
-              $"Move to folder:" 2 1 "" 2 45 24 28 \
243
-              $"Public:" 3 1 $"no" 3 45 4 25 \
244
-              2> $data
241
+           $"When email arrives with subject containing:" 1 1 "" 1 45 24 28 \
242
+           $"Move to folder:" 2 1 "" 2 45 24 28 \
243
+           $"Public:" 3 1 $"no" 3 45 4 25 \
244
+           2> $data
245 245
     sel=$?
246 246
     case $sel in
247 247
         1) return;;
@@ -271,7 +271,7 @@ function email_rule_subject {
271 271
     fi
272 272
 
273 273
     ${PROJECT_NAME}-addemail -u $USER -s "$RULE_SUBJECT" \
274
-                         -g "$RULE_FOLDER" --public $RULE_PUBLIC
274
+                   -g "$RULE_FOLDER" --public $RULE_PUBLIC
275 275
     dialog --title $"Create an email rule" \
276 276
            --msgbox $"Email rule for subject '$RULE_SUBJECT' was added" 6 40
277 277
 }
@@ -283,9 +283,9 @@ function block_unblock_email {
283 283
     dialog --backtitle $"Freedombone User Control Panel" \
284 284
            --title "$blockstr" \
285 285
            --form "\n" 8 65 3 \
286
-              $"When email arrives from address:" 1 1 "" 1 35 24 100 \
287
-              $"Block it:" 2 1 "yes" 2 35 4 4 \
288
-              2> $data
286
+           $"When email arrives from address:" 1 1 "" 1 35 24 100 \
287
+           $"Block it:" 2 1 "yes" 2 35 4 4 \
288
+           2> $data
289 289
     sel=$?
290 290
     case $sel in
291 291
         1) return;;
@@ -321,9 +321,9 @@ function block_unblock_subject {
321 321
     dialog --backtitle $"Freedombone User Control Panel" \
322 322
            --title "$blockstr" \
323 323
            --form "\n" 8 70 3 \
324
-              $"When email arrives with subject text:" 1 1 "" 1 40 24 28 \
325
-              $"Block it:" 2 1 "yes" 2 40 4 4 \
326
-              2> $data
324
+           $"When email arrives with subject text:" 1 1 "" 1 40 24 28 \
325
+           $"Block it:" 2 1 "yes" 2 40 4 4 \
326
+           2> $data
327 327
     sel=$?
328 328
     case $sel in
329 329
         1) return;;
@@ -559,16 +559,17 @@ function menu_top_level {
559 559
         trap "rm -f $data" 0 1 2 5 15
560 560
         dialog --backtitle $"Freedombone User Control Panel" \
561 561
                --title $"User Control Panel" \
562
-               --radiolist $"Choose an operation:" 16 50 9 \
562
+               --radiolist $"Choose an operation:" 17 50 10 \
563 563
                1 $"Use Email" off \
564 564
                2 $"Change Email Filtering Rules" off \
565 565
                3 $"Use Tox Chat" off \
566 566
                4 $"Use XMPP Chat" off \
567 567
                5 $"Use IRC" off \
568
-               6 $"Your Encryption Keys" off \
569
-               7 $"Administrator controls" off \
570
-               8 $"Exit to the command line" off \
571
-               9 $"Log out" on 2> $data
568
+               6 $"Browse the Web" off \
569
+               7 $"Your Encryption Keys" off \
570
+               8 $"Administrator controls" off \
571
+               9 $"Exit to the command line" off \
572
+               10 $"Log out" on 2> $data
572 573
         sel=$?
573 574
         case $sel in
574 575
             1) exit 1;;
@@ -580,10 +581,11 @@ function menu_top_level {
580 581
             3) toxic --force-tcp --SOCKS5-proxy 127.0.0.1 9050;;
581 582
             4) torify profanity;;
582 583
             5) torify irssi;;
583
-            6) menu_encryption_keys;;
584
-            7) menu_admin;;
585
-            8) break;;
586
-            9) kill -HUP `pgrep -s 0 -o`;;
584
+            6) torify elinks;;
585
+            7) menu_encryption_keys;;
586
+            8) menu_admin;;
587
+            9) break;;
588
+            10) kill -HUP `pgrep -s 0 -o`;;
587 589
         esac
588 590
     done
589 591
 }