Quellcode durchsuchen

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

Bob Mottram vor 7 Jahren
Ursprung
Commit
fc62fe6bfd
4 geänderte Dateien mit 46 neuen und 24 gelöschten Zeilen
  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 Datei anzeigen

@@ -39,7 +39,7 @@ Once it has installed go to *About* on the *Administrator control panel* and loo
39 39
 
40 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 44
 * Enabling password login
45 45
 

+ 3
- 0
src/freedombone-app-searx Datei anzeigen

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

+ 28
- 9
src/freedombone-utils-web Datei anzeigen

@@ -534,20 +534,39 @@ function install_dynamicdns {
534 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 564
 function install_command_line_browser {
538 565
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
539 566
         return
540 567
     fi
541 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 571
     mark_completed $FUNCNAME
553 572
 }

+ 14
- 14
website/EN/app_searx.html Datei anzeigen

@@ -3,7 +3,7 @@
3 3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5 5
 <head>
6
-<!-- 2017-09-23 Sat 11:02 -->
6
+<!-- 2017-09-23 Sat 11:08 -->
7 7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8 8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
9 9
 <title>&lrm;</title>
@@ -265,9 +265,9 @@ In terms of security both the connection between you and the server, and the out
265 265
 </div>
266 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 271
 <p>
272 272
 ssh into the system with:
273 273
 </p>
@@ -287,18 +287,18 @@ Once it has installed go to <b>About</b> on the <b>Administrator control panel</
287 287
 </div>
288 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 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 295
 </p>
296 296
 </div>
297 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 302
 <p>
303 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 304
 </p>
@@ -309,9 +309,9 @@ To enable password login go to the <b>Administrator control panel</b> then <b>Ap
309 309
 </div>
310 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 315
 <p>
316 316
 It's also possible to customise the background image if you go to <b>App settings</b> then select <b>searx</b>.
317 317
 </p>