Bläddra i källkod

Merge branch 'stretch' of https://github.com/bashrc/freedombone

Bob Mottram 7 år sedan
förälder
incheckning
fc62fe6bfd
4 ändrade filer med 46 tillägg och 24 borttagningar
  1. 1
    1
      doc/EN/app_searx.org
  2. 3
    0
      src/freedombone-app-searx
  3. 28
    9
      src/freedombone-utils-web
  4. 14
    14
      website/EN/app_searx.html

+ 1
- 1
doc/EN/app_searx.org Visa fil

39
 
39
 
40
 * Make it your default search
40
 * Make it your default search
41
 
41
 
42
-If you are using a Tor browser or Firefox then click on the magnifying glass icon next to the search box and you can then add your metasearch site. A small icon will appear called "/Freedombone Metasearch/" and you can then right click on it and make it the default search.
42
+In a Tor browser click on the magnifying glass icon next to the search box and you can then add your metasearch site. A small icon will appear called "/Freedombone Metasearch/" and you can then right click on it and make it the default search.
43
 
43
 
44
 * Enabling password login
44
 * Enabling password login
45
 
45
 

+ 3
- 0
src/freedombone-app-searx Visa fil

846
     remove_completion_param install_searx
846
     remove_completion_param install_searx
847
     sed -i '/Search engine /d' $COMPLETION_FILE
847
     sed -i '/Search engine /d' $COMPLETION_FILE
848
     sed -i '/searx /d' $COMPLETION_FILE
848
     sed -i '/searx /d' $COMPLETION_FILE
849
+    update_default_search_engine
849
 }
850
 }
850
 
851
 
851
 function install_searx {
852
 function install_searx {
1011
     systemctl daemon-reload
1012
     systemctl daemon-reload
1012
     systemctl start searx.service
1013
     systemctl start searx.service
1013
 
1014
 
1015
+    update_default_search_engine
1016
+
1014
     SEARX_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
1017
     SEARX_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
1015
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a searx -p "$SEARX_PASSWORD"
1018
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a searx -p "$SEARX_PASSWORD"
1016
     if grep -q "$MY_USERNAME:" /etc/nginx/.htpasswd; then
1019
     if grep -q "$MY_USERNAME:" /etc/nginx/.htpasswd; then

+ 28
- 9
src/freedombone-utils-web Visa fil

534
     mark_completed $FUNCNAME
534
     mark_completed $FUNCNAME
535
 }
535
 }
536
 
536
 
