Compare commits
1
Commits
fcdf6f27f2
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1f8ac8270 |
@@ -4,8 +4,6 @@
|
||||
|
||||
当前安装位置:`F:\@Other\kaoyan-studio`。原 YAM、yzw 和 proxy_pool 源码不作修改。
|
||||
|
||||
Debian 12 / MariaDB 服务器模式、HTTPS 访问与代理池后台运行见 [服务器部署说明](docs/debian-deployment.md)。服务器适配在 `feat/debian-server` 分支,Windows 继续默认使用 SQLite。设置页支持随机请求间隔上下限及按成功请求次数自动轮换代理。
|
||||
|
||||
## 启动
|
||||
|
||||
双击 **启动工作台.cmd**,浏览器打开 **http://127.0.0.1:8765**。窗口关闭后后台服务继续运行;双击 **停止工作台.cmd** 结束本项目服务。
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Preserve existing sites. Prefer a domain certificate; CDN IP origins can use
|
||||
# the server's existing valid IP certificate when HTTP-01 is unavailable.
|
||||
set -euo pipefail
|
||||
root=/opt/kaoyan-studio-deploy/app
|
||||
test -f /etc/nginx/kaoyan-studio.htpasswd
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
root = Path('/opt/kaoyan-studio-deploy/app/deploy')
|
||||
text = (root / 'nginx-http-bootstrap.conf').read_text() + '\n' + (root / 'nginx-https.conf').read_text()
|
||||
cert = Path('/etc/letsencrypt/live/kaoyan.fjayson.com/fullchain.pem')
|
||||
if not cert.exists():
|
||||
replacement = '/etc/letsencrypt/live/186.241.68.230/'
|
||||
if not Path(replacement, 'fullchain.pem').exists():
|
||||
raise SystemExit('Install a valid origin certificate before configuring HTTPS')
|
||||
text = text.replace('/etc/letsencrypt/live/kaoyan.fjayson.com/', replacement)
|
||||
if Path('/etc/letsencrypt/live/186.241.68.230/fullchain.pem').exists():
|
||||
text += '\n' + (root / 'nginx-ip-origin.conf').read_text()
|
||||
Path('/etc/nginx/sites-available/kaoyan-studio').write_text(text)
|
||||
PY
|
||||
ln -sfn /etc/nginx/sites-available/kaoyan-studio /etc/nginx/sites-enabled/kaoyan-studio
|
||||
nginx -t
|
||||
systemctl reload nginx
|
||||
@@ -8,11 +8,6 @@ server {
|
||||
client_max_body_size 100m;
|
||||
auth_basic "Kaoyan Workbench";
|
||||
auth_basic_user_file /etc/nginx/kaoyan-studio.htpasswd;
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
root /var/www/kaoyan-acme;
|
||||
auth_basic off;
|
||||
add_header Cache-Control no-store;
|
||||
}
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8765;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# An authenticated HTTPS entry while the CDN domain is being configured.
|
||||
# Uses the server's separately renewed IP certificate and an unused port.
|
||||
server {
|
||||
listen 9443 ssl;
|
||||
listen [::]:9443 ssl;
|
||||
server_name 186.241.68.230;
|
||||
ssl_certificate /etc/letsencrypt/live/186.241.68.230/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/186.241.68.230/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
client_max_body_size 100m;
|
||||
auth_basic "Kaoyan Workbench";
|
||||
auth_basic_user_file /etc/nginx/kaoyan-studio.htpasswd;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8765;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_read_timeout 120s;
|
||||
proxy_hide_header Cache-Control;
|
||||
add_header Cache-Control "private, no-store" always;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header X-Frame-Options DENY always;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
# Debian 12 服务器部署
|
||||
|
||||
服务器:186.241.68.230;域名:https://kaoyan.fjayson.com;备用入口:https://186.241.68.230:9443。部署分支 `feat/debian-server`,应用监听回环 8765,Nginx 提供访问认证;域名通过用户的 CDN 回源。备用入口使用有效 IP 证书,与域名共用访问账号。账号密码单独交付,不放入 Git。浏览器第一次访问会提示输入工作台访问账号,这与学信网账号不同。
|
||||
|
||||
## 目录与服务
|
||||
|
||||
- `/opt/kaoyan-studio-deploy/app`:代码与构建网页。
|
||||
- `/opt/kaoyan-studio-deploy/venv`:Python 3.11 虚拟环境。
|
||||
- `/var/lib/kaoyan-studio`:设置、加密 Cookie 与权限 0600 的加密密钥。
|
||||
- `/opt/kaoyan-studio-deploy/mysql.json`:MariaDB 私密连接配置,root:kaoyan 权限 0640。
|
||||
- `/opt/kaoyan-studio-deploy/proxy_pool` 与 `proxy-venv`:独立原版代理池。
|
||||
- MariaDB 数据库 `kaoyan_studio`;数据、收藏、历史分数、任务、日志与断点均写入此库。
|
||||
- `kaoyan-studio.service`:工作台,单进程,异常退出自动重启,已设置开机启动。
|
||||
- `kaoyan-proxy-api.service`、`kaoyan-proxy-scheduler.service`:代理 API 与定时抓取检测,开机启动。
|
||||
- `kaoyan-proxy-redis`:独立 Redis 容器,只映射 `127.0.0.1:6381`,不操作原服务器的 Redis。
|
||||
|
||||
安装模板在 `deploy/`。Python 依赖按 `requirements.lock` 安装;前端 `npm ci && npm run build`。不要启动多个工作台进程连接同一数据库,否则任务恢复状态会互相影响。原有站点、数据库和 fail2ban 配置不作修改。
|
||||
|
||||
## 操作
|
||||
|
||||
```bash
|
||||
systemctl status kaoyan-studio kaoyan-proxy-api kaoyan-proxy-scheduler
|
||||
journalctl -u kaoyan-studio -f
|
||||
systemctl restart kaoyan-studio
|
||||
```
|
||||
|
||||
后台采集与浏览器连接无关,关掉电脑或网页后服务器继续运行。重启仅恢复被服务停止打断的运行任务;手动暂停、取消和等待登录的任务保持原状态。仍可能遇到研招验证码、登录到期、源站限流或免费代理不可用,需要到页面处理后恢复。
|
||||
|
||||
默认每次请求随机等待 1.2–2.4 秒,每 100 次成功请求轮换代理。设置页可修改上下限和轮换次数;0 表示关闭自动轮换。代理页显示实际成功请求路由、计数和切换次数。登录表单、会话同步、权限验证及紧随其后的失败页重试保持同一路由。免费代理池初次启动可能没有 HTTPS 候选,部署时保留了原电脑代理池的候选作为备用;这些候选仍会经过实际请求与失败隔离。
|
||||
|
||||
Linux 无桌面环境,界面提供研招网登录入口与粘贴 Cookie。请在自己的电脑浏览器打开研招目录并登录,从开发者工具中复制目录接口请求的单行 Cookie,粘贴到工作台后点验证。服务器重新同步会话并检查受保护的第二页。迁移 Windows Cookie 时只经 SSH 传输加密封装,在服务器重新加密;不继承原验证标记。
|
||||
|
||||
## 迁移与验证
|
||||
|
||||
对原 SQLite 使用在线 `backup()` 取得一致性快照,源库只读,原任务保持原状态。使用以下命令导入一个空 MySQL 库:
|
||||
|
||||
```bash
|
||||
python -m studio.migrate /path/to/studio-snapshot.db --config /path/to/private-mysql.json
|
||||
```
|
||||
|
||||
目标非空时拒绝覆盖,并保留已有任务状态;导入失败回滚整批写入。CLI 不执行应用启动的任务恢复。记录 ID、收藏、任务参数、日志 ID 与完成单元均保留,迁移来的任务暂停,验证登录后由用户恢复。
|
||||
|
||||
正式快照:27,901 条目录、0 条历史线、559 条院校索引、4 个任务、4,302 个断点、4,319 条日志;当前全国任务含 4,282 个完成单元。数据仍处于 2027 招生目录阶段,历史数据不会因部署自动出现。逐表内容校验结果位于服务器 `/opt/kaoyan-studio-deploy/migration-verification.json`。
|
||||
|
||||
目录、历史线、任务、断点和日志逐表内容一致。应用启动载入内置院校索引时更新了两个索引名称:82605 更新为“冶金自动化研究设计院”,83401 更新为“中国石油勘探开发研究院”;目录记录中的原始名称与内容均保留,因此运行后的院校索引全表哈希不同。迁移 Cookie 的实际第二页验证返回要求登录,必须在页面更新 Cookie 后再恢复原暂停任务。
|
||||
|
||||
## HTTPS 与 CDN
|
||||
|
||||
CDN 回源地址为该服务器,应用保持原始 Host `kaoyan.fjayson.com`,使用 HTTPS 443 回源,并转发 Authorization、请求方法与正文。禁止缓存工作台 HTML/API,源站已返回 `Cache-Control: private, no-store`。域名的浏览器证书由 CDN 提供;源站优先使用域名证书,也可使用当前有效的 IP 证书用于 CDN IP 回源。
|
||||
|
||||
部署时 HTTP-01 的本地回源探测成功,但证书机构访问另一 CDN 节点收到 404,因此没有替换服务器现有证书。`configure-nginx.sh` 优先选择域名证书,否则保留现有源站 IP 证书,并提供独立 9443 入口。可通过 DNS-01 或修正全部 CDN 节点的挑战路径回源后申请域名证书,再重新运行配置脚本。
|
||||
|
||||
源站 IP 证书使用服务器原有 `/opt/certbot-venv/bin/certbot` 5.8.0 维护,`certbot.timer` 已启用,续期后自动 reload Nginx。2026-10-11 对该 IP 证书执行 `renew --cert-name 186.241.68.230 --dry-run --no-random-sleep-on-renew` 成功。不要误用 `/usr/bin/certbot` 2.1.0 维护此 IP 证书。[Let's Encrypt 的 IP 证书说明](https://letsencrypt.org/2026/03/11/shorter-certs-certbot/)要求受支持的新版客户端。
|
||||
|
||||
HTTPS 域名若重定向到完全相同的网址,通常是 CDN 正在用 HTTP 回源源站的强制 HTTPS 入口。请改为 HTTPS 443 回源,保持请求 Host 与 TLS SNI 为 `kaoyan.fjayson.com`。源站当前证书的名称是 IP,供应商须支持按源站 IP 校验;若仅支持域名名称严格校验,则先取得域名证书。域名配置完成前可直接使用 9443 备用入口。
|
||||
|
||||
## 备份和升级
|
||||
|
||||
```bash
|
||||
# root 使用 MariaDB 原有本机 socket 认证,备份不在命令行放密码
|
||||
umask 077
|
||||
mkdir -p /var/backups/kaoyan-studio
|
||||
mariadb-dump --single-transaction --default-character-set=utf8mb4 kaoyan_studio > /var/backups/kaoyan-studio/database.sql
|
||||
cp -a /var/lib/kaoyan-studio /var/backups/kaoyan-studio/runtime
|
||||
```
|
||||
|
||||
同时保存数据库、运行目录(含 `cookie.key`)、私密 MySQL 配置和访问认证文件。不要把这些文件上传 Git 或公开网盘。升级前备份,停止工作台,拉取该部署分支并构建前端、安装锁定依赖,再启动工作台。原 Windows 项目继续保留 SQLite 模式,可作为原始备份。
|
||||
|
||||
代理池使用 [jhao104/proxy_pool](https://github.com/jhao104/proxy_pool),数据库适配参考 [PyMySQL 官方文档](https://pymysql.readthedocs.io/en/latest/user/examples.html) 和 [MariaDB 更新冲突记录的语法](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-on-duplicate-key-update)。
|
||||
+9
-13
@@ -195,7 +195,6 @@ export default function App() {
|
||||
const [tab, setTab] = useState<Tab>("overview");
|
||||
const [overview, setOverview] = useState<Overview | null>(null);
|
||||
const [majors, setMajors] = useState<Major[]>([]);
|
||||
const [serverMode, setServerMode] = useState(false);
|
||||
const [version, setVersion] = useState(0);
|
||||
const [notice, setNotice] = useState<{
|
||||
message: string;
|
||||
@@ -211,12 +210,10 @@ export default function App() {
|
||||
Promise.all([
|
||||
api<Overview>("/overview", { signal: controller.signal }),
|
||||
api<Major[]>("/majors", { signal: controller.signal }),
|
||||
api<{ platform: string }>("/health", { signal: controller.signal }),
|
||||
])
|
||||
.then(([o, m, health]) => {
|
||||
.then(([o, m]) => {
|
||||
setOverview(o);
|
||||
setMajors(m);
|
||||
setServerMode(health.platform === "linux");
|
||||
})
|
||||
.catch((e) => {
|
||||
if (e.name !== "AbortError") notify(e.message, true);
|
||||
@@ -250,7 +247,7 @@ export default function App() {
|
||||
<small>考研数据工作台</small>
|
||||
</span>
|
||||
</a>
|
||||
<div className="nav-label">WORKSPACE / {serverMode ? "服务器工作区" : "本地工作区"}</div>
|
||||
<div className="nav-label">WORKSPACE / 本地工作区</div>
|
||||
<nav aria-label="主导航">
|
||||
{NAV.map((n) => (
|
||||
<button
|
||||
@@ -266,7 +263,7 @@ export default function App() {
|
||||
</nav>
|
||||
<div className="sidebar-bottom">
|
||||
<div className="local-indicator">
|
||||
<span /> {serverMode ? "服务器数据 · 持续保存" : "本机数据 · 独立保存"}
|
||||
<span /> 本机数据 · 独立保存
|
||||
</div>
|
||||
<p>
|
||||
把全国目录与历年考情
|
||||
@@ -286,7 +283,7 @@ export default function App() {
|
||||
</div>
|
||||
<div className="topbar-right">
|
||||
<span className="local-tag">
|
||||
<ShieldCheck size={14} /> {serverMode ? "服务器运行" : "本地运行"}
|
||||
<ShieldCheck size={14} /> 本地运行
|
||||
</span>
|
||||
<button
|
||||
className="icon-button"
|
||||
@@ -306,7 +303,7 @@ export default function App() {
|
||||
</main>
|
||||
<footer>
|
||||
研途 · 数据以院校当年招生简章为准
|
||||
<span>全国招生目录 / 历年考情 / {serverMode ? "服务器工作区" : "本地工作区"}</span>
|
||||
<span>全国招生目录 / 历年考情 / 本地工作区</span>
|
||||
</footer>
|
||||
</div>
|
||||
{notice && (
|
||||
@@ -1757,7 +1754,7 @@ function ProxyPanel({ notify }: { notify: Notify }) {
|
||||
</section>
|
||||
<section className="card pool-controls">
|
||||
<div className="card-title">
|
||||
<h2>{services?.manager === "systemd" ? "服务器代理池服务" : "本机代理池服务"}</h2>
|
||||
<h2>本机代理池服务</h2>
|
||||
<Badge tone={services?.api_ready ? "green" : ""}>
|
||||
{services
|
||||
? services.api_ready
|
||||
@@ -1766,7 +1763,7 @@ function ProxyPanel({ notify }: { notify: Notify }) {
|
||||
: "正在查询"}
|
||||
</Badge>
|
||||
</div>
|
||||
<p>查看 API、代理抓取与检测、Redis 的运行状态,管理{services?.manager === "systemd" ? "服务器" : "本机"}服务。</p>
|
||||
<p>查看 API、代理抓取与检测、Redis 的运行状态,管理本机服务。</p>
|
||||
{services && (
|
||||
<ul className="pool-service-list">
|
||||
{services.items.map((service) => (
|
||||
@@ -2157,9 +2154,8 @@ function SettingsPanel({ notify }: { notify: Notify }) {
|
||||
</button>
|
||||
</div>
|
||||
<div className="info-box">
|
||||
{auth?.browser_supported === false
|
||||
? "Cookie 加密保存在服务器的数据目录中,导出文件不包含凭据。"
|
||||
: "Cookie 由当前 Windows 用户的 DPAPI 加密,保存在项目的本地数据目录中,导出文件不包含凭据。"}
|
||||
Cookie 由当前 Windows 用户的 DPAPI
|
||||
加密,保存在项目的本地数据目录中,导出文件不包含凭据。
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -113,7 +113,6 @@ export type Proxy = {
|
||||
proxies: { url: string; failed: boolean; active: boolean }[];
|
||||
};
|
||||
export type PoolServiceStatus = {
|
||||
manager?: string;
|
||||
api_ready: boolean;
|
||||
items: {
|
||||
name: string;
|
||||
|
||||
+2
-2
@@ -187,10 +187,10 @@ class AuthService:
|
||||
raise ValueError("请输入学信网账号和密码")
|
||||
if self.browser_cancel:
|
||||
self.browser_cancel.set()
|
||||
with self.check_lock, self.transport.router.hold_route():
|
||||
with self.check_lock:
|
||||
response = self.transport.request("GET", LOGIN_URL)
|
||||
soup = BeautifulSoup(response.text, "html.parser")
|
||||
form = {node.get("name"): node.get("value", "") for node in soup.find_all("input", attrs={"type": "hidden", "name": True})}
|
||||
form = {node.get("name"): node.get("value", "") for node in soup.select("input[type=hidden][name]")}
|
||||
if "lt" not in form or "execution" not in form:
|
||||
raise ValueError("登录页面需要人工验证,请使用浏览器登录")
|
||||
form.update(username=username, password=password, _eventId="submit")
|
||||
|
||||
@@ -72,7 +72,6 @@ class CatalogClient:
|
||||
raise
|
||||
# A CAS cookie may still be valid while the catalogue session has expired.
|
||||
# Refresh once, then retry exactly the same page; never skip its records.
|
||||
with self.transport.router.hold_route():
|
||||
status = self.auth.check()
|
||||
if not status["valid"]:
|
||||
raise LoginRequired(status["message"], reason="captcha" if status["state"] == "captcha_required" else "login") from None
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ def main():
|
||||
parser.add_argument('--config', type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
config = json.loads(args.config.read_text())
|
||||
print(json.dumps(migrate_sqlite(args.snapshot, MySQLDatabase(config, recover_jobs=False)), ensure_ascii=False))
|
||||
print(json.dumps(migrate_sqlite(args.snapshot, MySQLDatabase(config)), ensure_ascii=False))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -96,7 +96,7 @@ class Connection:
|
||||
|
||||
|
||||
class MySQLDatabase(Database):
|
||||
def __init__(self, config, recover_jobs=True):
|
||||
def __init__(self, config):
|
||||
self.config = {key: value for key, value in config.items() if key in ('host', 'port', 'user', 'password', 'database', 'unix_socket')}
|
||||
if not self.config.get('database'):
|
||||
raise ValueError('数据库配置缺少 database')
|
||||
@@ -106,7 +106,6 @@ class MySQLDatabase(Database):
|
||||
conn.execute(statement + ' ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin')
|
||||
if not conn.execute("SHOW COLUMNS FROM jobs LIKE 'resume_pending'").fetchone():
|
||||
conn.execute('ALTER TABLE jobs ADD COLUMN resume_pending TINYINT DEFAULT 0')
|
||||
if recover_jobs:
|
||||
recovery = "status IN ('running','queued') OR (status='paused' AND resume_pending=1)"
|
||||
self.recovered_job_ids = [row['id'] for row in conn.execute('SELECT id FROM jobs WHERE ' + recovery)]
|
||||
conn.execute("UPDATE jobs SET status='paused',resume_pending=0,message='服务重启,任务可从断点恢复' WHERE " + recovery)
|
||||
|
||||
@@ -97,14 +97,3 @@ def test_migration_rolls_back_every_table_on_bad_source(mysql, tmp_path):
|
||||
migrate_sqlite(tmp_path / 'bad.db', mysql)
|
||||
assert mysql.overview()['records'] == 0
|
||||
assert mysql.overview()['scores'] == 0
|
||||
|
||||
|
||||
def test_rejected_migration_cli_does_not_pause_destination_jobs(mysql, tmp_path):
|
||||
import subprocess
|
||||
import sys
|
||||
source = Database(tmp_path / 'source.db')
|
||||
mysql.job_create('existing-running-job', {'year': 2027})
|
||||
mysql.job_update('existing-running-job', status='running')
|
||||
result = subprocess.run([sys.executable, '-m', 'studio.migrate', str(source.path), '--config', os.environ['STUDIO_MYSQL_TEST_CONFIG']], capture_output=True, text=True)
|
||||
assert result.returncode != 0
|
||||
assert mysql.job_get('existing-running-job')['status'] == 'running'
|
||||
|
||||
@@ -3,10 +3,8 @@ import random
|
||||
import os
|
||||
import pytest
|
||||
|
||||
from studio.auth import CookieVault, AuthService, LOGIN_URL, CATALOG_ENTRY
|
||||
from studio.connectors import CatalogClient
|
||||
from studio.network import RemoteUnavailable
|
||||
from tests.test_network import setup_network, Remote, Response
|
||||
from studio.auth import CookieVault
|
||||
from tests.test_network import setup_network
|
||||
|
||||
|
||||
def test_requests_sample_a_fresh_delay_inside_configured_bounds(tmp_path, monkeypatch):
|
||||
@@ -47,47 +45,6 @@ def test_route_pin_defers_rotation_until_login_proof_finishes(tmp_path):
|
||||
assert transport.request('GET', 'https://yz.chsi.com.cn/zsml/').json()['routed_through'] == 'http://5.6.7.8:9090'
|
||||
|
||||
|
||||
class RouteBoundSession(Remote):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.bound = set()
|
||||
self.form_route = None
|
||||
|
||||
def request(self, method, url, **kwargs):
|
||||
route = kwargs.get('proxies', {}).get('https')
|
||||
if url == LOGIN_URL and method == 'GET':
|
||||
self.form_route = route
|
||||
return Response({}, text='<input type="hidden" name="lt" value="test"><input type="hidden" name="execution" value="test">')
|
||||
if url == LOGIN_URL and method == 'POST':
|
||||
if route != self.form_route:
|
||||
raise RemoteUnavailable('login form and credentials used different routes')
|
||||
return Response({})
|
||||
if url == CATALOG_ENTRY:
|
||||
self.bound = {route}
|
||||
return Response({})
|
||||
if url.endswith('/yjfxs.do'):
|
||||
return Response({'flag': True, 'msg': {'list': [{'direction': 'confirmed'}]}}) if route in self.bound else Response({'flag': False, 'msg': '请登录'})
|
||||
return super().request(method, url, **kwargs)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('threshold', [1, 2])
|
||||
def test_auth_recovery_preserves_proven_route_through_catalog_retry(tmp_path, threshold):
|
||||
settings, _, transport = setup_network(tmp_path, remote=RouteBoundSession())
|
||||
settings.update({'proxy_rotate_every': threshold})
|
||||
auth = AuthService(transport, CookieVault(tmp_path))
|
||||
assert auth.check()['valid']
|
||||
payload = CatalogClient(transport, auth).fetch_page('yjfxs', {'curPage': 2, 'start': 10, 'pageSize': 10})
|
||||
assert payload['list'][0]['direction'] == 'confirmed'
|
||||
|
||||
|
||||
def test_credential_login_pins_form_submission_and_verification(tmp_path):
|
||||
settings, _, transport = setup_network(tmp_path, remote=RouteBoundSession())
|
||||
settings.update({'proxy_rotate_every': 2})
|
||||
transport.request('GET', 'https://yz.chsi.com.cn/zsml/')
|
||||
auth = AuthService(transport, CookieVault(tmp_path))
|
||||
assert auth.login('test-user', 'test-password')['valid']
|
||||
|
||||
|
||||
def test_linux_cookie_vault_encrypts_and_preserves_domain_cookies(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(platform, 'system', lambda: 'Linux')
|
||||
cookies = [{'name': 'JSESSIONID', 'value': 'private-account-cookie', 'domain': 'account.chsi.com.cn'},
|
||||
|
||||
Reference in New Issue
Block a user