summaryrefslogtreecommitdiff
path: root/searx/webapp.py
AgeCommit message (Collapse)Author
2022-09-02template: when enable_metrics are disabled, hide the empty statsAlexandre FLAMENT
when metrics are disabled: * hide the link to /stats at the bottom of the pages * in /preferences, hide the columns "Response time" and "Reliability"
2022-09-02Stats: display only the score per result, no anymore the scoreAlexandre FLAMENT
2022-08-28settings.yml: set default values for result_proxyAlexandre FLAMENT
* initialize result_proxy with searx/settings_defaults.py * allow result_proxy.key to be a string this commit supersedes #1522
2022-08-11[fix] improve OpenSearch descriptionMarkus Heiser
Some HTTP-Clients do have issues with the ``opensearch.xml`` from SearXNG (related [1][2]) while other OpenSearch descriptions[3] (e.g. from qwant) work flawles. Inspired by the OpenSearch description from qwant and with informations from the specification[4] the ``opensearch.xml`` has been *improved*. - convert `<Url>` methods from lower case to upper case (`POST`|`GET`) - add `<moz:SearchForm>` and `xmlns:moz="http://www.mozilla.org/2006/browser/search/"` - add `<Query role="example" searchTerms="SearXNG" />` [4] OpenSearch description documents should include at least one Query element of `role="example"` that is expected to return search results. Search clients may use this example query to validate that the search engine is working properly. - modified `<LongName>` to SearXNG - modified `<Description>` the word 'hackable' scares uninitiated users and was removed - add the `type="image/png"` to `<Image>` Test can be done by:: make run Visit http://127.0.0.1:8888/ and add the search engine to your WEB-Browser / test with different WEB-Browser from desktop and Smartphones (are there any iOS user here, please test on Safari and Chrome). [1] https://app.element.io/#/room/#searxng:matrix.org/$xN_abdKhNqUlgXRBrb_9F3pqOxnSzGQ1TG0s0G9hQVw [2] https://github.com/searxng/searxng/issues/431 [3] https://developer.mozilla.org/en-US/docs/Web/OpenSearch [4] https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md#the-query-element Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-07-30[fix] pyright repported errorsAlexandre Flament
The errors make pyright usage useless since a new error won't be seen [1]. [1] https://github.com/searxng/searxng/pull/1569 ``` searx/compat.py:11:27 - error: Expression of type "Type[cached_property[_T@cached_property]]" cannot be assigned to declared type "Type[cached_property]" "Type[cached_property[_T@cached_property]]" is incompatible with "Type[cached_property]" Type "Type[cached_property[_T@cached_property]]" cannot be assigned to type "Type[cached_property]" (reportGeneralTypeIssues) searx/utils.py:69:36 - error: Expression of type "None" cannot be assigned to parameter of type "str" Type "None" cannot be assigned to type "str" (reportGeneralTypeIssues) searx/utils.py:573:85 - error: Expression of type "None" cannot be assigned to parameter of type "int" Type "None" cannot be assigned to type "int" (reportGeneralTypeIssues) searx/webapp.py:1306:22 - error: Argument of type "str" cannot be assigned to parameter "__a" of type "BytesPath" in function "join" Type "str" cannot be assigned to type "BytesPath" "str" is incompatible with "bytes" "str" is incompatible with protocol "PathLike[bytes]" "__fspath__" is not present (reportGeneralTypeIssues) searx/webapp.py:1306:68 - error: Argument of type "Literal['themes']" cannot be assigned to parameter "paths" of type "BytesPath" in function "join" Type "Literal['themes']" cannot be assigned to type "BytesPath" "Literal['themes']" is incompatible with "bytes" "Literal['themes']" is incompatible with protocol "PathLike[bytes]" "__fspath__" is not present (reportGeneralTypeIssues) searx/webapp.py:1306:78 - error: Argument of type "str | Any | None" cannot be assigned to parameter "paths" of type "BytesPath" in function "join" Type "str | Any | None" cannot be assigned to type "BytesPath" Type "str" cannot be assigned to type "BytesPath" "str" is incompatible with "bytes" "str" is incompatible with protocol "PathLike[bytes]" "__fspath__" is not present (reportGeneralTypeIssues) searx/webapp.py:1306:85 - error: Argument of type "Literal['img']" cannot be assigned to parameter "paths" of type "BytesPath" in function "join" Type "Literal['img']" cannot be assigned to type "BytesPath" "Literal['img']" is incompatible with "bytes" "Literal['img']" is incompatible with protocol "PathLike[bytes]" "__fspath__" is not present (reportGeneralTypeIssues) searx/engines/mongodb.py:8:6 - warning: Import "pymongo" could not be resolved (reportMissingImports) searx/engines/mysql_server.py:9:8 - warning: Import "mysql.connector" could not be resolved (reportMissingImports) searx/engines/postgresql.py:9:8 - warning: Import "psycopg2" could not be resolved from source (reportMissingModuleSource) searx/engines/xpath.py:187:28 - warning: "categories" is not defined (reportUndefinedVariable) searx/search/__init__.py:184:82 - warning: "flask" is not defined (reportUndefinedVariable) searx/search/checker/background.py:19:26 - error: Type of "schedule" is partially unknown Type of "schedule" is "(delay: Any, func: Any, *args: Any) -> Literal[True]" (reportUnknownVariableType) searx/shared/__init__.py:8:12 - warning: Import "uwsgi" could not be resolved (reportMissingImports) searx/shared/shared_uwsgi.py:5:8 - warning: Import "uwsgi" could not be resolved (reportMissingImports) ```
2022-07-02Donation link: default value to searxng.org, can be hidden or customAlexandre Flament
Add a new setting: general.donation_url By default the value is https://docs.searxng.org/donate.html When the value is false, the link is hidden When the value is true, the link goes to the infopage donation, the administrator can create a custom page.
2022-06-16Add privacypolicy_url optionsamsaptidev
2022-06-12Autocomplete: don't suggest the current query.Alexandre Flament
Example of minor issue before this commit: the autocompletion can suggest "Test" if the query is "Test".
2022-06-12[fix] move locale code from webapp.py to locales.py and fix #1303Markus Heiser
To improve modularization this patch: - moves *locale* related implementation from the webapp.py application to the locale.py module. - The initialization of the locales is now done in the application (webapp) and is no longer done while importing searx.locales. In the searx.locales module a new dictionary named `LOCALE_BEST_MATCH` has been added. In this dictionary we can map languages without a translation to languages we have a translation for. To fix #1303 zh-HK has been mapped to zh-Hant-TW (we do not need additional translations of traditional Chinese) Closes: https://github.com/searxng/searxng/issues/1303 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-06-03[fix] prepare for pylint 2.14.0Markus Heiser
Remove issue reported by Pylint 2.14.0: - no-self-use: has been moved to optional extension [1] - The refactoring checker now also raises 'consider-using-generator' messages for max(), min() and sum(). [2] .pylintrc: - <option name>-hint has been removed since long, Pylint 2.14.0 raises an error on invalid options - bad-continuation and bad-whitespace have been removed [3] [1] https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers [2] https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/full.html#what-s-new-in-pylint-2-14-0 [2] https://pylint.pycqa.org/en/latest/whatsnew/2/2.6/summary.html#summary-release-highlights Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-06-02[mod] image proxy: allow binary/octet-stream mime typeLéon Tiekötter
The Petal Search Images engine sends the thumbnails with the binary/octet-stream mime type.
2022-05-15Preferences URL in preferencesJulian Fairfax
Revert translation changes Auto-save preferences from URL Preferences URL in preferences Fix that Preferences URL in preferences
2022-05-10[fix] autocomplete and infinite scroll persistence in preferencesmrpaulblack
* fixes a regression from https://github.com/searxng/searxng/pull/1186
2022-05-10[fix] PR 1186: GET methodLéon Tiekötter
PR https://github.com/searxng/searxng/pull/1186 prevented the GET method from being selected.
2022-05-07theme: remove __common__Alexandre Flament
2022-05-07[format.python] based on bugfix in 9ed626130Markus Heiser
2022-05-07[mod] add setting: search.autocomplete_minMarkus Heiser
Minimun characters to type before autocompleter starts. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-05-07[mod] client_settings: pass settings from server to JS clientMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-05-06Add support for the Silesian languageAlexandre FLAMENT
2022-04-07fix: %2F in path will be converted to " › "HZH
2022-04-05Unquote path on result page.HZH
2022-03-29Extra null safetyAustin Huang
Co-Authored-By: Alexandre Flament <alex.andre@al-f.net>
2022-03-29[fix] merge fake "plugins" endpoint back to "static"Austin Huang
https: //matrix.to/#/!vxScbLNEAmRvOraXBn:matrix.org/$0zqTtH3s-eVKlMwiAgiEJdetOkRx27EIRs-C0o8FzSg?via=libera.chat&via=matrix.org&via=tchncs.de Co-Authored-By: Alexandre Flament <alex.andre@al-f.net>
2022-03-28[fix] return correct plugin pathAustin Huang
closes #1021
2022-03-20[interim fix] static files can't be delivered by HTTP.Markus Heiser
Since PR 932 [1][2] static files can't be delivered by HTTP server any longer. This patch makes the hash paramter in the URL of static files: /static/themes/simple/css/searxng.min.css?5fde34a74bc438c7b56ec8c6501e131cc9914bd8 optional. By default the hash parameter is disabled. HINT: Instances that do not deliver static files by their HTTP server and have a long expire time [3] should enable this option. ---- This is only a interim solution, on the long run: make static.build.commit creates files including the file name: css/searxng-5fde34a74bc438c7b56ec8c6501e131cc9914bd8.min.css and a mapping.json with this content[4] [1] https://github.com/searxng/searxng/issues/964 [2] https://github.com/searxng/searxng/pull/932#issuecomment-1067039518 [3] https://github.com/searxng/searxng/pull/932/commits/55833364401ed72c30b3e85c16824a75de6b547a [4] https://github.com/searxng/searxng/pull/932#issuecomment-1067216426 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-20Merge pull request #859 from return42/fix-814Markus Heiser
[mod] add i18n infrastructure for SearXNG message files (searxng.msg)
2022-03-16Info: code refactoring & bug fixesAlexandre Flament
2022-03-16[mod] move category and names of constants to searx/searxng.msgMarkus Heiser
Closes: https://github.com/searxng/searxng/issues/814 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-13Various change on PR 930Alexandre Flament
2022-03-12[mod] replace /help by /info pages and include pages in project docsMarkus Heiser
This patch implements a bolierplate to share content from info-pages of the SearXNG instance (URL /info) with the project documentation (path /docs/user). The info pages are using Markdown (CommonMark), to include them in the project documentation (reST) the myst-parser [1] is used in the Sphinx-doc build chain. If base_url is known (defined in settings.yml) links to the instance are also inserted into the project documentation:: searxng_extra/docs_prebuild [1] https://www.sphinx-doc.org/en/master/usage/markdown.html Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-05[mod] URL for the static file contains the sha1Alexandre Flament
* allow to cache the static file forever * avoid bugs when the static files are updated but not reloaded
2022-02-26[simple theme] replace Image_layout.js with flexbox CS impl.mrpaulblack
* drop image_layout.js from simple theme * move image_layout.js to oscar theme and delete common js dir (since its empty now) * align top position of image detail modal with bottom position of search header * use flexbox to display images; row height can be set via @results-image-row-height in defenitions.less * display span title underneath each image with a max width of 12rem * increase margin and padding around image article on desktop and tablet * make article height smaller on phone layout (height of 6rem) to display more content on current view * remove content from result, if the title and content matches * use a group that cotains the flex image article, if images are mixed with other categories * fix pylint issues in webapp.py * use the default.html result template in unit tests (thanks @return42)
2022-02-20[mod] infinite_scroll as preferenceAlexandre Flament
* oscar theme: code from searx/plugins/infinite_scroll.py * simple theme: new implementation Co-authored-by: Markus Heiser <markus.heiser@darmarIT.de>
2022-02-19[fix] image_proxy: allow HTTP redirectsMarkus Heiser
Without redirects the load of various images will fail when image_proxy is enabled [1]. [1] https://github.com/searxng/searxng/pull/910#issuecomment-1045966577 Suggested-by: @dalf [1] Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-02-01[enh] generate navigation for help pagesMartin Fischer
2022-02-01[enh] introduce /help routeMartin Fischer
Translation will be implemented in the future. For now the "en" in /help/en/<pagename> is hardcoded.
2022-01-27[pyright] remove no longer needed assertionMartin Fischer
The pyright bug[1] for which the assertion was added has been fixed. [1]: https://github.com/microsoft/pyright/issues/2930
2022-01-27[pyright:basic] searx.webappMartin Fischer
2022-01-23[mod] configuration to overwrite engine descriptionMarkus Heiser
Engine description can be configured, this is needed e.g. by custom search engines. Here is an example of a command engine with a description in the about section:: - name: locate engine: command command: ['locate', '{{QUERY}}'] disabled: true categories: files about: description: local files website: 'https://www.man7.org/linux/man-pages/man1/locate.1.html' delimiter: chars: ' ' keys: ['line'] Closes: https://github.com/searxng/searxng/issues/788 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-23[help] render user documentation once on startupMartin Fischer
Currently we have two kinds of user documentation: * the about page[1] which is written in HTML and part of the web application and can therefore link instance-specific pages (like e.g. the preferences) via Jinja variables * the Sphinx documentation[2] which is written in reStructuredText and cannot link instance-specific pages since it doesn't know which instance the user is using The plan is to integrate the user documentation currently in Sphinx into the application, so that it can also link instance specific pages. We also want to enable the user documentation to be translated. This commit implements the first step in this endeavor (see #722). [1]: searx/templates/__common__/about.html [2]: docs/user/ (currently served at https://docs.searxng.org/user/)
2022-01-17[typing] add type hints to webapp.pyMartin Fischer
2022-01-17[typing] add results.UnresponsiveEngineMartin Fischer
2022-01-17[refactor] remove never used parameterMartin Fischer
2022-01-17[typing] add results.TimingMartin Fischer
2022-01-17[typing] add ExtendedRequestMartin Fischer
webapp.py monkey-patches the Flask request global. This commit adds a type cast so that e.g. Pyright[1] doesn't show "Cannot access member" errors everywhere. [1]: https://github.com/microsoft/pyright
2022-01-09[fix] filtered_engines were not correctly evaluating validate_token()Martin Minka
2022-01-06Merge pull request #634 from not-my-profile/powered-byAlexandre Flament
Introduce `categories_as_tabs` & group engines in tabs
2022-01-05[enh] settings.yml: implement general.enable_metricsAlexandre Flament
* allow not to record metrics (response time, etc...) * this commit doesn't change the UI. If the metrics are disabled /stats and /stats/errors will return empty response. in /preferences, the columns response time and reliability will be empty.
2022-01-05[enh] change categories_as_tabs from a list to a dictMartin Fischer
The tab icon names are currently hard coded in the templates. This commit lets us introduce an icon property in the future, e.g: categories_as_tabs: general: icon: search-outline
2022-01-05[mod] move group_engines_in_tab to searx.webutilsMartin Fischer