🦀 ClawHub
PKU Campus Card
by @wjsoj
PKU Campus Card (校园卡) CLI tool built in Rust. Use this skill when working on the campuscard crate, debugging campus card commands, adding features, or when t...
TERMINAL
clawhub install pku-campuscard📖 About This Skill
name: campuscard description: "PKU Campus Card (校园卡) CLI tool built in Rust. Use this skill when working on the campuscard crate, debugging campus card commands, adding features, or when the user mentions 校园卡, campus card, balance, recharge, payment QR, transaction history, monthly spending, or bdcard.pku.edu.cn. Also use when dealing with Synjones platform auth, berserker-auth flow, mobile User-Agent requirements, or HTTP/1.1 constraints." version: 2.0.0
Campuscard - 北大校园卡 CLI
A CLI client for PKU's campus card system (Synjones platform at bdcard.pku.edu.cn).
Architecture
crates/campuscard/app_id="portal2017") → portal → berserker-auth → JWTsynjones-auth headerPKUANDROID) and http1_only() (server rejects HTTP/2)Key Source Files
src/main.rs — Clap CLI with subcommandssrc/commands.rs — Command implementationssrc/api.rs — API client with synjones-auth header injectionsrc/display.rs — Terminal output, QR code renderingsrc/client.rs — reqwest client with mobile UA and HTTP/1.1 enforcementCLI Commands
| Command | Alias | Function |
|---------|-------|----------|
| login / logout / status | | IAAA → portal → berserker → JWT |
| info | | Card balance and details |
| pay | | Display payment QR code in terminal |
| recharge | | Top up card balance |
| bills | ls | Transaction history (pagination, monthly filter) |
| stats | | Monthly spending statistics |
| otp | | TOTP 2FA management |
Auto-Login for AI Agents
# Check session status
info-auth checkAuto-login (reads credentials from OS keyring, no password needed)
campuscard login -p
Development Notes
PKUANDROID) or requests will be rejectedhttp1_only() — the Synjones server does not support HTTP/2info_common::qr (viuer or system viewer)anyhow::Result with .context("中文描述")~/.config/info/campuscard/info_common::credential (keyring → env → interactive)