Skip to content

Commit e851418

Browse files
baixiangerclaude
andcommitted
Update READMEs: add export/import, logout, Chromium support, VPS guide
- Auth table: added logout, export, import, --chrome flag - Login diagram: updated with browser detection and auto-headless - New section: Headless / VPS deployment with export/import workflow - Both READMEs kept in sync Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c595c46 commit e851418

2 files changed

Lines changed: 66 additions & 4 deletions

File tree

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ snowball kol SH600519
6363
|---|---|
6464
| `snowball login` | QR code login (shown in terminal) |
6565
| `snowball login --manual` | QR code login (scan in Chrome window) |
66+
| `snowball login --chrome <path>` | Specify custom Chrome/Chromium path |
6667
| `snowball token <cookie>` | Set token manually |
6768
| `snowball status` | Check login status + verify token |
69+
| `snowball logout` | Remove saved token |
70+
| `snowball export` | Print token as base64 (for transfer) |
71+
| `snowball import <base64>` | Import token from another machine |
6872

6973
### Market
7074

@@ -184,15 +188,42 @@ snowball trending | jq '.[].author'
184188
```
185189
snowball login
186190
187-
├─ Start Chrome (background) → visit xueqiu.com → solve WAF
191+
├─ Find Chrome/Chromium (CHROME_PATH > --chrome > auto-detect)
192+
├─ Start browser (background, headless on VPS) → visit xueqiu.com → solve WAF
188193
├─ Call Xueqiu API → generate QR code → render in terminal
189194
├─ Wait for scan → poll status every 2.5s
190195
├─ QR expired? → auto-regenerate (up to 3x)
191196
├─ All failed? → fallback to manual Chrome mode
192197
└─ Success → save cookies to ~/.snowball-cli/token.json
193198
```
194199

195-
Alternative: `snowball login --manual` opens Chrome window directly.
200+
Browser detection order: `CHROME_PATH` env → `--chrome` flag → Chrome → Chromium → platform defaults.
201+
202+
Auto headless: on Linux without `DISPLAY`, Chrome launches with `--headless` automatically.
203+
204+
## Headless / VPS deployment
205+
206+
No Chrome needed — transfer your token from a local machine:
207+
208+
```bash
209+
# One-liner: export from local, import on VPS
210+
ssh vps "snowball import $(snowball export)"
211+
212+
# Or step by step
213+
snowball export # prints base64 on local machine
214+
ssh vps "snowball import <base64>" # paste on VPS
215+
```
216+
217+
Alternatively, install Chromium on the VPS and login there:
218+
219+
```bash
220+
# Debian/Ubuntu
221+
apt install -y chromium-browser
222+
snowball login # auto-detects headless, QR shows in SSH terminal
223+
224+
# Custom path
225+
snowball login --chrome /snap/bin/chromium
226+
```
196227

197228
## License
198229

README.zh-CN.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ snowball kol SH600519
6363
|---|---|
6464
| `snowball login` | 二维码登录(终端内显示) |
6565
| `snowball login --manual` | 二维码登录(Chrome 窗口扫码) |
66+
| `snowball login --chrome <路径>` | 指定 Chrome/Chromium 路径 |
6667
| `snowball token <cookie>` | 手动设置 token |
6768
| `snowball status` | 查看登录状态并验证 token |
69+
| `snowball logout` | 删除已保存的 token |
70+
| `snowball export` | 导出 token(base64,用于传输) |
71+
| `snowball import <base64>` | 从其他机器导入 token |
6872

6973
### 行情
7074

@@ -184,15 +188,42 @@ snowball trending | jq '.[].author'
184188
```
185189
snowball login
186190
187-
├─ 后台启动 Chrome → 打开 xueqiu.com → 通过 WAF 验证
191+
├─ 查找 Chrome/Chromium(CHROME_PATH > --chrome > 自动检测)
192+
├─ 启动浏览器(后台运行,VPS 上自动无头)→ 打开 xueqiu.com → 通过 WAF
188193
├─ 调用雪球 API → 生成二维码 → 终端渲染
189194
├─ 等待扫码 → 每 2.5 秒轮询状态
190195
├─ 过期? → 自动刷新(最多 3 次)
191196
├─ 全部失败? → 降级为 Chrome 窗口手动扫码
192197
└─ 成功 → 保存 Cookie 到 ~/.snowball-cli/token.json
193198
```
194199

195-
备用:`snowball login --manual` 直接打开 Chrome 窗口扫码。
200+
浏览器检测顺序:`CHROME_PATH` 环境变量 → `--chrome` 参数 → Chrome → Chromium → 平台默认路径
201+
202+
自动无头:Linux 上没有 `DISPLAY` 时,Chrome 自动以 `--headless` 模式启动。
203+
204+
## 无头服务器 / VPS 部署
205+
206+
不需要浏览器 — 从本地机器传输 token:
207+
208+
```bash
209+
# 一行搞定:本地导出,VPS 导入
210+
ssh vps "snowball import $(snowball export)"
211+
212+
# 或者分步
213+
snowball export # 本地打印 base64
214+
ssh vps "snowball import <base64>" # VPS 上粘贴
215+
```
216+
217+
也可以在 VPS 上装 Chromium 直接扫码登录:
218+
219+
```bash
220+
# Debian/Ubuntu
221+
apt install -y chromium-browser
222+
snowball login # 自动检测无头模式,二维码在 SSH 终端显示
223+
224+
# 指定路径
225+
snowball login --chrome /snap/bin/chromium
226+
```
196227

197228
## 协议
198229

0 commit comments

Comments
 (0)