fix: 代理探测只看学习站,手填地址只允许公网

This commit is contained in:
2026-11-16 09:29:45 +08:00
parent 89d9452967
commit 990b80c017
7 changed files with 152 additions and 42 deletions
+4 -4
View File
@@ -545,27 +545,27 @@ def test_user_can_set_proxy_with_or_without_password() -> None:
assert "password" not in empty.json()
saved = client.put(
"/api/settings/proxy",
json={"scheme": "http", "host": "10.0.0.1", "port": 8080, "username": "", "password": ""},
json={"scheme": "http", "host": "1.1.1.1", "port": 8080, "username": "", "password": ""},
)
assert saved.status_code == 200
assert saved.json() == {
"enabled": True,
"scheme": "http",
"host": "10.0.0.1",
"host": "1.1.1.1",
"port": 8080,
"username": "",
"has_password": False,
}
with_auth = client.put(
"/api/settings/proxy",
json={"scheme": "socks5", "host": "127.0.0.1", "port": 1080, "username": "u", "password": "p@ss"},
json={"scheme": "socks5", "host": "8.8.8.8", "port": 1080, "username": "u", "password": "p@ss"},
)
assert with_auth.status_code == 200
assert with_auth.json()["has_password"] is True
assert "password" not in with_auth.json()
kept = client.put(
"/api/settings/proxy",
json={"scheme": "socks5", "host": "127.0.0.1", "port": 1080, "username": "u", "password": None},
json={"scheme": "socks5", "host": "8.8.8.8", "port": 1080, "username": "u", "password": None},
)
assert kept.status_code == 200
assert kept.json()["has_password"] is True