← 返回
未分类

PKU Campus Card

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...
PKU校园卡 CLI 工具,使用 Rust 编写。适用于处理 campuscard 工具库、调试校园卡命令、添加功能等场景。
wjsoj
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 419
下载
💾 0
安装
1
版本
#campus-card#cli#latest#pku#rust

概述

Campuscard - 北大校园卡 CLI

A CLI client for PKU's campus card system (Synjones platform at bdcard.pku.edu.cn).

Architecture

  • Crate location: crates/campuscard/
  • Auth flow: IAAA SSO (app_id="portal2017") → portal → berserker-auth → JWT
  • API: JSON REST with synjones-auth header
  • Constraints: Requires mobile UA (PKUANDROID) and http1_only() (server rejects HTTP/2)

Key Source Files

  • src/main.rs — Clap CLI with subcommands
  • src/commands.rs — Command implementations
  • src/api.rs — API client with synjones-auth header injection
  • src/display.rs — Terminal output, QR code rendering
  • src/client.rs — reqwest client with mobile UA and HTTP/1.1 enforcement

CLI Commands

CommandAliasFunction
--------------------------
login / logout / statusIAAA → portal → berserker → JWT
infoCard balance and details
payDisplay payment QR code in terminal
rechargeTop up card balance
billslsTransaction history (pagination, monthly filter)
statsMonthly spending statistics
otpTOTP 2FA management

Auto-Login for AI Agents

# Check session status
info-auth check

# Auto-login (reads credentials from OS keyring, no password needed)
campuscard login -p

Development Notes

  • The auth chain is the most complex: IAAA → portal → berserker-auth → JWT token
  • Must use mobile User-Agent (PKUANDROID) or requests will be rejected
  • Must use http1_only() — the Synjones server does not support HTTP/2
  • QR code for payment displayed via info_common::qr (viuer or system viewer)
  • All user-facing strings in Chinese
  • Error handling: anyhow::Result with .context("中文描述")
  • Session persisted to ~/.config/info/campuscard/
  • Credentials resolved via info_common::credential (keyring → env → interactive)

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-03 09:38 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Treehole

wjsoj
PKU树洞(北大树洞)是一款用Rust编写的匿名论坛CLI工具。在使用treehole crate、调试treehole命令、添加功能等场景下使用此技能。
★ 0 📥 419

PKU Info Auth

wjsoj
PKU 统一凭据管理 CLI(统一凭据管理)。当用户或 AI Agent 需要对 PKU服务进行身份验证或管理已存储的凭据时使用此技能。
★ 0 📥 431

Course

wjsoj
PKU 教学平台(北大教学网/Blackboard Learn)RustCLI 工具。用于课程 crate、调试课程命令、添加功能。
★ 0 📥 436