537
+function update_default_search_engine {
538
+    if [ -f /var/lib/tor/hidden_service_searx/hostname ]; then
539
+        DEFAULT_SEARCH="http://$(cat /var/lib/tor/hidden_service_searx/hostname)"
540
+    fi
541
+
542
+    for d in /home/*/ ; do
543
+        USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
544
+        if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
545
+            if ! grep -q "WWW_HOME" /home/$USERNAME/.bashrc; then
546
+                if ! grep -q 'controluser' /home/$USERNAME/.bashrc; then
547
+                    if ! grep -q 'export WWW_HOME=' /home/$USERNAME/.bashrc; then
548
+                        echo "export WWW_HOME=$DEFAULT_SEARCH" >> /home/$USERNAME/.bashrc
549
+                    else
550
+                        sed -i "s|export WWW_HOME=.*|export WWW_HOME=$DEFAULT_SEARCH|g" /home/$USERNAME/.bashrc
551
+                    fi
552
+                else
553
+                    if ! grep -q 'export WWW_HOME=' /home/$USERNAME/.bashrc; then
554
+                        sed -i "/controluser/i export WWW_HOME=$DEFAULT_SEARCH" /home/$USERNAME/.bashrc
555
+                    else
556
+                        sed -i "s|export WWW_HOME=.*|export WWW_HOME=$DEFAULT_SEARCH|g" /home/$USERNAME/.bashrc
557
+                    fi
558
+                fi
559
+            fi
560
+        fi
561
+    done
562
+}
563
+
537
 function install_command_line_browser {
564
 function install_command_line_browser {
538
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
565
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
539
         return
566
         return
540
     fi
567
     fi
541
     apt-get -yq install elinks
568
     apt-get -yq install elinks
542
-
543
-    # set the home page
544
-    if ! grep -q "WWW_HOME" /home/$MY_USERNAME/.bashrc; then
545
-        if ! grep -q 'controluser' /home/$MY_USERNAME/.bashrc; then
546
-            echo "export WWW_HOME=$DEFAULT_SEARCH" >> /home/$MY_USERNAME/.bashrc
547
-        else
548
-            sed -i "/controluser/i export WWW_HOME=$DEFAULT_SEARCH" /home/$MY_USERNAME/.bashrc
549
-        fi
550
-    fi
569
+    update_default_search_engine
551
 
570
 
552
     mark_completed $FUNCNAME
571
     mark_completed $FUNCNAME
553
 }
572
 }

+ 14
- 14
website/EN/app_searx.html Visa fil

3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5
 <head>
5
 <head>
6
-<!-- 2017-09-23 Sat 11:02 -->
6
+<!-- 2017-09-23 Sat 11:08 -->
7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
9
 <title>&lrm;</title>
9
 <title>&lrm;</title>
265
 </div>
265
 </div>
266
 </div>
266
 </div>
267
 
267
 
268
-<div id="outline-container-org404708e" class="outline-2">
269
-<h2 id="org404708e">Installation</h2>
270
-<div class="outline-text-2" id="text-org404708e">
268
+<div id="outline-container-org82f976b" class="outline-2">
269
+<h2 id="org82f976b">Installation</h2>
270
+<div class="outline-text-2" id="text-org82f976b">
271
 <p>
271
 <p>
272
 ssh into the system with:
272
 ssh into the system with:
273
 </p>
273
 </p>
287
 </div>
287
 </div>
288
 </div>
288
 </div>
289
 
289
 
290
-<div id="outline-container-org312dbda" class="outline-2">
291
-<h2 id="org312dbda">Make it your default search</h2>
292
-<div class="outline-text-2" id="text-org312dbda">
290
+<div id="outline-container-orgb6a91b8" class="outline-2">
291
+<h2 id="orgb6a91b8">Make it your default search</h2>
292
+<div class="outline-text-2" id="text-orgb6a91b8">
293
 <p>
293
 <p>
294
-If you are using a Tor browser or Firefox then click on the magnifying glass icon next to the search box and you can then add your metasearch site. A small icon will appear called "<i>Freedombone Metasearch</i>" and you can then right click on it and make it the default search.
294
+In a Tor browser click on the magnifying glass icon next to the search box and you can then add your metasearch site. A small icon will appear called "<i>Freedombone Metasearch</i>" and you can then right click on it and make it the default search.
295
 </p>
295
 </p>
296
 </div>
296
 </div>
297
 </div>
297
 </div>
298
 
298
 
299
-<div id="outline-container-org6b74e84" class="outline-2">
300
-<h2 id="org6b74e84">Enabling password login</h2>
301
-<div class="outline-text-2" id="text-org6b74e84">
299
+<div id="outline-container-org5b87faf" class="outline-2">
300
+<h2 id="org5b87faf">Enabling password login</h2>
301
+<div class="outline-text-2" id="text-org5b87faf">
302
 <p>
302
 <p>
303
 It's possible that you might not want just anyone on the interwebs to be able to use your metasearch engine. Even with the onion routing this might carry some legal risk or make you a target for denial-of-service attempts (although Tor's rate limits and the firewall will give you some defense against that).
303
 It's possible that you might not want just anyone on the interwebs to be able to use your metasearch engine. Even with the onion routing this might carry some legal risk or make you a target for denial-of-service attempts (although Tor's rate limits and the firewall will give you some defense against that).
304
 </p>
304
 </p>
309
 </div>
309
 </div>
310
 </div>
310
 </div>
311
 
311
 
312
-<div id="outline-container-orgae556b2" class="outline-2">
313
-<h2 id="orgae556b2">Customization</h2>
314
-<div class="outline-text-2" id="text-orgae556b2">
312
+<div id="outline-container-org6692381" class="outline-2">
313
+<h2 id="org6692381">Customization</h2>
314
+<div class="outline-text-2" id="text-org6692381">
315
 <p>
315
 <p>
316
 It's also possible to customise the background image if you go to <b>App settings</b> then select <b>searx</b>.
316
 It's also possible to customise the background image if you go to <b>App settings</b> then select <b>searx</b>.
317
 </p>
317
 </p>