mirror of
				https://github.com/searxng/searxng.git
				synced 2025-11-04 03:27:06 -05:00 
			
		
		
		
	utils/searx.sh & filtron.sh: misc changes from first tests (WIP)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
		
							parent
							
								
									924bf65517
								
							
						
					
					
						commit
						6274a54746
					
				@ -11,6 +11,10 @@ source_dot_config
 | 
			
		||||
# config
 | 
			
		||||
# ----------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
FILTRON_URL_PATH="${FILTRON_URL_PATH:-$(echo "${PUBLIC_URL}" \
 | 
			
		||||
| sed -e 's,^.*://[^/]*\(/.*\),\1,g')}"
 | 
			
		||||
[[ "${FILTRON_URL_PATH}" == "${PUBLIC_URL}" ]] && FILTRON_URL_PATH=/
 | 
			
		||||
 | 
			
		||||
FILTRON_ETC="/etc/filtron"
 | 
			
		||||
 | 
			
		||||
FILTRON_RULES="$FILTRON_ETC/rules.json"
 | 
			
		||||
@ -192,7 +196,9 @@ installations that were installed with this script."
 | 
			
		||||
    wait_key
 | 
			
		||||
    remove_user
 | 
			
		||||
    rm -r "$FILTRON_ETC" 2>&1 | prefix_stdout
 | 
			
		||||
    wait_key
 | 
			
		||||
    if service_is_available "${PUBLIC_URL}"; then
 | 
			
		||||
        MSG="** Don't forget to remove your public site! (${PUBLIC_URL}) **" wait_key 10
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
install_service() {
 | 
			
		||||
@ -329,6 +335,7 @@ inspect_service() {
 | 
			
		||||
sourced ${DOT_CONFIG#"$REPO_ROOT/"} :
 | 
			
		||||
 | 
			
		||||
  PUBLIC_URL          : ${PUBLIC_URL}
 | 
			
		||||
  FILTRON_URL_PATH    : ${FILTRON_URL_PATH}
 | 
			
		||||
  FILTRON_API         : ${FILTRON_API}
 | 
			
		||||
  FILTRON_LISTEN      : ${FILTRON_LISTEN}
 | 
			
		||||
  FILTRON_TARGET      : ${FILTRON_TARGET}
 | 
			
		||||
@ -395,6 +402,7 @@ This installs a reverse proxy (ProxyPass) into apache site (${APACHE_FILTRON_SIT
 | 
			
		||||
        return
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    a2enmod headers
 | 
			
		||||
    a2enmod proxy
 | 
			
		||||
    a2enmod proxy_http
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -121,10 +121,11 @@ wait_key(){
 | 
			
		||||
 | 
			
		||||
    clean_stdin
 | 
			
		||||
    local _t=$1
 | 
			
		||||
    local msg="${MSG:-** press any [KEY] to continue **}"
 | 
			
		||||
    [[ ! -z $FORCE_TIMEOUT ]] && _t=$FORCE_TIMEOUT
 | 
			
		||||
    [[ ! -z $_t ]] && _t="-t $_t"
 | 
			
		||||
    # shellcheck disable=SC2086
 | 
			
		||||
    read -r -s -n1 $_t -p "** press any [KEY] to continue **"
 | 
			
		||||
    read -r -s -n1 $_t -p "$msg"
 | 
			
		||||
    echo
 | 
			
		||||
    clean_stdin
 | 
			
		||||
}
 | 
			
		||||
@ -436,6 +437,9 @@ service_is_available() {
 | 
			
		||||
    if [[ $exit_val = 0 ]]; then
 | 
			
		||||
        info_msg "got $http_code from ${URL}"
 | 
			
		||||
    fi
 | 
			
		||||
    case "$http_code" in
 | 
			
		||||
        404|410|423) exit_val=$http_code;;
 | 
			
		||||
    esac
 | 
			
		||||
    return $exit_val
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -275,6 +275,9 @@ installations that were installed with this script."
 | 
			
		||||
    remove_searx_uwsgi
 | 
			
		||||
    wait_key
 | 
			
		||||
    remove_user
 | 
			
		||||
    if service_is_available "${PUBLIC_URL}"; then
 | 
			
		||||
        MSG="** Don't forgett to remove your public site! (${PUBLIC_URL}) **" wait_key 10
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
user_is_available() {
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,15 @@
 | 
			
		||||
# -*- coding: utf-8; mode: apache -*-
 | 
			
		||||
 | 
			
		||||
ProxyPass "/searx" "http://127.0.0.1:4004/"
 | 
			
		||||
<Location ${FILTRON_URL_PATH} >
 | 
			
		||||
 | 
			
		||||
    Require all granted
 | 
			
		||||
    Allow from all
 | 
			
		||||
 | 
			
		||||
    Order deny,allow
 | 
			
		||||
    Deny from all
 | 
			
		||||
    #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
 | 
			
		||||
 | 
			
		||||
    ProxyPass "http://127.0.0.1:4004"
 | 
			
		||||
    RequestHeader set "X-Script-Name" "${FILTRON_URL_PATH}"
 | 
			
		||||
 | 
			
		||||
</Location>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user