[mod] result_templates/default.html replace embedded HTML by data_src audio_src

Embedded HTML breaks SearXNG architecture.  To modularize, HTML is generated in
the templates (oscar & simple) and result parameter 'embedded' is replaced by
'data_src' (and 'audio_src'), an URL for embedded content (<iframe>).

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2022-02-07 21:59:21 +01:00
parent b9a2e8b387
commit 98cab4cf75
10 changed files with 62 additions and 53 deletions

View file

@ -29,9 +29,6 @@ search_url = (
url + "search/text/?query={query}&page={page}&fields=name,url,download,created,description,type&token={api_key}"
)
embedded_url = '<audio controls><source src="{uri}" type="audio/{ftype}"></audio>'
# search request
def request(query, params):
params["url"] = search_url.format(
@ -52,7 +49,6 @@ def response(resp):
content = result["description"][:128]
publishedDate = datetime.fromisoformat(result["created"])
uri = result["download"]
embedded = embedded_url.format(uri=uri, ftype=result["type"])
# append result
results.append(
@ -60,7 +56,7 @@ def response(resp):
"url": result["url"],
"title": title,
"publishedDate": publishedDate,
"embedded": embedded,
"audio_src": uri,
"content": content,
}
)