Merge branch 'searxng:master' into wikidata-fediverse

This commit is contained in:
Popolon 2025-01-17 22:23:14 +01:00 committed by GitHub
commit bd27c36de2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 239 additions and 85 deletions

View File

@ -173,4 +173,5 @@ features or generally made searx better:
- Austin Olacsi `<https://github.com/Austin-Olacsi>`
- @micsthepick
- Daniel Kukula `<https://github.com/dkuku>`
- Patrick Evans `https://github.com/holysoles`
- Patrick Evans `https://github.com/holysoles`
- Daniel Mowitz `<https://daniel.mowitz.rocks>`

View File

@ -50,7 +50,7 @@ search.checker.%: install
$(Q)./manage pyenv.cmd searxng-checker -v "$(subst _, ,$(patsubst search.checker.%,%,$@))"
PHONY += test ci.test test.shell
ci.test: test.yamllint test.black test.pyright test.pylint test.unit test.robot test.rst test.pybabel
ci.test: test.yamllint test.black test.pyright test.pylint test.unit test.robot test.rst test.pybabel test.themes
test: test.yamllint test.black test.pyright test.pylint test.unit test.robot test.rst test.shell
test.shell:
$(Q)shellcheck -x -s dash \
@ -83,8 +83,9 @@ MANAGE += node.env node.env.dev node.clean
MANAGE += py.build py.clean
MANAGE += pyenv pyenv.install pyenv.uninstall
MANAGE += format.python
MANAGE += test.yamllint test.pylint test.pyright test.black test.pybabel test.unit test.coverage test.robot test.rst test.clean
MANAGE += themes.all themes.simple themes.simple.test pygments.less
MANAGE += test.yamllint test.pylint test.pyright test.black test.pybabel test.unit test.coverage test.robot test.rst test.clean test.themes
MANAGE += themes.all themes.fix themes.test
MANAGE += themes.simple themes.simple.pygments themes.simple.fix
MANAGE += static.build.commit static.build.drop static.build.restore
MANAGE += nvm.install nvm.clean nvm.status nvm.nodejs

View File

@ -6,7 +6,8 @@ Development Quickstart
.. _npm: https://www.npmjs.com/
.. _Node.js: https://nodejs.org/
.. _eslint: https://eslint.org/
.. _stylelint: https://stylelint.io/
.. sidebar:: further read
@ -40,7 +41,8 @@ to our ":ref:`how to contribute`" guideline.
If you implement themes, you will need to setup a :ref:`Node.js environment
<make node.env>`. Before you call *make run* (2.), you need to compile the
modified styles and JavaScript: ``make node.clean themes.all``
modified styles and JavaScript: ``make node.clean themes.all``. If eslint_ or
stylelint_ report some issues, try ``make themes.fix``.
Alternatively you can also compile selective the theme you have modified,
e.g. the *simple* theme.

View File

