fix: route searx and alert SearXNG traffic through SOCKS5 proxy

Both plugins called urllib.request.urlopen directly, bypassing the
proxy. Switch to derp.http.urlopen and update the SearXNG endpoint
to the public domain (searx.mymx.me). Update test mocks to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
user
2026-02-15 16:56:45 +01:00
parent 6e591a85b2
commit 29e77f97b2
4 changed files with 17 additions and 16 deletions

View File

@@ -6,11 +6,12 @@ import json
import urllib.parse
import urllib.request
from derp.http import urlopen as _urlopen
from derp.plugin import command
# -- Constants ---------------------------------------------------------------
_SEARX_URL = "http://192.168.122.119:3000/search"
_SEARX_URL = "https://searx.mymx.me/search"
_FETCH_TIMEOUT = 10
_MAX_RESULTS = 3
_MAX_TITLE_LEN = 80
@@ -38,7 +39,7 @@ def _search(query: str) -> list[dict]:
url = f"{_SEARX_URL}?{params}"
req = urllib.request.Request(url, method="GET")
resp = urllib.request.urlopen(req, timeout=_FETCH_TIMEOUT)
resp = _urlopen(req, timeout=_FETCH_TIMEOUT)
raw = resp.read()
resp.close()