mirror of
https://github.com/searxng/searxng.git
synced 2026-10-19 01:47:04 +00:00
[mod] image proxy: /image with the default network (#6816)
Some checks are pending
Documentation / Release (push) Waiting to run
Integration / Python 3.11 (push) Waiting to run
Integration / Python 3.12 (push) Waiting to run
Integration / Python 3.13 (push) Waiting to run
Integration / Python 3.14 (push) Waiting to run
Integration / Theme (push) Waiting to run
Sync / Codeberg (push) Waiting to run
Some checks are pending
Documentation / Release (push) Waiting to run
Integration / Python 3.11 (push) Waiting to run
Integration / Python 3.12 (push) Waiting to run
Integration / Python 3.13 (push) Waiting to run
Integration / Python 3.14 (push) Waiting to run
Integration / Theme (push) Waiting to run
Sync / Codeberg (push) Waiting to run
- Changes the path of the /image_proxy endpoint to /image. This ensures that if the user copies the image through the browser, it is named image.png rather than image_proxy.png as the latter can be attributed to searxng hence preserving the privacy of the user. - Removed the dedicated network for the image proxy. Previously this was used to force http/2 off but since moving to curl from httpx this is not as much of a problem. Now instead uses the default network. Signed-off-by: vojkovic <git@vojk.au>
This commit is contained in:
parent
22c64b8d39
commit
b00212a836
2 changed files with 3 additions and 12 deletions
|
|
@ -409,14 +409,6 @@ def initialize(
|
|||
if isinstance(network, str):
|
||||
NETWORKS[engine_name] = NETWORKS[network]
|
||||
|
||||
# the /image_proxy endpoint has a dedicated network.
|
||||
# same parameters than the default network, but HTTP/2 is disabled.
|
||||
# It decreases the CPU load average, and the total time is more or less the same
|
||||
if 'image_proxy' not in NETWORKS:
|
||||
image_proxy_params = default_params.copy()
|
||||
image_proxy_params['enable_http2'] = False
|
||||
NETWORKS['image_proxy'] = new_network(image_proxy_params, logger_name='image_proxy')
|
||||
|
||||
|
||||
@atexit.register
|
||||
def done():
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ from searx import favicons
|
|||
from searx.valkeydb import initialize as valkey_initialize
|
||||
from searx.sxng_locales import sxng_locales
|
||||
import searx.search
|
||||
from searx.network import stream as http_stream, set_context_network_name
|
||||
from searx.network import stream as http_stream
|
||||
|
||||
logger = logger.getChild('webapp')
|
||||
|
||||
|
|
@ -1012,7 +1012,7 @@ def preferences():
|
|||
app.add_url_rule('/favicon_proxy', methods=['GET'], endpoint="favicon_proxy", view_func=favicons.favicon_proxy)
|
||||
|
||||
|
||||
@app.route('/image_proxy', methods=['GET'])
|
||||
@app.route('/image', methods=['GET'])
|
||||
def image_proxy():
|
||||
# pylint: disable=too-many-return-statements, too-many-branches
|
||||
|
||||
|
|
@ -1033,7 +1033,6 @@ def image_proxy():
|
|||
'Sec-GPC': '1',
|
||||
'DNT': '1',
|
||||
}
|
||||
set_context_network_name('image_proxy')
|
||||
resp, stream = http_stream(method='GET', url=url, headers=request_headers, allow_redirects=True)
|
||||
content_length = resp.headers.get('Content-Length')
|
||||
if content_length and content_length.isdigit() and int(content_length) > maximum_size:
|
||||
|
|
@ -1198,7 +1197,7 @@ def robots():
|
|||
"""User-agent: *
|
||||
Allow: /info/en/about
|
||||
Disallow: /stats
|
||||
Disallow: /image_proxy
|
||||
Disallow: /image
|
||||
Disallow: /preferences
|
||||
Disallow: /*?*q=*
|
||||
""",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue