mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Merge remote-tracking branch 'origin/latesto'
This commit is contained in:
commit
d008d78cd6
408 changed files with 96618 additions and 55272 deletions
52
.config.sh
52
.config.sh
|
@ -1,52 +0,0 @@
|
|||
# -*- coding: utf-8; mode: sh -*-
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# shellcheck shell=bash disable=SC2034
|
||||
#
|
||||
# This file should be edited only ones just before the installation of any
|
||||
# service is done. After the installation of the searx service a copy of this
|
||||
# file is placed into the $SEARX_SRC of the instance, e.g.::
|
||||
#
|
||||
# /usr/local/searx/searx-src/.config.sh
|
||||
#
|
||||
# .. hint::
|
||||
#
|
||||
# Before you change a value here, You have to fully uninstall any previous
|
||||
# installation of searx, morty and filtron services!
|
||||
|
||||
# utils/searx.sh
|
||||
# --------------
|
||||
|
||||
# The setup of the SearXNG instance is done in the settings.yml
|
||||
# (SEARXNG_SETTINGS_PATH). Read the remarks in [1] carefully and don't forget to
|
||||
# rebuild instance's environment (make buildenv) if needed. The settings.yml
|
||||
# file of an already installed instance is shown by::
|
||||
#
|
||||
# $ ./utils/searx.sh --help
|
||||
# ---- SearXNG instance setup (already installed)
|
||||
# SEARXNG_SETTINGS_PATH : /etc/searxng/settings.yml
|
||||
# SEARX_SRC : /usr/local/searx/searx-src
|
||||
#
|
||||
# [1] https://docs.searxng.org/admin/engines/settings.html
|
||||
|
||||
# utils/filtron.sh
|
||||
# ----------------
|
||||
|
||||
# FILTRON_API="127.0.0.1:4005"
|
||||
# FILTRON_LISTEN="127.0.0.1:4004"
|
||||
|
||||
# utils/morty.sh
|
||||
# --------------
|
||||
|
||||
# morty listen address
|
||||
# MORTY_LISTEN="127.0.0.1:3000"
|
||||
# PUBLIC_URL_PATH_MORTY="/morty/"
|
||||
|
||||
# system services
|
||||
# ---------------
|
||||
|
||||
# Common $HOME folder of the service accounts
|
||||
# SERVICE_HOME_BASE="/usr/local"
|
||||
|
||||
# **experimental**: Set SERVICE_USER to run all services by one account, but be
|
||||
# aware that removing discrete components might conflict!
|
||||
# SERVICE_USER=searx
|
|
@ -3,18 +3,23 @@
|
|||
;; Per-Directory Local Variables:
|
||||
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html
|
||||
;;
|
||||
;; .. hint::
|
||||
;; For full fledge developer tools install emacs packages:
|
||||
;;
|
||||
;; If you get ``*** EPC Error ***`` (even after a jedi:install-server) in
|
||||
;; your emacs session, mostly you have jedi-mode enabled but the python
|
||||
;; enviroment is missed. The python environment has to be next to the
|
||||
;; ``<repo>/.dir-locals.el`` in::
|
||||
;; M-x package-install ...
|
||||
;;
|
||||
;; ./local/py3
|
||||
;; magit gitconfig
|
||||
;; nvm lsp-mode lsp-pyright lsp-eslint
|
||||
;; pyvenv pylint pip-requirements
|
||||
;; jinja2-mode
|
||||
;; json-mode
|
||||
;; company company-jedi company-quickhelp company-shell
|
||||
;; realgud
|
||||
;; sphinx-doc markdown-mode graphviz-dot-mode
|
||||
;; apache-mode nginx-mode
|
||||
;;
|
||||
;; To setup such an environment, build target::
|
||||
;; To setup a developer environment, build target::
|
||||
;;
|
||||
;; $ make pyenv.install
|
||||
;; $ make node.env.dev pyenv.install
|
||||
;;
|
||||
;; Some buffer locals are referencing the project environment:
|
||||
;;
|
||||
|
@ -29,26 +34,11 @@
|
|||
;; (setq python-shell-virtualenv-root "/path/to/env/")
|
||||
;; - python-shell-interpreter --> <repo>/local/py3/bin/python
|
||||
;;
|
||||
;; Python development:
|
||||
;;
|
||||
;; Jedi, flycheck & other python stuff should use the 'python-shell-interpreter'
|
||||
;; from the local py3 environment.
|
||||
;;
|
||||
;; For pyright support you need to install::
|
||||
;;
|
||||
;; M-x package-install lsp-pyright
|
||||
;;
|
||||
;; Other useful jedi stuff you might add to your ~/.emacs::
|
||||
;;
|
||||
;; (global-set-key [f6] 'flycheck-mode)
|
||||
;; (add-hook 'python-mode-hook 'my:python-mode-hook)
|
||||
;;
|
||||
;; (defun my:python-mode-hook ()
|
||||
;; (add-to-list 'company-backends 'company-jedi)
|
||||
;; (require 'jedi-core)
|
||||
;; (jedi:setup)
|
||||
;; (define-key python-mode-map (kbd "C-c C-d") 'jedi:show-doc)
|
||||
;; (define-key python-mode-map (kbd "M-.") 'jedi:goto-definition)
|
||||
;; (define-key python-mode-map (kbd "M-,") 'jedi:goto-definition-pop-marker)
|
||||
;; )
|
||||
|
||||
((nil
|
||||
. ((fill-column . 80)
|
||||
|
@ -64,10 +54,16 @@
|
|||
(setq-local python-environment-directory
|
||||
(expand-file-name "./local" prj-root))
|
||||
|
||||
;; to get in use of NVM enviroment, install https://github.com/rejeep/nvm.el
|
||||
;; to get in use of NVM environment, install https://github.com/rejeep/nvm.el
|
||||
(setq-local nvm-dir (expand-file-name "./.nvm" prj-root))
|
||||
|
||||
;; use 'py3' enviroment as default
|
||||
;; use nodejs from the (local) NVM environment (see nvm-dir)
|
||||
(nvm-use-for-buffer)
|
||||
(ignore-errors (require 'lsp))
|
||||
(setq-local lsp-server-install-dir (car (cdr nvm-current-version)))
|
||||
(setq-local lsp-enable-file-watchers nil)
|
||||
|
||||
;; use 'py3' environment as default
|
||||
(setq-local python-environment-default-root-name
|
||||
"py3")
|
||||
|
||||
|
@ -100,22 +96,22 @@
|
|||
|
||||
(js-mode
|
||||
. ((eval . (progn
|
||||
;; use nodejs from the (local) NVM environment (see nvm-dir)
|
||||
(nvm-use-for-buffer)
|
||||
(ignore-errors (require 'lsp-eslint))
|
||||
(setq-local js-indent-level 2)
|
||||
;; flycheck should use the eslint checker from developer tools
|
||||
(setq-local flycheck-javascript-eslint-executable
|
||||
(expand-file-name "node_modules/.bin/eslint" prj-root))
|
||||
;; (flycheck-mode)
|
||||
|
||||
(flycheck-mode)
|
||||
(if (featurep 'lsp-eslint)
|
||||
(lsp))
|
||||
))))
|
||||
|
||||
(python-mode
|
||||
. ((eval . (progn
|
||||
;; use nodejs from the (local) NVM environment (see nvm-dir)
|
||||
(nvm-use-for-buffer)
|
||||
(if (featurep 'lsp-pyright)
|
||||
(lsp))
|
||||
(ignore-errors (require 'jedi-core))
|
||||
(ignore-errors (require 'lsp-pyright))
|
||||
(ignore-errors (sphinx-doc-mode))
|
||||
(setq-local python-environment-virtualenv
|
||||
(list (expand-file-name "bin/virtualenv" python-shell-virtualenv-root)
|
||||
;;"--system-site-packages"
|
||||
|
@ -124,6 +120,9 @@
|
|||
(setq-local pylint-command
|
||||
(expand-file-name "bin/pylint" python-shell-virtualenv-root))
|
||||
|
||||
(if (featurep 'lsp-pyright)
|
||||
(lsp))
|
||||
|
||||
;; pylint will find the '.pylintrc' file next to the CWD
|
||||
;; https://pylint.readthedocs.io/en/latest/user_guide/run.html#command-line-options
|
||||
(setq-local flycheck-pylintrc
|
||||
|
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Questions & Answers (Q&A)
|
||||
url: https://github.com/searxng/searxng/discussions/categories/q-a
|
||||
about: Ask questions and find answers
|
8
.github/ISSUE_TEMPLATE/discuss.md
vendored
8
.github/ISSUE_TEMPLATE/discuss.md
vendored
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: Question
|
||||
about: Ask questions or start a discussion
|
||||
title: '[question]'
|
||||
labels: question
|
||||
assignees: ''
|
||||
|
||||
---
|
4
.github/workflows/data-update.yml
vendored
4
.github/workflows/data-update.yml
vendored
|
@ -1,7 +1,7 @@
|
|||
name: "Update searx.data"
|
||||
on:
|
||||
schedule:
|
||||
- cron: "05 06 1 * *"
|
||||
- cron: "59 23 28 * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
@ -26,7 +26,7 @@ jobs:
|
|||
|
||||
- name: Install Ubuntu packages
|
||||
run: |
|
||||
sudo ./utils/searx.sh install packages
|
||||
sudo ./utils/searxng.sh install packages
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
|
|
68
.github/workflows/integration.yml
vendored
68
.github/workflows/integration.yml
vendored
|
@ -6,6 +6,9 @@ on:
|
|||
pull_request:
|
||||
branches: ["master"]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
python:
|
||||
name: Python ${{ matrix.python-version }}
|
||||
|
@ -13,24 +16,27 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-20.04]
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Ubuntu packages
|
||||
run: |
|
||||
sudo ./utils/searx.sh install packages
|
||||
sudo ./utils/searxng.sh install packages
|
||||
sudo apt install firefox
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: 'x64'
|
||||
- name: Cache Python dependencies
|
||||
id: cache-python
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./local
|
||||
path: |
|
||||
./local
|
||||
./.nvm
|
||||
./node_modules
|
||||
key: python-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements*.txt', 'setup.py') }}
|
||||
- name: Install Python dependencies
|
||||
if: steps.cache-python.outputs.cache-hit != 'true'
|
||||
|
@ -55,18 +61,21 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Ubuntu packages
|
||||
run: sudo ./utils/searx.sh install buildhost
|
||||
run: sudo ./utils/searxng.sh install buildhost
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
architecture: 'x64'
|
||||
- name: Cache Python dependencies
|
||||
id: cache-python
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./local
|
||||
key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
|
||||
path: |
|
||||
./local
|
||||
./.nvm
|
||||
./node_modules
|
||||
key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }}
|
||||
- name: Install node dependencies
|
||||
run: make V=1 node.env
|
||||
- name: Build themes
|
||||
|
@ -75,6 +84,8 @@ jobs:
|
|||
documentation:
|
||||
name: Documentation
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: write # for JamesIves/github-pages-deploy-action to push changes in repo
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
@ -82,18 +93,21 @@ jobs:
|
|||
fetch-depth: '0'
|
||||
persist-credentials: false
|
||||
- name: Install Ubuntu packages
|
||||
run: sudo ./utils/searx.sh install buildhost
|
||||
run: sudo ./utils/searxng.sh install buildhost
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
architecture: 'x64'
|
||||
- name: Cache Python dependencies
|
||||
id: cache-python
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./local
|
||||
key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
|
||||
path: |
|
||||
./local
|
||||
./.nvm
|
||||
./node_modules
|
||||
key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }}
|
||||
- name: Build documentation
|
||||
run: |
|
||||
make V=1 docs.clean docs.html
|
||||
|
@ -116,6 +130,8 @@ jobs:
|
|||
- python
|
||||
- themes
|
||||
- documentation
|
||||
permissions:
|
||||
contents: write # for make V=1 weblate.push.translations
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
@ -123,16 +139,19 @@ jobs:
|
|||
fetch-depth: '0'
|
||||
token: ${{ secrets.WEBLATE_GITHUB_TOKEN }}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
architecture: 'x64'
|
||||
- name: Cache Python dependencies
|
||||
id: cache-python
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./local
|
||||
key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
|
||||
path: |
|
||||
./local
|
||||
./.nvm
|
||||
./node_modules
|
||||
key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }}
|
||||
- name: weblate & git setup
|
||||
env:
|
||||
WEBLATE_CONFIG: ${{ secrets.WEBLATE_CONFIG }}
|
||||
|
@ -165,16 +184,19 @@ jobs:
|
|||
# make sure "make docker.push" can get the git history
|
||||
fetch-depth: '0'
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
architecture: 'x64'
|
||||
- name: Cache Python dependencies
|
||||
id: cache-python
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./local
|
||||
key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
|
||||
path: |
|
||||
./local
|
||||
./.nvm
|
||||
./node_modules
|
||||
key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }}
|
||||
- name: Set up QEMU
|
||||
if: env.DOCKERHUB_USERNAME != null
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
|
28
.github/workflows/security.yml
vendored
Normal file
28
.github/workflows/security.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: "Security checks"
|
||||
on:
|
||||
schedule:
|
||||
- cron: "42 05 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
dockers:
|
||||
name: Trivy ${{ matrix.image }}
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
image-ref: 'searxng/searxng:latest'
|
||||
ignore-unfixed: false
|
||||
vuln-type: 'os,library'
|
||||
severity: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL'
|
||||
format: 'sarif'
|
||||
output: 'trivy-results.sarif'
|
||||
|
||||
- name: Upload Trivy scan results to GitHub Security tab
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
sarif_file: 'trivy-results.sarif'
|
11
.github/workflows/translations-update.yml
vendored
11
.github/workflows/translations-update.yml
vendored
|
@ -16,16 +16,19 @@ jobs:
|
|||
fetch-depth: '0'
|
||||
token: ${{ secrets.WEBLATE_GITHUB_TOKEN }}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
architecture: 'x64'
|
||||
- name: Cache Python dependencies
|
||||
id: cache-python
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./local
|
||||
key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
|
||||
path: |
|
||||
./local
|
||||
./.nvm
|
||||
./node_modules
|
||||
key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }}
|
||||
- name: weblate & git setup
|
||||
env:
|
||||
WEBLATE_CONFIG: ${{ secrets.WEBLATE_CONFIG }}
|
||||
|
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -19,3 +19,7 @@ gh-pages/
|
|||
|
||||
/package-lock.json
|
||||
/node_modules/
|
||||
|
||||
.idea/
|
||||
|
||||
searx/version_frozen.py
|
||||
|
|
2
.nvmrc
2
.nvmrc
|
@ -1 +1 @@
|
|||
v16.13.0
|
||||
v16.15.1
|
44
.pylintrc
44
.pylintrc
|
@ -59,8 +59,7 @@ confidence=
|
|||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||
# --disable=W"
|
||||
disable=bad-whitespace,
|
||||
duplicate-code,
|
||||
disable=duplicate-code,
|
||||
missing-function-docstring,
|
||||
consider-using-f-string,
|
||||
|
||||
|
@ -108,39 +107,21 @@ max-nested-blocks=5
|
|||
|
||||
[BASIC]
|
||||
|
||||
# List of builtins function names that should not be used, separated by a comma
|
||||
bad-functions=map,filter,apply,input
|
||||
|
||||
# Naming hint for argument names
|
||||
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct argument names
|
||||
argument-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Naming hint for attribute names
|
||||
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct attribute names
|
||||
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*)|([A-Z0-9_]*))$
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma
|
||||
bad-names=foo,bar,baz,toto,tutu,tata
|
||||
|
||||
# Naming hint for class attribute names
|
||||
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||
|
||||
# Regular expression matching correct class attribute names
|
||||
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||
|
||||
# Naming hint for class names
|
||||
class-name-hint=[A-Z_][a-zA-Z0-9]+$
|
||||
|
||||
# Regular expression matching correct class names
|
||||
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||
|
||||
# Naming hint for constant names
|
||||
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
# Regular expression matching correct constant names
|
||||
const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
|
||||
#const-rgx=[f]?[A-Z_][a-zA-Z0-9_]{2,30}$
|
||||
|
@ -149,9 +130,6 @@ const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
|
|||
# ones are exempt.
|
||||
docstring-min-length=-1
|
||||
|
||||
# Naming hint for function names
|
||||
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct function names
|
||||
function-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
|
@ -161,21 +139,12 @@ good-names=i,j,k,ex,Run,_,log,cfg,id
|
|||
# Include a hint for the correct naming format with invalid-name
|
||||
include-naming-hint=no
|
||||
|
||||
# Naming hint for inline iteration names
|
||||
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Regular expression matching correct inline iteration names
|
||||
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Naming hint for method names
|
||||
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct method names
|
||||
method-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Naming hint for module names
|
||||
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Regular expression matching correct module names
|
||||
#module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
module-rgx=([a-z_][a-z0-9_]*)$
|
||||
|
@ -192,9 +161,6 @@ no-docstring-rgx=^_
|
|||
# to this list to register other decorators that produce valid properties.
|
||||
property-classes=abc.abstractproperty
|
||||
|
||||
# Naming hint for variable names
|
||||
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct variable names
|
||||
variable-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*)|([a-z]))$
|
||||
|
||||
|
@ -220,12 +186,6 @@ max-line-length=120
|
|||
# Maximum number of lines in a module
|
||||
max-module-lines=2000
|
||||
|
||||
# List of optional constructs for which whitespace checking is disabled. `dict-
|
||||
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
|
||||
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
|
||||
# `empty-line` allows space-only lines.
|
||||
no-space-check=trailing-comma,dict-separator
|
||||
|
||||
# Allow the body of a class to be on the same line as the declaration if body
|
||||
# contains single statement.No config file found, using default configuration
|
||||
|
||||
|
@ -444,4 +404,4 @@ known-third-party=enchant
|
|||
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "Exception"
|
||||
overgeneral-exceptions=Exception
|
||||
overgeneral-exceptions=builtins.Exception
|
||||
|
|
2
.weblate
2
.weblate
|
@ -1,3 +1,3 @@
|
|||
[weblate]
|
||||
url = https://weblate.bubu1.eu/api/
|
||||
url = https://translate.codeberg.org/api/
|
||||
translation = searxng/searxng
|
||||
|
|
|
@ -163,3 +163,9 @@ features or generally made searx better:
|
|||
- @xenrox
|
||||
- @OliveiraHermogenes
|
||||
- Paul Alcock @Guilvareux
|
||||
- Sam A. `<https://samsapti.dev>`_
|
||||
- @XavierHorwood
|
||||
- Ahmad Alkadri `<https://github.com/ahmad-alkadri>`_
|
||||
- Milad Laly @Milad-Laly
|
||||
- @llmII
|
||||
- @blob42 `<https://blob42.xyz>`_
|
||||
|
|
|
@ -323,7 +323,7 @@ Special thanks to `NLNet <https://nlnet.nl>`__ for sponsoring multiple features
|
|||
- Removed engines: faroo
|
||||
|
||||
Special thanks to `NLNet <https://nlnet.nl>`__ for sponsoring multiple features of this release.
|
||||
Special thanks to https://www.accessibility.nl/english for making accessibilty audit.
|
||||
Special thanks to https://www.accessibility.nl/english for making accessibility audit.
|
||||
|
||||
News
|
||||
~~~~
|
||||
|
|
22
Dockerfile
22
Dockerfile
|
@ -1,7 +1,6 @@
|
|||
FROM alpine:3.15
|
||||
FROM alpine:3.17
|
||||
ENTRYPOINT ["/sbin/tini","--","/usr/local/searxng/dockerfiles/docker-entrypoint.sh"]
|
||||
EXPOSE 8080
|
||||
VOLUME /etc/searx
|
||||
VOLUME /etc/searxng
|
||||
|
||||
ARG SEARXNG_GID=977
|
||||
|
@ -20,11 +19,9 @@ ENV INSTANCE_NAME=searxng \
|
|||
|
||||
WORKDIR /usr/local/searxng
|
||||
|
||||
|
||||
COPY requirements.txt ./requirements.txt
|
||||
|
||||
RUN apk upgrade --no-cache \
|
||||
&& apk add --no-cache -t build-dependencies \
|
||||
RUN apk add --no-cache -t build-dependencies \
|
||||
build-base \
|
||||
py3-setuptools \
|
||||
python3-dev \
|
||||
|
@ -46,21 +43,21 @@ RUN apk upgrade --no-cache \
|
|||
uwsgi \
|
||||
uwsgi-python3 \
|
||||
brotli \
|
||||
&& pip3 install --upgrade pip wheel setuptools \
|
||||
&& pip3 install --no-cache -r requirements.txt \
|
||||
&& apk del build-dependencies \
|
||||
&& rm -rf /root/.cache
|
||||
|
||||
COPY --chown=searxng:searxng . .
|
||||
COPY --chown=searxng:searxng dockerfiles ./dockerfiles
|
||||
COPY --chown=searxng:searxng searx ./searx
|
||||
|
||||
ARG TIMESTAMP_SETTINGS=0
|
||||
ARG TIMESTAMP_UWSGI=0
|
||||
ARG VERSION_GITCOMMIT=unknown
|
||||
|
||||
RUN su searxng -c "/usr/bin/python3 -m compileall -q searx"; \
|
||||
touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml; \
|
||||
touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
|
||||
find /usr/local/searxng/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
|
||||
RUN su searxng -c "/usr/bin/python3 -m compileall -q searx" \
|
||||
&& touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml \
|
||||
&& touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini \
|
||||
&& find /usr/local/searxng/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
|
||||
-o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
|
||||
-type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+
|
||||
|
||||
|
@ -68,6 +65,7 @@ RUN su searxng -c "/usr/bin/python3 -m compileall -q searx"; \
|
|||
ARG LABEL_DATE=
|
||||
ARG GIT_URL=unknown
|
||||
ARG SEARXNG_GIT_VERSION=unknown
|
||||
ARG SEARXNG_DOCKER_TAG=unknown
|
||||
ARG LABEL_VCS_REF=
|
||||
ARG LABEL_VCS_URL=
|
||||
LABEL maintainer="searxng <${GIT_URL}>" \
|
||||
|
@ -82,7 +80,7 @@ LABEL maintainer="searxng <${GIT_URL}>" \
|
|||
org.label-schema.build-date="${LABEL_DATE}" \
|
||||
org.label-schema.usage="https://github.com/searxng/searxng-docker" \
|
||||
org.opencontainers.image.title="searxng" \
|
||||
org.opencontainers.image.version="${SEARXNG_GIT_VERSION}" \
|
||||
org.opencontainers.image.version="${SEARXNG_DOCKER_TAG}" \
|
||||
org.opencontainers.image.url="${LABEL_VCS_URL}" \
|
||||
org.opencontainers.image.revision=${LABEL_VCS_REF} \
|
||||
org.opencontainers.image.source=${LABEL_VCS_URL} \
|
||||
|
|
7
Makefile
7
Makefile
|
@ -59,17 +59,16 @@ test.shell:
|
|||
utils/brand.env \
|
||||
$(MTOOLS) \
|
||||
utils/lib.sh \
|
||||
utils/lib_install.sh \
|
||||
utils/lib_nvm.sh \
|
||||
utils/lib_static.sh \
|
||||
utils/lib_go.sh \
|
||||
utils/lib_redis.sh \
|
||||
utils/filtron.sh \
|
||||
utils/searx.sh \
|
||||
utils/searxng.sh \
|
||||
utils/morty.sh \
|
||||
utils/lxc.sh \
|
||||
utils/lxc-searx.env \
|
||||
.config.sh
|
||||
utils/lxc-searxng.env
|
||||
$(Q)$(MTOOLS) build_msg TEST "$@ OK"
|
||||
|
||||
|
||||
|
@ -81,7 +80,7 @@ MANAGE += data.all data.languages data.useragents data.osm_keys_tags
|
|||
MANAGE += docs.html docs.live docs.gh-pages docs.prebuild docs.clean
|
||||
MANAGE += docker.build docker.push docker.buildx
|
||||
MANAGE += gecko.driver
|
||||
MANAGE += node.env node.clean
|
||||
MANAGE += node.env node.env.dev node.clean
|
||||
MANAGE += py.build py.clean
|
||||
MANAGE += pyenv pyenv.install pyenv.uninstall
|
||||
MANAGE += pypi.upload pypi.upload.test
|
||||
|
|
37
README.rst
37
README.rst
|
@ -59,8 +59,8 @@ our homepage_.
|
|||
.. |commits| image:: https://img.shields.io/github/commit-activity/y/searxng/searxng?color=yellow&label=commits
|
||||
:target: https://github.com/searxng/searxng/commits/master
|
||||
|
||||
.. |weblate| image:: https://weblate.bubu1.eu/widgets/searxng/-/searxng/svg-badge.svg
|
||||
:target: https://weblate.bubu1.eu/projects/searxng/
|
||||
.. |weblate| image:: https://translate.codeberg.org/widgets/searxng/-/searxng/svg-badge.svg
|
||||
:target: https://translate.codeberg.org/projects/searxng/
|
||||
|
||||
|
||||
Contact
|
||||
|
@ -101,17 +101,25 @@ User experience
|
|||
* engines are grouped inside each tab
|
||||
* each engine has a description
|
||||
|
||||
- it is easier to report a bug of an engine
|
||||
- but you can also disable the recording of the metrics on the server
|
||||
- thanks to the anonymous metrics, it is easier to report a bug of an engine and
|
||||
thus engines get fixed more quickly
|
||||
|
||||
- if you don't want any metrics to be recorded, you can `disable them on the server
|
||||
<https://docs.searxng.org/admin/engines/settings.html#general>`_
|
||||
|
||||
- administrator can `block and/or replace the URLs in the search results
|
||||
<https://github.com/searxng/searxng/blob/5c1c0817c3996c5670a545d05831d234d21e6217/searx/settings.yml#L191-L199>`_
|
||||
|
||||
|
||||
Setup
|
||||
-----
|
||||
|
||||
- the Docker image is now also built for ARM64 and ARM/v7 architectures
|
||||
- you don't need `Morty`_ to proxy the images even on a public instance
|
||||
- on the way to embed `Filtron`_ into SearXNG
|
||||
- up to date installation scripts
|
||||
- you don't need `Filtron`_ to block bots, we implemented the builtin `limiter`_
|
||||
- you get a well maintained `Docker image`_, now also built for ARM64 and ARM/v7 architectures
|
||||
- alternatively we have up to date installation scripts
|
||||
|
||||
.. _Docker image: https://github.com/searxng/searxng-docker
|
||||
|
||||
|
||||
Contributing is easier
|
||||
|
@ -125,7 +133,8 @@ Contributing is easier
|
|||
|
||||
.. _Morty: https://github.com/asciimoo/morty
|
||||
.. _Filtron: https://github.com/searxng/filtron
|
||||
.. _Weblate: https://weblate.bubu1.eu/projects/searxng/searxng/
|
||||
.. _limiter: https://docs.searxng.org/src/searx.plugins.limiter.html
|
||||
.. _Weblate: https://translate.codeberg.org/projects/searxng/searxng/
|
||||
.. _Development Quickstart: https://docs.searxng.org/dev/quickstart.html
|
||||
|
||||
|
||||
|
@ -133,8 +142,14 @@ Translations
|
|||
============
|
||||
|
||||
We need translators, suggestions are welcome at
|
||||
https://weblate.bubu1.eu/projects/searxng/searxng/
|
||||
https://translate.codeberg.org/projects/searxng/searxng/
|
||||
|
||||
.. figure:: https://weblate.bubu1.eu/widgets/searxng/-/multi-auto.svg
|
||||
:target: https://weblate.bubu1.eu/projects/searxng/
|
||||
.. figure:: https://translate.codeberg.org/widgets/searxng/-/multi-auto.svg
|
||||
:target: https://translate.codeberg.org/projects/searxng/
|
||||
|
||||
|
||||
Make a donation
|
||||
===============
|
||||
|
||||
You can support the SearXNG project by clicking on the donation page:
|
||||
https://docs.searxng.org/donate.html
|
||||
|
|
|
@ -61,6 +61,12 @@ echo "SearXNG version ${SEARXNG_VERSION}"
|
|||
# helpers to update the configuration files
|
||||
patch_uwsgi_settings() {
|
||||
CONF="$1"
|
||||
|
||||
# update uwsg.ini
|
||||
sed -i \
|
||||
-e "s|workers = .*|workers = ${UWSGI_WORKERS:-%k}|g" \
|
||||
-e "s|threads = .*|threads = ${UWSGI_THREADS:-4}|g" \
|
||||
"${CONF}"
|
||||
}
|
||||
|
||||
patch_searxng_settings() {
|
||||
|
@ -106,7 +112,7 @@ update_conf() {
|
|||
# There is a new version
|
||||
if [ "$FORCE_CONF_UPDATE" -ne 0 ]; then
|
||||
# Replace the current configuration
|
||||
printf '⚠️ Automaticaly update %s to the new version\n' "${CONF}"
|
||||
printf '⚠️ Automatically update %s to the new version\n' "${CONF}"
|
||||
if [ ! -f "${OLD_CONF}" ]; then
|
||||
printf 'The previous configuration is saved to %s\n' "${OLD_CONF}"
|
||||
mv "${CONF}" "${OLD_CONF}"
|
||||
|
|
|
@ -10,7 +10,7 @@ threads = 4
|
|||
# The right granted on the created socket
|
||||
chmod-socket = 666
|
||||
|
||||
# Plugin to use and interpretor config
|
||||
# Plugin to use and interpreter config
|
||||
single-interpreter = true
|
||||
master = true
|
||||
plugin = python3
|
||||
|
|
2
docs/_themes/searxng/static/searxng.css
vendored
2
docs/_themes/searxng/static/searxng.css
vendored
|
@ -40,7 +40,7 @@ p.sidebar-title, .sidebar p {
|
|||
/* admonitions
|
||||
*/
|
||||
|
||||
div.admonition, div.topic, div.toctree-wrapper {
|
||||
div.admonition, div.topic, nav.contents, div.toctree-wrapper {
|
||||
background-color: #fafafa;
|
||||
margin: 8px 0px;
|
||||
padding: 1em;
|
||||
|
|
|
@ -1,33 +1,30 @@
|
|||
digraph G {
|
||||
|
||||
node [style=filled, shape=box, fillcolor="#ffffcc", fontname="Sans"];
|
||||
node [style=filled, shape=box, fillcolor="#ffffcc", fontname=Sans];
|
||||
edge [fontname="Sans"];
|
||||
|
||||
browser [label="Browser", shape=Mdiamond];
|
||||
rp [label="Reverse Proxy", href="https://docs.searxng.org/utils/filtron.sh.html#public-reverse-proxy"];
|
||||
filtron [label="Filtron", href="https://docs.searxng.org/utils/filtron.sh.html"];
|
||||
morty [label="Morty", href="https://docs.searxng.org/utils/morty.sh.html"];
|
||||
static [label="Static files", href="url to configure static files"];
|
||||
uwsgi [label="uwsgi", href="https://docs.searxng.org/utils/searx.sh.html"]
|
||||
searx1 [label="Searx #1"];
|
||||
searx2 [label="Searx #2"];
|
||||
searx3 [label="Searx #3"];
|
||||
searx4 [label="Searx #4"];
|
||||
browser [label="browser", shape=tab, fillcolor=aliceblue];
|
||||
rp [label="reverse proxy"];
|
||||
static [label="static files", shape=folder, href="url to configure static files", fillcolor=lightgray];
|
||||
uwsgi [label="uwsgi", shape=parallelogram href="https://docs.searxng.org/utils/searx.sh.html"]
|
||||
redis [label="redis DB", shape=cylinder];
|
||||
searxng1 [label="SearXNG #1", fontcolor=blue3];
|
||||
searxng2 [label="SearXNG #2", fontcolor=blue3];
|
||||
searxng3 [label="SearXNG #3", fontcolor=blue3];
|
||||
searxng4 [label="SearXNG #4", fontcolor=blue3];
|
||||
|
||||
browser -> rp [label="HTTPS"]
|
||||
|
||||
subgraph cluster_searx {
|
||||
label = "Searx instance" fontname="Sans";
|
||||
subgraph cluster_searxng {
|
||||
label = "SearXNG instance" fontname=Sans;
|
||||
bgcolor="#fafafa";
|
||||
{ rank=same; static rp };
|
||||
rp -> morty [label="optional: images and HTML pages proxy"];
|
||||
rp -> static [label="optional: reverse proxy serves directly static files"];
|
||||
rp -> filtron [label="HTTP"];
|
||||
filtron -> uwsgi [label="HTTP"];
|
||||
uwsgi -> searx1;
|
||||
uwsgi -> searx2;
|
||||
uwsgi -> searx3;
|
||||
uwsgi -> searx4;
|
||||
rp -> static [label="optional: reverse proxy serves static files", fillcolor=slategray, fontcolor=slategray];
|
||||
rp -> uwsgi [label="http:// (tcp) or unix:// (socket)"];
|
||||
uwsgi -> searxng1 -> redis;
|
||||
uwsgi -> searxng2 -> redis;
|
||||
uwsgi -> searxng3 -> redis;
|
||||
uwsgi -> searxng4 -> redis;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,17 +8,19 @@ Architecture
|
|||
|
||||
- Reverse Proxy: :ref:`Apache <apache searxng site>` & :ref:`nginx <nginx
|
||||
searxng site>`
|
||||
- Filtron: :ref:`searxng filtron`
|
||||
- Morty: :ref:`searxng morty`
|
||||
- uWSGI: :ref:`searxng uwsgi`
|
||||
- SearXNG: :ref:`installation basic`
|
||||
|
||||
Herein you will find some hints and suggestions about typical architectures of
|
||||
SearXNG infrastructures.
|
||||
|
||||
We start with a contribution from :pull-searx:`@dalf <1776#issuecomment-567917320>`.
|
||||
It shows a *reference* setup for public SearXNG instances which can build up and
|
||||
maintained by the scripts from our :ref:`toolboxing`.
|
||||
.. _architecture uWSGI:
|
||||
|
||||
uWSGI Setup
|
||||
===========
|
||||
|
||||
We start with a *reference* setup for public SearXNG instances which can be build
|
||||
up and maintained by the scripts from our :ref:`toolboxing`.
|
||||
|
||||
.. _arch public:
|
||||
|
||||
|
@ -26,3 +28,11 @@ maintained by the scripts from our :ref:`toolboxing`.
|
|||
:alt: arch_public.dot
|
||||
|
||||
Reference architecture of a public SearXNG setup.
|
||||
|
||||
The reference installation activates ``server.limiter``, ``server.image_proxy``
|
||||
and ``ui.static_use_hash`` (:origin:`/etc/searxng/settings.yml
|
||||
<utils/templates/etc/searxng/settings.yml>`)
|
||||
|
||||
.. literalinclude:: ../../utils/templates/etc/searxng/settings.yml
|
||||
:language: yaml
|
||||
:end-before: # preferences:
|
||||
|
|
|
@ -15,19 +15,19 @@ Buildhosts
|
|||
:backlinks: entry
|
||||
|
||||
To get best results from build, its recommend to install additional packages
|
||||
on build hosts (see :ref:`searx.sh`).::
|
||||
on build hosts (see :ref:`searxng.sh`).::
|
||||
|
||||
sudo -H ./utils/searx.sh install buildhost
|
||||
sudo -H ./utils/searxng.sh install buildhost
|
||||
|
||||
This will install packages needed by searx:
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START distro-packages
|
||||
:end-before: END distro-packages
|
||||
|
||||
and packages needed to build docuemtation and run tests:
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START build-packages
|
||||
:end-before: END build-packages
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ place the templates at::
|
|||
|
||||
searx/templates/{theme_name}/result_templates/{template_name}
|
||||
|
||||
Futhermore, if you do not wish to expose these engines on a public instance, you
|
||||
Furthermore, if you do not wish to expose these engines on a public instance, you
|
||||
can still add them and limit the access by setting ``tokens`` as described in
|
||||
section :ref:`private engines`.
|
||||
|
||||
|
@ -42,11 +42,11 @@ Extra Dependencies
|
|||
|
||||
For using :ref:`engine redis_server` or :ref:`engine mongodb` you need to
|
||||
install additional packages in Python's Virtual Environment of your SearXNG
|
||||
instance. To switch into the environment (:ref:`searx-src`) you can use
|
||||
:ref:`searx.sh`::
|
||||
instance. To switch into the environment (:ref:`searxng-src`) you can use
|
||||
:ref:`searxng.sh`::
|
||||
|
||||
$ sudo utils/searx.sh shell
|
||||
(searx-pyenv)$ pip install ...
|
||||
$ sudo utils/searxng.sh instance cmd bash
|
||||
(searxng-pyenv)$ pip install ...
|
||||
|
||||
|
||||
.. _engine redis_server:
|
||||
|
|
|
@ -39,7 +39,7 @@ Example
|
|||
Scenario:
|
||||
|
||||
#. Recoll indexes a local filesystem mounted in ``/export/documents/reference``,
|
||||
#. the Recoll search inteface can be reached at https://recoll.example.org/ and
|
||||
#. the Recoll search interface can be reached at https://recoll.example.org/ and
|
||||
#. the contents of this filesystem can be reached though https://download.example.org/reference
|
||||
|
||||
.. code:: yaml
|
||||
|
|
|
@ -21,7 +21,7 @@ above are added to ``settings.yml`` just commented out, as you have to
|
|||
Please note that if you are not using HTTPS to access these engines, you have to enable
|
||||
HTTP requests by setting ``enable_http`` to ``True``.
|
||||
|
||||
Futhermore, if you do not want to expose these engines on a public instance, you
|
||||
Furthermore, if you do not want to expose these engines on a public instance, you
|
||||
can still add them and limit the access by setting ``tokens`` as described in
|
||||
section :ref:`private engines`.
|
||||
|
||||
|
|
|
@ -70,14 +70,26 @@ Global Settings
|
|||
.. code:: yaml
|
||||
|
||||
general:
|
||||
debug: false # Debug mode, only for development
|
||||
instance_name: "SearXNG" # displayed name
|
||||
contact_url: false # mailto:contact@example.com
|
||||
debug: false
|
||||
instance_name: "SearXNG"
|
||||
privacypolicy_url: false
|
||||
donation_url: https://docs.searxng.org/donate.html
|
||||
contact_url: false
|
||||
enable_metrics: true
|
||||
|
||||
``debug`` : ``$SEARXNG_DEBUG``
|
||||
Allow a more detailed log if you run SearXNG directly. Display *detailed* error
|
||||
messages in the browser too, so this must be deactivated in production.
|
||||
|
||||
``donation_url`` :
|
||||
At default the donation link points to the `SearXNG project
|
||||
<https://docs.searxng.org/donate.html>`_. Set value to ``true`` to use your
|
||||
own donation page written in the :ref:`searx/info/en/donate.md
|
||||
<searx.infopage>` and use ``false`` to disable the donation link altogether.
|
||||
|
||||
``privacypolicy_url``:
|
||||
Link to privacy policy.
|
||||
|
||||
``contact_url``:
|
||||
Contact ``mailto:`` address or WEB form.
|
||||
|
||||
|
@ -98,6 +110,13 @@ Global Settings
|
|||
default_lang: ""
|
||||
ban_time_on_fail: 5
|
||||
max_ban_time_on_fail: 120
|
||||
suspended_times:
|
||||
SearxEngineAccessDenied: 86400
|
||||
SearxEngineCaptcha: 86400
|
||||
SearxEngineTooManyRequests: 3600
|
||||
cf_SearxEngineCaptcha: 1296000
|
||||
cf_SearxEngineAccessDenied: 86400
|
||||
recaptcha_SearxEngineCaptcha: 604800
|
||||
formats:
|
||||
- html
|
||||
|
||||
|
@ -147,6 +166,25 @@ Global Settings
|
|||
``max_ban_time_on_fail``:
|
||||
Max ban time in seconds after engine errors.
|
||||
|
||||
``suspended_times``:
|
||||
Engine suspension time after error (in seconds; set to 0 to disable)
|
||||
|
||||
``SearxEngineAccessDenied``: 86400
|
||||
For error "Access denied" and "HTTP error [402, 403]"
|
||||
|
||||
``SearxEngineCaptcha``: 86400
|
||||
For error "CAPTCHA"
|
||||
|
||||
``SearxEngineTooManyRequests``: 3600
|
||||
For error "Too many request" and "HTTP error 429"
|
||||
|
||||
Cloudflare CAPTCHA:
|
||||
- ``cf_SearxEngineCaptcha``: 1296000
|
||||
- ``cf_SearxEngineAccessDenied``: 86400
|
||||
|
||||
Google CAPTCHA:
|
||||
- ``recaptcha_SearxEngineCaptcha``: 604800
|
||||
|
||||
``formats``:
|
||||
Result formats available from web, remove format to deny access (use lower
|
||||
case).
|
||||
|
@ -156,6 +194,7 @@ Global Settings
|
|||
- ``json``
|
||||
- ``rss``
|
||||
|
||||
|
||||
.. _settings server:
|
||||
|
||||
``server:``
|
||||
|
@ -195,10 +234,14 @@ Global Settings
|
|||
``secret_key`` : ``$SEARXNG_SECRET``
|
||||
Used for cryptography purpose.
|
||||
|
||||
.. _limiter:
|
||||
|
||||
``limiter`` :
|
||||
Rate limit the number of request on the instance, block some bots. The
|
||||
:ref:`limiter plugin` requires a :ref:`settings redis` database.
|
||||
|
||||
.. _image_proxy:
|
||||
|
||||
``image_proxy`` :
|
||||
Allow your instance of SearXNG of being able to proxy images. Uses memory space.
|
||||
|
||||
|
@ -213,31 +256,60 @@ Global Settings
|
|||
``ui:``
|
||||
-------
|
||||
|
||||
.. _cache busting:
|
||||
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#caching_static_assets_with_cache_busting
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
ui:
|
||||
static_use_hash: false
|
||||
default_locale: ""
|
||||
query_in_title: false
|
||||
infinite_scroll: false
|
||||
center_alignment: false
|
||||
cache_url: https://web.archive.org/web/
|
||||
default_theme: simple
|
||||
theme_args:
|
||||
simple_style: auto
|
||||
|
||||
.. _static_use_hash:
|
||||
|
||||
``static_use_hash`` :
|
||||
Enables `cache busting`_ of static files.
|
||||
|
||||
``default_locale`` :
|
||||
SearXNG interface language. If blank, the locale is detected by using the
|
||||
browser language. If it doesn't work, or you are deploying a language
|
||||
specific instance of searx, a locale can be defined using an ISO language
|
||||
code, like ``fr``, ``en``, ``de``.
|
||||
|
||||
``query_in_title`` :
|
||||
When true, the result page's titles contains the query it decreases the
|
||||
privacy, since the browser can records the page titles.
|
||||
|
||||
``infinite_scroll``:
|
||||
When true, automatically loads the next page when scrolling to bottom of the current page.
|
||||
|
||||
``center_alignment`` : default ``false``
|
||||
When enabled, the results are centered instead of being in the left (or RTL)
|
||||
side of the screen. This setting only affects the *desktop layout*
|
||||
(:origin:`min-width: @tablet <searx/static/themes/simple/src/less/definitions.less>`)
|
||||
|
||||
.. cache_url:
|
||||
|
||||
``cache_url`` : ``https://web.archive.org/web/``
|
||||
URL prefix of the internet archive or cache, don't forgett trailing slash (if
|
||||
needed). The default is https://web.archive.org/web/ alternatives are:
|
||||
|
||||
- https://webcache.googleusercontent.com/search?q=cache:
|
||||
- https://archive.today/
|
||||
|
||||
``default_theme`` :
|
||||
Name of the theme you want to use by default on your SearXNG instance.
|
||||
|
||||
``theme_args.simple_style``:
|
||||
Style of simple theme: ``auto``, ``light``, ``dark``
|
||||
|
||||
``query_in_title`` :
|
||||
When true, the result page's titles contains the query it decreases the
|
||||
privacy, since the browser can records the page titles.
|
||||
|
||||
``results_on_new_tab``:
|
||||
Open result links in a new tab by default.
|
||||
|
||||
|
@ -249,7 +321,7 @@ Global Settings
|
|||
|
||||
.. _Redis.from_url(url): https://redis-py.readthedocs.io/en/stable/connections.html#redis.client.Redis.from_url
|
||||
|
||||
A redis DB can be connected by an URL, in :py:obj:`searx.shared.redisdb` you
|
||||
A redis DB can be connected by an URL, in :py:obj:`searx.redisdb` you
|
||||
will find a description to test your redis connection in SerXNG. When using
|
||||
sockets, don't forget to check the access rights on the socket::
|
||||
|
||||
|
@ -269,20 +341,21 @@ developer) account needs to be added to the *searxng-redis* group.
|
|||
|
||||
.. admonition:: Tip for developers
|
||||
|
||||
To set up a local redis instance using sockets simply use::
|
||||
|
||||
$ ./manage redis.build
|
||||
$ sudo -H ./manage redis.install
|
||||
$ sudo -H ./manage redis.addgrp "${USER}"
|
||||
# don't forget to logout & login to get member of group
|
||||
|
||||
The YAML setting for such a redis instance is:
|
||||
To set up a local redis instance, first set the socket path of the Redis DB
|
||||
in your YAML setting:
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
redis:
|
||||
url: unix:///usr/local/searxng-redis/run/redis.sock?db=0
|
||||
|
||||
Then use the following commands to install the redis instance ::
|
||||
|
||||
$ ./manage redis.build
|
||||
$ sudo -H ./manage redis.install
|
||||
$ sudo -H ./manage redis.addgrp "${USER}"
|
||||
# don't forget to logout & login to get member of group
|
||||
|
||||
|
||||
.. _settings outgoing:
|
||||
|
||||
|
@ -296,24 +369,33 @@ Communication with search engines.
|
|||
outgoing:
|
||||
request_timeout: 2.0 # default timeout in seconds, can be override by engine
|
||||
max_request_timeout: 10.0 # the maximum timeout in seconds
|
||||
useragent_suffix: "" # informations like an email address to the administrator
|
||||
useragent_suffix: "" # information like an email address to the administrator
|
||||
pool_connections: 100 # Maximum number of allowable connections, or null
|
||||
# for no limits. The default is 100.
|
||||
pool_maxsize: 10 # Number of allowable keep-alive connections, or null
|
||||
# to always allow. The default is 10.
|
||||
enable_http2: true # See https://www.python-httpx.org/http2/
|
||||
# uncomment below section if you want to use a proxy
|
||||
# proxies:
|
||||
# all://:
|
||||
# - http://proxy1:8080
|
||||
# - http://proxy2:8080
|
||||
# uncomment below section only if you have more than one network interface
|
||||
# which can be the source of outgoing search requests
|
||||
# source_ips:
|
||||
# - 1.1.1.1
|
||||
# - 1.1.1.2
|
||||
# - fe80::/126
|
||||
|
||||
# uncomment below section if you want to use a custom server certificate
|
||||
# see https://www.python-httpx.org/advanced/#changing-the-verification-defaults
|
||||
# and https://www.python-httpx.org/compatibility/#ssl-configuration
|
||||
# verify: ~/.mitmproxy/mitmproxy-ca-cert.cer
|
||||
#
|
||||
# uncomment below section if you want to use a proxyq see: SOCKS proxies
|
||||
# https://2.python-requests.org/en/latest/user/advanced/#proxies
|
||||
# are also supported: see
|
||||
# https://2.python-requests.org/en/latest/user/advanced/#socks
|
||||
#
|
||||
# proxies:
|
||||
# all://:
|
||||
# - http://proxy1:8080
|
||||
# - http://proxy2:8080
|
||||
#
|
||||
# using_tor_proxy: true
|
||||
#
|
||||
# Extra seconds to add in order to account for the time taken by the proxy
|
||||
#
|
||||
# extra_proxy_timeout: 10.0
|
||||
#
|
||||
|
||||
``request_timeout`` :
|
||||
Global timeout of the requests made to others engines in seconds. A bigger
|
||||
|
@ -363,6 +445,17 @@ Communication with search engines.
|
|||
``enable_http2`` :
|
||||
Enable by default. Set to ``false`` to disable HTTP/2.
|
||||
|
||||
.. _httpx verification defaults: https://www.python-httpx.org/advanced/#changing-the-verification-defaults
|
||||
.. _httpx ssl configuration: https://www.python-httpx.org/compatibility/#ssl-configuration
|
||||
|
||||
``verify``: : ``$SSL_CERT_FILE``, ``$SSL_CERT_DIR``
|
||||
Allow to specify a path to certificate.
|
||||
see `httpx verification defaults`_.
|
||||
|
||||
In addition to ``verify``, SearXNG supports the ``$SSL_CERT_FILE`` (for a file) and
|
||||
``$SSL_CERT_DIR`` (for a directory) OpenSSL variables.
|
||||
see `httpx ssl configuration`_.
|
||||
|
||||
``max_redirects`` :
|
||||
30 by default. Maximum redirect before it is an error.
|
||||
|
||||
|
@ -405,6 +498,7 @@ engine is shown. Most of the options have a default value or even are optional.
|
|||
engine: example
|
||||
shortcut: demo
|
||||
base_url: 'https://{language}.example.com/'
|
||||
send_accept_language_header: false
|
||||
categories: general
|
||||
timeout: 3.0
|
||||
api_key: 'apikey'
|
||||
|
@ -453,6 +547,13 @@ engine is shown. Most of the options have a default value or even are optional.
|
|||
use multiple sites using only one engine, or updating the site URL without
|
||||
touching at the code.
|
||||
|
||||
``send_accept_language_header`` :
|
||||
Several engines that support languages (or regions) deal with the HTTP header
|
||||
``Accept-Language`` to build a response that fits to the locale. When this
|
||||
option is activated, the language (locale) that is selected by the user is used
|
||||
to build and send a ``Accept-Language`` header in the request to the origin
|
||||
search engine.
|
||||
|
||||
``categories`` : optional
|
||||
Define in which categories this engine will be active. Most of the time, it is
|
||||
defined in the code of the engine, but in a few cases it is useful, like when
|
||||
|
@ -556,8 +657,9 @@ and can relied on the default configuration :origin:`searx/settings.yml` using:
|
|||
``engines:``
|
||||
With ``use_default_settings: true``, each settings can be override in a
|
||||
similar way, the ``engines`` section is merged according to the engine
|
||||
``name``. In this example, SearXNG will load all the engine and the arch linux
|
||||
wiki engine has a :ref:`token <private engines>`:
|
||||
``name``. In this example, SearXNG will load all the default engines, will
|
||||
enable the ``bing`` engine and define a :ref:`token <private engines>` for
|
||||
the arch linux engine:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
|
@ -567,6 +669,9 @@ and can relied on the default configuration :origin:`searx/settings.yml` using:
|
|||
engines:
|
||||
- name: arch linux wiki
|
||||
tokens: ['$ecretValue']
|
||||
- name: bing
|
||||
disabled: false
|
||||
|
||||
|
||||
``engines:`` / ``remove:``
|
||||
It is possible to remove some engines from the default settings. The following
|
||||
|
|
|
@ -98,11 +98,11 @@ Extra Dependencies
|
|||
|
||||
For using :ref:`engine postgresql` or :ref:`engine mysql_server` you need to
|
||||
install additional packages in Python's Virtual Environment of your SearXNG
|
||||
instance. To switch into the environment (:ref:`searx-src`) you can use
|
||||
:ref:`searx.sh`::
|
||||
instance. To switch into the environment (:ref:`searxng-src`) you can use
|
||||
:ref:`searxng.sh`::
|
||||
|
||||
$ sudo utils/searx.sh shell
|
||||
(searx-pyenv)$ pip install ...
|
||||
$ sudo utils/searxng.sh instance cmd bash
|
||||
(searxng-pyenv)$ pip install ...
|
||||
|
||||
|
||||
.. _engine postgresql:
|
||||
|
@ -145,7 +145,7 @@ engine, you must install the package ``mysql-connector-python``.
|
|||
|
||||
The authentication plugin is configurable by setting ``auth_plugin`` in the
|
||||
attributes. By default it is set to ``caching_sha2_password``. This is an
|
||||
example configuration for quering a MySQL server:
|
||||
example configuration for querying a MySQL server:
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
|
|
|
@ -1,193 +0,0 @@
|
|||
|
||||
.. _searxng filtron:
|
||||
|
||||
==========================
|
||||
How to protect an instance
|
||||
==========================
|
||||
|
||||
.. tip::
|
||||
|
||||
To protect your instance a installation of filtron (as described here) is no
|
||||
longer needed, alternatively activate the :ref:`limiter plugin` in your
|
||||
``settings.yml``. Note that the :ref:`limiter plugin` requires a :ref:`Redis
|
||||
<settings redis>` database.
|
||||
|
||||
|
||||
.. sidebar:: further reading
|
||||
|
||||
- :ref:`filtron.sh`
|
||||
- :ref:`nginx searxng site`
|
||||
|
||||
.. _filtron: https://github.com/searxng/filtron
|
||||
|
||||
SearXNG depends on external search services. To avoid the abuse of these services
|
||||
it is advised to limit the number of requests processed by SearXNG.
|
||||
|
||||
An application firewall, filtron_ solves exactly this problem. Filtron is just
|
||||
a middleware between your web server (nginx, apache, ...) and searx, we describe
|
||||
such infrastructures in chapter: :ref:`architecture`.
|
||||
|
||||
|
||||
filtron & go
|
||||
============
|
||||
|
||||
.. _Go: https://golang.org/
|
||||
.. _filtron README: https://github.com/searxng/filtron/blob/master/README.md
|
||||
|
||||
Filtron needs Go_ installed. If Go_ is preinstalled, filtron_ is simply
|
||||
installed by ``go get`` package management (see `filtron README`_). If you use
|
||||
filtron as middleware, a more isolated setup is recommended. To simplify such
|
||||
an installation and the maintenance of, use our script :ref:`filtron.sh`.
|
||||
|
||||
.. _Sample configuration of filtron:
|
||||
|
||||
Sample configuration of filtron
|
||||
===============================
|
||||
|
||||
.. sidebar:: Tooling box
|
||||
|
||||
- :origin:`/etc/filtron/rules.json <utils/templates/etc/filtron/rules.json>`
|
||||
|
||||
An example configuration can be find below. This configuration limits the access
|
||||
of:
|
||||
|
||||
- scripts or applications (roboagent limit)
|
||||
- webcrawlers (botlimit)
|
||||
- IPs which send too many requests (IP limit)
|
||||
- too many json, csv, etc. requests (rss/json limit)
|
||||
- the same UserAgent of if too many requests (useragent limit)
|
||||
|
||||
.. code:: json
|
||||
|
||||
[
|
||||
{
|
||||
"name": "search request",
|
||||
"filters": [
|
||||
"Param:q",
|
||||
"Path=^(/|/search)$"
|
||||
],
|
||||
"interval": "<time-interval-in-sec (int)>",
|
||||
"limit": "<max-request-number-in-interval (int)>",
|
||||
"subrules": [
|
||||
{
|
||||
"name": "missing Accept-Language",
|
||||
"filters": ["!Header:Accept-Language"],
|
||||
"limit": "<max-request-number-in-interval (int)>",
|
||||
"stop": true,
|
||||
"actions": [
|
||||
{"name":"log"},
|
||||
{"name": "block",
|
||||
"params": {"message": "Rate limit exceeded"}}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "suspiciously Connection=close header",
|
||||
"filters": ["Header:Connection=close"],
|
||||
"limit": "<max-request-number-in-interval (int)>",
|
||||
"stop": true,
|
||||
"actions": [
|
||||
{"name":"log"},
|
||||
{"name": "block",
|
||||
"params": {"message": "Rate limit exceeded"}}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "IP limit",
|
||||
"interval": "<time-interval-in-sec (int)>",
|
||||
"limit": "<max-request-number-in-interval (int)>",
|
||||
"stop": true,
|
||||
"aggregations": [
|
||||
"Header:X-Forwarded-For"
|
||||
],
|
||||
"actions": [
|
||||
{ "name": "log"},
|
||||
{ "name": "block",
|
||||
"params": {
|
||||
"message": "Rate limit exceeded"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rss/json limit",
|
||||
"filters": [
|
||||
"Param:format=(csv|json|rss)"
|
||||
],
|
||||
"interval": "<time-interval-in-sec (int)>",
|
||||
"limit": "<max-request-number-in-interval (int)>",
|
||||
"stop": true,
|
||||
"actions": [
|
||||
{ "name": "log"},
|
||||
{ "name": "block",
|
||||
"params": {
|
||||
"message": "Rate limit exceeded"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "useragent limit",
|
||||
"interval": "<time-interval-in-sec (int)>",
|
||||
"limit": "<max-request-number-in-interval (int)>",
|
||||
"aggregations": [
|
||||
"Header:User-Agent"
|
||||
],
|
||||
"actions": [
|
||||
{ "name": "log"},
|
||||
{ "name": "block",
|
||||
"params": {
|
||||
"message": "Rate limit exceeded"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
.. _filtron route request:
|
||||
|
||||
Route request through filtron
|
||||
=============================
|
||||
|
||||
.. sidebar:: further reading
|
||||
|
||||
- :ref:`filtron.sh overview`
|
||||
- :ref:`installation nginx`
|
||||
- :ref:`installation apache`
|
||||
|
||||
Filtron can be started using the following command:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
$ filtron -rules rules.json
|
||||
|
||||
It listens on ``127.0.0.1:4004`` and forwards filtered requests to
|
||||
``127.0.0.1:8888`` by default.
|
||||
|
||||
Use it along with ``nginx`` with the following example configuration.
|
||||
|
||||
.. code:: nginx
|
||||
|
||||
# https://example.org/searx
|
||||
|
||||
location /searx {
|
||||
proxy_pass http://127.0.0.1:4004/;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_set_header X-Script-Name /searx;
|
||||
}
|
||||
|
||||
location /searx/static {
|
||||
/usr/local/searx/searx-src/searx/static;
|
||||
}
|
||||
|
||||
|
||||
Requests are coming from port 4004 going through filtron and then forwarded to
|
||||
port 8888 where a SearXNG is being run. For a complete setup see: :ref:`nginx
|
||||
searxng site`.
|
|
@ -7,17 +7,15 @@ Administrator documentation
|
|||
:caption: Contents
|
||||
|
||||
installation
|
||||
installation-docker
|
||||
installation-scripts
|
||||
installation-searxng
|
||||
installation-uwsgi
|
||||
installation-nginx
|
||||
installation-apache
|
||||
installation-docker
|
||||
installation-switch2ng
|
||||
update-searxng
|
||||
engines/index
|
||||
api
|
||||
architecture
|
||||
filtron
|
||||
morty
|
||||
plugins
|
||||
buildhosts
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
.. _installation apache:
|
||||
|
||||
===================
|
||||
Install with apache
|
||||
===================
|
||||
======
|
||||
Apache
|
||||
======
|
||||
|
||||
.. _Apache: https://httpd.apache.org/
|
||||
.. _Apache Debian:
|
||||
https://cwiki.apache.org/confluence/display/HTTPD/DistrosDefaultLayout#DistrosDefaultLayout-Debian,Ubuntu(Apachehttpd2.x):
|
||||
.. _README.Debian:
|
||||
.. _apache2.README.Debian:
|
||||
https://salsa.debian.org/apache-team/apache2/raw/master/debian/apache2.README.Debian
|
||||
.. _Apache Arch Linux:
|
||||
https://wiki.archlinux.org/index.php/Apache_HTTP_Server
|
||||
|
@ -23,7 +23,9 @@ Install with apache
|
|||
https://httpd.apache.org/docs/current/en/configuring.html
|
||||
.. _ProxyPreserveHost: https://httpd.apache.org/docs/trunk/mod/mod_proxy.html#proxypreservehost
|
||||
.. _LoadModule:
|
||||
https://httpd.apache.org/docs/2.4/mod/mod_so.html#loadmodule
|
||||
https://httpd.apache.org/docs/mod/mod_so.html#loadmodule
|
||||
.. _IncludeOptional:
|
||||
https://httpd.apache.org/docs/mod/core.html#includeoptional
|
||||
.. _DocumentRoot:
|
||||
https://httpd.apache.org/docs/trunk/mod/core.html#documentroot
|
||||
.. _Location:
|
||||
|
@ -32,11 +34,30 @@ Install with apache
|
|||
https://uwsgi-docs.readthedocs.io/en/latest/Apache.html
|
||||
.. _mod_proxy_uwsgi:
|
||||
https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-proxy-uwsgi
|
||||
.. _mod_proxy_http:
|
||||
https://httpd.apache.org/docs/current/mod/mod_proxy_http.html
|
||||
.. _mod_proxy:
|
||||
https://httpd.apache.org/docs/current/mod/mod_proxy.html
|
||||
|
||||
|
||||
This section explains how to set up a SearXNG instance using the HTTP server Apache_.
|
||||
If you did use the :ref:`installation scripts` and do not have any special preferences
|
||||
you can install the :ref:`SearXNG site <apache searxng site>` using
|
||||
:ref:`searxng.sh <searxng.sh overview>`:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/searxng.sh install apache
|
||||
|
||||
If you have special interests or problems with setting up Apache, the following
|
||||
section might give you some guidance.
|
||||
|
||||
|
||||
.. sidebar:: further read
|
||||
|
||||
- `Apache Arch Linux`_
|
||||
- `Apache Debian`_ and `README.Debian`_
|
||||
- `Apache Debian`_
|
||||
- `apache2.README.Debian`_
|
||||
- `Apache Fedora`_
|
||||
- `Apache directives`_
|
||||
|
||||
|
@ -45,23 +66,8 @@ Install with apache
|
|||
:local:
|
||||
:backlinks: entry
|
||||
|
||||
----
|
||||
|
||||
**Install** :ref:`apache searxng site` using :ref:`filtron.sh <filtron.sh overview>`
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/filtron.sh apache install
|
||||
|
||||
**Install** :ref:`apache searxng site` using :ref:`morty.sh <morty.sh overview>`
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/morty.sh apache install
|
||||
|
||||
----
|
||||
|
||||
The apache HTTP server
|
||||
The Apache HTTP server
|
||||
======================
|
||||
|
||||
If Apache_ is not installed, install it now. If apache_ is new to you, the
|
||||
|
@ -73,13 +79,13 @@ Directives`_ documentation gives first orientation. There is also a list of
|
|||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H apt-get install apache2
|
||||
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H pacman -S apache
|
||||
sudo -H systemctl enable httpd
|
||||
|
@ -87,21 +93,21 @@ Directives`_ documentation gives first orientation. There is also a list of
|
|||
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H dnf install httpd
|
||||
sudo -H systemctl enable httpd
|
||||
sudo -H systemctl start httpd
|
||||
|
||||
Now at http://localhost you should see any kind of *Welcome* or *Test* page.
|
||||
How this default intro site is configured, depends on the linux distribution
|
||||
Now at http://localhost you should see some kind of *Welcome* or *Test* page.
|
||||
How this default site is configured, depends on the linux distribution
|
||||
(compare `Apache directives`_).
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
less /etc/apache2/sites-enabled/000-default.conf
|
||||
|
||||
|
@ -115,7 +121,7 @@ How this default intro site is configured, depends on the linux distribution
|
|||
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
less /etc/httpd/conf/httpd.conf
|
||||
|
||||
|
@ -130,8 +136,8 @@ How this default intro site is configured, depends on the linux distribution
|
|||
Require all granted
|
||||
</Directory>
|
||||
|
||||
The *welcome* page of Arch Linux is a page showing directory located at
|
||||
``DocumentRoot``. This is *directory* page is generated by the Module
|
||||
The *welcome* page of Arch Linux is a page showing the directory located
|
||||
at ``DocumentRoot``. This *directory* page is generated by the Module
|
||||
`mod_autoindex <https://httpd.apache.org/docs/2.4/mod/mod_autoindex.html>`_:
|
||||
|
||||
.. code:: apache
|
||||
|
@ -142,7 +148,7 @@ How this default intro site is configured, depends on the linux distribution
|
|||
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
less /etc/httpd/conf/httpd.conf
|
||||
|
||||
|
@ -163,323 +169,204 @@ How this default intro site is configured, depends on the linux distribution
|
|||
|
||||
less /etc/httpd/conf.d/welcome.conf
|
||||
|
||||
.. _apache searxng site:
|
||||
|
||||
Apache Reverse Proxy
|
||||
====================
|
||||
.. _Debian's Apache layout:
|
||||
|
||||
.. sidebar:: public to the internet?
|
||||
Debian's Apache layout
|
||||
----------------------
|
||||
|
||||
If your SearXNG instance is public, stop here and first install :ref:`filtron
|
||||
reverse proxy <filtron.sh>` and :ref:`result proxy morty <morty.sh>`, see
|
||||
:ref:`installation scripts`. If already done, follow setup: *SearXNG via
|
||||
filtron plus morty*.
|
||||
Be aware, Debian's Apache layout is quite different from the standard Apache
|
||||
configuration. For details look at the apache2.README.Debian_
|
||||
(``/usr/share/doc/apache2/README.Debian.gz``). Some commands you should know on
|
||||
Debian:
|
||||
|
||||
To setup a Apache revers proxy you have to enable the *headers* and *proxy*
|
||||
modules and create a `Location`_ configuration for the SearXNG site. In most
|
||||
distributions you have to un-comment the lines in the main configuration file,
|
||||
except in :ref:`The Debian Layout`.
|
||||
* :man:`apache2ctl`: Apache HTTP server control interface
|
||||
* :man:`a2enmod`, :man:`a2dismod`: switch on/off modules
|
||||
* :man:`a2enconf`, :man:`a2disconf`: switch on/off configurations
|
||||
* :man:`a2ensite`, :man:`a2dissite`: switch on/off sites
|
||||
|
||||
.. _apache modules:
|
||||
|
||||
Apache modules
|
||||
--------------
|
||||
|
||||
To load additional modules, in most distributions you have to un-comment the
|
||||
lines with the corresponding LoadModule_ directive, except in :ref:`Debian's
|
||||
Apache layout`.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
In the Apache setup, enable headers and proxy modules:
|
||||
:ref:`Debian's Apache layout` uses :man:`a2enmod` and :man:`a2dismod` to
|
||||
activate or disable modules:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H a2enmod ssl
|
||||
sudo -H a2enmod headers
|
||||
sudo -H a2enmod proxy
|
||||
sudo -H a2enmod proxy_http
|
||||
sudo -H a2enmod proxy_uwsgi
|
||||
|
||||
In :ref:`The Debian Layout` you create a ``searxng.conf`` with the
|
||||
``<Location /searx >`` directive and save this file in the *sites
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
In the ``/etc/httpd/conf/httpd.conf`` file, activate LoadModule_
|
||||
directives:
|
||||
|
||||
.. code:: apache
|
||||
|
||||
LoadModule ssl_module modules/mod_ssl.so
|
||||
LoadModule headers_module modules/mod_headers.so
|
||||
LoadModule proxy_module modules/mod_proxy.so
|
||||
LoadModule proxy_http_module modules/mod_proxy_http.so
|
||||
LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
|
||||
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
In the ``/etc/httpd/conf/httpd.conf`` file, activate LoadModule_
|
||||
directives:
|
||||
|
||||
.. code:: apache
|
||||
|
||||
LoadModule ssl_module modules/mod_ssl.so
|
||||
LoadModule headers_module modules/mod_headers.so
|
||||
LoadModule proxy_module modules/mod_proxy.so
|
||||
LoadModule proxy_http_module modules/mod_proxy_http.so
|
||||
LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
|
||||
|
||||
|
||||
.. _apache sites:
|
||||
|
||||
Apache sites
|
||||
------------
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
In :ref:`Debian's Apache layout` you create a ``searxng.conf`` with the
|
||||
``<Location /searxng >`` directive and save this file in the *sites
|
||||
available* folder at ``/etc/apache2/sites-available``. To enable the
|
||||
``searxng.conf`` use :man:`a2ensite`:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H a2ensite searxng.conf
|
||||
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
In the ``/etc/httpd/conf/httpd.conf`` file, activate headers and proxy
|
||||
modules (LoadModule_):
|
||||
In the ``/etc/httpd/conf/httpd.conf`` file add a IncludeOptional_
|
||||
directive:
|
||||
|
||||
.. code:: apache
|
||||
|
||||
FIXME needs test
|
||||
IncludeOptional sites-enabled/*.conf
|
||||
|
||||
LoadModule headers_module modules/mod_headers.so
|
||||
LoadModule proxy_module modules/mod_proxy.so
|
||||
LoadModule proxy_http_module modules/mod_proxy_http.so
|
||||
Create two folders, one for the *available sites* and one for the *enabled sites*:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
mkdir -p /etc/httpd/sites-available
|
||||
mkdir -p /etc/httpd/sites-enabled
|
||||
|
||||
Create configuration at ``/etc/httpd/sites-available`` and place a
|
||||
symlink to ``sites-enabled``:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sudo -H ln -s /etc/httpd/sites-available/searxng.conf \
|
||||
/etc/httpd/sites-enabled/searxng.conf
|
||||
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
In the ``/etc/httpd/conf/httpd.conf`` file, activate headers and proxy
|
||||
modules (LoadModule_):
|
||||
In the ``/etc/httpd/conf/httpd.conf`` file add a IncludeOptional_
|
||||
directive:
|
||||
|
||||
.. code:: apache
|
||||
|
||||
FIXME needs test
|
||||
IncludeOptional sites-enabled/*.conf
|
||||
|
||||
LoadModule headers_module modules/mod_headers.so
|
||||
LoadModule proxy_module modules/mod_proxy.so
|
||||
LoadModule proxy_http_module modules/mod_proxy_http.so
|
||||
Create two folders, one for the *available sites* and one for the *enabled sites*:
|
||||
|
||||
With ProxyPreserveHost_ the incoming Host HTTP request header is passed to the
|
||||
proxied host.
|
||||
.. code:: bash
|
||||
|
||||
.. _apache searxng via filtron plus morty:
|
||||
mkdir -p /etc/httpd/sites-available
|
||||
mkdir -p /etc/httpd/sites-enabled
|
||||
|
||||
Create configuration at ``/etc/httpd/sites-available`` and place a
|
||||
symlink to ``sites-enabled``:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sudo -H ln -s /etc/httpd/sites-available/searxng.conf \
|
||||
/etc/httpd/sites-enabled/searxng.conf
|
||||
|
||||
|
||||
.. _apache searxng site:
|
||||
|
||||
Apache's SearXNG site
|
||||
=====================
|
||||
|
||||
.. _mod_uwsgi: https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-uwsgi
|
||||
|
||||
.. sidebar:: uWSGI
|
||||
|
||||
Use mod_proxy_uwsgi_ / don't use the old mod_uwsgi_ anymore.
|
||||
|
||||
To proxy the incoming requests to the SearXNG instance Apache needs the
|
||||
mod_proxy_ module (:ref:`apache modules`).
|
||||
|
||||
.. sidebar:: HTTP headers
|
||||
|
||||
With ProxyPreserveHost_ the incoming ``Host`` header is passed to the proxied
|
||||
host.
|
||||
|
||||
Depending on what your SearXNG installation is listening on, you need a http
|
||||
mod_proxy_http_) or socket (mod_proxy_uwsgi_) communication to upstream.
|
||||
|
||||
The :ref:`installation scripts` installs the :ref:`reference setup
|
||||
<use_default_settings.yml>` and a :ref:`uwsgi setup` that listens on a socket by default.
|
||||
You can install and activate your own ``searxng.conf`` like shown in
|
||||
:ref:`apache sites`.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: SearXNG via filtron plus morty
|
||||
.. group-tab:: socket
|
||||
|
||||
Use this setup, if your instance is public to the internet, compare
|
||||
figure: :ref:`architecture <arch public>` and :ref:`installation scripts`.
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START apache socket
|
||||
:end-before: END apache socket
|
||||
|
||||
1. Configure a reverse proxy for :ref:`filtron <filtron.sh>`, listening on
|
||||
*localhost 4004* (:ref:`filtron route request`):
|
||||
.. group-tab:: http
|
||||
|
||||
.. code:: apache
|
||||
|
||||
<Location /searx >
|
||||
|
||||
# SetEnvIf Request_URI "/searx" dontlog
|
||||
# CustomLog /dev/null combined env=dontlog
|
||||
|
||||
Require all granted
|
||||
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
#Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
|
||||
Allow from all
|
||||
|
||||
ProxyPreserveHost On
|
||||
ProxyPass http://127.0.0.1:4004
|
||||
RequestHeader set X-Script-Name /searx
|
||||
|
||||
</Location>
|
||||
|
||||
2. Configure reverse proxy for :ref:`morty <searxng morty>`, listening on
|
||||
*localhost 3000*
|
||||
|
||||
.. code:: apache
|
||||
|
||||
ProxyPreserveHost On
|
||||
|
||||
<Location /morty >
|
||||
|
||||
# SetEnvIf Request_URI "/morty" dontlog
|
||||
# CustomLog /dev/null combined env=dontlog
|
||||
|
||||
Require all granted
|
||||
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
#Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
|
||||
Allow from all
|
||||
|
||||
ProxyPass http://127.0.0.1:3000
|
||||
RequestHeader set X-Script-Name /morty
|
||||
|
||||
</Location>
|
||||
|
||||
For a fully result proxification add :ref:`morty's <searxng morty>` **public
|
||||
URL** to your :origin:`searx/settings.yml`:
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
result_proxy:
|
||||
# replace example.org with your server's public name
|
||||
url : https://example.org/morty
|
||||
key : !!binary "insert_your_morty_proxy_key_here"
|
||||
|
||||
server:
|
||||
image_proxy : True
|
||||
|
||||
uWSGI support
|
||||
=============
|
||||
|
||||
Be warned, with this setup, your instance isn't :ref:`protected <searxng
|
||||
filtron>`, nevertheless it is good enough for intranet usage. In modern Linux
|
||||
distributions, the `mod_proxy_uwsgi`_ is compiled into the *normal* apache
|
||||
package and you need to install only the :ref:`uWSGI <searxng uwsgi>` package:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
.. code:: sh
|
||||
|
||||
sudo -H apt-get install uwsgi
|
||||
|
||||
# Ubuntu =< 18.04
|
||||
sudo -H apt-get install libapache2-mod-proxy-uwsgi
|
||||
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
.. code:: sh
|
||||
|
||||
sudo -H pacman -S uwsgi
|
||||
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
.. code:: sh
|
||||
|
||||
sudo -H dnf install uwsgi
|
||||
|
||||
The next example shows a configuration using the `uWSGI Apache support`_ via
|
||||
unix sockets and `mod_proxy_uwsgi`_.
|
||||
|
||||
For socket communication, you have to activate ``socket =
|
||||
/run/uwsgi/app/searx/socket`` and comment out the ``http = 127.0.0.1:8888``
|
||||
configuration in your :ref:`uwsgi ini file <uwsgi configuration>`. If not
|
||||
already exists, create a folder for the unix sockets, which can be used by the
|
||||
SearXNG account (see :ref:`create searxng user`):
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sudo -H mkdir -p /run/uwsgi/app/searx/
|
||||
sudo -H chown -R searx:searx /run/uwsgi/app/searx/
|
||||
|
||||
If the server is public; to limit access to your intranet replace ``Allow from
|
||||
all`` directive and replace ``192.168.0.0/16`` with your subnet IP/class.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
.. code:: apache
|
||||
|
||||
LoadModule headers_module /usr/lib/apache2/mod_headers.so
|
||||
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
|
||||
LoadModule proxy_uwsgi_module /usr/lib/apache2/modules/mod_proxy_uwsgi.so
|
||||
|
||||
# SetEnvIf Request_URI /searx dontlog
|
||||
# CustomLog /dev/null combined env=dontlog
|
||||
|
||||
<Location /searx>
|
||||
|
||||
Require all granted
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
# Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
|
||||
Allow from all
|
||||
|
||||
ProxyPreserveHost On
|
||||
ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
|
||||
|
||||
</Location>
|
||||
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
.. code:: apache
|
||||
|
||||
FIXME needs test
|
||||
|
||||
LoadModule proxy_module modules/mod_proxy.so
|
||||
LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
|
||||
|
||||
# SetEnvIf Request_URI /searx dontlog
|
||||
# CustomLog /dev/null combined env=dontlog
|
||||
|
||||
<Location /searx>
|
||||
|
||||
Require all granted
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
# Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
|
||||
Allow from all
|
||||
|
||||
ProxyPreserveHost On
|
||||
ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
|
||||
|
||||
</Location>
|
||||
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
.. code:: apache
|
||||
|
||||
FIXME needs test
|
||||
|
||||
LoadModule proxy_module modules/mod_proxy.so
|
||||
LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
|
||||
<IfModule proxy_uwsgi_module>
|
||||
|
||||
# SetEnvIf Request_URI /searx dontlog
|
||||
# CustomLog /dev/null combined env=dontlog
|
||||
|
||||
<Location /searx>
|
||||
|
||||
Require all granted
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
# Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
|
||||
Allow from all
|
||||
|
||||
ProxyPreserveHost On
|
||||
ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
|
||||
|
||||
</Location>
|
||||
|
||||
</IfModule>
|
||||
|
||||
.. group-tab:: old mod_wsgi
|
||||
|
||||
We show this only for historical reasons, DON'T USE `mod_uwsgi
|
||||
<https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-uwsgi>`_.
|
||||
ANYMORE!
|
||||
|
||||
.. code:: apache
|
||||
|
||||
<IfModule mod_uwsgi.c>
|
||||
|
||||
# SetEnvIf Request_URI "/searx" dontlog
|
||||
# CustomLog /dev/null combined env=dontlog
|
||||
|
||||
<Location /searx >
|
||||
|
||||
Require all granted
|
||||
|
||||
Options FollowSymLinks Indexes
|
||||
SetHandler uwsgi-handler
|
||||
uWSGISocket /run/uwsgi/app/searx/socket
|
||||
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
# Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
|
||||
Allow from all
|
||||
|
||||
</Location>
|
||||
|
||||
</IfModule>
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START apache http
|
||||
:end-before: END apache http
|
||||
|
||||
.. _restart apache:
|
||||
|
||||
Restart service
|
||||
===============
|
||||
Restart service:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H systemctl restart apache2
|
||||
sudo -H service uwsgi restart searx
|
||||
sudo -H service uwsgi restart searxng
|
||||
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H systemctl restart httpd
|
||||
sudo -H systemctl restart uwsgi@searx
|
||||
sudo -H systemctl restart uwsgi@searxng
|
||||
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H systemctl restart httpd
|
||||
sudo -H touch /etc/uwsgi.d/searxng.ini
|
||||
|
@ -489,27 +376,13 @@ disable logs
|
|||
============
|
||||
|
||||
For better privacy you can disable Apache logs. In the examples above activate
|
||||
one of the lines and `restart apache`_::
|
||||
one of the lines and `restart apache`_:
|
||||
|
||||
.. code:: apache
|
||||
|
||||
# SetEnvIf Request_URI "/searx" dontlog
|
||||
# CustomLog /dev/null combined env=dontlog
|
||||
SetEnvIf Request_URI "/searxng" dontlog
|
||||
# CustomLog /dev/null combined env=dontlog
|
||||
|
||||
The ``CustomLog`` directive disable logs for the whole (virtual) server, use it
|
||||
when the URL of the service does not have a path component (``/searx``) / is
|
||||
located at root (``/``).
|
||||
|
||||
.. _The Debian Layout:
|
||||
|
||||
The Debian Layout
|
||||
=================
|
||||
|
||||
Be aware that the Debian layout is quite different from the standard Apache
|
||||
configuration. For details look at the README.Debian_
|
||||
(``/usr/share/doc/apache2/README.Debian.gz``). Some commands you should know on
|
||||
Debian:
|
||||
|
||||
* :man:`apache2ctl`: Apache HTTP server control interface
|
||||
* :man:`a2enmod`, :man:`a2dismod`: switch on/off modules
|
||||
* :man:`a2enconf`, :man:`a2disconf`: switch on/off configurations
|
||||
* :man:`a2ensite`, :man:`a2dissite`: switch on/off sites
|
||||
The ``CustomLog`` directive disables logs for the entire (virtual) server, use it
|
||||
when the URL of the service does not have a path component (``/searxng``), so when
|
||||
SearXNG is located at root (``/``).
|
||||
|
|
|
@ -1,37 +1,60 @@
|
|||
|
||||
.. _installation docker:
|
||||
|
||||
===================
|
||||
Docker installation
|
||||
===================
|
||||
================
|
||||
Docker Container
|
||||
================
|
||||
|
||||
.. _ENTRYPOINT: https://docs.docker.com/engine/reference/builder/#entrypoint
|
||||
.. _searxng/searxng @dockerhub: https://hub.docker.com/r/searxng/searxng
|
||||
.. _searxng-docker: https://github.com/searxng/searxng-docker
|
||||
.. _[filtron]: https://hub.docker.com/r/dalf/filtron
|
||||
.. _[morty]: https://hub.docker.com/r/dalf/morty
|
||||
.. _[caddy]: https://hub.docker.com/_/caddy
|
||||
.. _Redis: https://redis.io/
|
||||
|
||||
----
|
||||
|
||||
.. sidebar:: info
|
||||
|
||||
- `searxng/searxng @dockerhub`_
|
||||
- :origin:`Dockerfile`
|
||||
- `searxng/searxng @dockerhub <https://hub.docker.com/r/searxng/searxng>`_
|
||||
- `Docker overview <https://docs.docker.com/get-started/overview>`_
|
||||
- `Docker Cheat Sheet <https://www.docker.com/sites/default/files/d8/2019-09/docker-cheat-sheet.pdf>`_
|
||||
- `Alpine Linux <https://alpinelinux.org>`_ `(wiki) <https://en.wikipedia.org/wiki/Alpine_Linux>`__ `apt packages <https://pkgs.alpinelinux.org/packages>`_
|
||||
- `Docker Cheat Sheet <https://docs.docker.com/get-started/docker_cheatsheet.pdf>`_
|
||||
- `Alpine Linux <https://alpinelinux.org>`_
|
||||
`(wiki) <https://en.wikipedia.org/wiki/Alpine_Linux>`__
|
||||
`apt packages <https://pkgs.alpinelinux.org/packages>`_
|
||||
- Alpine's ``/bin/sh`` is :man:`dash`
|
||||
|
||||
.. tip::
|
||||
**If you intend to create a public instance using Docker, use our well maintained
|
||||
docker container**
|
||||
|
||||
If you intend to create a public instance using Docker, use our well
|
||||
maintained searxng-docker_ image which includes
|
||||
- `searxng/searxng @dockerhub`_.
|
||||
|
||||
- :ref:`protection <searxng filtron>` `[filtron]`_,
|
||||
- a :ref:`result proxy <searxng morty>` `[morty]`_ and
|
||||
- a HTTPS reverse proxy `[caddy]`_.
|
||||
.. sidebar:: hint
|
||||
|
||||
Make sure you have `installed Docker <https://docs.docker.com/get-docker/>`_ and
|
||||
on Linux, don't forget to add your user to the docker group (log out and log
|
||||
back in so that your group membership is re-evaluated):
|
||||
The rest of this article is of interest only to those who want to create and
|
||||
maintain their own Docker images.
|
||||
|
||||
The sources are hosted at searxng-docker_ and the container includes:
|
||||
|
||||
- a HTTPS reverse proxy `[caddy]`_ and
|
||||
- a Redis_ DB
|
||||
|
||||
The `default SearXNG setup <https://github.com/searxng/searxng-docker/blob/master/searxng/settings.yml>`_
|
||||
of this container:
|
||||
|
||||
- enables :ref:`limiter <limiter>` to protect against bots
|
||||
- enables :ref:`image proxy <image_proxy>` for better privacy
|
||||
- enables :ref:`cache busting <static_use_hash>` to save bandwith
|
||||
|
||||
----
|
||||
|
||||
|
||||
Get Docker
|
||||
==========
|
||||
|
||||
If you plan to build and maintain a docker image by yourself, make sure you have
|
||||
`Docker installed <https://docs.docker.com/get-docker/>`_. On Linux don't
|
||||
forget to add your user to the docker group (log out and log back in so that
|
||||
your group membership is re-evaluated):
|
||||
|
||||
.. code:: sh
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
.. _installation nginx:
|
||||
|
||||
==================
|
||||
Install with nginx
|
||||
==================
|
||||
=====
|
||||
NGINX
|
||||
=====
|
||||
|
||||
.. _nginx:
|
||||
https://docs.nginx.com/nginx/admin-guide/
|
||||
|
@ -19,6 +19,19 @@ Install with nginx
|
|||
.. _SCRIPT_NAME:
|
||||
https://werkzeug.palletsprojects.com/en/1.0.x/wsgi/#werkzeug.wsgi.get_script_name
|
||||
|
||||
This section explains how to set up a SearXNG instance using the HTTP server nginx_.
|
||||
If you have used the :ref:`installation scripts` and do not have any special preferences
|
||||
you can install the :ref:`SearXNG site <nginx searxng site>` using
|
||||
:ref:`searxng.sh <searxng.sh overview>`:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/searxng.sh install nginx
|
||||
|
||||
If you have special interests or problems with setting up nginx, the following
|
||||
section might give you some guidance.
|
||||
|
||||
|
||||
.. sidebar:: further reading
|
||||
|
||||
- nginx_
|
||||
|
@ -27,39 +40,23 @@ Install with nginx
|
|||
- `Getting Started wiki`_
|
||||
- `uWSGI support from nginx`_
|
||||
|
||||
|
||||
.. contents:: Contents
|
||||
:depth: 2
|
||||
:local:
|
||||
:backlinks: entry
|
||||
|
||||
----
|
||||
|
||||
**Install** :ref:`nginx searxng site` using :ref:`filtron.sh <filtron.sh overview>`
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/filtron.sh nginx install
|
||||
|
||||
**Install** :ref:`nginx searxng site` using :ref:`morty.sh <morty.sh overview>`
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/morty.sh nginx install
|
||||
|
||||
----
|
||||
|
||||
|
||||
The nginx HTTP server
|
||||
=====================
|
||||
|
||||
If nginx_ is not installed (uwsgi will not work with the package nginx-light),
|
||||
install it now.
|
||||
If nginx_ is not installed, install it now.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H apt-get install nginx
|
||||
|
||||
|
@ -81,18 +78,18 @@ install it now.
|
|||
|
||||
Now at http://localhost you should see a *Welcome to nginx!* page, on Fedora you
|
||||
see a *Fedora Webserver - Test Page*. The test page comes from the default
|
||||
`nginx server configuration`_. How this default intro site is configured,
|
||||
`nginx server configuration`_. How this default site is configured,
|
||||
depends on the linux distribution:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
less /etc/nginx/nginx.conf
|
||||
|
||||
there is a line including site configurations from:
|
||||
There is one line that includes site configurations from:
|
||||
|
||||
.. code:: nginx
|
||||
|
||||
|
@ -104,7 +101,7 @@ depends on the linux distribution:
|
|||
|
||||
less /etc/nginx/nginx.conf
|
||||
|
||||
in there is a configuration section named ``server``:
|
||||
There is a configuration section named ``server``:
|
||||
|
||||
.. code-block:: nginx
|
||||
|
||||
|
@ -120,249 +117,121 @@ depends on the linux distribution:
|
|||
|
||||
less /etc/nginx/nginx.conf
|
||||
|
||||
there is a line including site configurations from:
|
||||
There is one line that includes site configurations from:
|
||||
|
||||
.. code:: nginx
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
|
||||
.. _nginx searxng site:
|
||||
|
||||
A nginx SearXNG site
|
||||
NGINX's SearXNG site
|
||||
====================
|
||||
|
||||
.. sidebar:: public to the internet?
|
||||
Now you have to create a configuration file (``searxng.conf``) for the SearXNG
|
||||
site. If nginx_ is new to you, the `nginx beginners guide`_ is a good starting
|
||||
point and the `Getting Started wiki`_ is always a good resource *to keep in the
|
||||
pocket*.
|
||||
|
||||
If your SearXNG instance is public, stop here and first install :ref:`filtron
|
||||
reverse proxy <filtron.sh>` and :ref:`result proxy morty <morty.sh>`, see
|
||||
:ref:`installation scripts`. If already done, follow setup: *SearXNG via
|
||||
filtron plus morty*.
|
||||
Depending on what your SearXNG installation is listening on, you need a http or socket
|
||||
communication to upstream.
|
||||
|
||||
Now you have to create a configuration for the SearXNG site. If nginx_ is new to
|
||||
you, the `nginx beginners guide`_ is a good starting point and the `Getting
|
||||
Started wiki`_ is always a good resource *to keep in the pocket*.
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: socket
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START nginx socket
|
||||
:end-before: END nginx socket
|
||||
|
||||
.. group-tab:: http
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START nginx http
|
||||
:end-before: END nginx http
|
||||
|
||||
The :ref:`installation scripts` installs the :ref:`reference setup
|
||||
<use_default_settings.yml>` and a :ref:`uwsgi setup` that listens on a socket by default.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
Create configuration at ``/etc/nginx/sites-available/searxng`` and place a
|
||||
symlink to sites-enabled:
|
||||
Create configuration at ``/etc/nginx/sites-available/`` and place a
|
||||
symlink to ``sites-enabled``:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H ln -s /etc/nginx/sites-available/searxng /etc/nginx/sites-enabled/searxng
|
||||
sudo -H ln -s /etc/nginx/sites-available/searxng.conf \
|
||||
/etc/nginx/sites-enabled/searxng.conf
|
||||
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
In the ``/etc/nginx/nginx.conf`` file, replace the configuration section
|
||||
named ``server``.
|
||||
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
Create configuration at ``/etc/nginx/conf.d/searxng`` and place a
|
||||
symlink to sites-enabled:
|
||||
|
||||
.. _nginx searxng via filtron plus morty:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: SearXNG via filtron plus morty
|
||||
|
||||
Use this setup, if your instance is public to the internet, compare
|
||||
figure: :ref:`architecture <arch public>` and :ref:`installation scripts`.
|
||||
|
||||
1. Configure a reverse proxy for :ref:`filtron <filtron.sh>`, listening on
|
||||
*localhost 4004* (:ref:`filtron route request`):
|
||||
|
||||
.. code:: nginx
|
||||
|
||||
# https://example.org/searx
|
||||
|
||||
location /searx {
|
||||
proxy_pass http://127.0.0.1:4004/;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_set_header X-Script-Name /searx;
|
||||
}
|
||||
|
||||
location /searx/static/ {
|
||||
alias /usr/local/searx/searx-src/searx/static/;
|
||||
}
|
||||
|
||||
|
||||
2. Configure reverse proxy for :ref:`morty <searxng morty>`, listening on
|
||||
*localhost 3000*:
|
||||
|
||||
.. code:: nginx
|
||||
|
||||
# https://example.org/morty
|
||||
|
||||
location /morty {
|
||||
proxy_pass http://127.0.0.1:3000/;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
}
|
||||
|
||||
For a fully result proxification add :ref:`morty's <searxng morty>` **public
|
||||
URL** to your :origin:`searx/settings.yml`:
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
result_proxy:
|
||||
# replace example.org with your server's public name
|
||||
url : https://example.org/morty
|
||||
key : !!binary "insert_your_morty_proxy_key_here"
|
||||
|
||||
server:
|
||||
image_proxy : True
|
||||
|
||||
|
||||
.. group-tab:: proxy or uWSGI
|
||||
|
||||
Be warned, with this setup, your instance isn't :ref:`protected <searxng
|
||||
filtron>`. Nevertheless it is good enough for intranet usage and it is a
|
||||
excellent example of; *how different services can be set up*. The next
|
||||
example shows a reverse proxy configuration wrapping the :ref:`searx-uWSGI
|
||||
application <uwsgi configuration>`, listening on ``http =
|
||||
127.0.0.1:8888``.
|
||||
|
||||
.. code:: nginx
|
||||
|
||||
# https://hostname.local/
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8888;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_buffering off;
|
||||
}
|
||||
|
||||
Alternatively you can use the `uWSGI support from nginx`_ via unix
|
||||
sockets. For socket communication, you have to activate ``socket =
|
||||
/run/uwsgi/app/searx/socket`` and comment out the ``http =
|
||||
127.0.0.1:8888`` configuration in your :ref:`uwsgi ini file <uwsgi
|
||||
configuration>`.
|
||||
|
||||
The example shows a nginx virtual ``server`` configuration, listening on
|
||||
port 80 (IPv4 and IPv6 http://[::]:80). The uWSGI app is configured at
|
||||
location ``/`` by importing the `uwsgi_params`_ and passing requests to
|
||||
the uWSGI socket (``uwsgi_pass``). The ``server``\'s root points to the
|
||||
:ref:`searx-src clone <searx-src>` and wraps directly the
|
||||
:origin:`searx/static/` content at ``location /static``.
|
||||
In the ``/etc/nginx/nginx.conf`` file, in the ``server`` section add a
|
||||
`include <https://nginx.org/en/docs/ngx_core_module.html#include>`_
|
||||
directive:
|
||||
|
||||
.. code:: nginx
|
||||
|
||||
server {
|
||||
# replace hostname.local with your server's name
|
||||
server_name hostname.local;
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
location / {
|
||||
include uwsgi_params;
|
||||
uwsgi_pass unix:/run/uwsgi/app/searx/socket;
|
||||
}
|
||||
|
||||
root /usr/local/searx/searx-src/searx;
|
||||
location /static { }
|
||||
# ...
|
||||
include /etc/nginx/default.d/*.conf;
|
||||
# ...
|
||||
}
|
||||
|
||||
If not already exists, create a folder for the unix sockets, which can be
|
||||
used by the SearXNG account:
|
||||
Create two folders, one for the *available sites* and one for the *enabled sites*:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
mkdir -p /run/uwsgi/app/searx/
|
||||
sudo -H chown -R searx:searx /run/uwsgi/app/searx/
|
||||
mkdir -p /etc/nginx/default.d
|
||||
mkdir -p /etc/nginx/default.apps-available
|
||||
|
||||
.. group-tab:: \.\. at subdir URL
|
||||
Create configuration at ``/etc/nginx/default.apps-available`` and place a
|
||||
symlink to ``default.d``:
|
||||
|
||||
Be warned, with these setups, your instance isn't :ref:`protected <searxng
|
||||
filtron>`. The examples are just here to demonstrate how to export the
|
||||
SearXNG application from a subdirectory URL ``https://example.org/searx/``.
|
||||
.. code:: bash
|
||||
|
||||
.. code:: nginx
|
||||
sudo -H ln -s /etc/nginx/default.apps-available/searxng.conf \
|
||||
/etc/nginx/default.d/searxng.conf
|
||||
|
||||
# https://hostname.local/searx
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
location /searx {
|
||||
proxy_pass http://127.0.0.1:8888;
|
||||
Create a folder for the *available sites*:
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_set_header X-Script-Name /searx;
|
||||
proxy_buffering off;
|
||||
}
|
||||
.. code:: bash
|
||||
|
||||
location /searx/static/ {
|
||||
alias /usr/local/searx/searx-src/searx/static/;
|
||||
}
|
||||
mkdir -p /etc/nginx/default.apps-available
|
||||
|
||||
The ``X-Script-Name /searx`` is needed by the SearXNG implementation to
|
||||
calculate relative URLs correct. The next example shows a uWSGI
|
||||
configuration. Since there are no HTTP headers in a (u)WSGI protocol, the
|
||||
value is shipped via the SCRIPT_NAME_ in the WSGI environment.
|
||||
Create configuration at ``/etc/nginx/default.apps-available`` and place a
|
||||
symlink to ``conf.d``:
|
||||
|
||||
.. code:: nginx
|
||||
.. code:: bash
|
||||
|
||||
# https://hostname.local/searx
|
||||
sudo -H ln -s /etc/nginx/default.apps-available/searxng.conf \
|
||||
/etc/nginx/conf.d/searxng.conf
|
||||
|
||||
location /searx {
|
||||
uwsgi_param SCRIPT_NAME /searx;
|
||||
include uwsgi_params;
|
||||
uwsgi_pass unix:/run/uwsgi/app/searx/socket;
|
||||
}
|
||||
|
||||
location /searx/static/ {
|
||||
alias /usr/local/searx/searx-src/searx/;
|
||||
}
|
||||
|
||||
For SearXNG to work correctly the ``base_url`` must be set in the
|
||||
:origin:`searx/settings.yml`.
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
server:
|
||||
# replace example.org with your server's public name
|
||||
base_url : https://example.org/searx/
|
||||
|
||||
|
||||
Restart service:
|
||||
Restart services:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H systemctl restart nginx
|
||||
sudo -H service uwsgi restart searx
|
||||
sudo -H service uwsgi restart searxng
|
||||
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H systemctl restart nginx
|
||||
sudo -H systemctl restart uwsgi@searx
|
||||
sudo -H systemctl restart uwsgi@searxng
|
||||
|
||||
.. group-tab:: Fedora
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
sudo -H systemctl restart nginx
|
||||
sudo -H touch /etc/uwsgi.d/searxng.ini
|
||||
|
|
62
docs/admin/installation-scripts.rst
Normal file
62
docs/admin/installation-scripts.rst
Normal file
|
@ -0,0 +1,62 @@
|
|||
.. _installation scripts:
|
||||
|
||||
===================
|
||||
Installation Script
|
||||
===================
|
||||
|
||||
.. sidebar:: Update the OS first!
|
||||
|
||||
To avoid unwanted side effects, update your OS before installing SearXNG.
|
||||
|
||||
The following will install a setup as shown in :ref:`the reference architecture
|
||||
<arch public>`. First you need to get a clone of the repository. The clone is only needed for
|
||||
the installation procedure and some maintenance tasks.
|
||||
|
||||
.. sidebar:: further read
|
||||
|
||||
- :ref:`toolboxing`
|
||||
|
||||
Jump to a folder that is readable by *others* and start to clone SearXNG,
|
||||
alternatively you can create your own fork and clone from there.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ cd ~/Downloads
|
||||
$ git clone https://github.com/searxng/searxng.git searxng
|
||||
$ cd searxng
|
||||
|
||||
.. sidebar:: further read
|
||||
|
||||
- :ref:`inspect searxng`
|
||||
|
||||
To install a SearXNG :ref:`reference setup <use_default_settings.yml>`
|
||||
including a :ref:`uWSGI setup <architecture uWSGI>` as described in the
|
||||
:ref:`installation basic` and in the :ref:`searxng uwsgi` section type:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/searxng.sh install all
|
||||
|
||||
.. attention::
|
||||
|
||||
For the installation procedure, use a *sudoer* login to run the scripts. If
|
||||
you install from ``root``, take into account that the scripts are creating a
|
||||
``searxng`` user. In the installation procedure this new created user does
|
||||
need read access to the cloned SearXNG repository, which is not the case if you clone
|
||||
it into a folder below ``/root``!
|
||||
|
||||
.. sidebar:: further read
|
||||
|
||||
- :ref:`update searxng`
|
||||
|
||||
.. _caddy: https://hub.docker.com/_/caddy
|
||||
|
||||
When all services are installed and running fine, you can add SearXNG to your
|
||||
HTTP server. We do not have any preferences for the HTTP server, you can use
|
||||
whatever you prefer.
|
||||
|
||||
We use caddy in our :ref:`docker image <installation docker>` and we have
|
||||
implemented installation procedures for:
|
||||
|
||||
- :ref:`installation nginx`
|
||||
- :ref:`installation apache`
|
|
@ -9,15 +9,16 @@ Step by step installation
|
|||
:local:
|
||||
:backlinks: entry
|
||||
|
||||
Step by step installation with virtualenv. For Ubuntu, be sure to have enable
|
||||
universe repository.
|
||||
|
||||
In this section we show the setup of a SearXNG instance that will be installed
|
||||
by the :ref:`installation scripts`.
|
||||
|
||||
.. _install packages:
|
||||
|
||||
Install packages
|
||||
================
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START distro-packages
|
||||
:end-before: END distro-packages
|
||||
|
||||
|
@ -30,32 +31,32 @@ Install packages
|
|||
Create user
|
||||
===========
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START create user
|
||||
:end-before: END create user
|
||||
|
||||
.. _searx-src:
|
||||
.. _searxng-src:
|
||||
|
||||
Install SearXNG & dependencies
|
||||
==============================
|
||||
|
||||
Start a interactive shell from new created user and clone searx:
|
||||
Start a interactive shell from new created user and clone SearXNG:
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START clone searxng
|
||||
:end-before: END clone searxng
|
||||
|
||||
In the same shell create *virtualenv*:
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START create virtualenv
|
||||
:end-before: END create virtualenv
|
||||
|
||||
To install searx's dependencies, exit the SearXNG *bash* session you opened above
|
||||
and restart a new. Before install, first check if your *virtualenv* was sourced
|
||||
To install SearXNG's dependencies, exit the SearXNG *bash* session you opened above
|
||||
and start a new one. Before installing, check if your *virtualenv* was sourced
|
||||
from the login (*~/.profile*):
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START manage.sh update_packages
|
||||
:end-before: END manage.sh update_packages
|
||||
|
||||
|
@ -77,30 +78,41 @@ Configuration
|
|||
- :ref:`settings use_default_settings`
|
||||
- :origin:`/etc/searxng/settings.yml <utils/templates/etc/searxng/settings.yml>`
|
||||
|
||||
To create a initial ``/etc/searxng/settings.yml`` you can start with a copy of
|
||||
the file :origin:`utils/templates/etc/searxng/settings.yml`. This setup
|
||||
To create a initial ``/etc/searxng/settings.yml`` we recommend to start with a
|
||||
copy of the file :origin:`utils/templates/etc/searxng/settings.yml`. This setup
|
||||
:ref:`use default settings <settings use_default_settings>` from
|
||||
:origin:`searx/settings.yml`.
|
||||
:origin:`searx/settings.yml` and is shown in the tab *"Use default settings"*
|
||||
below. This setup:
|
||||
|
||||
For a *minimal setup*, configure like shown below – replace ``searx@$(uname
|
||||
-n)`` with a name of your choice, set ``ultrasecretkey`` -- *and/or* edit
|
||||
``/etc/searxng/settings.yml`` to your needs.
|
||||
- enables :ref:`limiter <limiter>` to protect against bots
|
||||
- enables :ref:`image proxy <image_proxy>` for better privacy
|
||||
- enables :ref:`cache busting <static_use_hash>` to save bandwith
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
:start-after: START searxng config
|
||||
:end-before: END searxng config
|
||||
Modify the ``/etc/searxng/settings.yml`` to your needs:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Use default settings
|
||||
|
||||
.. literalinclude:: ../../utils/templates/etc/searxng/settings.yml
|
||||
:language: yaml
|
||||
.. literalinclude:: ../../utils/templates/etc/searxng/settings.yml
|
||||
:language: yaml
|
||||
:end-before: # hostname_replace:
|
||||
|
||||
To see the entire file jump to :origin:`utils/templates/etc/searxng/settings.yml`
|
||||
|
||||
.. group-tab:: searx/settings.yml
|
||||
|
||||
.. literalinclude:: ../../searx/settings.yml
|
||||
:language: yaml
|
||||
.. literalinclude:: ../../searx/settings.yml
|
||||
:language: yaml
|
||||
:end-before: # hostname_replace:
|
||||
|
||||
To see the entire file jump to :origin:`searx/settings.yml`
|
||||
|
||||
For a *minimal setup* you need to set ``server:secret_key``.
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START searxng config
|
||||
:end-before: END searxng config
|
||||
|
||||
|
||||
Check
|
||||
|
@ -110,11 +122,11 @@ To check your SearXNG setup, optional enable debugging and start the *webapp*.
|
|||
SearXNG looks at the exported environment ``$SEARXNG_SETTINGS_PATH`` for a
|
||||
configuration file.
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START check searxng installation
|
||||
:end-before: END check searxng installation
|
||||
|
||||
If everything works fine, hit ``[CTRL-C]`` to stop the *webapp* and disable the
|
||||
debug option in ``settings.yml``. You can now exit SearXNG user bash (enter exit
|
||||
debug option in ``settings.yml``. You can now exit SearXNG user bash session (enter exit
|
||||
command twice). At this point SearXNG is not demonized; uwsgi allows this.
|
||||
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
.. _installation switch2ng:
|
||||
|
||||
============================
|
||||
Switch from searx to SearXNG
|
||||
============================
|
||||
|
||||
.. sidebar:: info
|
||||
|
||||
- :pull:`456`
|
||||
- :pull:`A comment about rolling release <446#issuecomment-954730358>`
|
||||
|
||||
.. contents:: Contents
|
||||
:depth: 2
|
||||
:local:
|
||||
:backlinks: entry
|
||||
|
||||
If you have a searx installation on your sever and want to switch to SearXNG,
|
||||
you need to uninstall searx first. If you have an old searx docker installation
|
||||
replace your docker image / see :ref:`installation docker`.
|
||||
|
||||
If your searx instance was installed *"Step by step"* or by the *"Installation
|
||||
scripts"*, you need to undo the installation procedure completely. If you have
|
||||
morty & filtron installed, it is recommended to uninstall these services also.
|
||||
In case of scripts, to uninstall use the scripts from the origin you installed
|
||||
searx from.
|
||||
|
||||
If you have removed the old searx installation, clone from SearXNG and and start
|
||||
with your installation procedure (e.g. :ref:`installation scripts`):
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ cd ~/Downloads
|
||||
$ git clone https://github.com/searxng/searxng.git searxng
|
||||
$ cd searxng
|
||||
$ ...
|
||||
|
||||
``.config.sh``
|
||||
==============
|
||||
|
||||
Please take into account; SearXNG has normalized ``.config.sh`` with
|
||||
``settings.yml`` and some of the environment settings has been removed from or
|
||||
renamed in the ``.config.sh``:
|
||||
|
||||
- :patch:`[mod] normalize .config.sh with settings.yml <f61c918d>`
|
||||
- :patch:`[fix] ./utils/filtron.sh - FILTRON_TARGET from YAML settings <7196a9b5>`
|
||||
- :patch:`SearXNG: SEARXNG_SETTINGS_PATH <253b8503>`
|
||||
|
||||
|
||||
Check after Installation
|
||||
========================
|
||||
|
||||
Once you have done your installation, you can run a SearXNG *check* procedure,
|
||||
to see if there are some left overs. In this example there exists a *old*
|
||||
``/etc/searx/settings.yml``::
|
||||
|
||||
$ sudo -H ./utils/searx.sh install check
|
||||
|
||||
============================
|
||||
SearXNG (check installation)
|
||||
============================
|
||||
ERROR: settings.yml in /etc/searx/ is deprecated, move file to folder /etc/searxng/
|
||||
INFO: SearXNG instance already installed at: /usr/local/searx/searx-src
|
||||
...
|
||||
INFO: Service account searx exists.
|
||||
INFO: ~searx: python environment is available.
|
||||
INFO: ~searx: SearXNG software is installed.
|
||||
INFO: uWSGI app searxng.ini is enabled.
|
||||
INFO searx : merge the default settings ( /usr/local/searx/searx-src/searx/settings.yml ) and the user setttings ( /etc/searxng/settings.yml )
|
||||
INFO searx : max_request_timeout=None
|
||||
|
||||
|
||||
To *check* the filtron & morty installations, use similar commands::
|
||||
|
||||
$ sudo -H /utils/filtron.sh install check
|
||||
$ sudo -H /utils/morty.sh install check
|
|
@ -1,7 +1,7 @@
|
|||
.. _searxng uwsgi:
|
||||
|
||||
=====
|
||||
uwsgi
|
||||
uWSGI
|
||||
=====
|
||||
|
||||
.. sidebar:: further reading
|
||||
|
@ -29,51 +29,77 @@ uwsgi
|
|||
Origin uWSGI
|
||||
============
|
||||
|
||||
How uWSGI is implemented by distributors is different. uWSGI itself
|
||||
recommend two methods
|
||||
.. _Tyrant mode:
|
||||
https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#tyrant-mode-secure-multi-user-hosting
|
||||
|
||||
`systemd.unit`_ template files as described here `One service per app in systemd`_.
|
||||
How uWSGI is implemented by distributors varies. The uWSGI project itself
|
||||
recommends two methods:
|
||||
|
||||
There is one `systemd unit template`_ and one `uwsgi ini file`_ per uWSGI-app
|
||||
placed at dedicated locations. Take archlinux and a searxng.ini as example::
|
||||
1. `systemd.unit`_ template file as described here `One service per app in systemd`_:
|
||||
|
||||
unit template --> /usr/lib/systemd/system/uwsgi@.service
|
||||
uwsgi ini files --> /etc/uwsgi/searxng.ini
|
||||
There is one `systemd unit template`_ on the system installed and one `uwsgi
|
||||
ini file`_ per uWSGI-app placed at dedicated locations. Take archlinux and a
|
||||
``searxng.ini`` as example::
|
||||
|
||||
The SearXNG app can be maintained as know from common systemd units::
|
||||
systemd template unit: /usr/lib/systemd/system/uwsgi@.service
|
||||
contains: [Service]
|
||||
ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi/%I.ini
|
||||
|
||||
systemctl enable uwsgi@searx
|
||||
systemctl start uwsgi@searx
|
||||
systemctl restart uwsgi@searx
|
||||
systemctl stop uwsgi@searx
|
||||
SearXNG application: /etc/uwsgi/searxng.ini
|
||||
links to: /etc/uwsgi/apps-available/searxng.ini
|
||||
|
||||
The `uWSGI Emperor`_ mode which fits for maintaining a large range of uwsgi apps.
|
||||
The SearXNG app (template ``/etc/uwsgi/%I.ini``) can be maintained as known
|
||||
from common systemd units:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
$ systemctl enable uwsgi@searxng
|
||||
$ systemctl start uwsgi@searxng
|
||||
$ systemctl restart uwsgi@searxng
|
||||
$ systemctl stop uwsgi@searxng
|
||||
|
||||
2. The `uWSGI Emperor`_ which fits for maintaining a large range of uwsgi
|
||||
apps and there is a `Tyrant mode`_ to secure multi-user hosting.
|
||||
|
||||
The Emperor mode is a special uWSGI instance that will monitor specific
|
||||
events. The Emperor mode (service) is started by a (common, not template)
|
||||
systemd unit. The Emperor service will scan specific directories for `uwsgi
|
||||
ini file`_\s (also know as *vassals*). If a *vassal* is added, removed or the
|
||||
timestamp is modified, a corresponding action takes place: a new uWSGI
|
||||
instance is started, reload or stopped. Take Fedora and a searxng.ini as
|
||||
example::
|
||||
events. The Emperor mode (the service) is started by a (common, not template)
|
||||
systemd unit.
|
||||
|
||||
The Emperor service will scan specific directories for `uwsgi ini file`_\s
|
||||
(also know as *vassals*). If a *vassal* is added, removed or the timestamp is
|
||||
modified, a corresponding action takes place: a new uWSGI instance is started,
|
||||
reload or stopped. Take Fedora and a ``searxng.ini`` as example::
|
||||
|
||||
to install & start SearXNG instance create --> /etc/uwsgi.d/searxng.ini
|
||||
to reload the instance edit timestamp --> touch /etc/uwsgi.d/searxng.ini
|
||||
to stop instance remove ini --> rm /etc/uwsgi.d/searxng.ini
|
||||
|
||||
to start a new SearXNG instance create --> /etc/uwsgi.d/searxng.ini
|
||||
to reload the instance edit timestamp --> touch /etc/uwsgi.d/searxng.ini
|
||||
to stop instance remove ini --> rm /etc/uwsgi.d/searxng.ini
|
||||
|
||||
Distributors
|
||||
============
|
||||
|
||||
The `uWSGI Emperor`_ mode and `systemd unit template`_ is what the distributors
|
||||
mostly offer their users, even if they differ in the way they implement both
|
||||
modes and their defaults. Another point they might differ is the packaging of
|
||||
modes and their defaults. Another point they might differ in is the packaging of
|
||||
plugins (if so, compare :ref:`install packages`) and what the default python
|
||||
interpreter is (python2 vs. python3).
|
||||
|
||||
Fedora starts a Emperor by default, while archlinux does not start any uwsgi
|
||||
service by default. Worth to know; debian (ubuntu) follow a complete different
|
||||
approach. *debian*: your are familiar with the apache infrastructure? .. they
|
||||
do similar for the uWSGI infrastructure (with less comfort), the folders are::
|
||||
While archlinux does not start a uWSGI service by default, Fedora (RHEL) starts
|
||||
a Emperor in `Tyrant mode`_ by default (you should have read :ref:`uWSGI Tyrant
|
||||
mode pitfalls`). Worth to know; debian (ubuntu) follow a complete different
|
||||
approach, read see :ref:`Debian's uWSGI layout`.
|
||||
|
||||
.. _Debian's uWSGI layout:
|
||||
|
||||
Debian's uWSGI layout
|
||||
---------------------
|
||||
|
||||
.. _uwsgi.README.Debian:
|
||||
https://salsa.debian.org/uwsgi-team/uwsgi/-/raw/debian/latest/debian/uwsgi.README.Debian
|
||||
|
||||
Be aware, Debian's uWSGI layout is quite different from the standard uWSGI
|
||||
configuration. Your are familiar with :ref:`Debian's Apache layout`? .. they do a
|
||||
similar thing for the uWSGI infrastructure. The folders are::
|
||||
|
||||
/etc/uwsgi/apps-available/
|
||||
/etc/uwsgi/apps-enabled/
|
||||
|
@ -82,29 +108,52 @@ The `uwsgi ini file`_ is enabled by a symbolic link::
|
|||
|
||||
ln -s /etc/uwsgi/apps-available/searxng.ini /etc/uwsgi/apps-enabled/
|
||||
|
||||
From debian's documentation (``/usr/share/doc/uwsgi/README.Debian.gz``): You
|
||||
could control specific instance(s) by issuing::
|
||||
More details can be found in the uwsgi.README.Debian_
|
||||
(``/usr/share/doc/uwsgi/README.Debian.gz``). Some commands you should know on
|
||||
Debian:
|
||||
|
||||
service uwsgi <command> <confname> <confname> ...
|
||||
.. code:: none
|
||||
|
||||
sudo -H service uwsgi start searx
|
||||
sudo -H service uwsgi stop searx
|
||||
Commands recognized by init.d script
|
||||
====================================
|
||||
|
||||
My experience is, that this command is a bit buggy.
|
||||
You can issue to init.d script following commands:
|
||||
* start | starts daemon
|
||||
* stop | stops daemon
|
||||
* reload | sends to daemon SIGHUP signal
|
||||
* force-reload | sends to daemon SIGTERM signal
|
||||
* restart | issues 'stop', then 'start' commands
|
||||
* status | shows status of daemon instance (running/not running)
|
||||
|
||||
.. _uwsgi configuration:
|
||||
'status' command must be issued with exactly one argument: '<confname>'.
|
||||
|
||||
Alltogether
|
||||
===========
|
||||
Controlling specific instances of uWSGI
|
||||
=======================================
|
||||
|
||||
Create the configuration ini-file according to your distribution (see below) and
|
||||
restart the uwsgi application.
|
||||
You could control specific instance(s) by issuing:
|
||||
|
||||
SYSTEMCTL_SKIP_REDIRECT=1 service uwsgi <command> <confname> <confname>...
|
||||
|
||||
where:
|
||||
* <command> is one of 'start', 'stop' etc.
|
||||
* <confname> is the name of configuration file (without extension)
|
||||
|
||||
For example, this is how instance for /etc/uwsgi/apps-enabled/hello.xml is
|
||||
started:
|
||||
|
||||
SYSTEMCTL_SKIP_REDIRECT=1 service uwsgi start hello
|
||||
|
||||
|
||||
.. _uWSGI maintenance:
|
||||
|
||||
uWSGI maintenance
|
||||
=================
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START searxng uwsgi-description ubuntu-20.04
|
||||
:end-before: END searxng uwsgi-description ubuntu-20.04
|
||||
|
||||
|
@ -112,7 +161,7 @@ restart the uwsgi application.
|
|||
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START searxng uwsgi-description arch
|
||||
:end-before: END searxng uwsgi-description arch
|
||||
|
||||
|
@ -120,16 +169,28 @@ restart the uwsgi application.
|
|||
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START searxng uwsgi-description fedora
|
||||
:end-before: END searxng uwsgi-description fedora
|
||||
|
||||
|
||||
.. _uwsgi setup:
|
||||
|
||||
uWSGI setup
|
||||
===========
|
||||
|
||||
Create the configuration ini-file according to your distribution and restart the
|
||||
uwsgi application. As shown below, the :ref:`installation scripts` installs by
|
||||
default:
|
||||
|
||||
- a uWSGI setup that listens on a socket and
|
||||
- enables :ref:`cache busting <static_use_hash>`.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: Ubuntu / debian
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START searxng uwsgi-appini ubuntu-20.04
|
||||
:end-before: END searxng uwsgi-appini ubuntu-20.04
|
||||
|
||||
|
@ -137,7 +198,7 @@ restart the uwsgi application.
|
|||
|
||||
.. group-tab:: Arch Linux
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START searxng uwsgi-appini arch
|
||||
:end-before: END searxng uwsgi-appini arch
|
||||
|
||||
|
@ -145,6 +206,63 @@ restart the uwsgi application.
|
|||
|
||||
.. group-tab:: Fedora / RHEL
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
|
||||
.. kernel-include:: $DOCS_BUILD/includes/searxng.rst
|
||||
:start-after: START searxng uwsgi-appini fedora
|
||||
:end-before: END searxng uwsgi-appini fedora
|
||||
|
||||
|
||||
.. _uWSGI Tyrant mode pitfalls:
|
||||
|
||||
Pitfalls of the Tyrant mode
|
||||
===========================
|
||||
|
||||
The implementation of the process owners and groups in the `Tyrant mode`_ is
|
||||
somewhat unusual and requires special consideration. In `Tyrant mode`_ mode the
|
||||
Emperor will run the vassal using the UID/GID of the vassal configuration file
|
||||
(user and group of the app ``.ini`` file).
|
||||
|
||||
.. _#2099@uWSGI: https://github.com/unbit/uwsgi/issues/2099
|
||||
.. _#752@uWSGI: https://github.com/unbit/uwsgi/pull/752
|
||||
.. _#2425uWSGI: https://github.com/unbit/uwsgi/issues/2425
|
||||
|
||||
Without option ``emperor-tyrant-initgroups=true`` in ``/etc/uwsgi.ini`` the
|
||||
process won't get the additional groups, but this option is not available in
|
||||
2.0.x branch (see `#2099@uWSGI`_) the feature `#752@uWSGI`_ has been merged (on
|
||||
Oct. 2014) to the master branch of uWSGI but had never been released; the last
|
||||
major release is from Dec. 2013, since the there had been only bugfix releases
|
||||
(see `#2425uWSGI`_). To shorten up:
|
||||
|
||||
**In Tyrant mode, there is no way to get additional groups, and the uWSGI
|
||||
process misses additional permissions that may be needed.**
|
||||
|
||||
For example on Fedora (RHEL): If you try to install a redis DB with socket
|
||||
communication and you want to connect to it from the SearXNG uWSGI, you will see a
|
||||
*Permission denied* in the log of your instance::
|
||||
|
||||
ERROR:searx.redisdb: [searxng (993)] can't connect redis DB ...
|
||||
ERROR:searx.redisdb: Error 13 connecting to unix socket: /usr/local/searxng-redis/run/redis.sock. Permission denied.
|
||||
ERROR:searx.plugins.limiter: init limiter DB failed!!!
|
||||
|
||||
Even if your *searxng* user of the uWSGI process is added to additional groups
|
||||
to give access to the socket from the redis DB::
|
||||
|
||||
$ groups searxng
|
||||
searxng : searxng searxng-redis
|
||||
|
||||
To see the effective groups of the uwsgi process, you have to look at the status
|
||||
of the process, by example::
|
||||
|
||||
$ ps -aef | grep '/usr/sbin/uwsgi --ini searxng.ini'
|
||||
searxng 93 92 0 12:43 ? 00:00:00 /usr/sbin/uwsgi --ini searxng.ini
|
||||
searxng 186 93 0 12:44 ? 00:00:01 /usr/sbin/uwsgi --ini searxng.ini
|
||||
|
||||
Here you can see that the additional "Groups" of PID 186 are unset (missing gid
|
||||
of ``searxng-redis``)::
|
||||
|
||||
$ cat /proc/186/task/186/status
|
||||
...
|
||||
Uid: 993 993 993 993
|
||||
Gid: 993 993 993 993
|
||||
FDSize: 128
|
||||
Groups:
|
||||
...
|
||||
|
|
|
@ -4,109 +4,19 @@
|
|||
Installation
|
||||
============
|
||||
|
||||
.. sidebar:: info
|
||||
|
||||
:ref:`installation switch2ng`
|
||||
|
||||
*You're spoilt for choice*, choose your preferred method of installation.
|
||||
|
||||
- :ref:`installation docker`
|
||||
- :ref:`installation scripts`
|
||||
- :ref:`installation basic`
|
||||
|
||||
The :ref:`installation basic` is good enough for intranet usage and it is a
|
||||
excellent illustration of *how a SearXNG instance is build up*. If you place your
|
||||
instance public to the internet you should really consider to install a
|
||||
:ref:`filtron reverse proxy <filtron.sh>` and for privacy a :ref:`result proxy
|
||||
<morty.sh>` is mandatory.
|
||||
The :ref:`installation basic` is an excellent illustration of *how a SearXNG
|
||||
instance is build up* (see :ref:`architecture uWSGI`). If you do not have any
|
||||
special preferences, its recommend to use the :ref:`installation docker` or the
|
||||
:ref:`installation scripts`.
|
||||
|
||||
Therefore, if you do not have any special preferences, its recommend to use the
|
||||
:ref:`installation docker` or the `Installation scripts`_ from our :ref:`tooling
|
||||
box <toolboxing>` as described below.
|
||||
.. attention::
|
||||
|
||||
.. _installation scripts:
|
||||
|
||||
Installation scripts
|
||||
====================
|
||||
|
||||
.. sidebar:: Update OS first!
|
||||
|
||||
To avoid unwanted side effects, update your OS before installing SearXNG.
|
||||
|
||||
The following will install a setup as shown in :ref:`architecture`. First you
|
||||
need to get a clone. The clone is only needed for the installation procedure
|
||||
and some maintenance tasks (alternatively you can create your own fork).
|
||||
|
||||
For the installation procedure, use a *sudoer* login to run the scripts. If you
|
||||
install from ``root``, take into account that the scripts are creating a
|
||||
``searx``, a ``filtron`` and a ``morty`` user. In the installation procedure
|
||||
these new created users do need read access to the clone of searx, which is not
|
||||
the case if you clone into a folder below ``/root``.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ cd ~/Downloads
|
||||
$ git clone https://github.com/searxng/searxng.git searxng
|
||||
$ cd searxng
|
||||
|
||||
.. sidebar:: further read
|
||||
|
||||
- :ref:`toolboxing`
|
||||
- :ref:`update searxng`
|
||||
- :ref:`inspect searxng`
|
||||
|
||||
**Install** :ref:`SearXNG service <searx.sh>`
|
||||
|
||||
This installs SearXNG as described in :ref:`installation basic`.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/searx.sh install all
|
||||
|
||||
**Install** :ref:`filtron reverse proxy <filtron.sh>`
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/filtron.sh install all
|
||||
|
||||
**Install** :ref:`result proxy <morty.sh>`
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/morty.sh install all
|
||||
|
||||
If all services are running fine, you can add it to your HTTP server:
|
||||
|
||||
**Install** HTTP
|
||||
|
||||
- :ref:`installation apache`
|
||||
- :ref:`installation nginx`
|
||||
|
||||
**Install** :ref:`external plugins <dev plugin>`
|
||||
|
||||
Use SearXNG's ``shell`` to install external plugins. In the example below we
|
||||
install the SearXNG plugins from **The Green Web Foundation** `[ref]
|
||||
<https://www.thegreenwebfoundation.org/news/searching-the-green-web-with-searx/>`__:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/searx.sh shell
|
||||
// exit with [CTRL-D]
|
||||
(searx-pyenv) searx@ryzen:~$ pip install git+https://github.com/return42/tgwf-searx-plugins
|
||||
|
||||
In the :ref:`settings.yml` activate the ``plugins:`` section and add module
|
||||
``only_show_green_results`` from tgwf-searx-plugins.
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
plugins:
|
||||
- only_show_green_results
|
||||
|
||||
.. _git stash: https://git-scm.com/docs/git-stash
|
||||
|
||||
.. tip::
|
||||
|
||||
About script's installation options have a look at chapter :ref:`toolboxing
|
||||
setup`. How to brand your instance see chapter :ref:`settings global`. To
|
||||
*stash* your instance's setup, `git stash`_ your clone's :origin:`.config.sh`
|
||||
file .
|
||||
SearXNG is growing rapidly, you should regularly read our :ref:`migrate and
|
||||
stay tuned` section. If you want to upgrade an existing instance or migrate
|
||||
from searx to SearXNG, you should read this section first!
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
|
||||
.. _searxng morty:
|
||||
|
||||
=========================
|
||||
How to setup result proxy
|
||||
=========================
|
||||
|
||||
.. sidebar:: further reading
|
||||
|
||||
- :ref:`morty.sh`
|
||||
|
||||
.. _morty: https://github.com/asciimoo/morty
|
||||
.. _morty's README: https://github.com/asciimoo/morty
|
||||
|
||||
By default SearXNG can only act as an image proxy for result images, but it is
|
||||
possible to proxify all the result URLs with an external service, morty_.
|
||||
|
||||
To use this feature, morty has to be installed and activated in SearXNG's
|
||||
``settings.yml``. Add the following snippet to your ``settings.yml`` and
|
||||
restart searx:
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
result_proxy:
|
||||
url : http://127.0.0.1:3000/
|
||||
key : !!binary "insert_your_morty_proxy_key_here"
|
||||
|
||||
Note that the example above (``http://127.0.0.1:3000``) is only for single-user
|
||||
instances without a HTTP proxy. If your morty service is public, the url is the
|
||||
address of the reverse proxy (e.g ``https://example.org/morty``).
|
||||
|
||||
For more information about *result proxy* have a look at *"SearXNG via filtron
|
||||
plus morty"* in the :ref:`nginx <nginx searxng via filtron plus morty>` and
|
||||
:ref:`apache <apache searxng via filtron plus morty>` sections.
|
||||
|
||||
``url``
|
||||
Is the address of the running morty service.
|
||||
|
||||
``key``
|
||||
Is an optional argument, see `morty's README`_ for more information.
|
|
@ -1,59 +1,136 @@
|
|||
.. _update searxng:
|
||||
|
||||
=============
|
||||
How to update
|
||||
=============
|
||||
|
||||
How to update depends on the :ref:`installation` method. If you have used the
|
||||
:ref:`installation scripts`, use ``update`` command from the scripts.
|
||||
|
||||
**Update** :ref:`SearXNG service <searx.sh>`
|
||||
|
||||
.. code:: sh
|
||||
|
||||
sudo -H ./utils/searx.sh update searx
|
||||
|
||||
**Update** :ref:`filtron reverse proxy <filtron.sh>`
|
||||
|
||||
.. code:: sh
|
||||
|
||||
sudo -H ./utils/filtron.sh update filtron
|
||||
|
||||
**Update** :ref:`result proxy <morty.sh>`
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/morty.sh update morty
|
||||
|
||||
.. _inspect searxng:
|
||||
|
||||
======================
|
||||
How to inspect & debug
|
||||
======================
|
||||
===================
|
||||
SearXNG maintenance
|
||||
===================
|
||||
|
||||
.. sidebar:: further read
|
||||
|
||||
- :ref:`toolboxing`
|
||||
- :ref:`Makefile`
|
||||
- :ref:`uWSGI maintenance`
|
||||
|
||||
.. contents:: Contents
|
||||
:depth: 2
|
||||
:local:
|
||||
:backlinks: entry
|
||||
|
||||
.. _update searxng:
|
||||
|
||||
How to update
|
||||
=============
|
||||
|
||||
How to update depends on the :ref:`installation` method. If you have used the
|
||||
:ref:`installation scripts`, use the ``update`` command from the :ref:`searxng.sh`
|
||||
script.
|
||||
|
||||
.. code:: sh
|
||||
|
||||
sudo -H ./utils/searxng.sh instance update
|
||||
|
||||
.. _inspect searxng:
|
||||
|
||||
How to inspect & debug
|
||||
======================
|
||||
|
||||
How to debug depends on the :ref:`installation` method. If you have used the
|
||||
:ref:`installation scripts`, use ``inspect`` command from the scripts.
|
||||
|
||||
**Inspect** :ref:`SearXNG service <searx.sh>`
|
||||
:ref:`installation scripts`, use the ``inspect`` command from the :ref:`searxng.sh`
|
||||
script.
|
||||
|
||||
.. code:: sh
|
||||
|
||||
sudo -H ./utils/searx.sh inspect service
|
||||
sudo -H ./utils/searxng.sh instance inspect
|
||||
|
||||
**Inspect** :ref:`filtron reverse proxy <filtron.sh>`
|
||||
.. _migrate and stay tuned:
|
||||
|
||||
.. code:: sh
|
||||
Migrate and stay tuned!
|
||||
=======================
|
||||
|
||||
sudo -H ./utils/filtron.sh inspect service
|
||||
.. sidebar:: info
|
||||
|
||||
**Inspect** :ref:`result proxy <morty.sh>`
|
||||
- :pull:`1332`
|
||||
- :pull:`456`
|
||||
- :pull:`A comment about rolling release <446#issuecomment-954730358>`
|
||||
|
||||
.. code:: bash
|
||||
SearXNG is a *rolling release*; each commit to the master branch is a release.
|
||||
SearXNG is growing rapidly, the services and opportunities are change every now
|
||||
and then, to name just a few:
|
||||
|
||||
$ sudo -H ./utils/morty.sh inspect service
|
||||
- Bot protection has been switched from filtron to SearXNG's :ref:`limiter
|
||||
<limiter>`, this requires a :ref:`Redis <settings redis>` database.
|
||||
|
||||
- The image proxy morty is no longer needed, it has been replaced by the
|
||||
:ref:`image proxy <image_proxy>` from SearXNG.
|
||||
|
||||
- To save bandwith :ref:`cache busting <static_use_hash>` has been implemented.
|
||||
To get in use, the ``static-expires`` needs to be set in the :ref:`uwsgi
|
||||
setup`.
|
||||
|
||||
To stay tuned and get in use of the new features, instance maintainers have to
|
||||
update the SearXNG code regularly (see :ref:`update searxng`). As the above
|
||||
examples show, this is not always enough, sometimes services have to be set up
|
||||
or reconfigured and sometimes services that are no longer needed should be
|
||||
uninstalled.
|
||||
|
||||
.. hint::
|
||||
|
||||
First of all: SearXNG is installed by the script :ref:`searxng.sh`. If you
|
||||
have old filtron, morty or searx setup you should consider complete
|
||||
uninstall/reinstall.
|
||||
|
||||
Here you will find a list of changes that affect the infrastructure. Please
|
||||
check to what extent it is necessary to update your installations:
|
||||
|
||||
:pull:`1595`: ``[fix] uWSGI: increase buffer-size``
|
||||
Re-install uWSGI (:ref:`searxng.sh`) or fix your uWSGI ``searxng.ini``
|
||||
file manually.
|
||||
|
||||
|
||||
remove obsolete services
|
||||
------------------------
|
||||
|
||||
If your searx instance was installed *"Step by step"* or by the *"Installation
|
||||
scripts"*, you need to undo the installation procedure completely. If you have
|
||||
morty & filtron installed, it is recommended to uninstall these services also.
|
||||
In case of scripts, to uninstall use the scripts from the origin you installed
|
||||
searx from or try::
|
||||
|
||||
$ sudo -H ./utils/filtron.sh remove all
|
||||
$ sudo -H ./utils/morty.sh remove all
|
||||
$ sudo -H ./utils/searx.sh remove all
|
||||
|
||||
.. hint::
|
||||
|
||||
If you are migrate from searx take into account that the ``.config.sh`` is no
|
||||
longer used.
|
||||
|
||||
If you upgrade from searx or from before :pull:`1332` has been merged and you
|
||||
have filtron and/or morty installed, don't forget to remove HTTP sites.
|
||||
|
||||
Apache::
|
||||
|
||||
$ sudo -H ./utils/filtron.sh apache remove
|
||||
$ sudo -H ./utils/morty.sh apache remove
|
||||
|
||||
nginx::
|
||||
|
||||
$ sudo -H ./utils/filtron.sh nginx remove
|
||||
$ sudo -H ./utils/morty.sh nginx remove
|
||||
|
||||
|
||||
|
||||
Check after Installation
|
||||
------------------------
|
||||
|
||||
Once you have done your installation, you can run a SearXNG *check* procedure,
|
||||
to see if there are some left overs. In this example there exists a *old*
|
||||
``/etc/searx/settings.yml``::
|
||||
|
||||
$ sudo -H ./utils/searxng.sh instance check
|
||||
|
||||
SearXNG checks
|
||||
--------------
|
||||
ERROR: settings.yml in /etc/searx/ is deprecated, move file to folder /etc/searxng/
|
||||
INFO: [OK] (old) account 'searx' does not exists
|
||||
INFO: [OK] (old) account 'filtron' does not exists
|
||||
INFO: [OK] (old) account 'morty' does not exists
|
||||
...
|
||||
INFO searx.redisdb : connecting to Redis db=0 path='/usr/local/searxng-redis/run/redis.sock'
|
||||
INFO searx.redisdb : connected to Redis
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.. template evaluated by: ./utils/searx.sh docs
|
||||
.. template evaluated by: ./utils/searxng.sh searxng.doc.rst
|
||||
.. hint: all dollar-names are variables, dollar sign itself is quoted by: \\$
|
||||
|
||||
.. START distro-packages
|
||||
|
@ -65,7 +65,8 @@ ${fedora_build}
|
|||
|
||||
$ sudo -H useradd --shell /bin/bash --system \\
|
||||
--home-dir \"$SERVICE_HOME\" \\
|
||||
--comment 'Privacy-respecting metasearch engine' $SERVICE_USER
|
||||
--comment 'Privacy-respecting metasearch engine' \\
|
||||
$SERVICE_USER
|
||||
|
||||
$ sudo -H mkdir \"$SERVICE_HOME\"
|
||||
$ sudo -H chown -R \"$SERVICE_GROUP:$SERVICE_GROUP\" \"$SERVICE_HOME\"
|
||||
|
@ -81,7 +82,8 @@ ${fedora_build}
|
|||
.. code-block:: sh
|
||||
|
||||
$ sudo -H -u ${SERVICE_USER} -i
|
||||
(${SERVICE_USER})$ git clone \"$GIT_URL\" \"$SEARX_SRC\"
|
||||
(${SERVICE_USER})$ git clone \"$GIT_URL\" \\
|
||||
\"$SEARXNG_SRC\"
|
||||
|
||||
.. END clone searxng
|
||||
|
||||
|
@ -93,8 +95,9 @@ ${fedora_build}
|
|||
|
||||
.. code-block:: sh
|
||||
|
||||
(${SERVICE_USER})$ python3 -m venv \"${SEARX_PYENV}\"
|
||||
(${SERVICE_USER})$ echo \". ${SEARX_PYENV}/bin/activate\" >> \"$SERVICE_HOME/.profile\"
|
||||
(${SERVICE_USER})$ python3 -m venv \"${SEARXNG_PYENV}\"
|
||||
(${SERVICE_USER})$ echo \". ${SEARXNG_PYENV}/bin/activate\" \\
|
||||
>> \"$SERVICE_HOME/.profile\"
|
||||
|
||||
.. END create virtualenv
|
||||
|
||||
|
@ -109,7 +112,7 @@ ${fedora_build}
|
|||
$ sudo -H -u ${SERVICE_USER} -i
|
||||
|
||||
(${SERVICE_USER})$ command -v python && python --version
|
||||
$SEARX_PYENV/bin/python
|
||||
$SEARXNG_PYENV/bin/python
|
||||
Python 3.8.1
|
||||
|
||||
# update pip's boilerplate ..
|
||||
|
@ -119,7 +122,7 @@ ${fedora_build}
|
|||
pip install -U pyyaml
|
||||
|
||||
# jump to SearXNG's working tree and install SearXNG into virtualenv
|
||||
(${SERVICE_USER})$ cd \"$SEARX_SRC\"
|
||||
(${SERVICE_USER})$ cd \"$SEARXNG_SRC\"
|
||||
(${SERVICE_USER})$ pip install -e .
|
||||
|
||||
|
||||
|
@ -134,24 +137,15 @@ ${fedora_build}
|
|||
.. code-block:: sh
|
||||
|
||||
$ sudo -H mkdir -p \"$(dirname ${SEARXNG_SETTINGS_PATH})\"
|
||||
$ sudo -H cp \"$SEARX_SRC/utils/templates/etc/searxng/settings.yml\" \\
|
||||
$ sudo -H cp \"$SEARXNG_SRC/utils/templates/etc/searxng/settings.yml\" \\
|
||||
\"${SEARXNG_SETTINGS_PATH}\"
|
||||
|
||||
.. group-tab:: searx/settings.yml
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ sudo -H mkdir -p \"$(dirname ${SEARXNG_SETTINGS_PATH})\"
|
||||
$ sudo -H cp \"$SEARX_SRC/searx/settings.yml\" \\
|
||||
\"${SEARXNG_SETTINGS_PATH}\"
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: minimal setup
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ sudo -H sed -i -e \"s/ultrasecretkey/\$(openssl rand -hex 16)/g\" \"$SEARXNG_SETTINGS_PATH\"
|
||||
$ sudo -H sed -i -e \"s/ultrasecretkey/\$(openssl rand -hex 16)/g\" \\
|
||||
\"$SEARXNG_SETTINGS_PATH\"
|
||||
|
||||
.. END searxng config
|
||||
|
||||
|
@ -168,14 +162,14 @@ ${fedora_build}
|
|||
|
||||
# start webapp
|
||||
$ sudo -H -u ${SERVICE_USER} -i
|
||||
(${SERVICE_USER})$ cd ${SEARX_SRC}
|
||||
(${SERVICE_USER})$ cd ${SEARXNG_SRC}
|
||||
(${SERVICE_USER})$ export SEARXNG_SETTINGS_PATH=\"${SEARXNG_SETTINGS_PATH}\"
|
||||
(${SERVICE_USER})$ python searx/webapp.py
|
||||
|
||||
# disable debug
|
||||
$ sudo -H sed -i -e \"s/debug : True/debug : False/g\" \"$SEARXNG_SETTINGS_PATH\"
|
||||
|
||||
Open WEB browser and visit http://$SEARX_INTERNAL_HTTP . If you are inside a
|
||||
Open WEB browser and visit http://$SEARXNG_INTERNAL_HTTP . If you are inside a
|
||||
container or in a script, test with curl:
|
||||
|
||||
.. tabs::
|
||||
|
@ -184,13 +178,13 @@ container or in a script, test with curl:
|
|||
|
||||
.. code-block:: sh
|
||||
|
||||
$ xdg-open http://$SEARX_INTERNAL_HTTP
|
||||
$ xdg-open http://$SEARXNG_INTERNAL_HTTP
|
||||
|
||||
.. group-tab:: curl
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
$ curl --location --verbose --head --insecure $SEARX_INTERNAL_HTTP
|
||||
$ curl --location --verbose --head --insecure $SEARXNG_INTERNAL_HTTP
|
||||
|
||||
* Trying 127.0.0.1:8888...
|
||||
* TCP_NODELAY set
|
31
docs/conf.py
31
docs/conf.py
|
@ -18,6 +18,7 @@ SEARXNG_URL = get_setting('server.base_url') or 'https://example.org/searxng'
|
|||
ISSUE_URL = get_setting('brand.issue_url')
|
||||
DOCS_URL = get_setting('brand.docs_url')
|
||||
PUBLIC_INSTANCES = get_setting('brand.public_instances')
|
||||
PRIVACYPOLICY_URL = get_setting('general.privacypolicy_url')
|
||||
CONTACT_URL = get_setting('general.contact_url')
|
||||
WIKI_URL = get_setting('brand.wiki_url')
|
||||
|
||||
|
@ -87,26 +88,26 @@ def setup(app):
|
|||
extlinks = {}
|
||||
|
||||
# upstream links
|
||||
extlinks['wiki'] = ('https://github.com/searxng/searxng/wiki/%s', ' ')
|
||||
extlinks['pull'] = ('https://github.com/searxng/searxng/pull/%s', 'PR ')
|
||||
extlinks['pull-searx'] = ('https://github.com/searx/searx/pull/%s', 'PR ')
|
||||
extlinks['wiki'] = ('https://github.com/searxng/searxng/wiki/%s', ' %s')
|
||||
extlinks['pull'] = ('https://github.com/searxng/searxng/pull/%s', 'PR %s')
|
||||
extlinks['pull-searx'] = ('https://github.com/searx/searx/pull/%s', 'PR %s')
|
||||
|
||||
# links to custom brand
|
||||
extlinks['origin'] = (GIT_URL + '/blob/' + GIT_BRANCH + '/%s', 'git://')
|
||||
extlinks['patch'] = (GIT_URL + '/commit/%s', '#')
|
||||
extlinks['docs'] = (DOCS_URL + '/%s', 'docs: ')
|
||||
extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ')
|
||||
extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '')
|
||||
extlinks['origin'] = (GIT_URL + '/blob/' + GIT_BRANCH + '/%s', 'git://%s')
|
||||
extlinks['patch'] = (GIT_URL + '/commit/%s', '#%s')
|
||||
extlinks['docs'] = (DOCS_URL + '/%s', 'docs: %s')
|
||||
extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: %s')
|
||||
extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '%s')
|
||||
#extlinks['role'] = (
|
||||
# 'https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-%s', '')
|
||||
extlinks['duref'] = (
|
||||
'https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#%s', '')
|
||||
'https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#%s', '%s')
|
||||
extlinks['durole'] = (
|
||||
'https://docutils.sourceforge.io/docs/ref/rst/roles.html#%s', '')
|
||||
'https://docutils.sourceforge.io/docs/ref/rst/roles.html#%s', '%s')
|
||||
extlinks['dudir'] = (
|
||||
'https://docutils.sourceforge.io/docs/ref/rst/directives.html#%s', '')
|
||||
'https://docutils.sourceforge.io/docs/ref/rst/directives.html#%s', '%s')
|
||||
extlinks['ctan'] = (
|
||||
'https://ctan.org/pkg/%s', 'CTAN: ')
|
||||
'https://ctan.org/pkg/%s', 'CTAN: %s')
|
||||
|
||||
extensions = [
|
||||
'sphinx.ext.imgmath',
|
||||
|
@ -135,10 +136,12 @@ suppress_warnings = ['myst.domains']
|
|||
intersphinx_mapping = {
|
||||
"python": ("https://docs.python.org/3/", None),
|
||||
"flask": ("https://flask.palletsprojects.com/", None),
|
||||
"flask_babel": ("https://python-babel.github.io/flask-babel/", None),
|
||||
# "werkzeug": ("https://werkzeug.palletsprojects.com/", None),
|
||||
"jinja": ("https://jinja.palletsprojects.com/", None),
|
||||
"linuxdoc" : ("https://return42.github.io/linuxdoc/", None),
|
||||
"sphinx" : ("https://www.sphinx-doc.org/en/master/", None),
|
||||
"redis": ('https://redis.readthedocs.io/en/stable/', None),
|
||||
}
|
||||
|
||||
issues_github_path = "searxng/searxng"
|
||||
|
@ -170,6 +173,8 @@ if PUBLIC_INSTANCES:
|
|||
html_context["project_links"].append(ProjectLink("Public instances", PUBLIC_INSTANCES))
|
||||
if ISSUE_URL:
|
||||
html_context["project_links"].append(ProjectLink("Issue Tracker", ISSUE_URL))
|
||||
if PRIVACYPOLICY_URL:
|
||||
html_context["project_links"].append(ProjectLink("Privacy Policy", PRIVACYPOLICY_URL))
|
||||
if CONTACT_URL:
|
||||
html_context["project_links"].append(ProjectLink("Contact", CONTACT_URL))
|
||||
|
||||
|
@ -190,5 +195,5 @@ html_show_sourcelink = True
|
|||
# LaTeX ----------------------------------------------------------------
|
||||
|
||||
latex_documents = [
|
||||
(master_doc, "searx-{}.tex".format(VERSION_STRING), html_title, author, "manual")
|
||||
(master_doc, "searxng-{}.tex".format(VERSION_STRING), html_title, author, "manual")
|
||||
]
|
||||
|
|
|
@ -47,7 +47,7 @@ Engine File
|
|||
argument type information
|
||||
======================= =========== ========================================================
|
||||
categories list pages, in which the engine is working
|
||||
paging boolean support multible pages
|
||||
paging boolean support multiple pages
|
||||
time_range_support boolean support search time range
|
||||
engine_type str - ``online`` :ref:`[ref] <demo online engine>` by
|
||||
default, other possibles values are:
|
||||
|
@ -66,11 +66,11 @@ For a more detailed description, see :ref:`settings engine` in the :ref:`settin
|
|||
.. table:: Common options in the engine setup (``settings.yml``)
|
||||
:width: 100%
|
||||
|
||||
======================= =========== ===============================================
|
||||
======================= =========== ==================================================
|
||||
argument type information
|
||||
======================= =========== ===============================================
|
||||
======================= =========== ==================================================
|
||||
name string name of search-engine
|
||||
engine string name of searx-engine (filename without ``.py``)
|
||||
engine string name of searxng-engine (file name without ``.py``)
|
||||
enable_http bool enable HTTP (by default only HTTPS is enabled).
|
||||
shortcut string shortcut of search-engine
|
||||
timeout string specific timeout for search-engine
|
||||
|
@ -78,7 +78,7 @@ For a more detailed description, see :ref:`settings engine` in the :ref:`settin
|
|||
proxies dict set proxies for a specific engine
|
||||
(e.g. ``proxies : {http: socks5://proxy:port,
|
||||
https: socks5://proxy:port}``)
|
||||
======================= =========== ===============================================
|
||||
======================= =========== ==================================================
|
||||
|
||||
.. _engine overrides:
|
||||
|
||||
|
@ -311,3 +311,92 @@ the parameter ``template`` must be set to the desired type.
|
|||
address.postcode postcode of object
|
||||
address.country country of object
|
||||
========================= =====================================================
|
||||
|
||||
.. _BibTeX format: https://www.bibtex.com/g/bibtex-format/
|
||||
.. _BibTeX field types: https://en.wikipedia.org/wiki/BibTeX#Field_types
|
||||
|
||||
.. list-table:: Parameter of the **paper** media type /
|
||||
see `BibTeX field types`_ and `BibTeX format`_
|
||||
:header-rows: 2
|
||||
:width: 100%
|
||||
|
||||
* - result-parameter
|
||||
- Python type
|
||||
- information
|
||||
|
||||
* - template
|
||||
- :py:class:`str`
|
||||
- is set to ``paper.html``
|
||||
|
||||
* - title
|
||||
- :py:class:`str`
|
||||
- title of the result
|
||||
|
||||
* - content
|
||||
- :py:class:`str`
|
||||
- abstract
|
||||
|
||||
* - comments
|
||||
- :py:class:`str`
|
||||
- free text display in italic below the content
|
||||
|
||||
* - tags
|
||||
- :py:class:`List <list>`\ [\ :py:class:`str`\ ]
|
||||
- free tag list
|
||||
|
||||
* - publishedDate
|
||||
- :py:class:`datetime <datetime.datetime>`
|
||||
- last publication date
|
||||
|
||||
* - type
|
||||
- :py:class:`str`
|
||||
- short description of medium type, e.g. *book*, *pdf* or *html* ...
|
||||
|
||||
* - authors
|
||||
- :py:class:`List <list>`\ [\ :py:class:`str`\ ]
|
||||
- list of authors of the work (authors with a "s")
|
||||
|
||||
* - editor
|
||||
- :py:class:`str`
|
||||
- list of editors of a book
|
||||
|
||||
* - publisher
|
||||
- :py:class:`str`
|
||||
- name of the publisher
|
||||
|
||||
* - journal
|
||||
- :py:class:`str`
|
||||
- name of the journal or magazine the article was
|
||||
published in
|
||||
|
||||
* - volume
|
||||
- :py:class:`str`
|
||||
- volume number
|
||||
|
||||
* - pages
|
||||
- :py:class:`str`
|
||||
- page range where the article is
|
||||
|
||||
* - number
|
||||
- :py:class:`str`
|
||||
- number of the report or the issue number for a journal article
|
||||
|
||||
* - doi
|
||||
- :py:class:`str`
|
||||
- DOI number (like ``10.1038/d41586-018-07848-2``)
|
||||
|
||||
* - issn
|
||||
- :py:class:`List <list>`\ [\ :py:class:`str`\ ]
|
||||
- ISSN number like ``1476-4687``
|
||||
|
||||
* - isbn
|
||||
- :py:class:`List <list>`\ [\ :py:class:`str`\ ]
|
||||
- ISBN number like ``9780201896831``
|
||||
|
||||
* - pdf_url
|
||||
- :py:class:`str`
|
||||
- URL to the full article, the PDF version
|
||||
|
||||
* - html_url
|
||||
- :py:class:`str`
|
||||
- URL to full article, HTML version
|
||||
|
|
|
@ -45,9 +45,7 @@ be set on a *production* system.
|
|||
The scripts from :ref:`searx_utils` can divide in those to install and maintain
|
||||
software:
|
||||
|
||||
- :ref:`searx.sh`
|
||||
- :ref:`filtron.sh`
|
||||
- :ref:`morty.sh`
|
||||
- :ref:`searxng.sh`
|
||||
|
||||
and the script :ref:`lxc.sh`, with we can scale our installation, maintenance or
|
||||
even development tasks over a stack of isolated containers / what we call the:
|
||||
|
@ -73,7 +71,7 @@ once:
|
|||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ snap install lxd
|
||||
$ lxd init --auto
|
||||
|
@ -85,28 +83,28 @@ fork:
|
|||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ cd ~/Downloads
|
||||
$ git clone https://github.com/searxng/searxng.git searxng
|
||||
$ cd searxng
|
||||
|
||||
The :ref:`lxc-searx.env` consists of several images, see ``export
|
||||
LXC_SUITE=(...`` near by :origin:`utils/lxc-searx.env#L19`. For this blog post
|
||||
The :ref:`lxc-searxng.env` consists of several images, see ``export
|
||||
LXC_SUITE=(...`` near by :origin:`utils/lxc-searxng.env#L19`. For this blog post
|
||||
we exercise on a archlinux_ image. The container of this image is named
|
||||
``searx-archlinux``. Lets build the container, but be sure that this container
|
||||
``searxng-archlinux``. Lets build the container, but be sure that this container
|
||||
does not already exists, so first lets remove possible old one:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh remove searx-archlinux
|
||||
$ sudo -H ./utils/lxc.sh build searx-archlinux
|
||||
$ sudo -H ./utils/lxc.sh remove searxng-archlinux
|
||||
$ sudo -H ./utils/lxc.sh build searxng-archlinux
|
||||
|
||||
.. sidebar:: The ``searx-archlinux`` container
|
||||
.. sidebar:: The ``searxng-archlinux`` container
|
||||
|
||||
is the base of all our exercises here.
|
||||
|
||||
|
@ -117,9 +115,9 @@ In this container we install all services :ref:`including searx, morty & filtron
|
|||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh install suite searx-archlinux
|
||||
$ sudo -H ./utils/lxc.sh install suite searxng-archlinux
|
||||
|
||||
To proxy HTTP from filtron and morty in the container to the outside of the
|
||||
container, install nginx into the container. Once for the bot blocker filtron:
|
||||
|
@ -128,9 +126,9 @@ container, install nginx into the container. Once for the bot blocker filtron:
|
|||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux \
|
||||
./utils/filtron.sh nginx install
|
||||
...
|
||||
INFO: got 429 from http://10.174.184.156/searx
|
||||
|
@ -141,9 +139,9 @@ and once for the content sanitizer (content proxy morty):
|
|||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux \
|
||||
./utils/morty.sh nginx install
|
||||
...
|
||||
INFO: got 200 from http://10.174.184.156/morty/
|
||||
|
@ -154,7 +152,7 @@ and once for the content sanitizer (content proxy morty):
|
|||
blocker (filtron) and WEB content sanitizer (content proxy morty), both are
|
||||
needed for a *privacy protecting* search engine.
|
||||
|
||||
On your system, the IP of your ``searx-archlinux`` container differs from
|
||||
On your system, the IP of your ``searxng-archlinux`` container differs from
|
||||
http://10.174.184.156/searx, just open the URL reported in your installation
|
||||
protocol in your WEB browser from the desktop to test the instance from outside
|
||||
of the container.
|
||||
|
@ -169,27 +167,27 @@ In containers, work as usual
|
|||
|
||||
Usually you open a root-bash using ``sudo -H bash``. In case of LXC containers
|
||||
open the root-bash in the container using ``./utils/lxc.sh cmd
|
||||
searx-archlinux``:
|
||||
searxng-archlinux``:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux bash
|
||||
INFO: [searx-archlinux] bash
|
||||
[root@searx-archlinux searx]# pwd
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux bash
|
||||
INFO: [searxng-archlinux] bash
|
||||
[root@searxng-archlinux searx]# pwd
|
||||
/share/searxng
|
||||
|
||||
The prompt ``[root@searx-archlinux ...]`` signals, that you are the root user in
|
||||
the searx-container. To debug the running SearXNG instance use:
|
||||
The prompt ``[root@searxng-archlinux ...]`` signals, that you are the root user in
|
||||
the searxng-container. To debug the running SearXNG instance use:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: root@searx-archlinux
|
||||
.. group-tab:: root@searxng-archlinux
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ ./utils/searx.sh inspect service
|
||||
...
|
||||
|
@ -202,56 +200,42 @@ above. You can stop monitoring using ``CTRL-C``, this also disables the *"debug
|
|||
option"* in SearXNG's settings file and restarts the SearXNG uwsgi application.
|
||||
To debug services from filtron and morty analogous use:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: root@searx-archlinux
|
||||
|
||||
.. code:: sh
|
||||
|
||||
$ ./utils/filtron.sh inspect service
|
||||
$ ./utils/morty.sh inspect service
|
||||
|
||||
Another point we have to notice is that each service (:ref:`SearXNG <searx.sh>`,
|
||||
:ref:`filtron <filtron.sh>` and :ref:`morty <morty.sh>`) runs under dedicated
|
||||
system user account with the same name (compare :ref:`create searxng user`). To
|
||||
get a shell from theses accounts, simply call one of the scripts:
|
||||
Another point we have to notice is that the service (:ref:`SearXNG <searxng.sh>`
|
||||
runs under dedicated system user account with the same name (compare
|
||||
:ref:`create searxng user`). To get a shell from these accounts, simply call:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: root@searx-archlinux
|
||||
.. group-tab:: root@searxng-archlinux
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ ./utils/searx.sh shell
|
||||
$ ./utils/filtron.sh shell
|
||||
$ ./utils/morty.sh shell
|
||||
$ ./utils/searxng.sh instance cmd bash
|
||||
|
||||
To get in touch, open a shell from the service user (searx@searx-archlinux):
|
||||
To get in touch, open a shell from the service user (searxng@searxng-archlinux):
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
./utils/searx.sh shell
|
||||
// exit with [CTRL-D]
|
||||
(searx-pyenv) [searx@searx-archlinux ~]$ ...
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux ./utils/searxng.sh instance cmd bash
|
||||
INFO: [searxng-archlinux] ./utils/searxng.sh instance cmd bash
|
||||
[searxng@searxng-archlinux ~]$
|
||||
|
||||
The prompt ``[searx@searx-archlinux]`` signals that you are logged in as system
|
||||
user ``searx`` in the ``searx-archlinux`` container and the python *virtualenv*
|
||||
``(searx-pyenv)`` environment is activated.
|
||||
The prompt ``[searxng@searxng-archlinux]`` signals that you are logged in as system
|
||||
user ``searx`` in the ``searxng-archlinux`` container and the python *virtualenv*
|
||||
``(searxng-pyenv)`` environment is activated.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: searx@searx-archlinux
|
||||
.. group-tab:: searxng@searxng-archlinux
|
||||
|
||||
.. code:: sh
|
||||
|
||||
(searx-pyenv) [searx@searx-archlinux ~]$ pwd
|
||||
/usr/local/searx
|
||||
.. code:: bash
|
||||
|
||||
(searxng-pyenv) [searxng@searxng-archlinux ~]$ pwd
|
||||
/usr/local/searxng
|
||||
|
||||
|
||||
Wrap production into developer suite
|
||||
|
@ -262,23 +246,22 @@ from a LXC container (which is quite ready for production) into a developer
|
|||
suite. For this, we have to keep an eye on the :ref:`installation basic`:
|
||||
|
||||
- SearXNG setup in: ``/etc/searxng/settings.yml``
|
||||
- SearXNG user's home: ``/usr/local/searx``
|
||||
- virtualenv in: ``/usr/local/searx/searx-pyenv``
|
||||
- SearXNG software in: ``/usr/local/searx/searx-src``
|
||||
- SearXNG user's home: ``/usr/local/searxng``
|
||||
- virtualenv in: ``/usr/local/searxng/searxng-pyenv``
|
||||
- SearXNG software in: ``/usr/local/searxng/searxng-src``
|
||||
|
||||
With the use of the :ref:`searx.sh` the SearXNG service was installed as
|
||||
With the use of the :ref:`searxng.sh` the SearXNG service was installed as
|
||||
:ref:`uWSGI application <searxng uwsgi>`. To maintain this service, we can use
|
||||
``systemctl`` (compare :ref:`service architectures on distributions <uwsgi
|
||||
configuration>`).
|
||||
``systemctl`` (compare :ref:`uWSGI maintenance`).
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
systemctl stop uwsgi@searx
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux \
|
||||
systemctl stop uwsgi@searxng
|
||||
|
||||
With the command above, we stopped the SearXNG uWSGI-App in the archlinux
|
||||
container.
|
||||
|
@ -291,41 +274,41 @@ least you should attend the settings of ``uid``, ``chdir``, ``env`` and
|
|||
env = SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml
|
||||
http = 127.0.0.1:8888
|
||||
|
||||
chdir = /usr/local/searx/searx-src/searx
|
||||
virtualenv = /usr/local/searx/searx-pyenv
|
||||
pythonpath = /usr/local/searx/searx-src
|
||||
chdir = /usr/local/searxng/searxng-src/searx
|
||||
virtualenv = /usr/local/searxng/searxng-pyenv
|
||||
pythonpath = /usr/local/searxng/searxng-src
|
||||
|
||||
If you have read the :ref:`"Good to know section" <lxc.sh>` you remember, that
|
||||
each container shares the root folder of the repository and the command
|
||||
``utils/lxc.sh cmd`` handles relative path names **transparent**. To wrap the
|
||||
SearXNG installation into a developer one, we simple have to create a smylink to
|
||||
the **transparent** reposetory from the desktop. Now lets replace the
|
||||
repository at ``searx-src`` in the container with the working tree from outside
|
||||
repository at ``searxng-src`` in the container with the working tree from outside
|
||||
of the container:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: container becomes a developer suite
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
mv /usr/local/searx/searx-src /usr/local/searx/searx-src.old
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux \
|
||||
mv /usr/local/searxng/searxng-src /usr/local/searxng/searxng-src.old
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
ln -s /share/searx/ /usr/local/searx/searx-src
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux \
|
||||
ln -s /share/searx/ /usr/local/searxng/searxng-src
|
||||
|
||||
Now we can develop as usual in the working tree of our desktop system. Every
|
||||
time the software was changed, you have to restart the SearXNG service (in the
|
||||
conatiner):
|
||||
container):
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux \
|
||||
systemctl restart uwsgi@searx
|
||||
|
||||
|
||||
|
@ -338,30 +321,30 @@ daily usage:
|
|||
|
||||
To *inspect* the SearXNG instance (already described above):
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux \
|
||||
./utils/searx.sh inspect service
|
||||
|
||||
Run :ref:`makefile`, e.g. to test inside the container:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux \
|
||||
make test
|
||||
|
||||
To install all prerequisites needed for a :ref:`buildhosts`:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
./utils/searx.sh install buildhost
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux \
|
||||
./utils/searxng.sh install buildhost
|
||||
|
||||
To build the docs on a buildhost :ref:`buildhosts`:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux \
|
||||
make docs.html
|
||||
|
||||
.. _lxcdev summary:
|
||||
|
@ -371,18 +354,18 @@ Summary
|
|||
|
||||
We build up a fully functional SearXNG suite in a archlinux container:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh install suite searx-archlinux
|
||||
$ sudo -H ./utils/lxc.sh install suite searxng-archlinux
|
||||
|
||||
To access HTTP from the desktop we installed nginx for the services inside the
|
||||
conatiner:
|
||||
container:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: [root@searx-archlinux]
|
||||
.. group-tab:: [root@searxng-archlinux]
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ ./utils/filtron.sh nginx install
|
||||
$ ./utils/morty.sh nginx install
|
||||
|
@ -393,12 +376,12 @@ the container :
|
|||
|
||||
.. tabs::
|
||||
|
||||
.. group-tab:: [root@searx-archlinux]
|
||||
.. group-tab:: [root@searxng-archlinux]
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ mv /usr/local/searx/searx-src /usr/local/searx/searx-src.old
|
||||
$ ln -s /share/searx/ /usr/local/searx/searx-src
|
||||
$ mv /usr/local/searxng/searxng-src /usr/local/searxng/searxng-src.old
|
||||
$ ln -s /share/searx/ /usr/local/searxng/searxng-src
|
||||
$ systemctl restart uwsgi@searx
|
||||
|
||||
To get information about the searxNG suite in the archlinux container we can
|
||||
|
@ -408,13 +391,13 @@ use:
|
|||
|
||||
.. group-tab:: desktop
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh show suite searx-archlinux
|
||||
$ sudo -H ./utils/lxc.sh show suite searxng-archlinux
|
||||
...
|
||||
[searx-archlinux] INFO: (eth0) filtron: http://10.174.184.156:4004/ http://10.174.184.156/searx
|
||||
[searx-archlinux] INFO: (eth0) morty: http://10.174.184.156:3000/
|
||||
[searx-archlinux] INFO: (eth0) docs.live: http://10.174.184.156:8080/
|
||||
[searx-archlinux] INFO: (eth0) IPv6: http://[fd42:573b:e0b3:e97e:216:3eff:fea5:9b65]
|
||||
[searxng-archlinux] INFO: (eth0) filtron: http://10.174.184.156:4004/ http://10.174.184.156/searx
|
||||
[searxng-archlinux] INFO: (eth0) morty: http://10.174.184.156:3000/
|
||||
[searxng-archlinux] INFO: (eth0) docs.live: http://10.174.184.156:8080/
|
||||
[searxng-archlinux] INFO: (eth0) IPv6: http://[fd42:573b:e0b3:e97e:216:3eff:fea5:9b65]
|
||||
...
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ We do no longer need to build up the virtualenv manually. Jump into your git
|
|||
working tree and release a ``make install`` to get a virtualenv with a
|
||||
*developer install* of SearXNG (:origin:`setup.py`). ::
|
||||
|
||||
$ cd ~/searx-clone
|
||||
$ cd ~/searxng-clone
|
||||
$ make install
|
||||
PYENV [virtualenv] installing ./requirements*.txt into local/py3
|
||||
...
|
||||
|
@ -288,27 +288,3 @@ To filter out HTTP redirects (3xx_)::
|
|||
https://news.google.com:443 "GET /search?q=computer&hl=en&lr=lang_en&ie=utf8&oe=utf8&ceid=US%3Aen&gl=US HTTP/1.1" 302 0
|
||||
https://news.google.com:443 "GET /search?q=computer&hl=en-US&lr=lang_en&ie=utf8&oe=utf8&ceid=US:en&gl=US HTTP/1.1" 200 None
|
||||
--
|
||||
|
||||
|
||||
``make pybuild``
|
||||
================
|
||||
|
||||
.. _PyPi: https://pypi.org/
|
||||
.. _twine: https://twine.readthedocs.io/en/latest/
|
||||
|
||||
Build Python packages in ``./dist/py``::
|
||||
|
||||
$ make pybuild
|
||||
...
|
||||
BUILD pybuild
|
||||
running sdist
|
||||
running egg_info
|
||||
...
|
||||
running bdist_wheel
|
||||
|
||||
$ ls ./dist
|
||||
searx-0.18.0-py3-none-any.whl searx-0.18.0.tar.gz
|
||||
|
||||
To upload packages to PyPi_, there is also a ``pypi.upload`` target (to test use
|
||||
``pypi.upload.test``). Since you are not the owner of :pypi:`searx` you will
|
||||
never need to upload.
|
||||
|
|
|
@ -55,10 +55,10 @@ admins can install packages in advance.
|
|||
|
||||
If there is a need to install additional packages in *Python's Virtual
|
||||
Environment* of your SearXNG instance you need to switch into the environment
|
||||
(:ref:`searx-src`) first, for this you can use :ref:`searx.sh`::
|
||||
(:ref:`searxng-src`) first, for this you can use :ref:`searxng.sh`::
|
||||
|
||||
$ sudo utils/searx.sh shell
|
||||
(searx-pyenv)$ pip install ...
|
||||
$ sudo utils/searxng.sh instance cmd bash
|
||||
(searxng-pyenv)$ pip install ...
|
||||
|
||||
|
||||
Private engines (Security)
|
||||
|
|
|
@ -33,17 +33,26 @@ Example plugin
|
|||
External plugins
|
||||
================
|
||||
|
||||
External plugins are standard python modules implementing all the requirements of the standard plugins.
|
||||
Plugins can be enabled by adding them to :ref:`settings.yml`'s ``plugins`` section.
|
||||
Example external plugin can be found `here <https://github.com/asciimoo/searx_external_plugin_example>`_.
|
||||
SearXNG supports *external plugins* / there is no need to install one, SearXNG
|
||||
runs out of the box. But to demonstrate; in the example below we install the
|
||||
SearXNG plugins from *The Green Web Foundation* `[ref]
|
||||
<https://www.thegreenwebfoundation.org/news/searching-the-green-web-with-searx/>`__:
|
||||
|
||||
Register your plugin
|
||||
====================
|
||||
.. code:: bash
|
||||
|
||||
$ sudo utils/searxng.sh instance cmd bash
|
||||
(searxng-pyenv)$ pip install git+https://github.com/return42/tgwf-searx-plugins
|
||||
|
||||
In the :ref:`settings.yml` activate the ``plugins:`` section and add module
|
||||
``only_show_green_results`` from ``tgwf-searx-plugins``.
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
plugins:
|
||||
...
|
||||
- only_show_green_results
|
||||
...
|
||||
|
||||
To enable your plugin register your plugin in
|
||||
searx > plugin > __init__.py.
|
||||
And at the bottom of the file add your plugin like.
|
||||
``plugins.register(name_of_python_file)``
|
||||
|
||||
Plugin entry points
|
||||
===================
|
||||
|
|
|
@ -10,7 +10,7 @@ Development Quickstart
|
|||
SearXNG loves developers, just clone and start hacking. All the rest is done for
|
||||
you simply by using :ref:`make <makefile>`.
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
git clone https://github.com/searxng/searxng.git searxng
|
||||
|
||||
|
@ -27,21 +27,21 @@ to our ":ref:`how to contribute`" guideline.
|
|||
|
||||
If you implement themes, you will need to setup a :ref:`make node.env` once:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
make node.env
|
||||
|
||||
Before you call *make run* (2.), you need to compile the modified styles and
|
||||
JavaScript:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
make themes.all
|
||||
|
||||
Alternatively you can also compile selective the theme you have modified,
|
||||
e.g. the *simple* theme.
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
make themes.simple
|
||||
|
||||
|
@ -52,7 +52,7 @@ e.g. the *simple* theme.
|
|||
If you finished your *tests* you can start to commit your changes. To separate
|
||||
the modified source code from the build products first run:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
make static.build.restore
|
||||
|
||||
|
@ -60,13 +60,13 @@ This will restore the old build products and only your changes of the code
|
|||
remain in the working tree which can now be added & commited. When all sources
|
||||
are commited, you can commit the build products simply by:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
make static.build.commit
|
||||
|
||||
Commiting the build products should be the last step, just before you send us
|
||||
your PR. There is also a make target to rewind this last build commit:
|
||||
|
||||
.. code:: sh
|
||||
.. code:: bash
|
||||
|
||||
make static.build.drop
|
||||
|
|
|
@ -15,7 +15,7 @@ generated and deployed at :docs:`github.io <.>`. For build prerequisites read
|
|||
:ref:`docs build`.
|
||||
|
||||
The source files of Searx's documentation are located at :origin:`docs`. Sphinx
|
||||
assumes source files to be encoded in UTF-8 by defaul. Run :ref:`make docs.live
|
||||
assumes source files to be encoded in UTF-8 by default. Run :ref:`make docs.live
|
||||
<make docs.live>` to build HTML while editing.
|
||||
|
||||
.. sidebar:: Further reading
|
||||
|
@ -227,13 +227,13 @@ To refer anchors use the `ref role`_ markup:
|
|||
|
||||
.. code:: reST
|
||||
|
||||
Visit chapter :ref:`reST anchor`. Or set hyperlink text manualy :ref:`foo
|
||||
Visit chapter :ref:`reST anchor`. Or set hyperlink text manually :ref:`foo
|
||||
bar <reST anchor>`.
|
||||
|
||||
.. admonition:: ``:ref:`` role
|
||||
:class: rst-example
|
||||
|
||||
Visist chapter :ref:`reST anchor`. Or set hyperlink text manualy :ref:`foo
|
||||
Visist chapter :ref:`reST anchor`. Or set hyperlink text manually :ref:`foo
|
||||
bar <reST anchor>`.
|
||||
|
||||
.. _reST ordinary ref:
|
||||
|
@ -494,8 +494,8 @@ Figures & Images
|
|||
is flexible. To get best results in the generated output format, install
|
||||
ImageMagick_ and Graphviz_.
|
||||
|
||||
Searx's sphinx setup includes: :ref:`linuxdoc:kfigure`. Scaleable here means;
|
||||
scaleable in sense of the build process. Normally in absence of a converter
|
||||
Searx's sphinx setup includes: :ref:`linuxdoc:kfigure`. Scalable here means;
|
||||
scalable in sense of the build process. Normally in absence of a converter
|
||||
tool, the build process will break. From the authors POV it’s annoying to care
|
||||
about the build process when handling with images, especially since he has no
|
||||
access to the build process. With :ref:`linuxdoc:kfigure` the build process
|
||||
|
@ -503,7 +503,7 @@ continues and scales output quality in dependence of installed image processors.
|
|||
|
||||
If you want to add an image, you should use the ``kernel-figure`` (inheritance
|
||||
of :dudir:`figure`) and ``kernel-image`` (inheritance of :dudir:`image`)
|
||||
directives. E.g. to insert a figure with a scaleable image format use SVG
|
||||
directives. E.g. to insert a figure with a scalable image format use SVG
|
||||
(:ref:`svg image example`):
|
||||
|
||||
.. code:: reST
|
||||
|
@ -1185,7 +1185,7 @@ and *targets* (e.g. a ref to :ref:`row 2 of table's body <row body 2>`).
|
|||
- cell 4.4
|
||||
|
||||
* - row 5
|
||||
- cell 5.1 with automatic span to rigth end
|
||||
- cell 5.1 with automatic span to right end
|
||||
|
||||
* - row 6
|
||||
- cell 6.1
|
||||
|
@ -1237,7 +1237,7 @@ and *targets* (e.g. a ref to :ref:`row 2 of table's body <row body 2>`).
|
|||
- cell 4.4
|
||||
|
||||
* - row 5
|
||||
- cell 5.1 with automatic span to rigth end
|
||||
- cell 5.1 with automatic span to right end
|
||||
|
||||
* - row 6
|
||||
- cell 6.1
|
||||
|
|
|
@ -32,12 +32,14 @@ Parameters
|
|||
See more at :ref:`search-syntax`
|
||||
|
||||
``categories`` : optional
|
||||
Comma separated list, specifies the active search categories
|
||||
Comma separated list, specifies the active search categories (see
|
||||
:ref:`configured engines`)
|
||||
|
||||
``engines`` : optional
|
||||
Comma separated list, specifies the active search engines.
|
||||
Comma separated list, specifies the active search engines (see
|
||||
:ref:`configured engines`).
|
||||
|
||||
``lang`` : default ``all``
|
||||
``language`` : default from :ref:`settings search`
|
||||
Code of the language.
|
||||
|
||||
``pageno`` : default ``1``
|
||||
|
@ -52,25 +54,27 @@ Parameters
|
|||
``format`` : optional
|
||||
[ ``json``, ``csv``, ``rss`` ]
|
||||
|
||||
Output format of results.
|
||||
Output format of results. Format needs to be activated in :ref:`settings
|
||||
search`.
|
||||
|
||||
``results_on_new_tab`` : default ``0``
|
||||
[ ``0``, ``1`` ]
|
||||
|
||||
Open search results on new tab.
|
||||
|
||||
``image_proxy`` : default ``False``
|
||||
``image_proxy`` : default from :ref:`settings server`
|
||||
[ ``True``, ``False`` ]
|
||||
|
||||
Proxy image results through SearXNG.
|
||||
|
||||
``autocomplete`` : default *empty*
|
||||
[ ``google``, ``dbpedia``, ``duckduckgo``, ``startpage``, ``wikipedia`` ]
|
||||
``autocomplete`` : default from :ref:`settings search`
|
||||
[ ``google``, ``dbpedia``, ``duckduckgo``, ``startpage``, ``wikipedia``,
|
||||
``swisscows``, ``qwant`` ]
|
||||
|
||||
Service which completes words as you type.
|
||||
|
||||
``safesearch`` : default ``None``
|
||||
[ ``0``, ``1``, ``None`` ]
|
||||
``safesearch`` : default from :ref:`settings search`
|
||||
[ ``0``, ``1``, ``2`` ]
|
||||
|
||||
Filter search results of engines which support safe search. See if an engine
|
||||
supports safe search in the preferences page of an instance.
|
||||
|
@ -87,20 +91,32 @@ Parameters
|
|||
``enabled_plugins`` : optional
|
||||
List of enabled plugins.
|
||||
|
||||
:default: ``HTTPS_rewrite``, ``Self_Informations``,
|
||||
``Search_on_category_select``, ``Tracker_URL_remover``
|
||||
:default:
|
||||
``Hash_plugin``, ``Search_on_category_select``,
|
||||
``Self_Information``, ``Tracker_URL_remover``,
|
||||
``Ahmia_blacklist``
|
||||
|
||||
:values: ``DOAI_rewrite``, ``HTTPS_rewrite``, ``Infinite_scroll``,
|
||||
``Vim-like_hotkeys``, ``Self_Informations``, ``Tracker_URL_remover``,
|
||||
``Search_on_category_select``, ``Hostname_replace``
|
||||
:values:
|
||||
.. enabled by default
|
||||
|
||||
``Hash_plugin``, ``Search_on_category_select``,
|
||||
``Self_Information``, ``Tracker_URL_remover``,
|
||||
``Ahmia_blacklist``,
|
||||
|
||||
.. disabled by default
|
||||
|
||||
``Hostname_replace``, ``Open_Access_DOI_rewrite``,
|
||||
``Vim-like_hotkeys``, ``Tor_check_plugin``
|
||||
|
||||
``disabled_plugins``: optional
|
||||
List of disabled plugins.
|
||||
|
||||
:default: ``DOAI_rewrite``, ``Infinite_scroll``, ``Vim-like_hotkeys``, ``Hostname_replace``
|
||||
:values: ``DOAI_rewrite``, ``HTTPS_rewrite``, ``Infinite_scroll``,
|
||||
``Vim-like_hotkeys``, ``Self_Informations``, ``Tracker_URL_remover``,
|
||||
``Search_on_category_select``, ``Hostname_replace``
|
||||
:default:
|
||||
``Hostname_replace``, ``Open_Access_DOI_rewrite``,
|
||||
``Vim-like_hotkeys``, ``Tor_check_plugin``
|
||||
|
||||
:values:
|
||||
see values from ``enabled_plugins``
|
||||
|
||||
``enabled_engines`` : optional : *all* :origin:`engines <searx/engines>`
|
||||
List of enabled engines.
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
Translation
|
||||
===========
|
||||
|
||||
.. _weblate.bubu1.eu: https://weblate.bubu1.eu/projects/searxng/
|
||||
.. _translate.codeberg.org: https://translate.codeberg.org/projects/searxng/
|
||||
.. _Weblate: https://docs.weblate.org
|
||||
.. _translations branch: https://github.com/searxng/searxng/tree/translations
|
||||
.. _orphan branch: https://git-scm.com/docs/git-checkout#Documentation/git-checkout.txt---orphanltnewbranchgt
|
||||
.. _Weblate repository: https://weblate.bubu1.eu/projects/searxng/searxng/#repository
|
||||
.. _Weblate repository: https://translate.codeberg.org/projects/searxng/searxng/#repository
|
||||
.. _wlc: https://docs.weblate.org/en/latest/wlc.html
|
||||
|
||||
.. |translated| image:: https://weblate.bubu1.eu/widgets/searxng/-/searxng/svg-badge.svg
|
||||
:target: https://weblate.bubu1.eu/projects/searxng/
|
||||
.. |translated| image:: https://translate.codeberg.org/widgets/searxng/-/searxng/svg-badge.svg
|
||||
:target: https://translate.codeberg.org/projects/searxng/
|
||||
|
||||
.. sidebar:: |translated|
|
||||
|
||||
|
@ -24,11 +24,11 @@ Translation
|
|||
- Babel Command-Line: `pybabel <http://babel.pocoo.org/en/latest/cmdline.html>`_
|
||||
- `weblate workflow <https://docs.weblate.org/en/latest/workflows.html>`_
|
||||
|
||||
Translation takes place on weblate.bubu1.eu_.
|
||||
Translation takes place on translate.codeberg.org_.
|
||||
|
||||
Translations which has been added by translators on the weblate.bubu1.eu_ UI are
|
||||
Translations which has been added by translators on the translate.codeberg.org_ UI are
|
||||
committed to Weblate's counterpart of the SearXNG *origin* repository which is
|
||||
located at ``https://weblate.bubu1.eu/git/searxng/searxng``.
|
||||
located at ``https://translate.codeberg.org/git/searxng/searxng``.
|
||||
|
||||
There is no need to clone this repository, :ref:`SearXNG Weblate workflow` take
|
||||
care of the synchronization with the *origin*. To avoid merging commits from
|
||||
|
@ -68,7 +68,7 @@ wlc
|
|||
===
|
||||
|
||||
.. _wlc configuration: https://docs.weblate.org/en/latest/wlc.html#wlc-config
|
||||
.. _API key: https://weblate.bubu1.eu/accounts/profile/#api
|
||||
.. _API key: https://translate.codeberg.org/accounts/profile/#api
|
||||
|
||||
All weblate integration is done by GitHub workflows, but if you want to use wlc_,
|
||||
copy this content into `wlc configuration`_ in your HOME ``~/.config/weblate``
|
||||
|
@ -76,6 +76,6 @@ copy this content into `wlc configuration`_ in your HOME ``~/.config/weblate``
|
|||
.. code-block:: ini
|
||||
|
||||
[keys]
|
||||
https://weblate.bubu1.eu/api/ = APIKEY
|
||||
https://translate.codeberg.org/api/ = APIKEY
|
||||
|
||||
Replace ``APIKEY`` by your `API key`_.
|
||||
|
|
40
docs/donate.rst
Normal file
40
docs/donate.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
Donate to searxng.org
|
||||
=====================
|
||||
|
||||
Why donating?
|
||||
-------------
|
||||
|
||||
If you want to support the SearXNG team you can make a donation.
|
||||
|
||||
This will help us to pay the costs for:
|
||||
|
||||
- the two VPS servers for searx.space
|
||||
- the domain names (searxng.org and searx.space)
|
||||
- the protonmail account
|
||||
|
||||
If there is enough fund we can ask for a security audit or pay an User Experience (UX) designer.
|
||||
|
||||
Payment methods
|
||||
---------------
|
||||
|
||||
- Credit/debit card and bank transfer
|
||||
|
||||
- `Liberapay`_ (recurrent donation)
|
||||
- `Buy Me a Coffee`_ (one time donation)
|
||||
|
||||
- Cryptocurrency
|
||||
|
||||
- Bitcoin: `bc1qn3rw8t86h05cs3grx2kmwmptw9k4kt4hyzktqj`_ (Segwit
|
||||
compatible)
|
||||
- Bitcoin cash: `qpead2yu482e3h9amy5zk45l8qrfhk59jcpw3cth9e`_
|
||||
- Ethereum: `0xCf82c7eb915Ee70b5B69C1bBB5525e157F35FA43`_
|
||||
- Dogecoin: `DBCYS9issTt84pddXSsTHpQxyQDTFp1TE4`_
|
||||
- Litecoin: `ltc1q5j6x6f4f2htldhq570e353clc8fmw44ra5er5q`_
|
||||
|
||||
.. _Liberapay: https://liberapay.com/SearXNG/
|
||||
.. _Buy Me a Coffee: https://buymeacoffee.com/searxng
|
||||
.. _bc1qn3rw8t86h05cs3grx2kmwmptw9k4kt4hyzktqj: bitcoin:bc1qn3rw8t86h05cs3grx2kmwmptw9k4kt4hyzktqj
|
||||
.. _qpead2yu482e3h9amy5zk45l8qrfhk59jcpw3cth9e: bitcoincash:qpead2yu482e3h9amy5zk45l8qrfhk59jcpw3cth9e
|
||||
.. _0xCf82c7eb915Ee70b5B69C1bBB5525e157F35FA43: ethereum:0xCf82c7eb915Ee70b5B69C1bBB5525e157F35FA43
|
||||
.. _DBCYS9issTt84pddXSsTHpQxyQDTFp1TE4: dogecoin:DBCYS9issTt84pddXSsTHpQxyQDTFp1TE4
|
||||
.. _ltc1q5j6x6f4f2htldhq570e353clc8fmw44ra5er5q: litecoin:ltc1q5j6x6f4f2htldhq570e353clc8fmw44ra5er5q
|
|
@ -36,5 +36,6 @@ If you don't trust anyone, you can set up your own, see :ref:`installation`.
|
|||
dev/index
|
||||
utils/index
|
||||
src/index
|
||||
donate
|
||||
|
||||
.. _searx.space: https://searx.space
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Source-Code
|
||||
===========
|
||||
|
||||
This is a partial documentation of our source code. We are not aim to document
|
||||
This is a partial documentation of our source code. We are not aiming to document
|
||||
every item from the source code, but we will add documentation when requested.
|
||||
|
||||
|
||||
|
|
8
docs/src/searx.exceptions.rst
Normal file
8
docs/src/searx.exceptions.rst
Normal file
|
@ -0,0 +1,8 @@
|
|||
.. _searx.exceptions:
|
||||
|
||||
==================
|
||||
SearXNG Exceptions
|
||||
==================
|
||||
|
||||
.. automodule:: searx.exceptions
|
||||
:members:
|
8
docs/src/searx.plugins.autodetect_search_language.rst
Normal file
8
docs/src/searx.plugins.autodetect_search_language.rst
Normal file
|
@ -0,0 +1,8 @@
|
|||
.. _autodetect search language:
|
||||
|
||||
======================
|
||||
Search language plugin
|
||||
======================
|
||||
|
||||
.. automodule:: searx.plugins.autodetect_search_language
|
||||
:members:
|
9
docs/src/searx.plugins.tor_check.rst
Normal file
9
docs/src/searx.plugins.tor_check.rst
Normal file
|
@ -0,0 +1,9 @@
|
|||
.. _tor check plugin:
|
||||
|
||||
================
|
||||
Tor check plugin
|
||||
================
|
||||
|
||||
.. automodule:: searx.plugins.tor_check
|
||||
:members:
|
||||
|
|
@ -4,5 +4,5 @@
|
|||
Redis DB
|
||||
========
|
||||
|
||||
.. automodule:: searx.shared.redisdb
|
||||
.. automodule:: searx.redisdb
|
||||
:members:
|
8
docs/src/searx.redislib.rst
Normal file
8
docs/src/searx.redislib.rst
Normal file
|
@ -0,0 +1,8 @@
|
|||
.. _searx.redis:
|
||||
|
||||
=============
|
||||
Redis Library
|
||||
=============
|
||||
|
||||
.. automodule:: searx.redislib
|
||||
:members:
|
|
@ -1,80 +0,0 @@
|
|||
|
||||
.. _filtron.sh:
|
||||
|
||||
====================
|
||||
``utils/filtron.sh``
|
||||
====================
|
||||
|
||||
.. sidebar:: further reading
|
||||
|
||||
- :ref:`searxng filtron`
|
||||
- :ref:`architecture`
|
||||
- :ref:`installation` (:ref:`nginx <installation nginx>` & :ref:`apache
|
||||
<installation apache>`)
|
||||
|
||||
.. _Go: https://golang.org/
|
||||
.. _filtron: https://github.com/searxng/filtron
|
||||
.. _filtron README: https://github.com/searxng/filtron/blob/master/README.md
|
||||
|
||||
To simplify installation and maintenance of a filtron instance you can use the
|
||||
script :origin:`utils/filtron.sh`. In most cases you will install filtron_
|
||||
simply by running the command:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sudo -H ./utils/filtron.sh install all
|
||||
|
||||
The script adds a ``${SERVICE_USER}`` (default:``filtron``) and installs filtron_
|
||||
into this user account:
|
||||
|
||||
#. Create a separated user account (``filtron``).
|
||||
#. Download and install Go_ binary in user's $HOME (``~filtron``).
|
||||
#. Install filtron with the package management from Go_ (``go get -v -u
|
||||
github.com/searxng/filtron``)
|
||||
#. Setup a proper rule configuration :origin:`[ref]
|
||||
<utils/templates/etc/filtron/rules.json>` (``/etc/filtron/rules.json``).
|
||||
#. Setup a systemd service unit :origin:`[ref]
|
||||
<utils/templates/lib/systemd/system/filtron.service>`
|
||||
(``/lib/systemd/system/filtron.service``).
|
||||
|
||||
|
||||
Create user
|
||||
===========
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/filtron.rst
|
||||
:start-after: START create user
|
||||
:end-before: END create user
|
||||
|
||||
|
||||
Install go
|
||||
==========
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/filtron.rst
|
||||
:start-after: START install go
|
||||
:end-before: END install go
|
||||
|
||||
|
||||
Install filtron
|
||||
===============
|
||||
|
||||
Install :origin:`rules.json <utils/templates/etc/filtron/rules.json>` at
|
||||
``/etc/filtron/rules.json`` (see :ref:`Sample configuration of filtron`) and
|
||||
install filtron software and systemd unit:
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/filtron.rst
|
||||
:start-after: START install filtron
|
||||
:end-before: END install filtron
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/filtron.rst
|
||||
:start-after: START install systemd unit
|
||||
:end-before: END install systemd unit
|
||||
|
||||
.. _filtron.sh overview:
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
The ``--help`` output of the script is largely self-explanatory
|
||||
(:ref:`toolboxing common`):
|
||||
|
||||
.. program-output:: ../utils/filtron.sh --help
|
|
@ -1,52 +1,30 @@
|
|||
.. _searx_utils:
|
||||
.. _toolboxing:
|
||||
|
||||
===================
|
||||
Admin's tooling box
|
||||
===================
|
||||
==================
|
||||
DevOps tooling box
|
||||
==================
|
||||
|
||||
In the folder :origin:`utils/` we maintain some tools useful for administrators.
|
||||
In the folder :origin:`utils/` we maintain some tools useful for administrators
|
||||
and developers.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents
|
||||
|
||||
searx.sh
|
||||
filtron.sh
|
||||
morty.sh
|
||||
searxng.sh
|
||||
lxc.sh
|
||||
|
||||
.. _toolboxing common:
|
||||
Common command environments
|
||||
===========================
|
||||
|
||||
Common commands & environment
|
||||
=============================
|
||||
|
||||
Scripts to maintain services often dispose of common commands and environments.
|
||||
|
||||
``shell`` : command
|
||||
Opens a shell from the service user ``${SERVICE_USSR}``, very helpful for
|
||||
troubleshooting.
|
||||
|
||||
``inspect service`` : command
|
||||
Shows status and log of the service, most often you have a option to enable
|
||||
more verbose debug logs. Very helpful for debugging, but be careful not to
|
||||
enable debugging in a production environment!
|
||||
The scripts in our tooling box often dispose of common environments:
|
||||
|
||||
``FORCE_TIMEOUT`` : environment
|
||||
Sets timeout for interactive prompts. If you want to run a script in batch
|
||||
job, with defaults choices, set ``FORCE_TIMEOUT=0``. By example; to install a
|
||||
reverse proxy for filtron on all containers of the :ref:`SearXNG suite
|
||||
<lxc-searx.env>` use ::
|
||||
SearXNG server and nginx proxy on all containers of the :ref:`SearXNG suite
|
||||
<lxc-searxng.env>` use::
|
||||
|
||||
sudo -H ./utils/lxc.sh cmd -- FORCE_TIMEOUT=0 ./utils/filtron.sh apache install
|
||||
|
||||
.. _toolboxing setup:
|
||||
|
||||
Tooling box setup
|
||||
=================
|
||||
|
||||
The main setup is done in the :origin:`.config.sh` (read also :ref:`settings
|
||||
global`).
|
||||
|
||||
.. literalinclude:: ../../.config.sh
|
||||
:language: bash
|
||||
sudo -H ./utils/lxc.sh cmd -- FORCE_TIMEOUT=0 ./utils/searxng.sh install all
|
||||
sudo -H ./utils/lxc.sh cmd -- FORCE_TIMEOUT=0 ./utils/searxng.sh install nginx
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
With the use of *Linux Containers* (LXC_) we can scale our tasks over a stack of
|
||||
containers, what we call the: *lxc suite*. The *SearXNG suite*
|
||||
(:origin:`lxc-searx.env <utils/lxc-searx.env>`) is loaded by default, every time
|
||||
(:origin:`lxc-searxng.env <utils/lxc-searxng.env>`) is loaded by default, every time
|
||||
you start the ``lxc.sh`` script (*you do not need to care about*).
|
||||
|
||||
Before you can start with containers, you need to install and initiate LXD_
|
||||
|
@ -49,7 +49,7 @@ help>`.
|
|||
|
||||
If you do not want to build all containers, **you can build just one**::
|
||||
|
||||
$ sudo -H ./utils/lxc.sh build searx-ubu1804
|
||||
$ sudo -H ./utils/lxc.sh build searxng-archlinux
|
||||
|
||||
*Good to know ...*
|
||||
|
||||
|
@ -62,9 +62,9 @@ of::
|
|||
|
||||
In the containers, you can run what ever you want, e.g. to start a bash use::
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searx-ubu1804 bash
|
||||
INFO: [searx-ubu1804] bash
|
||||
root@searx-ubu1804:/share/searx#
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux bash
|
||||
INFO: [searxng-archlinux] bash
|
||||
[root@searxng-archlinux SearXNG]#
|
||||
|
||||
If there comes the time you want to **get rid off all** the containers and
|
||||
**clean up local images** just type::
|
||||
|
@ -121,28 +121,26 @@ Install suite
|
|||
=============
|
||||
|
||||
To install the complete :ref:`SearXNG suite (includes searx, morty & filtron)
|
||||
<lxc-searx.env>` into all LXC_ use::
|
||||
<lxc-searxng.env>` into all LXC_ use::
|
||||
|
||||
$ sudo -H ./utils/lxc.sh install suite
|
||||
|
||||
The command above installs a SearXNG suite (see :ref:`installation scripts`). To
|
||||
get the IP (URL) of the filtron service in the containers use ``show suite``
|
||||
The command above installs a SearXNG suite (see :ref:`installation scripts`).
|
||||
To :ref:`install a nginx <installation nginx>` reverse proxy (or alternatively
|
||||
use :ref:`apache <installation apache>`)::
|
||||
|
||||
sudo -H ./utils/lxc.sh cmd -- FORCE_TIMEOUT=0 ./utils/searxng.sh install nginx
|
||||
|
||||
To get the IP (URL) of the SearXNG service in the containers use ``show suite``
|
||||
command. To test instances from containers just open the URLs in your
|
||||
WEB-Browser::
|
||||
|
||||
$ sudo ./utils/lxc.sh show suite | grep filtron
|
||||
[searx-ubu1604] INFO: (eth0) filtron: http://n.n.n.246:4004/ http://n.n.n.246/searx
|
||||
[searx-ubu1804] INFO: (eth0) filtron: http://n.n.n.147:4004/ http://n.n.n.147/searx
|
||||
[searx-ubu1910] INFO: (eth0) filtron: http://n.n.n.140:4004/ http://n.n.n.140/searx
|
||||
[searx-ubu2004] INFO: (eth0) filtron: http://n.n.n.18:4004/ http://n.n.n.18/searx
|
||||
[searx-fedora31] INFO: (eth0) filtron: http://n.n.n.46:4004/ http://n.n.n.46/searx
|
||||
[searx-archlinux] INFO: (eth0) filtron: http://n.n.n.32:4004/ http://n.n.n.32/searx
|
||||
$ sudo ./utils/lxc.sh show suite | grep SEARXNG_URL
|
||||
|
||||
To :ref:`install a nginx <installation nginx>` reverse proxy for filtron and
|
||||
morty use (or alternatively use :ref:`apache <installation apache>`)::
|
||||
|
||||
sudo -H ./utils/lxc.sh cmd -- FORCE_TIMEOUT=0 ./utils/filtron.sh nginx install
|
||||
sudo -H ./utils/lxc.sh cmd -- FORCE_TIMEOUT=0 ./utils/morty.sh nginx install
|
||||
[searxng-ubu2110] SEARXNG_URL : http://n.n.n.147/searxng
|
||||
[searxng-ubu2004] SEARXNG_URL : http://n.n.n.246/searxng
|
||||
[searxnggfedora35] SEARXNG_URL : http://n.n.n.140/searxng
|
||||
[searxng-archlinux] SEARXNG_URL : http://n.n.n.165/searxng
|
||||
|
||||
|
||||
Running commands
|
||||
|
@ -152,8 +150,8 @@ Running commands
|
|||
:ref:`toolboxing`. By example: to setup a :ref:`buildhosts` and run the
|
||||
Makefile target ``test`` in the archlinux_ container::
|
||||
|
||||
sudo -H ./utils/lxc.sh cmd searx-archlinux ./utils/searx.sh install buildhost
|
||||
sudo -H ./utils/lxc.sh cmd searx-archlinux make test
|
||||
sudo -H ./utils/lxc.sh cmd searxng-archlinux ./utils/searxng.sh install buildhost
|
||||
sudo -H ./utils/lxc.sh cmd searxng-archlinux make test
|
||||
|
||||
|
||||
Setup SearXNG buildhost
|
||||
|
@ -164,11 +162,11 @@ The installation procedure to set up a :ref:`build host<buildhosts>` takes its
|
|||
time. Installation in all containers will take more time (time for another cup
|
||||
of coffee).::
|
||||
|
||||
sudo -H ./utils/lxc.sh cmd -- ./utils/searx.sh install buildhost
|
||||
sudo -H ./utils/lxc.sh cmd -- ./utils/searxng.sh install buildhost
|
||||
|
||||
To build (live) documentation inside a archlinux_ container::
|
||||
|
||||
sudo -H ./utils/lxc.sh cmd searx-archlinux make docs.clean docs.live
|
||||
sudo -H ./utils/lxc.sh cmd searxng-archlinux make docs.clean docs.live
|
||||
...
|
||||
[I 200331 15:00:42 server:296] Serving on http://0.0.0.0:8080
|
||||
|
||||
|
@ -176,7 +174,7 @@ To get IP of the container and the port number *live docs* is listening::
|
|||
|
||||
$ sudo ./utils/lxc.sh show suite | grep docs.live
|
||||
...
|
||||
[searx-archlinux] INFO: (eth0) docs.live: http://n.n.n.12:8080/
|
||||
[searxng-archlinux] INFO: (eth0) docs.live: http://n.n.n.12:8080/
|
||||
|
||||
|
||||
.. _lxc.sh help:
|
||||
|
@ -189,10 +187,10 @@ The ``--help`` output of the script is largely self-explanatory:
|
|||
.. program-output:: ../utils/lxc.sh --help
|
||||
|
||||
|
||||
.. _lxc-searx.env:
|
||||
.. _lxc-searxng.env:
|
||||
|
||||
SearXNG suite
|
||||
=============
|
||||
|
||||
.. literalinclude:: ../../utils/lxc-searx.env
|
||||
.. literalinclude:: ../../utils/lxc-searxng.env
|
||||
:language: bash
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
|
||||
.. _morty: https://github.com/asciimoo/morty
|
||||
.. _morty's README: https://github.com/asciimoo/morty
|
||||
.. _Go: https://golang.org/
|
||||
|
||||
.. _morty.sh:
|
||||
|
||||
==================
|
||||
``utils/morty.sh``
|
||||
==================
|
||||
|
||||
.. sidebar:: further reading
|
||||
|
||||
- :ref:`architecture`
|
||||
- :ref:`installation` (:ref:`nginx <installation nginx>` & :ref:`apache
|
||||
<installation apache>`)
|
||||
- :ref:`searxng morty`
|
||||
|
||||
To simplify installation and maintenance of a morty_ instance you can use the
|
||||
script :origin:`utils/morty.sh`. In most cases you will install morty_ simply by
|
||||
running the command:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sudo -H ./utils/morty.sh install all
|
||||
|
||||
The script adds a ``${SERVICE_USER}`` (default:``morty``) and installs morty_
|
||||
into this user account:
|
||||
|
||||
#. Create a separated user account (``morty``).
|
||||
#. Download and install Go_ binary in user's $HOME (``~morty``).
|
||||
#. Install morty_ with the package management from Go_ (``go get -v -u
|
||||
github.com/asciimoo/morty``)
|
||||
#. Setup a systemd service unit :origin:`[ref]
|
||||
<utils/templates/lib/systemd/system/morty.service>`
|
||||
(``/lib/systemd/system/morty.service``).
|
||||
|
||||
.. hint::
|
||||
|
||||
To add morty to your SearXNG instance read chapter :ref:`searxng morty`.
|
||||
|
||||
Create user
|
||||
===========
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/morty.rst
|
||||
:start-after: START create user
|
||||
:end-before: END create user
|
||||
|
||||
|
||||
Install go
|
||||
==========
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/morty.rst
|
||||
:start-after: START install go
|
||||
:end-before: END install go
|
||||
|
||||
|
||||
Install morty
|
||||
=============
|
||||
|
||||
Install morty software and systemd unit:
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/morty.rst
|
||||
:start-after: START install morty
|
||||
:end-before: END install morty
|
||||
|
||||
.. kernel-include:: $DOCS_BUILD/includes/morty.rst
|
||||
:start-after: START install systemd unit
|
||||
:end-before: END install systemd unit
|
||||
|
||||
.. _morty.sh overview:
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
The ``--help`` output of the script is largely self-explanatory
|
||||
(:ref:`toolboxing common`):
|
||||
|
||||
.. program-output:: ../utils/morty.sh --help
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
|
||||
.. _searx.sh:
|
||||
|
||||
==================
|
||||
``utils/searx.sh``
|
||||
==================
|
||||
|
||||
.. sidebar:: further reading
|
||||
|
||||
- :ref:`architecture`
|
||||
- :ref:`installation`
|
||||
- :ref:`installation nginx`
|
||||
- :ref:`installation apache`
|
||||
|
||||
To simplify installation and maintenance of a SearXNG instance you can use the
|
||||
script :origin:`utils/searx.sh`.
|
||||
|
||||
Install
|
||||
=======
|
||||
|
||||
In most cases you will install SearXNG simply by running the command:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sudo -H ./utils/searx.sh install all
|
||||
|
||||
The script adds a ``${SERVICE_USER}`` (default:``searx``) and installs SearXNG
|
||||
into this user account. The installation is described in chapter
|
||||
:ref:`installation basic`.
|
||||
|
||||
.. _intranet reverse proxy:
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
The ``--help`` output of the script is largely self-explanatory
|
||||
(:ref:`toolboxing common`):
|
||||
|
||||
.. program-output:: ../utils/searx.sh --help
|
36
docs/utils/searxng.sh.rst
Normal file
36
docs/utils/searxng.sh.rst
Normal file
|
@ -0,0 +1,36 @@
|
|||
|
||||
.. _searxng.sh:
|
||||
|
||||
====================
|
||||
``utils/searxng.sh``
|
||||
====================
|
||||
|
||||
.. sidebar:: further reading
|
||||
|
||||
- :ref:`architecture`
|
||||
- :ref:`installation`
|
||||
- :ref:`installation nginx`
|
||||
- :ref:`installation apache`
|
||||
|
||||
To simplify the installation and maintenance of a SearXNG instance you can use the
|
||||
script :origin:`utils/searxng.sh`.
|
||||
|
||||
Install
|
||||
=======
|
||||
|
||||
In most cases you will install SearXNG simply by running the command:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sudo -H ./utils/searx.sh install all
|
||||
|
||||
The installation is described in chapter :ref:`installation basic`.
|
||||
|
||||
.. _searxng.sh overview:
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
The ``--help`` output of the script is largely self-explanatory:
|
||||
|
||||
.. program-output:: ../utils/searxng.sh --help
|
51
manage
51
manage
|
@ -30,7 +30,13 @@ GECKODRIVER_VERSION="v0.30.0"
|
|||
export NODE_MINIMUM_VERSION="16.13.0"
|
||||
# SPHINXOPTS=
|
||||
BLACK_OPTIONS=("--target-version" "py37" "--line-length" "120" "--skip-string-normalization")
|
||||
BLACK_TARGETS=("--exclude" "searx/static,searx/languages.py" "--include" "searxng.msg" "searx" "searxng_extra" "tests")
|
||||
BLACK_TARGETS=("--exclude" "searx/static,searx/languages.py" "--include" 'searxng.msg|\.pyi?$' "searx" "searxng_extra" "tests")
|
||||
|
||||
_dev_redis_sock="/usr/local/searxng-redis/run/redis.sock"
|
||||
# set SEARXNG_REDIS_URL if it is not defined and "{_dev_redis_sock}" exists.
|
||||
if [ -S "${_dev_redis_sock}" ] && [ -z "${SEARXNG_REDIS_URL}" ]; then
|
||||
export SEARXNG_REDIS_URL="unix://${_dev_redis_sock}?db=0"
|
||||
fi
|
||||
|
||||
pylint.FILES() {
|
||||
|
||||
|
@ -65,6 +71,8 @@ help() {
|
|||
cat <<EOF
|
||||
buildenv:
|
||||
rebuild ./utils/brand.env
|
||||
webapp.:
|
||||
run : run developer instance
|
||||
weblate.:
|
||||
push.translations: push translation changes from SearXNG to Weblate's counterpart
|
||||
to.translations: Update 'translations' branch with last additions from Weblate.
|
||||
|
@ -89,7 +97,8 @@ redis:
|
|||
install : create user (${REDIS_USER}) and install systemd service (${REDIS_SERVICE_NAME})
|
||||
help : show more redis commands
|
||||
node.:
|
||||
env : download & install npm dependencies locally
|
||||
env : download & install SearXNG's npm dependencies locally
|
||||
env.dev : download & install developer and CI tools
|
||||
clean : drop locally npm installations
|
||||
py.:
|
||||
build : Build python packages at ./${PYDIST}
|
||||
|
@ -121,6 +130,10 @@ pygments.:
|
|||
EOF
|
||||
go.help
|
||||
static_help
|
||||
cat <<EOF
|
||||
environment ...
|
||||
SEARXNG_REDIS_URL : ${SEARXNG_REDIS_URL}
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
@ -178,11 +191,11 @@ weblate.translations.worktree() {
|
|||
# 'translations' from Weblate's counterpart (weblate) of the SearXNG
|
||||
# (origin).
|
||||
#
|
||||
# remote weblate https://weblate.bubu1.eu/git/searxng/searxng/
|
||||
# remote weblate https://translate.codeberg.org/git/searxng/searxng/
|
||||
|
||||
( set -e
|
||||
if ! git remote get-url weblate 2> /dev/null; then
|
||||
git remote add weblate https://weblate.bubu1.eu/git/searxng/searxng/
|
||||
git remote add weblate https://translate.codeberg.org/git/searxng/searxng/
|
||||
fi
|
||||
if [ -d "${TRANSLATIONS_WORKTREE}" ]; then
|
||||
pushd .
|
||||
|
@ -416,9 +429,7 @@ docs.prebuild() {
|
|||
set -e
|
||||
[ "$VERBOSE" = "1" ] && set -x
|
||||
mkdir -p "${DOCS_BUILD}/includes"
|
||||
./utils/searx.sh doc | cat > "${DOCS_BUILD}/includes/searx.rst"
|
||||
./utils/filtron.sh doc | cat > "${DOCS_BUILD}/includes/filtron.rst"
|
||||
./utils/morty.sh doc | cat > "${DOCS_BUILD}/includes/morty.rst"
|
||||
./utils/searxng.sh searxng.doc.rst > "${DOCS_BUILD}/includes/searxng.rst"
|
||||
pyenv.cmd searxng_extra/docs_prebuild
|
||||
)
|
||||
dump_return $?
|
||||
|
@ -468,7 +479,7 @@ docker.build() {
|
|||
eval "$(python -m searx.version)"
|
||||
|
||||
# Get the last git commit id
|
||||
VERSION_GITCOMMIT=$(echo "$VERSION_STRING" | cut -d- -f3)
|
||||
VERSION_GITCOMMIT=$(echo "$VERSION_TAG" | cut -d+ -f2)
|
||||
build_msg DOCKER "Last commit : $VERSION_GITCOMMIT"
|
||||
|
||||
# define the docker image name
|
||||
|
@ -490,6 +501,7 @@ docker.build() {
|
|||
docker $BUILD \
|
||||
--build-arg BASE_IMAGE="${DEPENDENCIES_IMAGE_NAME}" \
|
||||
--build-arg GIT_URL="${GIT_URL}" \
|
||||
--build-arg SEARXNG_DOCKER_TAG="${DOCKER_TAG}" \
|
||||
--build-arg SEARXNG_GIT_VERSION="${VERSION_STRING}" \
|
||||
--build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
|
||||
--build-arg LABEL_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
|
||||
|
@ -497,11 +509,11 @@ docker.build() {
|
|||
--build-arg LABEL_VCS_URL="${GIT_URL}" \
|
||||
--build-arg TIMESTAMP_SETTINGS="$(git log -1 --format="%cd" --date=unix -- searx/settings.yml)" \
|
||||
--build-arg TIMESTAMP_UWSGI="$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini)" \
|
||||
-t "${SEARXNG_IMAGE_NAME}:latest" -t "${SEARXNG_IMAGE_NAME}:${VERSION_STRING}" .
|
||||
-t "${SEARXNG_IMAGE_NAME}:latest" -t "${SEARXNG_IMAGE_NAME}:${DOCKER_TAG}" .
|
||||
|
||||
if [ "$1" = "push" ]; then
|
||||
docker push "${SEARXNG_IMAGE_NAME}:latest"
|
||||
docker push "${SEARXNG_IMAGE_NAME}:${SEARXNG_GIT_VERSION}"
|
||||
docker push "${SEARXNG_IMAGE_NAME}:${DOCKER_TAG}"
|
||||
fi
|
||||
)
|
||||
dump_return $?
|
||||
|
@ -552,16 +564,15 @@ nodejs.ensure() {
|
|||
node.env() {
|
||||
nodejs.ensure
|
||||
( set -e
|
||||
|
||||
build_msg INSTALL "searx/static/themes/simple/package.json"
|
||||
build_msg INSTALL "./searx/static/themes/simple/package.json"
|
||||
npm --prefix searx/static/themes/simple install
|
||||
)
|
||||
dump_return $?
|
||||
}
|
||||
|
||||
node.env.devtools() {
|
||||
node.env.dev() {
|
||||
nodejs.ensure
|
||||
build_msg INSTALL "package.json: developer and CI tools"
|
||||
build_msg INSTALL "./package.json: developer and CI tools"
|
||||
npm install
|
||||
}
|
||||
|
||||
|
@ -574,6 +585,10 @@ node.clean() {
|
|||
( set -e
|
||||
npm --prefix searx/static/themes/simple run clean
|
||||
)
|
||||
build_msg CLEAN "locally installed developer and CI tools"
|
||||
( set -e
|
||||
npm --prefix . run clean
|
||||
)
|
||||
dump_return $?
|
||||
}
|
||||
|
||||
|
@ -661,7 +676,8 @@ format.python() {
|
|||
|
||||
test.yamllint() {
|
||||
build_msg TEST "[yamllint] \$YAMLLINT_FILES"
|
||||
pyenv.cmd yamllint --format parsable "${YAMLLINT_FILES[@]}"
|
||||
pyenv.cmd yamllint --strict --format parsable "${YAMLLINT_FILES[@]}"
|
||||
dump_return $?
|
||||
}
|
||||
|
||||
test.pylint() {
|
||||
|
@ -690,7 +706,7 @@ test.pylint() {
|
|||
|
||||
test.pyright() {
|
||||
build_msg TEST "[pyright] static type check of python sources"
|
||||
node.env.devtools
|
||||
node.env.dev
|
||||
# We run Pyright in the virtual environment because Pyright
|
||||
# executes "python" to determine the Python version.
|
||||
build_msg TEST "[pyright] suppress warnings related to intentional monkey patching"
|
||||
|
@ -699,7 +715,8 @@ test.pyright() {
|
|||
| grep -v '/engines/.*.py.* - warning: "logger" is not defined'\
|
||||
| grep -v '/plugins/.*.py.* - error: "logger" is not defined'\
|
||||
| grep -v '/engines/.*.py.* - warning: "supported_languages" is not defined' \
|
||||
| grep -v '/engines/.*.py.* - warning: "language_aliases" is not defined'
|
||||
| grep -v '/engines/.*.py.* - warning: "language_aliases" is not defined' \
|
||||
| grep -v '/engines/.*.py.* - warning: "categories" is not defined'
|
||||
dump_return $?
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"eslint": "^8.11.0",
|
||||
"pyright": "^1.1.215"
|
||||
"eslint": "^8.18.0",
|
||||
"pyright": "^1.1.255"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rm -Rf node_modules package-lock.json"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
mock==4.0.3
|
||||
nose2[coverage_plugin]==0.11.0
|
||||
mock==5.0.1
|
||||
nose2[coverage_plugin]==0.12.0
|
||||
cov-core==1.15.0
|
||||
black==22.3.0
|
||||
pycodestyle==2.8.0
|
||||
pylint==2.13.8
|
||||
splinter==0.17.0
|
||||
selenium==4.1.5
|
||||
twine==4.0.0
|
||||
Pallets-Sphinx-Themes==2.0.2
|
||||
Sphinx==4.5.0
|
||||
black==22.12.0
|
||||
pylint==2.16.2
|
||||
splinter==0.19.0
|
||||
selenium==4.8.0
|
||||
twine==4.0.2
|
||||
Pallets-Sphinx-Themes==2.0.3
|
||||
Sphinx==5.3.0
|
||||
sphinx-issues==3.0.1
|
||||
sphinx-jinja==2.0.1
|
||||
sphinx-tabs==3.3.1
|
||||
sphinx-jinja==2.0.2
|
||||
sphinx-tabs==3.4.1
|
||||
sphinxcontrib-programoutput==0.17
|
||||
sphinx-autobuild==2021.3.14
|
||||
sphinx-notfound-page==0.8
|
||||
myst-parser==0.17.2
|
||||
linuxdoc==20211220
|
||||
aiounittest==1.4.1
|
||||
yamllint==1.26.3
|
||||
sphinx-notfound-page==0.8.3
|
||||
myst-parser==0.18.1
|
||||
linuxdoc==20221127
|
||||
aiounittest==1.4.2
|
||||
yamllint==1.29.0
|
||||
wlc==1.13
|
||||
coloredlogs==15.0.1
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
certifi==2021.10.8
|
||||
babel==2.10.1
|
||||
flask-babel==2.0.0
|
||||
flask==2.1.2
|
||||
certifi==2022.12.7
|
||||
babel==2.11.0
|
||||
flask-babel==3.0.1
|
||||
flask==2.2.3
|
||||
jinja2==3.1.2
|
||||
lxml==4.8.0
|
||||
pygments==2.12.0
|
||||
lxml==4.9.2
|
||||
pygments==2.14.0
|
||||
python-dateutil==2.8.2
|
||||
pyyaml==6.0
|
||||
httpx[http2]==0.21.2
|
||||
Brotli==1.0.9
|
||||
uvloop==0.16.0
|
||||
uvloop==0.17.0
|
||||
httpx-socks[asyncio]==0.7.2
|
||||
langdetect==1.0.9
|
||||
setproctitle==1.2.3
|
||||
redis==4.2.2
|
||||
setproctitle==1.3.2
|
||||
redis==4.5.1
|
||||
markdown-it-py==2.1.0
|
||||
typing_extensions==4.2.0
|
||||
typing_extensions==4.5.0
|
||||
fasttext-predict==0.9.2.1
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"""This module implements functions needed for the autocompleter.
|
||||
|
||||
"""
|
||||
# pylint: disable=use-dict-literal
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
|
@ -89,17 +90,24 @@ def seznam(query, _lang):
|
|||
# seznam search autocompleter
|
||||
url = 'https://suggest.seznam.cz/fulltext/cs?{query}'
|
||||
|
||||
resp = get(url.format(query=urlencode(
|
||||
{'phrase': query, 'cursorPosition': len(query), 'format': 'json-2', 'highlight': '1', 'count': '6'}
|
||||
)))
|
||||
resp = get(
|
||||
url.format(
|
||||
query=urlencode(
|
||||
{'phrase': query, 'cursorPosition': len(query), 'format': 'json-2', 'highlight': '1', 'count': '6'}
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if not resp.ok:
|
||||
return []
|
||||
|
||||
data = resp.json()
|
||||
return [''.join(
|
||||
[part.get('text', '') for part in item.get('text', [])]
|
||||
) for item in data.get('result', []) if item.get('itemType', None) == 'ItemType.TEXT']
|
||||
return [
|
||||
''.join([part.get('text', '') for part in item.get('text', [])])
|
||||
for item in data.get('result', [])
|
||||
if item.get('itemType', None) == 'ItemType.TEXT'
|
||||
]
|
||||
|
||||
|
||||
def startpage(query, lang):
|
||||
# startpage autocompleter
|
||||
|
@ -145,6 +153,16 @@ def wikipedia(query, lang):
|
|||
return []
|
||||
|
||||
|
||||
def yandex(query, _lang):
|
||||
# yandex autocompleter
|
||||
url = "https://suggest.yandex.com/suggest-ff.cgi?{0}"
|
||||
|
||||
resp = loads(get(url.format(urlencode(dict(part=query)))).text)
|
||||
if len(resp) > 1:
|
||||
return resp[1]
|
||||
return []
|
||||
|
||||
|
||||
backends = {
|
||||
'dbpedia': dbpedia,
|
||||
'duckduckgo': duckduckgo,
|
||||
|
@ -155,6 +173,7 @@ backends = {
|
|||
'qwant': qwant,
|
||||
'wikipedia': wikipedia,
|
||||
'brave': brave,
|
||||
'yandex': yandex,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,8 +7,11 @@
|
|||
# pylint: disable=C,R
|
||||
|
||||
|
||||
__all__ = ('cached_property',)
|
||||
|
||||
|
||||
try:
|
||||
from functools import cached_property # pylint: disable=unused-import
|
||||
from functools import cached_property # type: ignore
|
||||
|
||||
except ImportError:
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -1396,170 +1396,155 @@
|
|||
"sv",
|
||||
"zh"
|
||||
],
|
||||
"qwant": [
|
||||
"bg-BG",
|
||||
"ca-ES",
|
||||
"cs-CZ",
|
||||
"da-DK",
|
||||
"de-AT",
|
||||
"de-CH",
|
||||
"de-DE",
|
||||
"el-GR",
|
||||
"en-AU",
|
||||
"en-CA",
|
||||
"en-GB",
|
||||
"en-IE",
|
||||
"en-MY",
|
||||
"en-NZ",
|
||||
"en-US",
|
||||
"es-AR",
|
||||
"es-CL",
|
||||
"es-ES",
|
||||
"es-MX",
|
||||
"et-EE",
|
||||
"fi-FI",
|
||||
"fr-BE",
|
||||
"fr-CA",
|
||||
"fr-CH",
|
||||
"fr-FR",
|
||||
"hu-HU",
|
||||
"it-CH",
|
||||
"it-IT",
|
||||
"ko-KR",
|
||||
"nb-NO",
|
||||
"nl-BE",
|
||||
"nl-NL",
|
||||
"pl-PL",
|
||||
"pt-PT",
|
||||
"ro-RO",
|
||||
"sv-SE",
|
||||
"th-TH",
|
||||
"zh-CN",
|
||||
"zh-HK"
|
||||
],
|
||||
"qwant images": [
|
||||
"bg-BG",
|
||||
"ca-ES",
|
||||
"cs-CZ",
|
||||
"da-DK",
|
||||
"de-AT",
|
||||
"de-CH",
|
||||
"de-DE",
|
||||
"el-GR",
|
||||
"en-AU",
|
||||
"en-CA",
|
||||
"en-GB",
|
||||
"en-IE",
|
||||
"en-MY",
|
||||
"en-NZ",
|
||||
"en-US",
|
||||
"es-AR",
|
||||
"es-CL",
|
||||
"es-ES",
|
||||
"es-MX",
|
||||
"et-EE",
|
||||
"fi-FI",
|
||||
"fr-BE",
|
||||
"fr-CA",
|
||||
"fr-CH",
|
||||
"fr-FR",
|
||||
"hu-HU",
|
||||
"it-CH",
|
||||
"it-IT",
|
||||
"ko-KR",
|
||||
"nb-NO",
|
||||
"nl-BE",
|
||||
"nl-NL",
|
||||
"pl-PL",
|
||||
"pt-PT",
|
||||
"ro-RO",
|
||||
"sv-SE",
|
||||
"th-TH",
|
||||
"zh-CN",
|
||||
"zh-HK"
|
||||
],
|
||||
"qwant news": [
|
||||
"bg-BG",
|
||||
"ca-ES",
|
||||
"cs-CZ",
|
||||
"da-DK",
|
||||
"de-AT",
|
||||
"de-CH",
|
||||
"de-DE",
|
||||
"el-GR",
|
||||
"en-AU",
|
||||
"en-CA",
|
||||
"en-GB",
|
||||
"en-IE",
|
||||
"en-MY",
|
||||
"en-NZ",
|
||||
"en-US",
|
||||
"es-AR",
|
||||
"es-CL",
|
||||
"es-ES",
|
||||
"es-MX",
|
||||
"et-EE",
|
||||
"fi-FI",
|
||||
"fr-BE",
|
||||
"fr-CA",
|
||||
"fr-CH",
|
||||
"fr-FR",
|
||||
"hu-HU",
|
||||
"it-CH",
|
||||
"it-IT",
|
||||
"ko-KR",
|
||||
"nb-NO",
|
||||
"nl-BE",
|
||||
"nl-NL",
|
||||
"pl-PL",
|
||||
"pt-PT",
|
||||
"ro-RO",
|
||||
"sv-SE",
|
||||
"th-TH",
|
||||
"zh-CN",
|
||||
"zh-HK"
|
||||
],
|
||||
"qwant videos": [
|
||||
"bg-BG",
|
||||
"ca-ES",
|
||||
"cs-CZ",
|
||||
"da-DK",
|
||||
"de-AT",
|
||||
"de-CH",
|
||||
"de-DE",
|
||||
"el-GR",
|
||||
"en-AU",
|
||||
"en-CA",
|
||||
"en-GB",
|
||||
"en-IE",
|
||||
"en-MY",
|
||||
"en-NZ",
|
||||
"en-US",
|
||||
"es-AR",
|
||||
"es-CL",
|
||||
"es-ES",
|
||||
"es-MX",
|
||||
"et-EE",
|
||||
"fi-FI",
|
||||
"fr-BE",
|
||||
"fr-CA",
|
||||
"fr-CH",
|
||||
"fr-FR",
|
||||
"hu-HU",
|
||||
"it-CH",
|
||||
"it-IT",
|
||||
"ko-KR",
|
||||
"nb-NO",
|
||||
"nl-BE",
|
||||
"nl-NL",
|
||||
"pl-PL",
|
||||
"pt-PT",
|
||||
"ro-RO",
|
||||
"sv-SE",
|
||||
"th-TH",
|
||||
"zh-CN",
|
||||
"zh-HK"
|
||||
],
|
||||
"qwant": {
|
||||
"bg-BG": "bg_BG",
|
||||
"ca-ES": "ca_ES",
|
||||
"cs-CZ": "cs_CZ",
|
||||
"da-DK": "da_DK",
|
||||
"de-AT": "de_AT",
|
||||
"de-CH": "de_CH",
|
||||
"de-DE": "de_DE",
|
||||
"el-GR": "el_GR",
|
||||
"en-AU": "en_AU",
|
||||
"en-CA": "en_CA",
|
||||
"en-GB": "en_GB",
|
||||
"en-IE": "en_IE",
|
||||
"en-MY": "en_MY",
|
||||
"en-NZ": "en_NZ",
|
||||
"en-US": "en_US",
|
||||
"es-AR": "es_AR",
|
||||
"es-CL": "es_CL",
|
||||
"es-ES": "es_ES",
|
||||
"es-MX": "es_MX",
|
||||
"et-EE": "et_EE",
|
||||
"fi-FI": "fi_FI",
|
||||
"fr-BE": "fr_BE",
|
||||
"fr-CA": "fr_CA",
|
||||
"fr-CH": "fr_CH",
|
||||
"fr-FR": "fr_FR",
|
||||
"hu-HU": "hu_HU",
|
||||
"it-CH": "it_CH",
|
||||
"it-IT": "it_IT",
|
||||
"ko-KR": "ko_KR",
|
||||
"nb-NO": "nb_NO",
|
||||
"nl-BE": "nl_BE",
|
||||
"nl-NL": "nl_NL",
|
||||
"pl-PL": "pl_PL",
|
||||
"pt-PT": "pt_PT",
|
||||
"ro-RO": "ro_RO",
|
||||
"sv-SE": "sv_SE",
|
||||
"th-TH": "th_TH",
|
||||
"zh-CN": "zh_CN",
|
||||
"zh-HK": "zh_HK"
|
||||
},
|
||||
"qwant images": {
|
||||
"bg-BG": "bg_BG",
|
||||
"ca-ES": "ca_ES",
|
||||
"cs-CZ": "cs_CZ",
|
||||
"da-DK": "da_DK",
|
||||
"de-AT": "de_AT",
|
||||
"de-CH": "de_CH",
|
||||
"de-DE": "de_DE",
|
||||
"el-GR": "el_GR",
|
||||
"en-AU": "en_AU",
|
||||
"en-CA": "en_CA",
|
||||
"en-GB": "en_GB",
|
||||
"en-IE": "en_IE",
|
||||
"en-MY": "en_MY",
|
||||
"en-NZ": "en_NZ",
|
||||
"en-US": "en_US",
|
||||
"es-AR": "es_AR",
|
||||
"es-CL": "es_CL",
|
||||
"es-ES": "es_ES",
|
||||
"es-MX": "es_MX",
|
||||
"et-EE": "et_EE",
|
||||
"fi-FI": "fi_FI",
|
||||
"fr-BE": "fr_BE",
|
||||
"fr-CA": "fr_CA",
|
||||
"fr-CH": "fr_CH",
|
||||
"fr-FR": "fr_FR",
|
||||
"hu-HU": "hu_HU",
|
||||
"it-CH": "it_CH",
|
||||
"it-IT": "it_IT",
|
||||
"ko-KR": "ko_KR",
|
||||
"nb-NO": "nb_NO",
|
||||
"nl-BE": "nl_BE",
|
||||
"nl-NL": "nl_NL",
|
||||
"pl-PL": "pl_PL",
|
||||
"pt-PT": "pt_PT",
|
||||
"ro-RO": "ro_RO",
|
||||
"sv-SE": "sv_SE",
|
||||
"th-TH": "th_TH",
|
||||
"zh-CN": "zh_CN",
|
||||
"zh-HK": "zh_HK"
|
||||
},
|
||||
"qwant news": {
|
||||
"ca-ES": "ca_ES",
|
||||
"de-AT": "de_AT",
|
||||
"de-CH": "de_CH",
|
||||
"de-DE": "de_DE",
|
||||
"en-AU": "en_AU",
|
||||
"en-CA": "en_CA",
|
||||
"en-GB": "en_GB",
|
||||
"en-IE": "en_IE",
|
||||
"en-MY": "en_MY",
|
||||
"en-NZ": "en_NZ",
|
||||
"en-US": "en_US",
|
||||
"es-AR": "es_AR",
|
||||
"es-CL": "es_CL",
|
||||
"es-ES": "es_ES",
|
||||
"es-MX": "es_MX",
|
||||
"fr-BE": "fr_BE",
|
||||
"fr-CA": "fr_CA",
|
||||
"fr-CH": "fr_CH",
|
||||
"fr-FR": "fr_FR",
|
||||
"it-CH": "it_CH",
|
||||
"it-IT": "it_IT",
|
||||
"nl-BE": "nl_BE",
|
||||
"nl-NL": "nl_NL",
|
||||
"pt-PT": "pt_PT"
|
||||
},
|
||||
"qwant videos": {
|
||||
"bg-BG": "bg_BG",
|
||||
"ca-ES": "ca_ES",
|
||||
"cs-CZ": "cs_CZ",
|
||||
"da-DK": "da_DK",
|
||||
"de-AT": "de_AT",
|
||||
"de-CH": "de_CH",
|
||||
"de-DE": "de_DE",
|
||||
"el-GR": "el_GR",
|
||||
"en-AU": "en_AU",
|
||||
"en-CA": "en_CA",
|
||||
"en-GB": "en_GB",
|
||||
"en-IE": "en_IE",
|
||||
"en-MY": "en_MY",
|
||||
"en-NZ": "en_NZ",
|
||||
"en-US": "en_US",
|
||||
"es-AR": "es_AR",
|
||||
"es-CL": "es_CL",
|
||||
"es-ES": "es_ES",
|
||||
"es-MX": "es_MX",
|
||||
"et-EE": "et_EE",
|
||||
"fi-FI": "fi_FI",
|
||||
"fr-BE": "fr_BE",
|
||||
"fr-CA": "fr_CA",
|
||||
"fr-CH": "fr_CH",
|
||||
"fr-FR": "fr_FR",
|
||||
"hu-HU": "hu_HU",
|
||||
"it-CH": "it_CH",
|
||||
"it-IT": "it_IT",
|
||||
"ko-KR": "ko_KR",
|
||||
"nb-NO": "nb_NO",
|
||||
"nl-BE": "nl_BE",
|
||||
"nl-NL": "nl_NL",
|
||||
"pl-PL": "pl_PL",
|
||||
"pt-PT": "pt_PT",
|
||||
"ro-RO": "ro_RO",
|
||||
"sv-SE": "sv_SE",
|
||||
"th-TH": "th_TH",
|
||||
"zh-CN": "zh_CN",
|
||||
"zh-HK": "zh_HK"
|
||||
},
|
||||
"startpage": {
|
||||
"af": {
|
||||
"alias": "afrikaans"
|
||||
|
@ -1952,6 +1937,10 @@
|
|||
"english_name": "Banjar",
|
||||
"name": "Bahasa Banjar"
|
||||
},
|
||||
"blk": {
|
||||
"english_name": "Pa'O",
|
||||
"name": "\u1015\u1021\u102d\u102f\u101d\u103a\u108f\u1018\u102c\u108f\u101e\u102c\u108f"
|
||||
},
|
||||
"bm": {
|
||||
"english_name": "Bambara",
|
||||
"name": "Bamanankan"
|
||||
|
@ -2352,6 +2341,10 @@
|
|||
"english_name": "Kabiye",
|
||||
"name": "Kab\u0269y\u025b"
|
||||
},
|
||||
"kcg": {
|
||||
"english_name": "Tyap",
|
||||
"name": "Tyap"
|
||||
},
|
||||
"kg": {
|
||||
"english_name": "Kongo",
|
||||
"name": "Kik\u00f4ngo"
|
||||
|
@ -2668,6 +2661,10 @@
|
|||
"english_name": "Picard",
|
||||
"name": "Picard"
|
||||
},
|
||||
"pcm": {
|
||||
"english_name": "Nigerian Pidgin",
|
||||
"name": "Naij\u00e1"
|
||||
},
|
||||
"pdc": {
|
||||
"english_name": "Pennsylvania German",
|
||||
"name": "Deitsch"
|
||||
|
@ -3214,6 +3211,10 @@
|
|||
"english_name": "Banjar",
|
||||
"name": "Bahasa Banjar"
|
||||
},
|
||||
"blk": {
|
||||
"english_name": "Pa'O",
|
||||
"name": "\u1015\u1021\u102d\u102f\u101d\u103a\u108f\u1018\u102c\u108f\u101e\u102c\u108f"
|
||||
},
|
||||
"bm": {
|
||||
"english_name": "Bambara",
|
||||
"name": "Bamanankan"
|
||||
|
@ -3614,6 +3615,10 @@
|
|||
"english_name": "Kabiye",
|
||||
"name": "Kab\u0269y\u025b"
|
||||
},
|
||||
"kcg": {
|
||||
"english_name": "Tyap",
|
||||
"name": "Tyap"
|
||||
},
|
||||
"kg": {
|
||||
"english_name": "Kongo",
|
||||
"name": "Kik\u00f4ngo"
|
||||
|
@ -3930,6 +3935,10 @@
|
|||
"english_name": "Picard",
|
||||
"name": "Picard"
|
||||
},
|
||||
"pcm": {
|
||||
"english_name": "Nigerian Pidgin",
|
||||
"name": "Naij\u00e1"
|
||||
},
|
||||
"pdc": {
|
||||
"english_name": "Pennsylvania German",
|
||||
"name": "Deitsch"
|
||||
|
|
File diff suppressed because it is too large
Load diff
BIN
searx/data/lid.176.ftz
Executable file
BIN
searx/data/lid.176.ftz
Executable file
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,7 @@
|
|||
{
|
||||
"versions": [
|
||||
"99.0.1",
|
||||
"99.0",
|
||||
"98.0.2",
|
||||
"98.0.1",
|
||||
"98.0"
|
||||
"109.0",
|
||||
"108.0"
|
||||
],
|
||||
"os": [
|
||||
"Windows NT 10.0; Win64; x64",
|
||||
|
|
|
@ -114,7 +114,6 @@
|
|||
"Q106645257": "MN m",
|
||||
"Q106645261": "kN m",
|
||||
"Q106645290": "dN m",
|
||||
"Q106647058": "u",
|
||||
"Q1067722": "Fg",
|
||||
"Q106777906": "μS/m",
|
||||
"Q106777917": "S/cm",
|
||||
|
@ -154,7 +153,6 @@
|
|||
"Q107164998": "cd mm²/m²",
|
||||
"Q107210119": "g/s",
|
||||
"Q107210344": "mg/s",
|
||||
"Q107213614": "kJ/100g",
|
||||
"Q107226391": "cm⁻¹",
|
||||
"Q1072404": "K",
|
||||
"Q107244316": "mm⁻¹",
|
||||
|
@ -209,16 +207,45 @@
|
|||
"Q1091257": "tex",
|
||||
"Q1092296": "a",
|
||||
"Q110143852": "Ω cm",
|
||||
"Q110143896": "cm³/g",
|
||||
"Q1104069": "$",
|
||||
"Q11061003": "μm²",
|
||||
"Q11061005": "nm²",
|
||||
"Q110742003": "dppx",
|
||||
"Q1131660": "st",
|
||||
"Q1137675": "cr",
|
||||
"Q114002440": "𒄀",
|
||||
"Q114002534": "𒃻",
|
||||
"Q114002568": "𒂠",
|
||||
"Q114002639": "𒈨𒊑",
|
||||
"Q114002688": "𒋗𒋛",
|
||||
"Q114002734": "𒊺",
|
||||
"Q114002796": "𒂆",
|
||||
"Q114002897": "𒊬",
|
||||
"Q114002930": "𒀺",
|
||||
"Q114002955": "𒀹𒃷",
|
||||
"Q114002974": "𒃷",
|
||||
"Q114002998": "𒁓",
|
||||
"Q114018694": "𒄥",
|
||||
"Q114018781": "𒁀𒌷𒂵",
|
||||
"Q1140444": "Zb",
|
||||
"Q1140577": "Yb",
|
||||
"Q114589269": "A",
|
||||
"Q1152074": "Pb",
|
||||
"Q1152323": "Tb",
|
||||
"Q115277430": "QB",
|
||||
"Q115280832": "RB",
|
||||
"Q115359862": "qg",
|
||||
"Q115359863": "rg",
|
||||
"Q115359865": "Rg",
|
||||
"Q115359866": "Qg",
|
||||
"Q115359910": "Rm",
|
||||
"Q115533751": "rm",
|
||||
"Q115533764": "qm",
|
||||
"Q115533776": "Qm",
|
||||
"Q116432446": "ᵐ",
|
||||
"Q116432563": "ˢ",
|
||||
"Q116443090": "ʰ",
|
||||
"Q1165799": "mil",
|
||||
"Q11776930": "Mg",
|
||||
"Q11830636": "psf",
|
||||
|
@ -237,12 +264,14 @@
|
|||
"Q12257695": "Eb/s",
|
||||
"Q12257696": "EB/s",
|
||||
"Q12261466": "kB/s",
|
||||
"Q12263659": "mgal",
|
||||
"Q12265780": "Pb/s",
|
||||
"Q12265783": "PB/s",
|
||||
"Q12269121": "Yb/s",
|
||||
"Q12269122": "YB/s",
|
||||
"Q12269308": "Zb/s",
|
||||
"Q12269309": "ZB/s",
|
||||
"Q1238720": "vols.",
|
||||
"Q1247300": "cm H₂O",
|
||||
"Q12714022": "cwt",
|
||||
"Q12789864": "GeV",
|
||||
|
@ -283,7 +312,6 @@
|
|||
"Q14914907": "th",
|
||||
"Q14916719": "Gpc",
|
||||
"Q14923662": "Pm³",
|
||||
"Q1511773": "LSd",
|
||||
"Q15120301": "l atm",
|
||||
"Q1542309": "xu",
|
||||
"Q1545979": "ft³",
|
||||
|
@ -305,7 +333,6 @@
|
|||
"Q17255465": "v_P",
|
||||
"Q173117": "R$",
|
||||
"Q1741429": "kpm",
|
||||
"Q174467": "Lm",
|
||||
"Q174728": "cm",
|
||||
"Q174789": "mm",
|
||||
"Q175821": "μm",
|
||||
|
@ -329,13 +356,11 @@
|
|||
"Q182429": "m/s",
|
||||
"Q1826195": "dl",
|
||||
"Q18413919": "cm/s",
|
||||
"Q184172": "F",
|
||||
"Q185078": "a",
|
||||
"Q185153": "erg",
|
||||
"Q185648": "Torr",
|
||||
"Q185759": "span",
|
||||
"Q1872619": "zs",
|
||||
"Q189097": "₧",
|
||||
"Q190095": "Gy",
|
||||
"Q19017495": "mm²",
|
||||
"Q190951": "S$",
|
||||
|
@ -351,6 +376,7 @@
|
|||
"Q194339": "B$",
|
||||
"Q1970718": "mam",
|
||||
"Q1972579": "pdl",
|
||||
"Q19877834": "cd-ft",
|
||||
"Q199462": "LE",
|
||||
"Q199471": "Afs",
|
||||
"Q200323": "dm",
|
||||
|
@ -389,7 +415,7 @@
|
|||
"Q211256": "mi/h",
|
||||
"Q21154419": "PD",
|
||||
"Q211580": "BTU (th)",
|
||||
"Q212120": "A h",
|
||||
"Q212120": "A⋅h",
|
||||
"Q213005": "G$",
|
||||
"Q2140397": "in³",
|
||||
"Q214377": "ell",
|
||||
|
@ -429,7 +455,6 @@
|
|||
"Q23931040": "dam²",
|
||||
"Q23931103": "nmi²",
|
||||
"Q240468": "syr£",
|
||||
"Q2414435": "$b.",
|
||||
"Q242988": "Lib$",
|
||||
"Q2438073": "ag",
|
||||
"Q2448803": "mV",
|
||||
|
@ -507,6 +532,7 @@
|
|||
"Q3013059": "ka",
|
||||
"Q304479": "tr",
|
||||
"Q305896": "DPI",
|
||||
"Q3095010": "γ",
|
||||
"Q31889818": "ppq",
|
||||
"Q3194304": "kb",
|
||||
"Q3207456": "mW",
|
||||
|
@ -546,7 +572,7 @@
|
|||
"Q3773454": "Mpc",
|
||||
"Q3815076": "Kib",
|
||||
"Q3833309": "£",
|
||||
"Q3858002": "mA h",
|
||||
"Q3858002": "mA⋅h",
|
||||
"Q3867152": "ft/s²",
|
||||
"Q389062": "Tib",
|
||||
"Q3902688": "pl",
|
||||
|
@ -607,6 +633,8 @@
|
|||
"Q53393868": "GJ",
|
||||
"Q53393886": "PJ",
|
||||
"Q53393890": "EJ",
|
||||
"Q53393893": "ZJ",
|
||||
"Q53393898": "YJ",
|
||||
"Q53448786": "yHz",
|
||||
"Q53448790": "zHz",
|
||||
"Q53448794": "fHz",
|
||||
|
@ -620,6 +648,7 @@
|
|||
"Q53448826": "hHz",
|
||||
"Q53448828": "yJ",
|
||||
"Q53448832": "zJ",
|
||||
"Q53448835": "fJ",
|
||||
"Q53448842": "pJ",
|
||||
"Q53448844": "nJ",
|
||||
"Q53448847": "μJ",
|
||||
|
@ -682,6 +711,7 @@
|
|||
"Q53951982": "Mt",
|
||||
"Q53952048": "kt",
|
||||
"Q54006645": "ZWb",
|
||||
"Q54081354": "ZT",
|
||||
"Q54081925": "ZSv",
|
||||
"Q54082468": "ZS",
|
||||
"Q54083144": "ZΩ",
|
||||
|
@ -706,8 +736,6 @@
|
|||
"Q56157046": "nmol",
|
||||
"Q56157048": "pmol",
|
||||
"Q56160603": "fmol",
|
||||
"Q56302633": "UM",
|
||||
"Q56317116": "mgal",
|
||||
"Q56317622": "Q_P",
|
||||
"Q56318907": "kbar",
|
||||
"Q56349362": "Bs.S",
|
||||
|
@ -1184,10 +1212,10 @@
|
|||
"Q11570": "kg",
|
||||
"Q11573": "m",
|
||||
"Q11574": "s",
|
||||
"Q11579": "K",
|
||||
"Q11582": "L",
|
||||
"Q12129": "pc",
|
||||
"Q12438": "N",
|
||||
"Q16068": "DM",
|
||||
"Q1811": "AU",
|
||||
"Q20764": "Ma",
|
||||
"Q2101": "e",
|
||||
|
|
77
searx/engines/9gag.py
Normal file
77
searx/engines/9gag.py
Normal file
|
@ -0,0 +1,77 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
# pylint: disable=invalid-name
|
||||
"""9GAG (social media)"""
|
||||
|
||||
from json import loads
|
||||
from datetime import datetime
|
||||
from urllib.parse import urlencode
|
||||
|
||||
about = {
|
||||
"website": 'https://9gag.com/',
|
||||
"wikidata_id": 'Q277421',
|
||||
"official_api_documentation": None,
|
||||
"use_official_api": True,
|
||||
"require_api_key": False,
|
||||
"results": 'JSON',
|
||||
}
|
||||
|
||||
categories = ['social media']
|
||||
paging = True
|
||||
|
||||
search_url = "https://9gag.com/v1/search-posts?{query}"
|
||||
page_size = 10
|
||||
|
||||
|
||||
def request(query, params):
|
||||
query = urlencode({'query': query, 'c': (params['pageno'] - 1) * page_size})
|
||||
|
||||
params['url'] = search_url.format(query=query)
|
||||
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
results = []
|
||||
|
||||
json_results = loads(resp.text)['data']
|
||||
|
||||
for result in json_results['posts']:
|
||||
result_type = result['type']
|
||||
|
||||
# Get the not cropped version of the thumbnail when the image height is not too important
|
||||
if result['images']['image700']['height'] > 400:
|
||||
thumbnail = result['images']['imageFbThumbnail']['url']
|
||||
else:
|
||||
thumbnail = result['images']['image700']['url']
|
||||
|
||||
if result_type == 'Photo':
|
||||
results.append(
|
||||
{
|
||||
'template': 'images.html',
|
||||
'url': result['url'],
|
||||
'title': result['title'],
|
||||
'content': result['description'],
|
||||
'publishedDate': datetime.utcfromtimestamp(result['creationTs']),
|
||||
'img_src': result['images']['image700']['url'],
|
||||
'thumbnail_src': thumbnail,
|
||||
}
|
||||
)
|
||||
elif result_type == 'Animated':
|
||||
results.append(
|
||||
{
|
||||
'template': 'videos.html',
|
||||
'url': result['url'],
|
||||
'title': result['title'],
|
||||
'content': result['description'],
|
||||
'publishedDate': datetime.utcfromtimestamp(result['creationTs']),
|
||||
'thumbnail': thumbnail,
|
||||
'iframe_src': result['images'].get('image460sv', {}).get('url'),
|
||||
}
|
||||
)
|
||||
|
||||
if 'tags' in json_results:
|
||||
for suggestion in json_results['tags']:
|
||||
results.append({'suggestion': suggestion['key']})
|
||||
|
||||
return results
|
|
@ -44,6 +44,7 @@ ENGINE_DEFAULT_ARGS = {
|
|||
"enable_http": False,
|
||||
"using_tor_proxy": False,
|
||||
"display_error_messages": True,
|
||||
"send_accept_language_header": False,
|
||||
"tokens": [],
|
||||
"about": {},
|
||||
}
|
||||
|
@ -80,6 +81,7 @@ engine_shortcuts = {}
|
|||
|
||||
engine_shortcuts[engine.shortcut] = engine.name
|
||||
|
||||
:meta hide-value:
|
||||
"""
|
||||
|
||||
|
||||
|
@ -104,8 +106,12 @@ def load_engine(engine_data: dict) -> Optional[Engine]:
|
|||
- required attribute is not set :py:func:`is_missing_required_attributes`
|
||||
|
||||
"""
|
||||
# pylint: disable=too-many-return-statements
|
||||
|
||||
engine_name = engine_data['name']
|
||||
engine_name = engine_data.get('name')
|
||||
if engine_name is None:
|
||||
logger.error('An engine does not have a "name" field')
|
||||
return None
|
||||
if '_' in engine_name:
|
||||
logger.error('Engine name contains underscore: "{}"'.format(engine_name))
|
||||
return None
|
||||
|
@ -116,7 +122,10 @@ def load_engine(engine_data: dict) -> Optional[Engine]:
|
|||
engine_data['name'] = engine_name
|
||||
|
||||
# load_module
|
||||
engine_module = engine_data['engine']
|
||||
engine_module = engine_data.get('engine')
|
||||
if engine_module is None:
|
||||
logger.error('The "engine" field is missing for the engine named "{}"'.format(engine_name))
|
||||
return None
|
||||
try:
|
||||
engine = load_module(engine_module + '.py', ENGINE_DIR)
|
||||
except (SyntaxError, KeyboardInterrupt, SystemExit, SystemError, ImportError, RuntimeError):
|
||||
|
@ -149,7 +158,11 @@ def set_loggers(engine, engine_name):
|
|||
engine.logger = logger.getChild(engine_name)
|
||||
# the engine may have load some other engines
|
||||
# may sure the logger is initialized
|
||||
for module_name, module in sys.modules.items():
|
||||
# use sys.modules.copy() to avoid "RuntimeError: dictionary changed size during iteration"
|
||||
# see https://github.com/python/cpython/issues/89516
|
||||
# and https://docs.python.org/3.10/library/sys.html#sys.modules
|
||||
modules = sys.modules.copy()
|
||||
for module_name, module in modules.items():
|
||||
if (
|
||||
module_name.startswith("searx.engines")
|
||||
and module_name != "searx.engines.__init__"
|
||||
|
@ -269,12 +282,12 @@ def is_engine_active(engine: Engine):
|
|||
|
||||
def register_engine(engine: Engine):
|
||||
if engine.name in engines:
|
||||
logger.error('Engine config error: ambigious name: {0}'.format(engine.name))
|
||||
logger.error('Engine config error: ambiguous name: {0}'.format(engine.name))
|
||||
sys.exit(1)
|
||||
engines[engine.name] = engine
|
||||
|
||||
if engine.shortcut in engine_shortcuts:
|
||||
logger.error('Engine config error: ambigious shortcut: {0}'.format(engine.shortcut))
|
||||
logger.error('Engine config error: ambiguous shortcut: {0}'.format(engine.shortcut))
|
||||
sys.exit(1)
|
||||
engine_shortcuts[engine.shortcut] = engine.name
|
||||
|
||||
|
|
57
searx/engines/apple_app_store.py
Normal file
57
searx/engines/apple_app_store.py
Normal file
|
@ -0,0 +1,57 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
"""
|
||||
Apple App Store
|
||||
"""
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
from dateutil.parser import parse
|
||||
|
||||
about = {
|
||||
"website": 'https://www.apple.com/app-store/',
|
||||
"wikidata_id": 'Q368215',
|
||||
"official_api_documentation": (
|
||||
'https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/'
|
||||
'iTuneSearchAPI/UnderstandingSearchResults.html#//apple_ref/doc/uid/TP40017632-CH8-SW1'
|
||||
),
|
||||
"use_official_api": True,
|
||||
"require_api_key": False,
|
||||
"results": 'JSON',
|
||||
}
|
||||
|
||||
categories = ['files', 'apps']
|
||||
safesearch = True
|
||||
|
||||
search_url = 'https://itunes.apple.com/search?{query}'
|
||||
|
||||
|
||||
def request(query, params):
|
||||
explicit = "Yes"
|
||||
|
||||
if params['safesearch'] > 0:
|
||||
explicit = "No"
|
||||
|
||||
params['url'] = search_url.format(query=urlencode({'term': query, 'media': 'software', 'explicit': explicit}))
|
||||
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
results = []
|
||||
|
||||
json_result = loads(resp.text)
|
||||
|
||||
for result in json_result['results']:
|
||||
results.append(
|
||||
{
|
||||
'url': result['trackViewUrl'],
|
||||
'title': result['trackName'],
|
||||
'content': result['description'],
|
||||
'img_src': result['artworkUrl100'],
|
||||
'publishedDate': parse(result['currentVersionReleaseDate']),
|
||||
'author': result['sellerName'],
|
||||
}
|
||||
)
|
||||
|
||||
return results
|
113
searx/engines/apple_maps.py
Normal file
113
searx/engines/apple_maps.py
Normal file
|
@ -0,0 +1,113 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
"""Apple Maps"""
|
||||
|
||||
from json import loads
|
||||
from time import time
|
||||
from urllib.parse import urlencode
|
||||
|
||||
from searx.network import get as http_get
|
||||
from searx.engines.openstreetmap import get_key_label
|
||||
|
||||
about = {
|
||||
"website": 'https://www.apple.com/maps/',
|
||||
"wikidata_id": 'Q276101',
|
||||
"official_api_documentation": None,
|
||||
"use_official_api": True,
|
||||
"require_api_key": False,
|
||||
"results": 'JSON',
|
||||
}
|
||||
|
||||
token = {'value': '', 'last_updated': None}
|
||||
|
||||
categories = ['map']
|
||||
paging = False
|
||||
|
||||
search_url = "https://api.apple-mapkit.com/v1/search?{query}&mkjsVersion=5.72.53"
|
||||
|
||||
|
||||
def obtain_token():
|
||||
update_time = time() - (time() % 1800)
|
||||
try:
|
||||
# use duckduckgo's mapkit token
|
||||
token_response = http_get('https://duckduckgo.com/local.js?get_mk_token=1', timeout=2.0)
|
||||
actual_token = http_get(
|
||||
'https://cdn.apple-mapkit.com/ma/bootstrap?apiVersion=2&mkjsVersion=5.72.53&poi=1',
|
||||
timeout=2.0,
|
||||
headers={'Authorization': 'Bearer ' + token_response.text},
|
||||
)
|
||||
token['value'] = loads(actual_token.text)['authInfo']['access_token']
|
||||
token['last_updated'] = update_time
|
||||
# pylint: disable=bare-except
|
||||
except:
|
||||
pass
|
||||
return token
|
||||
|
||||
|
||||
def request(query, params):
|
||||
if time() - (token['last_updated'] or 0) > 1800:
|
||||
obtain_token()
|
||||
|
||||
params['url'] = search_url.format(query=urlencode({'q': query, 'lang': params['language']}))
|
||||
|
||||
params['headers'] = {'Authorization': 'Bearer ' + token['value']}
|
||||
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
results = []
|
||||
|
||||
resp_json = loads(resp.text)
|
||||
|
||||
user_language = resp.search_params['language']
|
||||
|
||||
for result in resp_json['results']:
|
||||
boundingbox = None
|
||||
if 'displayMapRegion' in result:
|
||||
box = result['displayMapRegion']
|
||||
boundingbox = [box['southLat'], box['northLat'], box['westLng'], box['eastLng']]
|
||||
|
||||
links = []
|
||||
if 'telephone' in result:
|
||||
telephone = result['telephone']
|
||||
links.append(
|
||||
{
|
||||
'label': get_key_label('phone', user_language),
|
||||
'url': 'tel:' + telephone,
|
||||
'url_label': telephone,
|
||||
}
|
||||
)
|
||||
if result.get('urls'):
|
||||
url = result['urls'][0]
|
||||
links.append(
|
||||
{
|
||||
'label': get_key_label('website', user_language),
|
||||
'url': url,
|
||||
'url_label': url,
|
||||
}
|
||||
)
|
||||
|
||||
results.append(
|
||||
{
|
||||
'template': 'map.html',
|
||||
'type': result.get('poiCategory'),
|
||||
'title': result['name'],
|
||||
'links': links,
|
||||
'latitude': result['center']['lat'],
|
||||
'longitude': result['center']['lng'],
|
||||
'url': result['placecardUrl'],
|
||||
'boundingbox': boundingbox,
|
||||
'geojson': {'type': 'Point', 'coordinates': [result['center']['lng'], result['center']['lat']]},
|
||||
'address': {
|
||||
'name': result['name'],
|
||||
'house_number': result.get('subThoroughfare'),
|
||||
'road': result.get('thoroughfare'),
|
||||
'locality': result.get('locality'),
|
||||
'postcode': result.get('postCode'),
|
||||
'country': result.get('country'),
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
return results
|
|
@ -3,9 +3,10 @@
|
|||
ArXiV (Scientific preprints)
|
||||
"""
|
||||
|
||||
from lxml import html
|
||||
from lxml import etree
|
||||
from lxml.etree import XPath
|
||||
from datetime import datetime
|
||||
from searx.utils import eval_xpath_list, eval_xpath_getindex
|
||||
from searx.utils import eval_xpath, eval_xpath_list, eval_xpath_getindex
|
||||
|
||||
# about
|
||||
about = {
|
||||
|
@ -17,7 +18,7 @@ about = {
|
|||
"results": 'XML-RSS',
|
||||
}
|
||||
|
||||
categories = ['science']
|
||||
categories = ['science', 'scientific publications']
|
||||
paging = True
|
||||
|
||||
base_url = (
|
||||
|
@ -27,6 +28,23 @@ base_url = (
|
|||
# engine dependent config
|
||||
number_of_results = 10
|
||||
|
||||
# xpaths
|
||||
arxiv_namespaces = {
|
||||
"atom": "http://www.w3.org/2005/Atom",
|
||||
"arxiv": "http://arxiv.org/schemas/atom",
|
||||
}
|
||||
xpath_entry = XPath('//atom:entry', namespaces=arxiv_namespaces)
|
||||
xpath_title = XPath('.//atom:title', namespaces=arxiv_namespaces)
|
||||
xpath_id = XPath('.//atom:id', namespaces=arxiv_namespaces)
|
||||
xpath_summary = XPath('.//atom:summary', namespaces=arxiv_namespaces)
|
||||
xpath_author_name = XPath('.//atom:author/atom:name', namespaces=arxiv_namespaces)
|
||||
xpath_doi = XPath('.//arxiv:doi', namespaces=arxiv_namespaces)
|
||||
xpath_pdf = XPath('.//atom:link[@title="pdf"]', namespaces=arxiv_namespaces)
|
||||
xpath_published = XPath('.//atom:published', namespaces=arxiv_namespaces)
|
||||
xpath_journal = XPath('.//arxiv:journal_ref', namespaces=arxiv_namespaces)
|
||||
xpath_category = XPath('.//atom:category/@term', namespaces=arxiv_namespaces)
|
||||
xpath_comment = XPath('./arxiv:comment', namespaces=arxiv_namespaces)
|
||||
|
||||
|
||||
def request(query, params):
|
||||
# basic search
|
||||
|
@ -41,30 +59,50 @@ def request(query, params):
|
|||
|
||||
def response(resp):
|
||||
results = []
|
||||
dom = etree.fromstring(resp.content)
|
||||
for entry in eval_xpath_list(dom, xpath_entry):
|
||||
title = eval_xpath_getindex(entry, xpath_title, 0).text
|
||||
|
||||
dom = html.fromstring(resp.content)
|
||||
url = eval_xpath_getindex(entry, xpath_id, 0).text
|
||||
abstract = eval_xpath_getindex(entry, xpath_summary, 0).text
|
||||
|
||||
for entry in eval_xpath_list(dom, '//entry'):
|
||||
title = eval_xpath_getindex(entry, './/title', 0).text
|
||||
authors = [author.text for author in eval_xpath_list(entry, xpath_author_name)]
|
||||
|
||||
url = eval_xpath_getindex(entry, './/id', 0).text
|
||||
# doi
|
||||
doi_element = eval_xpath_getindex(entry, xpath_doi, 0, default=None)
|
||||
doi = None if doi_element is None else doi_element.text
|
||||
|
||||
content_string = '{doi_content}{abstract_content}'
|
||||
# pdf
|
||||
pdf_element = eval_xpath_getindex(entry, xpath_pdf, 0, default=None)
|
||||
pdf_url = None if pdf_element is None else pdf_element.attrib.get('href')
|
||||
|
||||
abstract = eval_xpath_getindex(entry, './/summary', 0).text
|
||||
# journal
|
||||
journal_element = eval_xpath_getindex(entry, xpath_journal, 0, default=None)
|
||||
journal = None if journal_element is None else journal_element.text
|
||||
|
||||
# If a doi is available, add it to the snipppet
|
||||
doi_element = eval_xpath_getindex(entry, './/link[@title="doi"]', 0, default=None)
|
||||
doi_content = doi_element.text if doi_element is not None else ''
|
||||
content = content_string.format(doi_content=doi_content, abstract_content=abstract)
|
||||
# tags
|
||||
tag_elements = eval_xpath(entry, xpath_category)
|
||||
tags = [str(tag) for tag in tag_elements]
|
||||
|
||||
if len(content) > 300:
|
||||
content = content[0:300] + "..."
|
||||
# TODO: center snippet on query term
|
||||
# comments
|
||||
comments_elements = eval_xpath_getindex(entry, xpath_comment, 0, default=None)
|
||||
comments = None if comments_elements is None else comments_elements.text
|
||||
|
||||
publishedDate = datetime.strptime(eval_xpath_getindex(entry, './/published', 0).text, '%Y-%m-%dT%H:%M:%SZ')
|
||||
publishedDate = datetime.strptime(eval_xpath_getindex(entry, xpath_published, 0).text, '%Y-%m-%dT%H:%M:%SZ')
|
||||
|
||||
res_dict = {'url': url, 'title': title, 'publishedDate': publishedDate, 'content': content}
|
||||
res_dict = {
|
||||
'template': 'paper.html',
|
||||
'url': url,
|
||||
'title': title,
|
||||
'publishedDate': publishedDate,
|
||||
'content': abstract,
|
||||
'doi': doi,
|
||||
'authors': authors,
|
||||
'journal': journal,
|
||||
'tags': tags,
|
||||
'comments': comments,
|
||||
'pdf_url': pdf_url,
|
||||
}
|
||||
|
||||
results.append(res_dict)
|
||||
|
||||
|
|
|
@ -4,11 +4,13 @@
|
|||
|
||||
- https://github.com/searx/searx/issues/2019#issuecomment-648227442
|
||||
"""
|
||||
# pylint: disable=too-many-branches
|
||||
|
||||
import re
|
||||
from urllib.parse import urlencode, urlparse, parse_qs
|
||||
from lxml import html
|
||||
from searx.utils import eval_xpath, extract_text, match_language
|
||||
from searx.utils import eval_xpath, extract_text, eval_xpath_list, match_language, eval_xpath_getindex
|
||||
from searx.network import multi_requests, Request
|
||||
|
||||
about = {
|
||||
"website": 'https://www.bing.com',
|
||||
|
@ -24,6 +26,7 @@ categories = ['general', 'web']
|
|||
paging = True
|
||||
time_range_support = False
|
||||
safesearch = False
|
||||
send_accept_language_header = True
|
||||
supported_languages_url = 'https://www.bing.com/account/general'
|
||||
language_aliases = {}
|
||||
|
||||
|
@ -67,42 +70,71 @@ def request(query, params):
|
|||
logger.debug("headers.Referer --> %s", referer)
|
||||
|
||||
params['url'] = base_url + search_path
|
||||
params['headers']['Accept-Language'] = "en-US,en;q=0.5"
|
||||
params['headers']['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
|
||||
results = []
|
||||
result_len = 0
|
||||
|
||||
dom = html.fromstring(resp.text)
|
||||
|
||||
for result in eval_xpath(dom, '//div[@class="sa_cc"]'):
|
||||
|
||||
# IMO //div[@class="sa_cc"] does no longer match
|
||||
logger.debug('found //div[@class="sa_cc"] --> %s', result)
|
||||
|
||||
link = eval_xpath(result, './/h3/a')[0]
|
||||
url = link.attrib.get('href')
|
||||
title = extract_text(link)
|
||||
content = extract_text(eval_xpath(result, './/p'))
|
||||
|
||||
# append result
|
||||
results.append({'url': url, 'title': title, 'content': content})
|
||||
|
||||
# parse results again if nothing is found yet
|
||||
for result in eval_xpath(dom, '//li[@class="b_algo"]'):
|
||||
|
||||
link = eval_xpath(result, './/h2/a')[0]
|
||||
url_to_resolve = []
|
||||
url_to_resolve_index = []
|
||||
i = 0
|
||||
for result in eval_xpath_list(dom, '//ol[@id="b_results"]/li[contains(@class, "b_algo")]'):
|
||||
|
||||
link = eval_xpath_getindex(result, './/h2/a', 0, None)
|
||||
if link is None:
|
||||
continue
|
||||
url = link.attrib.get('href')
|
||||
title = extract_text(link)
|
||||
content = extract_text(eval_xpath(result, './/p'))
|
||||
|
||||
# Make sure that the element is free of <a href> links and <span class='algoSlug_icon'>
|
||||
content = eval_xpath(result, '(.//p)[1]')
|
||||
for p in content:
|
||||
for e in p.xpath('.//a'):
|
||||
e.getparent().remove(e)
|
||||
for e in p.xpath('.//span[@class="algoSlug_icon"]'):
|
||||
e.getparent().remove(e)
|
||||
content = extract_text(content)
|
||||
|
||||
# get the real URL either using the URL shown to user or following the Bing URL
|
||||
if url.startswith('https://www.bing.com/ck/a?'):
|
||||
url_cite = extract_text(eval_xpath(result, './/div[@class="b_attribution"]/cite'))
|
||||
# Bing can shorten the URL either at the end or in the middle of the string
|
||||
if (
|
||||
url_cite.startswith('https://')
|
||||
and '…' not in url_cite
|
||||
and '...' not in url_cite
|
||||
and '›' not in url_cite
|
||||
):
|
||||
# no need for an additional HTTP request
|
||||
url = url_cite
|
||||
else:
|
||||
# resolve the URL with an additional HTTP request
|
||||
url_to_resolve.append(url.replace('&ntb=1', '&ntb=F'))
|
||||
url_to_resolve_index.append(i)
|
||||
url = None # remove the result if the HTTP Bing redirect raise an exception
|
||||
|
||||
# append result
|
||||
results.append({'url': url, 'title': title, 'content': content})
|
||||
# increment result pointer for the next iteration in this loop
|
||||
i += 1
|
||||
|
||||
# resolve all Bing redirections in parallel
|
||||
request_list = [
|
||||
Request.get(u, allow_redirects=False, headers=resp.search_params['headers']) for u in url_to_resolve
|
||||
]
|
||||
response_list = multi_requests(request_list)
|
||||
for i, redirect_response in enumerate(response_list):
|
||||
if not isinstance(redirect_response, Exception):
|
||||
results[url_to_resolve_index[i]]['url'] = redirect_response.headers['location']
|
||||
|
||||
# get number_of_results
|
||||
try:
|
||||
result_len_container = "".join(eval_xpath(dom, '//span[@class="sb_count"]//text()'))
|
||||
if "-" in result_len_container:
|
||||
|
|
|
@ -31,6 +31,7 @@ categories = ['images', 'web']
|
|||
paging = True
|
||||
safesearch = True
|
||||
time_range_support = True
|
||||
send_accept_language_header = True
|
||||
supported_languages_url = 'https://www.bing.com/account/general'
|
||||
number_of_results = 28
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ about = {
|
|||
categories = ['news']
|
||||
paging = True
|
||||
time_range_support = True
|
||||
send_accept_language_header = True
|
||||
|
||||
# search-url
|
||||
base_url = 'https://www.bing.com/'
|
||||
|
|
|
@ -30,6 +30,7 @@ categories = ['videos', 'web']
|
|||
paging = True
|
||||
safesearch = True
|
||||
time_range_support = True
|
||||
send_accept_language_header = True
|
||||
number_of_results = 28
|
||||
|
||||
base_url = 'https://www.bing.com/'
|
||||
|
@ -70,10 +71,6 @@ def request(query, params):
|
|||
if params['time_range'] in time_range_dict:
|
||||
params['url'] += time_range_string.format(interval=time_range_dict[params['time_range']])
|
||||
|
||||
# bing videos did not like "older" versions < 70.0.1 when selectin other
|
||||
# languages then 'en' .. very strange ?!?!
|
||||
params['headers']['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:73.0.1) Gecko/20100101 Firefox/73.0.1'
|
||||
|
||||
return params
|
||||
|
||||
|
||||
|
@ -83,7 +80,7 @@ def response(resp):
|
|||
|
||||
dom = html.fromstring(resp.text)
|
||||
|
||||
for result in dom.xpath('//div[@class="dg_u"]'):
|
||||
for result in dom.xpath('//div[@class="dg_u"]/div[contains(@class, "mc_vtvc")]'):
|
||||
metadata = loads(result.xpath('.//div[@class="vrhdata"]/@vrhm')[0])
|
||||
info = ' - '.join(result.xpath('.//div[@class="mc_vtvc_meta_block"]//span/text()')).strip()
|
||||
content = '{0} - {1}'.format(metadata['du'], info)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
"""
|
||||
|
||||
from json import loads
|
||||
from datetime import datetime
|
||||
from urllib.parse import urlencode
|
||||
|
||||
|
@ -19,7 +18,7 @@ about = {
|
|||
"results": 'JSON',
|
||||
}
|
||||
|
||||
categories = ['science']
|
||||
categories = ['science', 'scientific publications']
|
||||
paging = True
|
||||
nb_per_page = 10
|
||||
|
||||
|
@ -42,39 +41,75 @@ def request(query, params):
|
|||
)
|
||||
params['url'] = base_url + search_path
|
||||
|
||||
logger.debug("query_url --> %s", params['url'])
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
results = []
|
||||
json_data = loads(resp.text)
|
||||
json_data = resp.json()
|
||||
|
||||
for result in json_data['data']:
|
||||
|
||||
source = result['_source']
|
||||
url = None
|
||||
if source.get('urls'):
|
||||
url = source['urls'][0].replace('http://', 'https://', 1)
|
||||
|
||||
if url is None and source.get('doi'):
|
||||
# use the DOI reference
|
||||
url = 'https://doi.org/' + source['doi']
|
||||
|
||||
if url is None and source.get('downloadUrl'):
|
||||
# use the downloadUrl
|
||||
url = source['downloadUrl']
|
||||
|
||||
if url is None and source.get('identifiers'):
|
||||
# try to find an ark id, see
|
||||
# https://www.wikidata.org/wiki/Property:P8091
|
||||
# and https://en.wikipedia.org/wiki/Archival_Resource_Key
|
||||
arkids = [
|
||||
identifier[5:] # 5 is the length of "ark:/"
|
||||
for identifier in source.get('identifiers')
|
||||
if isinstance(identifier, str) and identifier.startswith('ark:/')
|
||||
]
|
||||
if len(arkids) > 0:
|
||||
url = 'https://n2t.net/' + arkids[0]
|
||||
|
||||
if url is None:
|
||||
continue
|
||||
|
||||
publishedDate = None
|
||||
time = source['publishedDate'] or source['depositedDate']
|
||||
if time:
|
||||
date = datetime.fromtimestamp(time / 1000)
|
||||
else:
|
||||
date = None
|
||||
publishedDate = datetime.fromtimestamp(time / 1000)
|
||||
|
||||
metadata = []
|
||||
if source['publisher'] and len(source['publisher']) > 3:
|
||||
metadata.append(source['publisher'])
|
||||
if source['topics']:
|
||||
metadata.append(source['topics'][0])
|
||||
if source['doi']:
|
||||
metadata.append(source['doi'])
|
||||
metadata = ' / '.join(metadata)
|
||||
# sometimes the 'title' is None / filter None values
|
||||
journals = [j['title'] for j in (source.get('journals') or []) if j['title']]
|
||||
|
||||
publisher = source['publisher']
|
||||
if publisher:
|
||||
publisher = source['publisher'].strip("'")
|
||||
|
||||
results.append(
|
||||
{
|
||||
'url': source['urls'][0].replace('http://', 'https://', 1),
|
||||
'template': 'paper.html',
|
||||
'title': source['title'],
|
||||
'content': source['description'],
|
||||
'publishedDate': date,
|
||||
'metadata': metadata,
|
||||
'url': url,
|
||||
'content': source['description'] or '',
|
||||
# 'comments': '',
|
||||
'tags': source['topics'],
|
||||
'publishedDate': publishedDate,
|
||||
'type': (source['types'] or [None])[0],
|
||||
'authors': source['authors'],
|
||||
'editor': ', '.join(source['contributors'] or []),
|
||||
'publisher': publisher,
|
||||
'journal': ', '.join(journals),
|
||||
# 'volume': '',
|
||||
# 'pages' : '',
|
||||
# 'number': '',
|
||||
'doi': source['doi'],
|
||||
'issn': [x for x in [source.get('issn')] if x],
|
||||
'isbn': [x for x in [source.get('isbn')] if x], # exists in the rawRecordXml
|
||||
'pdf_url': source.get('repositoryDocument', {}).get('pdfOrigin'),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
60
searx/engines/crossref.py
Normal file
60
searx/engines/crossref.py
Normal file
|
@ -0,0 +1,60 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
"""Semantic Scholar (Science)
|
||||
"""
|
||||
# pylint: disable=use-dict-literal
|
||||
|
||||
from urllib.parse import urlencode
|
||||
from searx.utils import html_to_text
|
||||
|
||||
about = {
|
||||
"website": 'https://www.crossref.org/',
|
||||
"wikidata_id": 'Q5188229',
|
||||
"official_api_documentation": 'https://github.com/CrossRef/rest-api-doc',
|
||||
"use_official_api": False,
|
||||
"require_api_key": False,
|
||||
"results": 'JSON',
|
||||
}
|
||||
|
||||
categories = ['science', 'scientific publications']
|
||||
paging = True
|
||||
search_url = 'https://api.crossref.org/works'
|
||||
|
||||
|
||||
def request(query, params):
|
||||
params['url'] = search_url + '?' + urlencode(dict(query=query, offset=20 * (params['pageno'] - 1)))
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
res = resp.json()
|
||||
results = []
|
||||
for record in res['message']['items']:
|
||||
record_type = record['type']
|
||||
if record_type == 'book-chapter':
|
||||
title = record['container-title'][0]
|
||||
if record['title'][0].lower().strip() != title.lower().strip():
|
||||
title = html_to_text(title) + ' (' + html_to_text(record['title'][0]) + ')'
|
||||
journal = None
|
||||
else:
|
||||
title = html_to_text(record['title'][0])
|
||||
journal = record.get('container-title', [None])[0]
|
||||
url = record.get('resource', {}).get('primary', {}).get('URL') or record['URL']
|
||||
authors = [author.get('given', '') + ' ' + author.get('family', '') for author in record.get('author', [])]
|
||||
isbn = record.get('isbn') or [i['value'] for i in record.get('isbn-type', [])]
|
||||
results.append(
|
||||
{
|
||||
'template': 'paper.html',
|
||||
'url': url,
|
||||
'title': title,
|
||||
'journal': journal,
|
||||
'volume': record.get('volume'),
|
||||
'type': record['type'],
|
||||
'content': html_to_text(record.get('abstract', '')),
|
||||
'publisher': record.get('publisher'),
|
||||
'authors': authors,
|
||||
'doi': record['DOI'],
|
||||
'isbn': isbn,
|
||||
}
|
||||
)
|
||||
return results
|
|
@ -30,7 +30,7 @@ number_of_results = 10
|
|||
|
||||
time_range_support = True
|
||||
time_delta_dict = {
|
||||
"day": timedelta(days=1),
|
||||
"day": timedelta(days=1),
|
||||
"week": timedelta(days=7),
|
||||
"month": timedelta(days=31),
|
||||
"year": timedelta(days=365),
|
||||
|
@ -58,7 +58,7 @@ search_url = (
|
|||
'fields={fields}&password_protected={password_protected}&private={private}&sort={sort}&limit={limit}'
|
||||
).format(
|
||||
fields=','.join(result_fields),
|
||||
password_protected= 'false',
|
||||
password_protected='false',
|
||||
private='false',
|
||||
sort='relevance',
|
||||
limit=number_of_results,
|
||||
|
@ -93,7 +93,7 @@ def request(query, params):
|
|||
query_args = {
|
||||
'search': query,
|
||||
'languages': language_iso639,
|
||||
'page': params['pageno'],
|
||||
'page': params['pageno'],
|
||||
}
|
||||
|
||||
if locale.territory:
|
||||
|
@ -170,7 +170,4 @@ def response(resp):
|
|||
# get supported languages from their site
|
||||
def _fetch_supported_languages(resp):
|
||||
response_json = resp.json()
|
||||
return [
|
||||
item['locale']
|
||||
for item in response_json['list']
|
||||
]
|
||||
return [item['locale'] for item in response_json['list']]
|
||||
|
|
62
searx/engines/deepl.py
Normal file
62
searx/engines/deepl.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
"""Deepl translation engine"""
|
||||
|
||||
from json import loads
|
||||
|
||||
about = {
|
||||
"website": 'https://deepl.com',
|
||||
"wikidata_id": 'Q43968444',
|
||||
"official_api_documentation": 'https://www.deepl.com/docs-api',
|
||||
"use_official_api": True,
|
||||
"require_api_key": True,
|
||||
"results": 'JSON',
|
||||
}
|
||||
|
||||
engine_type = 'online_dictionary'
|
||||
categories = ['general']
|
||||
|
||||
url = 'https://api-free.deepl.com/v2/translate'
|
||||
api_key = None
|
||||
|
||||
|
||||
def request(_query, params):
|
||||
'''pre-request callback
|
||||
|
||||
params<dict>:
|
||||
|
||||
- ``method`` : POST/GET
|
||||
- ``headers``: {}
|
||||
- ``data``: {} # if method == POST
|
||||
- ``url``: ''
|
||||
- ``category``: 'search category'
|
||||
- ``pageno``: 1 # number of the requested page
|
||||
'''
|
||||
|
||||
params['url'] = url
|
||||
params['method'] = 'POST'
|
||||
params['data'] = {'auth_key': api_key, 'text': params['query'], 'target_lang': params['to_lang'][1]}
|
||||
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
results = []
|
||||
result = loads(resp.text)
|
||||
translations = result['translations']
|
||||
|
||||
infobox = "<dl>"
|
||||
|
||||
for translation in translations:
|
||||
infobox += f"<dd>{translation['text']}</dd>"
|
||||
|
||||
infobox += "</dl>"
|
||||
|
||||
results.append(
|
||||
{
|
||||
'infobox': 'Deepl',
|
||||
'content': infobox,
|
||||
}
|
||||
)
|
||||
|
||||
return results
|
|
@ -19,7 +19,8 @@ list in ``settings.yml``:
|
|||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
|
||||
engine_type = 'offline'
|
||||
engine_type = 'online'
|
||||
send_accept_language_header = True
|
||||
categories = ['general']
|
||||
disabled = True
|
||||
timeout = 2.0
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"""Docker Hub (IT)
|
||||
|
||||
"""
|
||||
# pylint: disable=use-dict-literal
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
|
|
|
@ -18,7 +18,7 @@ from searx.network import get
|
|||
|
||||
# about
|
||||
about = {
|
||||
"website": 'https://lite.duckduckgo.com/lite',
|
||||
"website": 'https://lite.duckduckgo.com/lite/',
|
||||
"wikidata_id": 'Q12805',
|
||||
"official_api_documentation": 'https://duckduckgo.com/api',
|
||||
"use_official_api": False,
|
||||
|
@ -31,6 +31,7 @@ categories = ['general', 'web']
|
|||
paging = True
|
||||
supported_languages_url = 'https://duckduckgo.com/util/u588.js'
|
||||
time_range_support = True
|
||||
send_accept_language_header = True
|
||||
|
||||
language_aliases = {
|
||||
'ar-SA': 'ar-XA',
|
||||
|
@ -45,7 +46,7 @@ language_aliases = {
|
|||
time_range_dict = {'day': 'd', 'week': 'w', 'month': 'm', 'year': 'y'}
|
||||
|
||||
# search-url
|
||||
url = 'https://lite.duckduckgo.com/lite'
|
||||
url = 'https://lite.duckduckgo.com/lite/'
|
||||
url_ping = 'https://duckduckgo.com/t/sl_l'
|
||||
|
||||
# match query's language to a region code that duckduckgo will accept
|
||||
|
@ -72,6 +73,7 @@ def request(query, params):
|
|||
# link again and again ..
|
||||
|
||||
params['headers']['Content-Type'] = 'application/x-www-form-urlencoded'
|
||||
params['headers']['Referer'] = 'https://google.com/'
|
||||
|
||||
# initial page does not have an offset
|
||||
if params['pageno'] == 2:
|
||||
|
|
|
@ -27,6 +27,8 @@ about = {
|
|||
"results": 'JSON',
|
||||
}
|
||||
|
||||
send_accept_language_header = True
|
||||
|
||||
URL = 'https://api.duckduckgo.com/' + '?{query}&format=json&pretty=0&no_redirect=1&d=1'
|
||||
|
||||
WIKIDATA_PREFIX = ['http://www.wikidata.org/entity/', 'https://www.wikidata.org/entity/']
|
||||
|
@ -62,7 +64,6 @@ def request(query, params):
|
|||
params['url'] = URL.format(query=urlencode({'q': query}))
|
||||
language = match_language(params['language'], supported_languages, language_aliases)
|
||||
language = language.split('-')[0]
|
||||
params['headers']['Accept-Language'] = language
|
||||
return params
|
||||
|
||||
|
||||
|
@ -78,7 +79,7 @@ def response(resp):
|
|||
# * book / performing art / film / television / media franchise / concert tour / playwright
|
||||
# * prepared food
|
||||
# * website / software / os / programming language / file format / software engineer
|
||||
# * compagny
|
||||
# * company
|
||||
|
||||
content = ''
|
||||
heading = search_res.get('Heading', '')
|
||||
|
|
|
@ -30,6 +30,7 @@ about = {
|
|||
categories = ['images', 'web']
|
||||
paging = True
|
||||
safesearch = True
|
||||
send_accept_language_header = True
|
||||
|
||||
# search-url
|
||||
images_url = 'https://duckduckgo.com/i.js?{query}&s={offset}&p={safesearch}&o=json&vqd={vqd}'
|
||||
|
|
136
searx/engines/duckduckgo_weather.py
Normal file
136
searx/engines/duckduckgo_weather.py
Normal file
|
@ -0,0 +1,136 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
"""DuckDuckGo Weather"""
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import quote
|
||||
|
||||
from datetime import datetime
|
||||
from flask_babel import gettext
|
||||
|
||||
about = {
|
||||
"website": 'https://duckduckgo.com/',
|
||||
"wikidata_id": 'Q12805',
|
||||
"official_api_documentation": None,
|
||||
"use_official_api": True,
|
||||
"require_api_key": False,
|
||||
"results": "JSON",
|
||||
}
|
||||
|
||||
categories = ["others"]
|
||||
|
||||
url = "https://duckduckgo.com/js/spice/forecast/{query}/{lang}"
|
||||
|
||||
|
||||
def generate_condition_table(condition):
|
||||
res = ""
|
||||
|
||||
res += f"<tr><td><b>{gettext('Condition')}</b></td>" f"<td><b>{condition['summary']}</b></td></tr>"
|
||||
|
||||
res += (
|
||||
f"<tr><td><b>{gettext('Temperature')}</b></td>"
|
||||
f"<td><b>{f_to_c(condition['temperature'])}°C / {condition['temperature']}°F</b></td></tr>"
|
||||
)
|
||||
|
||||
res += (
|
||||
f"<tr><td>{gettext('Feels like')}</td><td>{f_to_c(condition['apparentTemperature'])}°C / "
|
||||
f"{condition['apparentTemperature']}°F</td></tr>"
|
||||
)
|
||||
|
||||
res += (
|
||||
f"<tr><td>{gettext('Wind')}</td><td>{condition['windBearing']}° — "
|
||||
f"{(condition['windSpeed'] * 1.6093440006147):.2f} km/h / {condition['windSpeed']} mph</td></tr>"
|
||||
)
|
||||
|
||||
res += f"<tr><td>{gettext('Visibility')}</td><td>{condition['visibility']} km</td>"
|
||||
|
||||
res += f"<tr><td>{gettext('Humidity')}</td><td>{(condition['humidity'] * 100):.1f}%</td></tr>"
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def generate_day_table(day):
|
||||
res = ""
|
||||
|
||||
res += (
|
||||
f"<tr><td>{gettext('Min temp.')}</td><td>{f_to_c(day['temperatureLow'])}°C / "
|
||||
f"{day['temperatureLow']}°F</td></tr>"
|
||||
)
|
||||
res += (
|
||||
f"<tr><td>{gettext('Max temp.')}</td><td>{f_to_c(day['temperatureHigh'])}°C / "
|
||||
f"{day['temperatureHigh']}°F</td></tr>"
|
||||
)
|
||||
res += f"<tr><td>{gettext('UV index')}</td><td>{day['uvIndex']}</td></tr>"
|
||||
res += (
|
||||
f"<tr><td>{gettext('Sunrise')}</td><td>{datetime.fromtimestamp(day['sunriseTime']).strftime('%H:%M')}</td></tr>"
|
||||
)
|
||||
res += (
|
||||
f"<tr><td>{gettext('Sunset')}</td><td>{datetime.fromtimestamp(day['sunsetTime']).strftime('%H:%M')}</td></tr>"
|
||||
)
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def request(query, params):
|
||||
params["url"] = url.format(query=quote(query), lang=params['language'].split('-')[0])
|
||||
|
||||
return params
|
||||
|
||||
|
||||
def f_to_c(temperature):
|
||||
return "%.2f" % ((temperature - 32) / 1.8)
|
||||
|
||||
|
||||
def response(resp):
|
||||
results = []
|
||||
|
||||
if resp.text.strip() == "ddg_spice_forecast();":
|
||||
return []
|
||||
|
||||
result = loads(resp.text[resp.text.find('\n') + 1 : resp.text.rfind('\n') - 2])
|
||||
|
||||
current = result["currently"]
|
||||
|
||||
title = result['flags']['ddg-location']
|
||||
|
||||
infobox = f"<h3>{gettext('Current condition')}</h3><table><tbody>"
|
||||
|
||||
infobox += generate_condition_table(current)
|
||||
|
||||
infobox += "</tbody></table>"
|
||||
|
||||
last_date = None
|
||||
|
||||
for time in result['hourly']['data']:
|
||||
current_time = datetime.fromtimestamp(time['time'])
|
||||
|
||||
if last_date != current_time.date():
|
||||
if last_date is not None:
|
||||
infobox += "</tbody></table>"
|
||||
|
||||
infobox += f"<h3>{current_time.strftime('%Y-%m-%d')}</h3>"
|
||||
|
||||
infobox += "<table><tbody>"
|
||||
|
||||
for day in result['daily']['data']:
|
||||
if datetime.fromtimestamp(day['time']).date() == current_time.date():
|
||||
infobox += generate_day_table(day)
|
||||
|
||||
infobox += "</tbody></table><table><tbody>"
|
||||
|
||||
last_date = current_time.date()
|
||||
|
||||
infobox += f"<tr><td rowspan=\"7\"><b>{current_time.strftime('%H:%M')}</b></td></tr>"
|
||||
|
||||
infobox += generate_condition_table(time)
|
||||
|
||||
infobox += "</tbody></table>"
|
||||
|
||||
results.append(
|
||||
{
|
||||
"infobox": title,
|
||||
"content": infobox,
|
||||
}
|
||||
)
|
||||
|
||||
return results
|
|
@ -7,6 +7,7 @@ import re
|
|||
from urllib.parse import quote, urljoin
|
||||
from lxml import html
|
||||
from searx.utils import extract_text, eval_xpath, eval_xpath_list, eval_xpath_getindex
|
||||
from searx.network import raise_for_httperror
|
||||
|
||||
# about
|
||||
about = {
|
||||
|
@ -47,6 +48,7 @@ def request(query, params):
|
|||
# after the last page of results, spelling corrections are returned after a HTTP redirect
|
||||
# whatever the page number is
|
||||
params['soft_max_redirects'] = 1
|
||||
params['raise_for_httperror'] = False
|
||||
return params
|
||||
|
||||
|
||||
|
@ -56,6 +58,11 @@ def response(resp):
|
|||
'''
|
||||
results = []
|
||||
|
||||
if resp.status_code == 404:
|
||||
return results
|
||||
|
||||
raise_for_httperror(resp)
|
||||
|
||||
dom = html.fromstring(resp.text)
|
||||
|
||||
number_of_results_element = eval_xpath_getindex(
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue