教务课表

pkuinfo/pku-harness-plugins/plugins/course-sync

官方内置

从学校同步本学期课表到日程。

插件可以访问的内容

插件只能做这里声明过的事。安装之前,App 会给你看同一份清单。如果以后的更新需要更多权限,App 会再次询问你。

校园服务使用你的登录
  • 树洞treehole.pku.edu.cn

这些请求由 App 使用你已登录的会话发送,插件看不到你的密码、Cookie 或令牌。

其他网站

无

App 功能
  • 树洞验证码
  • 读取和修改你的课表
工具
  • 同步教务课表course-sync.sync把本学期的课导入日程(替换上次同步的课)修改
  • 发送验证码course-sync.sendCode给绑定手机发送课表验证码修改
  • 课表同步状态course-sync.status已同步的课数和上次同步时间读取
界面与命令
  • 页面:home

需要的系统能力

  • 校园登录

    使用你已登录的校园会话,你的密码不会离开手机。

  • 联网

    会访问互联网上的服务器。

云端数据

不使用 PKU harness Cloud。

检查结果

  • 由 pkuinfo 维护,源码在官方插件仓库中。

给 AI 的说明

PLUGIN.md 的正文部分,会和插件一起提供给模型。

用户想导入/同步/更新课表时调用 course-sync__sync。

  • 已在「手机令牌」插件绑定时,课表二次验证会自动完成,不必问用户。
  • 返回 status "verification_required" 时:kind "login" 只能用短信;kind "course" 可用手机令牌(OTP)或短信。用 ui__render 给用户一个输入验证码的表单(发短信前先调用 course-sync__sendCode),拿到验证码后再调用 sync 并传 code 和 method。
  • 同步结果里 location 是从教务原文 info 解析出的教室;解析不到时为 null,可用 timetable__updateCourse 补上。

清单

PLUGIN.md 的 frontmatter,按原样显示。 来源: plugins/course-sync/PLUGIN.md. 字段说明

spec: 1
id: course-sync
name: 教务课表
description: 从学校同步本学期课表到日程。
version: 0.2.0
author: pkuinfo
icon: sync
homepage: https://github.com/pkuinfo/pku-harness-plugins/tree/main/plugins/course-sync
requires: [campus-session, network]
# Class timetable from PKU via the treehole course table (pkucli crates/treehole/src/api.rs
# get_coursetable + get_class_times). Writes into the shared timetable with source "campus";
# hand-added courses are never touched. Shares treehole's course-data token with grades:
# verifying in either unlocks both until the server expires it. The 40002 / 40077 second factor
# is the host's verify.treehole ability.
campus: [treehole]
abilities: [verify, timetable]
shared: shared.yaml
tools:
  sync: tools/sync.yaml
  sendCode: tools/sendCode.yaml
  status: tools/status.yaml
screens:
  home: screens/home.json
settings:
  - { screen: home, title: 教务课表, subtitle: 从学校同步课表, icon: sync }
i18n:
  en:
    name: Official timetable
    description: Syncs this semester’s timetable from the university into Schedule.
    tools:
      sync: { title: Sync official timetable, summary: Import this semester’s classes into Schedule (replaces the last sync) }
      sendCode: { title: Send verification code, summary: Text a timetable verification code to your phone }
      status: { title: Timetable sync status, summary: How many classes are synced and when the last sync ran }
    screens: { home: { title: Official timetable } }
    settings: { home: { title: Official timetable, subtitle: Sync your classes from the university } }

同一仓库中的其他插件

pkuinfo/pku-harness-plugins