fix: repair web UI helpers and proxy form handling
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -266,6 +266,11 @@ def get_device():
|
||||
f"Gesucht: '{wanted or 'beliebig'}'. Gefunden: {last}"
|
||||
)
|
||||
|
||||
|
||||
def _get_jd_device():
|
||||
"""Backward-compatible wrapper for older call sites."""
|
||||
return get_device()
|
||||
|
||||
SSH_KNOWN_HOSTS = os.environ.get("SSH_KNOWN_HOSTS", "/ssh/known_hosts")
|
||||
|
||||
def ssh_connect() -> paramiko.SSHClient:
|
||||
@@ -961,6 +966,11 @@ def render_page(message: str = "", error: str = "") -> str:
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
def render_main_page(message: str = "", error: str = "") -> str:
|
||||
"""Backward-compatible wrapper used by existing route handlers."""
|
||||
return render_page(message=message, error=error)
|
||||
|
||||
@dataclass
|
||||
class ProxyCheckResult:
|
||||
proto: str
|
||||
@@ -1314,18 +1324,18 @@ async def proxies_get():
|
||||
@app.post("/proxies", response_class=HTMLResponse)
|
||||
async def proxies_post(
|
||||
request: Request,
|
||||
socks5_proxies: str = Form(""),
|
||||
socks4_proxies: str = Form(""),
|
||||
socks5_in: str = Form(""),
|
||||
socks4_in: str = Form(""),
|
||||
export_path: str = Form(""),
|
||||
action: str = Form("preview"),
|
||||
):
|
||||
entries = _parse_proxy_entries(socks5_proxies, socks4_proxies)
|
||||
entries = _parse_proxy_entries(socks5_in, socks4_in)
|
||||
|
||||
if action == "preview" or not entries:
|
||||
msg = f"{len(entries)} Proxy/s erkannt." if entries else "Keine Proxies eingegeben."
|
||||
return render_proxies_page(
|
||||
socks5_in=socks5_proxies,
|
||||
socks4_in=socks4_proxies,
|
||||
socks5_in=socks5_in,
|
||||
socks4_in=socks4_in,
|
||||
export_path=export_path,
|
||||
message=msg,
|
||||
)
|
||||
@@ -1338,8 +1348,8 @@ async def proxies_post(
|
||||
jd_msg = push_proxies_to_jd(working)
|
||||
|
||||
return render_proxies_page(
|
||||
socks5_in=socks5_proxies,
|
||||
socks4_in=socks4_proxies,
|
||||
socks5_in=socks5_in,
|
||||
socks4_in=socks4_in,
|
||||
export_path=export_path,
|
||||
check_results=results,
|
||||
jd_message=jd_msg,
|
||||
|
||||
Reference in New Issue
Block a user