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
 # Contact details
49
 # Contact details
50
 PROJECT_BITMESSAGE="BM-2cWuhmBvVdfrHhLoZTdspCkKeiTorUesSL"
50
 PROJECT_BITMESSAGE="BM-2cWuhmBvVdfrHhLoZTdspCkKeiTorUesSL"
51
 
51
 
52
+# default search engine for command line browser
53
+DEFAULT_SEARCH='https://searx.laquadrature.net'
54
+
52
 # Are we installing on a Beaglebone Black (BBB) or some other system?
55
 # Are we installing on a Beaglebone Black (BBB) or some other system?
53
 INSTALLING_ON_BBB="no"
56
 INSTALLING_ON_BBB="no"
54
 
57
 
1063
         if [[ $CONFIGURATION_FILE != "/root/${PROJECT_NAME}.cfg" ]]; then
1066
         if [[ $CONFIGURATION_FILE != "/root/${PROJECT_NAME}.cfg" ]]; then
1064
             cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg
1067
             cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg
1065
         fi
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
         if grep -q "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE; then
1072
         if grep -q "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE; then
1067
             SEARCH_ENGINE_PASSWORD=$(grep "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
1073
             SEARCH_ENGINE_PASSWORD=$(grep "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
1068
         fi
1074
         fi
4322
     echo 'configure_internet_protocol' >> $COMPLETION_FILE
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
 function configure_email {
4350
 function configure_email {
4326
     if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
4351
     if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
4327
         return
4352
         return
10340
 initial_setup
10365
 initial_setup
10341
 install_tor
10366
 install_tor
10342
 resolve_dns_via_tor
10367
 resolve_dns_via_tor
10368
+install_command_line_browser
10343
 enable_ssh_via_onion
10369
 enable_ssh_via_onion
10344
 check_date
10370
 check_date
10345
 install_dynamicdns
10371
 install_dynamicdns

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

130
     dialog --backtitle $"Freedombone User Control Panel" \
130
     dialog --backtitle $"Freedombone User Control Panel" \
131
            --title $"Subscribe to a mailing list" \
131
            --title $"Subscribe to a mailing list" \
132
            --form $"You can either enter a subject or an email address\n" 11 68 4 \
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
     sel=$?
138
     sel=$?
139
     case $sel in
139
     case $sel in
140
         1) return;;
140
         1) return;;
189
     dialog --backtitle $"Freedombone User Control Panel" \
189
     dialog --backtitle $"Freedombone User Control Panel" \
190
            --title $"Create an email rule" \
190
            --title $"Create an email rule" \
191
            --form "\n" 9 65 4 \
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
     sel=$?
196
     sel=$?
197
     case $sel in
197
     case $sel in
198
         1) return;;
198
         1) return;;
227
     fi
227
     fi
228
 
228
 
229
     ${PROJECT_NAME}-addemail -u $USER -e "$RULE_EMAIL" \
229
     ${PROJECT_NAME}-addemail -u $USER -e "$RULE_EMAIL" \
230
-                         -g "$RULE_FOLDER" --public $RULE_PUBLIC
230
+                   -g "$RULE_FOLDER" --public $RULE_PUBLIC
231
     dialog --title $"Create an email rule" \
231
     dialog --title $"Create an email rule" \
232
            --msgbox $"Email rule for $RULE_EMAIL was added" 6 40
232
            --msgbox $"Email rule for $RULE_EMAIL was added" 6 40
233
 }
233
 }
238
     dialog --backtitle $"Freedombone User Control Panel" \
238
     dialog --backtitle $"Freedombone User Control Panel" \
239
            --title $"Create an email rule" \
239
            --title $"Create an email rule" \
240
            --form "\n" 9 75 4 \
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
     sel=$?
245
     sel=$?
246
     case $sel in
246
     case $sel in
247
         1) return;;
247
         1) return;;
271
     fi
271
     fi
272
 
272
 
273
     ${PROJECT_NAME}-addemail -u $USER -s "$RULE_SUBJECT" \
273
     ${PROJECT_NAME}-addemail -u $USER -s "$RULE_SUBJECT" \
274
-                         -g "$RULE_FOLDER" --public $RULE_PUBLIC
274
+                   -g "$RULE_FOLDER" --public $RULE_PUBLIC
275
     dialog --title $"Create an email rule" \
275
     dialog --title $"Create an email rule" \
276
            --msgbox $"Email rule for subject '$RULE_SUBJECT' was added" 6 40
276
            --msgbox $"Email rule for subject '$RULE_SUBJECT' was added" 6 40
277
 }
277
 }
283
     dialog --backtitle $"Freedombone User Control Panel" \
283
     dialog --backtitle $"Freedombone User Control Panel" \
284
            --title "$blockstr" \
284
            --title "$blockstr" \
285
            --form "\n" 8 65 3 \
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
     sel=$?
289
     sel=$?
290
     case $sel in
290
     case $sel in
291
         1) return;;
291
         1) return;;
321
     dialog --backtitle $"Freedombone User Control Panel" \
321
     dialog --backtitle $"Freedombone User Control Panel" \
322
            --title "$blockstr" \
322
            --title "$blockstr" \
323
            --form "\n" 8 70 3 \
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
     sel=$?
327
     sel=$?
328
     case $sel in
328
     case $sel in
329
         1) return;;
329
         1) return;;
559
         trap "rm -f $data" 0 1 2 5 15
559
         trap "rm -f $data" 0 1 2 5 15
560
         dialog --backtitle $"Freedombone User Control Panel" \
560
         dialog --backtitle $"Freedombone User Control Panel" \
561
                --title $"User Control Panel" \
561
                --title $"User Control Panel" \
562
-               --radiolist $"Choose an operation:" 16 50 9 \
562
+               --radiolist $"Choose an operation:" 17 50 10 \
563
                1 $"Use Email" off \
563
                1 $"Use Email" off \
564
                2 $"Change Email Filtering Rules" off \
564
                2 $"Change Email Filtering Rules" off \
565
                3 $"Use Tox Chat" off \
565
                3 $"Use Tox Chat" off \
566
                4 $"Use XMPP Chat" off \
566
                4 $"Use XMPP Chat" off \
567
                5 $"Use IRC" off \
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
         sel=$?
573
         sel=$?
573
         case $sel in
574
         case $sel in
574
             1) exit 1;;
575
             1) exit 1;;
580
             3) toxic --force-tcp --SOCKS5-proxy 127.0.0.1 9050;;
581
             3) toxic --force-tcp --SOCKS5-proxy 127.0.0.1 9050;;
581
             4) torify profanity;;
582
             4) torify profanity;;
582
             5) torify irssi;;
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
         esac
589
         esac
588
     done
590
     done
589
 }
591
 }