@ -0,0 +1,93 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
The Astrophysics Data System (ADS) is a digital library portal for researchers in astronomy and physics,
operated by the Smithsonian Astrophysical Observatory (SAO) under a NASA grant.
The engine is adapted from the solr engine.
"""
# pylint: disable=global-statement
from datetime import datetime
from json import loads
from urllib.parse import urlencode
from searx.exceptions import SearxEngineAPIException
about = {
"website": 'https://ui.adsabs.harvard.edu/',
"wikidata_id": 'Q752099',
"official_api_documentation": 'https://ui.adsabs.harvard.edu/help/api/api-docs.html',
"use_official_api": True,
"require_api_key": True,
"results": 'JSON',
}
base_url = 'https://api.adsabs.harvard.edu/v1/search'
result_base_url = 'https://ui.adsabs.harvard.edu/abs/'
rows = 10
sort = '' # sorting: asc or desc
field_list = ['bibcode', 'author', 'title', 'abstract', 'doi', 'date'] # list of field names to display on the UI
default_fields = '' # default field to query
query_fields = '' # query fields
paging = True
api_key = 'unset'
def init(_):
if api_key == 'unset':
raise SearxEngineAPIException('missing ADS API key')
def request(query, params):
query_params = {'q': query, 'rows': rows}
if field_list:
query_params['fl'] = ','.join(field_list)
if query_fields:
query_params['qf'] = ','.join(query_fields)
if default_fields:
query_params['df'] = default_fields
if sort:
query_params['sort'] = sort
query_params['start'] = rows * (params['pageno'] - 1)
params['headers']['Authorization'] = f'Bearer {api_key}'
params['url'] = f"{base_url}/query?{urlencode(query_params)}"
return params
def response(resp):
try:
resp_json = loads(resp.text)
except Exception as e:
raise SearxEngineAPIException("failed to parse response") from e
if 'error' in resp_json:
raise SearxEngineAPIException(resp_json['error']['msg'])
resp_json = resp_json["response"]
result_len = resp_json["numFound"]
results = []
for res in resp_json["docs"]:
author = res.get("author")
if author:
author = author[0] + ' et al.'
results.append(
{
'url': result_base_url + res.get("bibcode") + "/",
'title': res.get("title")[0],
'author': author,
'content': res.get("abstract"),
'doi': res.get("doi"),
'publishedDate': datetime.fromisoformat(res.get("date")),
}
)
results.append({'number_of_results': result_len})
return results

View File

@ -380,6 +380,14 @@ engines:
require_api_key: false
results: JSON
# - name: astrophysics data system
# engine: astrophysics_data_system
# sort: asc
# weight: 5
# categories: [science]
# api_key: your-new-key
# shortcut: ads
- name: alpine linux packages
engine: alpinelinux
disabled: true

Binary file not shown.

View File

@ -21,9 +21,10 @@ module.exports = function (grunt) {
pkg: grunt.file.readJSON('package.json'),
watch: {
scripts: {
files: ['gruntfile.js', 'src/**'],
files: ['gruntfile.js', 'eslint.config.mjs', '.stylelintrc.json', 'src/**'],
tasks: [
'eslint',
'stylelint',
'copy',
'uglify',
'less',
@ -49,6 +50,7 @@ module.exports = function (grunt) {
stylelint: {
options: {
formatter: 'unix',
fix: grunt.option('fix')
},
src: [
'src/less/**/*.less',
@ -298,7 +300,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-stylelint');
grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('test', ['eslint']);
grunt.registerTask('test', ['eslint', 'stylelint']);
grunt.registerTask('default', [
'eslint',

View File

@ -29,12 +29,13 @@
"scripts": {
"all": "npm install && grunt",
"build": "grunt",
"test": "grunt test",
"clean": "rm -Rf node_modules",
"eslint": "grunt eslint",
"eslint-fix": "grunt eslint --fix",
"watch": "grunt watch",
"clean": "rm -Rf node_modules",
"fix": "grunt test --fix",
"stylelint": "grunt stylelint",
"stylelint-fix": "grunt stylelint --fix"
"stylelint-fix": "grunt stylelint --fix",
"test": "grunt test",
"watch": "grunt watch --fix"
}
}

View File

@ -53,7 +53,7 @@
color: var(--color-autocomplete-font);
max-height: 32rem;
overflow-y: auto;
z-index: 100;
z-index: 5000;
margin-top: 3.5rem;
border-radius: 0.8rem;

View File

@ -280,7 +280,7 @@
@results-image-row-height-phone: 10rem;
@search-width: 44rem;
// heigh of #search, see detail.less
@search-height: 7.6rem;
@search-height: 13rem;
/// Device Size
/// @desktop > @tablet

View File

@ -22,7 +22,7 @@ article.result-images .detail {
bottom: 0;
background: var(--color-result-detail-background);
border: 1px solid var(--color-result-detail-background);
z-index: 10000;
z-index: 1000;
padding: 4rem 3rem 3rem 3rem;
a.result-images-source {
@ -148,7 +148,7 @@ article.result-images .detail {
height: 1.5rem;
position: absolute;
filter: opacity(40%);
z-index: 2000002;
z-index: 1200;
span {
display: block;

View File

@ -158,7 +158,7 @@ button.category_button {
outline: none;
color: var(--color-search-font);
font-size: 1.1rem;
z-index: 10000;
z-index: 1000;
&:hover {
color: var(--color-search-background-hover);
@ -183,7 +183,7 @@ html.no-js #clear_search.hide_if_nojs {
outline: none;
color: var(--color-search-font);
font-size: 1.1rem;
z-index: 2;
z-index: 100;
}
#q {
@ -332,7 +332,7 @@ html.no-js #clear_search.hide_if_nojs {
top: 0;
height: 100%;
width: 100%;
z-index: 10000;
z-index: 2000;
.search_box {
border-bottom: 1px solid var(--color-search-border);

View File

@ -543,7 +543,13 @@ article[data-vim-selected].category-social {
margin-bottom: 0;
.ltr-margin-left(@results-offset);
display: grid;
grid-template: "corrections sidebar" min-content "answers sidebar" min-content "urls sidebar" 1fr "pagination sidebar" min-content / @results-width @results-sidebar-width;
grid-template:
"corrections sidebar" min-content
"answers sidebar" min-content
"urls sidebar" 1fr
"pagination sidebar" min-content
/ @results-width @results-sidebar-width
;
gap: 0 @results-gap;
}
@ -967,7 +973,14 @@ summary.title {
margin: 0 auto;
justify-content: center;
display: grid;
grid-template: "corrections" min-content "answers" min-content "sidebar" min-content "urls" 1fr "pagination" min-content min-content / @results-width;
grid-template:
"corrections" min-content
"answers" min-content
"sidebar" min-content
"urls" 1fr
"pagination" min-content
/ @results-width
;
gap: 0;
}
}
@ -1005,7 +1018,13 @@ summary.title {
#main_results div#results.only_template_images {
margin: 1rem @results-tablet-offset 0 @results-tablet-offset;
display: grid;
grid-template: "corrections" min-content "answers" min-content "sidebar" min-content "urls" 1fr "pagination" min-content / 100%;
grid-template:
"corrections" min-content
"answers" min-content
"sidebar" min-content
"urls" 1fr
"pagination" min-content
/ 100%;
gap: 0;
#sidebar {

View File

@ -203,7 +203,7 @@ div.selectable_url {
left: 50%;
margin: 0 auto;
transform: translate(-50%, -50%);
z-index: 10000000;
z-index: 5000;
h3 {
margin-top: 0;
@ -339,7 +339,7 @@ select {
padding: 0.2rem !important;
color: var(--color-search-font);
font-size: 0.9rem;
z-index: 2;
z-index: 100;
&:hover,
&:focus {
@ -413,7 +413,7 @@ input.checkbox-onoff[type="checkbox"] {
border: 1px solid var(--color-btn-background);
border-radius: 12px;
box-shadow: var(--color-btn-background) 0 0 3px;
z-index: 10000;
z-index: 1200;
top: -0.55em;
left: -0.6em;
}
@ -573,7 +573,7 @@ input.checkbox-onoff.reversed-checkbox[type="checkbox"] {
background: var(--color-toolkit-engine-tooltip-background);
font-size: 14px;
font-weight: normal;
z-index: 1000000;
z-index: 5000;
text-align: left;
.rounded-corners;
}

View File

@ -25,20 +25,20 @@
# Yahya-Lando <yahya-lando@users.noreply.translate.codeberg.org>, 2025.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-01-06 16:16+0000\n"
"PO-Revision-Date: 2025-01-06 15:52+0000\n"
"Last-Translator: Yahya-Lando <yahya-"
"lando@users.noreply.translate.codeberg.org>\n"
"PO-Revision-Date: 2025-01-15 06:48+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
"Language-Team: Arabic <https://translate.codeberg.org/projects/searxng/"
"searxng/ar/>\n"
"Language: ar\n"
"Language-Team: Arabic "
"<https://translate.codeberg.org/projects/searxng/searxng/ar/>\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : "
"n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"X-Generator: Weblate 5.9.2\n"
"Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -1380,23 +1380,23 @@ msgstr "تغيير لغة واجهة البحث"
#: searx/templates/simple/preferences/urlformatting.html:2
msgid "URL formatting"
msgstr ""
msgstr "تنسيق العنوان"
#: searx/templates/simple/preferences/urlformatting.html:8
msgid "Pretty"
msgstr ""
msgstr "جميل"
#: searx/templates/simple/preferences/urlformatting.html:13
msgid "Full"
msgstr ""
msgstr "ممتلىء"
#: searx/templates/simple/preferences/urlformatting.html:18
msgid "Host"
msgstr ""
msgstr "مضيف"
#: searx/templates/simple/preferences/urlformatting.html:23
msgid "Change result URL formatting"
msgstr ""
msgstr "تغيير تنسيق العنوان للنتيجة"
#: searx/templates/simple/result_templates/code.html:13
msgid "repo"
@ -2004,4 +2004,3 @@ msgstr "إخفاء الفيديو"
#~ msgid "dummy"
#~ msgstr ""

View File

@ -27,19 +27,19 @@
# syobon <syobon@users.noreply.translate.codeberg.org>, 2025.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-01-06 16:16+0000\n"
"PO-Revision-Date: 2025-01-06 15:53+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>"
"\n"
"PO-Revision-Date: 2025-01-17 07:09+0000\n"
"Last-Translator: tentsbet <tentsbet@users.noreply.translate.codeberg.org>\n"
"Language-Team: Japanese <https://translate.codeberg.org/projects/searxng/"
"searxng/ja/>\n"
"Language: ja\n"
"Language-Team: Japanese "
"<https://translate.codeberg.org/projects/searxng/searxng/ja/>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 5.9.2\n"
"Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -1348,23 +1348,23 @@ msgstr "表示する言語を変更"
#: searx/templates/simple/preferences/urlformatting.html:2
msgid "URL formatting"
msgstr ""
msgstr "URL 書式"
#: searx/templates/simple/preferences/urlformatting.html:8
msgid "Pretty"
msgstr ""
msgstr "相当"
#: searx/templates/simple/preferences/urlformatting.html:13
msgid "Full"
msgstr ""
msgstr "一杯"
#: searx/templates/simple/preferences/urlformatting.html:18
msgid "Host"
msgstr ""
msgstr "ホスト"
#: searx/templates/simple/preferences/urlformatting.html:23
msgid "Change result URL formatting"
msgstr ""
msgstr "検索結果のURL書式を変更"
#: searx/templates/simple/result_templates/code.html:13
msgid "repo"
@ -1947,4 +1947,3 @@ msgstr "動画を隠す"
#~ msgid "dummy"
#~ msgstr ""

View File

@ -14,20 +14,21 @@
# Mooo <mooo@users.noreply.translate.codeberg.org>, 2025.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-01-06 16:16+0000\n"
"PO-Revision-Date: 2025-01-06 15:53+0000\n"
"Last-Translator: Mooo <mooo@users.noreply.translate.codeberg.org>\n"
"PO-Revision-Date: 2025-01-15 06:48+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
"Language-Team: Lithuanian <https://translate.codeberg.org/projects/searxng/"
"searxng/lt/>\n"
"Language: lt\n"
"Language-Team: Lithuanian "
"<https://translate.codeberg.org/projects/searxng/searxng/lt/>\n"
"Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100"
" < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < "
"11) ? 1 : n % 1 != 0 ? 2: 3);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < "
"11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 :"
" n % 1 != 0 ? 2: 3);\n"
"X-Generator: Weblate 5.9.2\n"
"Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -168,7 +169,7 @@ msgstr "tamsi"
#. STYLE_NAMES['BLACK']
#: searx/searxng.msg
msgid "black"
msgstr ""
msgstr "juoda"
#. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg
@ -1981,4 +1982,3 @@ msgstr "slėpti vaizdo įrašą"
#~ msgid "dummy"
#~ msgstr ""

View File

@ -14,7 +14,7 @@ msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-01-06 16:16+0000\n"
"PO-Revision-Date: 2025-01-10 07:09+0000\n"
"PO-Revision-Date: 2025-01-15 06:48+0000\n"
"Last-Translator: hirushaadi <hirushaadi@users.noreply.translate.codeberg.org>"
"\n"
"Language-Team: Sinhala <https://translate.codeberg.org/projects/searxng/"
@ -313,7 +313,7 @@ msgstr ""
#. SOCIAL_MEDIA_TERMS['COMMUNITY']
#: searx/engines/lemmy.py:131 searx/engines/lemmy.py:165 searx/searxng.msg
msgid "community"
msgstr ""
msgstr "ප්‍රජාව or පිරිස"
#. SOCIAL_MEDIA_TERMS['POINTS']
#: searx/engines/hackernews.py:82 searx/searxng.msg

View File

@ -100,7 +100,8 @@ static.build.commit() {
static.build.drop &>/dev/null
( set -e
# build the themes
# fix & build the themes
themes.fix
themes.all
# add build files

View File

@ -89,7 +89,6 @@ test.robot() {
dump_return $?
}
test.rst() {
build_msg TEST "[reST markup] ${RST_FILES[*]}"
@ -98,6 +97,12 @@ test.rst() {
done
}
test.themes() {
build_msg TEST 'SearXNG themes'
themes.test
dump_return $?
}
test.pybabel() {
TEST_BABEL_FOLDER="build/test/pybabel"
build_msg TEST "[extract messages] pybabel"

View File

@ -7,21 +7,41 @@ declare _creset
themes.help(){
cat <<EOF
themes.:
all : build all themes
live : to get live builds of CSS & JS use 'LIVE_THEME=simple make run'
simple.: build simple theme
test : test simple theme
all : test & build all themes
test : test all themes
fix : fix JS & CSS (LESS)
live : to get live builds of CSS & JS use: LIVE_THEME=simple make run
simple.: test & build simple theme ..
pygments: build pygment's LESS files for simple theme
test : test simple theme
fix : fix JS & CSS (LESS) of the simple theme
EOF
}
themes.all() {
( set -e
node.env
themes.simple
)
dump_return $?
}
themes.fix() {
( set -e
node.env
themes.simple.fix
)
dump_return $?
}
themes.test() {
( set -e
node.env
themes.simple.test
)
dump_return $?
}
themes.live() {
local LIVE_THEME="${LIVE_THEME:-${1}}"
case "${LIVE_THEME}" in
@ -29,30 +49,30 @@ themes.live() {
theme="searx/static/themes/${LIVE_THEME}"
;;
'')
die_caller 42 "missing theme argument"
die 42 "missing theme argument"
;;
*)
die_caller 42 "unknown theme '${LIVE_THEME}' // [simple]'"
die 42 "unknown theme '${LIVE_THEME}' // [simple]'"
;;
esac
build_msg GRUNT "theme: $1 (live build)"
nodejs.ensure
build_msg SIMPLE "theme: $1 (live build)"
node.env
themes.simple.pygments
cd "${theme}"
{
npm install
npm run watch
} 2>&1 \
| prefix_stdout "${_Blue}THEME ${1} ${_creset} " \
| grep -E --ignore-case --color 'error[s]?[:]? |warning[s]?[:]? |'
} # 2>&1 \
# | prefix_stdout "${_Blue}THEME ${1} ${_creset} " \
# | grep -E --ignore-case --color 'error[s]?[:]? |warning[s]?[:]? |'
}
themes.simple() {
( set -e
node.env
themes.simple.pygments
build_msg SIMPLE "theme: run build"
# "run build" includes tests from eslint and stylelint
npm --prefix searx/static/themes/simple run build
)
build_msg GRUNT "theme: simple"
npm --prefix searx/static/themes/simple run build
dump_return $?
}
@ -67,11 +87,14 @@ themes.simple.pygments() {
return 0
}
themes.simple.fix() {
build_msg SIMPLE "theme: fix"
npm --prefix searx/static/themes/simple run fix
dump_return $?
}
themes.simple.test() {
build_msg TEST "theme: simple"
node.env
npm --prefix searx/static/themes/simple install
build_msg SIMPLE "theme: run test"
npm --prefix searx/static/themes/simple run test
dump_return $?
}