Skip to content

Commit

Permalink
docs: update api docs, fix signedDataMonth descrption
Browse files Browse the repository at this point in the history
  • Loading branch information
beetcb committed Jan 16, 2022
1 parent d993e68 commit 32cf304
Show file tree
Hide file tree
Showing 22 changed files with 1,028 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

- 关于签到插件: ([学校配置](./docs/config.md)时)使用百度地图 API 获取学校全局签到地址, 使用今日校园接口返回的签到数据获取签到经纬度, 简单来说, 只需知道学校英文简称即可配置好所有签到信息, 充分懒人化

- 关于签到或查寝中的图片上传:无需特意配置,Cea 会自动使用之前成功签到过的图片来完成上传,这样既无需配置图片地址、也在运行过程中省去了图片上传操作(我们都知道这是个相对耗时的过程)
- 复用历史成功签到数据:表单填写方面,Cea 会查找历史签到中最新且成功签到的数据作为模板填写当前表单;查寝图片上传方面,Cea 使用同样的策略获取图片 URL;这省去了配置表单的繁琐过程和图片上传的费时操作

- 支持日志路由转发到微信:方便查看运行结果日志 (详见 [部署指南](./docs/deploy.md)),这也方便 Cea 插件开发者实现推送和统一日志输出 (详见 [插件开发](https://github.com/ceajs/cea#%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91))

Expand Down Expand Up @@ -124,7 +124,7 @@ cea.start()

## 插件列表

- [`check-in-helper`](./docs/api/plugins/check-in/README.md)
- [`check-in-helper`](./docs/api/plugins/check-in-helper/README.md)
- [`attendance`](./docs/api/plugins/attendance/README.md)
- [`sign`](./docs/api/plugins/sign/README.md)

Expand Down
4 changes: 2 additions & 2 deletions build/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ async function main() {

async function build(refs: Array<PackageRefs>) {
for (const { path } of refs) {
console.log(path)
const app = new TypeDoc.Application()
// If you want TypeDoc to load tsconfig.json / typedoc.json files
app.options.addReader(new TypeDoc.TSConfigReader())
app.options.addReader(new TypeDoc.TypeDocReader())
const pkgName = path.slice(-1)
const pkgName = path.slice(3)
app.bootstrap({
// typedoc options here
entryPoints: [`${path}src/index.ts`],
Expand All @@ -51,6 +50,7 @@ async function build(refs: Array<PackageRefs>) {
// Project may not have converted correctly
const outputDir = `docs/api${pkgName}`
// Rendered docs
console.log(`Rendering ${outputDir}`)
await app.generateDocs(project, outputDir)
}
}
Expand Down
44 changes: 37 additions & 7 deletions docs/api/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,47 @@
@ceajs/attendance-plugin / [Exports](modules.md)
cea / [Exports](modules.md)

### 简介
## 详细说明

Cea 插件: 实现自动查寝(无需配置查寝图片,自动获取)
https://github.com/ceajs/cea/tree/main

### 插件: <a align="center" href="https://www.npmjs.com/package/cea"><img alt="cea" src="https://img.shields.io/npm/v/cea?style=social&label=cea"></a>

### 安装

```bash
npm i @ceajs/attendance-plugin
# Install cea as a cli
npm i -g cea
# Using cea as a module
npm i cea
```

### 示例

1. 使用 CLI

今日校园签到:

```bash
cea sign
```

2. 使用模块

今日校园签到:

```ts
// 导入 Cea 和内置的签到插件中的函数 checkIn
import Cea, { checkIn } from 'cea'
// 创建 Cea 的实例
const cea = new Cea()
// 注册插件
cea.addPlugin(checkIn)
// 执行签到脚本
cea.start()
```

## 文档
# 文档

- 项目说明:https://github.com/ceajs/cea/tree/main/plugins/attendance-plugin
- API 文档:https://github.com/ceajs/cea/blob/main/docs/api/plugins/attendance/modules.md
- 项目说明:https://github.com/ceajs/cea/tree/main/internal
- API 文档:https://github.com/ceajs/cea/blob/main/docs/api/internal/modules.md
- 配置文档:https://github.com/ceajs/cea
File renamed without changes.
15 changes: 15 additions & 0 deletions docs/api/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@ceajs/core / [Exports](modules.md)

### 插件: <a align="center" href="https://www.npmjs.com/package/cea-core"><img alt="cea-core" src="https://img.shields.io/npm/v/cea-core?style=social&label=cea-core"></a>

### 安装

```bash
npm i @ceajs/core
```

## 文档

- 项目说明:https://github.com/ceajs/cea/tree/main/core
- API 文档:https://github.com/ceajs/cea/blob/main/docs/api/core/modules.md
- 配置文档:https://github.com/ceajs/cea
248 changes: 248 additions & 0 deletions docs/api/core/modules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
[@ceajs/core](README.md) / Exports

# @ceajs/core

## Table of contents

### Namespaces

- [sstore](modules/sstore.md)

### Type aliases

- [CookieRawObject](modules.md#cookierawobject)
- [SchoolConf](modules.md#schoolconf)
- [SchoolConfOpts](modules.md#schoolconfopts)
- [StringKV](modules.md#stringkv)
- [UserConfOpts](modules.md#userconfopts)
- [UsersConf](modules.md#usersconf)

### Variables

- [log](modules.md#log)

### Functions

- [cookieParse](modules.md#cookieparse)
- [cookieStr](modules.md#cookiestr)
- [getSchoolInfos](modules.md#getschoolinfos)
- [handleCookie](modules.md#handlecookie)
- [loadConfFromToml](modules.md#loadconffromtoml)

## Type aliases

### CookieRawObject

Ƭ **CookieRawObject**: `Object`

#### Index signature

[K: `string`]: `string`

#### Defined in

[src/types/cookie.ts:3](https://github.com/ceajs/cea/blob/d993e68/src/core/src/types/cookie.ts#L3)

___

### SchoolConf

Ƭ **SchoolConf**: `Object`

#### Index signature

[school: `string`]: [`SchoolConfOpts`](modules.md#schoolconfopts)

#### Defined in

[src/types/conf.ts:24](https://github.com/ceajs/cea/blob/d993e68/src/core/src/types/conf.ts#L24)

___

### SchoolConfOpts

Ƭ **SchoolConfOpts**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `authOrigin` | `string` |
| `captchaAuthMode` | `CaptchaAuthMode` |
| `chineseName` | `string` |
| `defaultAddr` | `string` |
| `edgeCase` | `SchoolEdgeCase` |
| `isCloud` | `boolean` |
| `loginURL?` | `string` |
| `preAuthURL` | `string` |

#### Defined in

[src/types/conf.ts:28](https://github.com/ceajs/cea/blob/d993e68/src/core/src/types/conf.ts#L28)

___

### StringKV

Ƭ **StringKV**: `Object`

#### Index signature

[key: `string`]: `string`

#### Defined in

[src/types/helper.ts:1](https://github.com/ceajs/cea/blob/d993e68/src/core/src/types/helper.ts#L1)

___

### UserConfOpts

Ƭ **UserConfOpts**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `addr` | [``""``] \| [`string`, `string`, `string`] |
| `alias` | `string` |
| `captcha?` | ``"MANUAL"`` \| ``"OCR"`` |
| `password` | `string` |
| `retry?` | `number` |
| `school` | `string` |
| `signedDataMonth?` | \`${number}-${number}\` |
| `username` | `string` |

#### Defined in

[src/types/conf.ts:13](https://github.com/ceajs/cea/blob/d993e68/src/core/src/types/conf.ts#L13)

___

### UsersConf

Ƭ **UsersConf**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `localEdgeCasesFile?` | `string` |
| `notifier?` | [\`${number}\`, `string`, `string`] |
| `users` | [`UserConfOpts`](modules.md#userconfopts)[] |

#### Defined in

[src/types/conf.ts:8](https://github.com/ceajs/cea/blob/d993e68/src/core/src/types/conf.ts#L8)

## Variables

### log

**log**: `LogRouter`

#### Defined in

[src/utils/logger.ts:28](https://github.com/ceajs/cea/blob/d993e68/src/core/src/utils/logger.ts#L28)

## Functions

### cookieParse

**cookieParse**(`host`, `headers`): `CookieMap`

Parse http response headers' cookie

#### Parameters

| Name | Type |
| :------ | :------ |
| `host` | `string` |
| `headers` | `Headers` |

#### Returns

`CookieMap`

#### Defined in

[src/utils/cookie-helper.ts:7](https://github.com/ceajs/cea/blob/d993e68/src/core/src/utils/cookie-helper.ts#L7)

___

### cookieStr

**cookieStr**(`host`, `cookieMap`): `string`

Construct a cookie object based on host

#### Parameters

| Name | Type |
| :------ | :------ |
| `host` | `string` |
| `cookieMap` | `CookieMap` |

#### Returns

`string`

#### Defined in

[src/utils/cookie-helper.ts:50](https://github.com/ceajs/cea/blob/d993e68/src/core/src/utils/cookie-helper.ts#L50)

___

### getSchoolInfos

**getSchoolInfos**(`__namedParameters`): `Promise`<[`SchoolConf`](modules.md#schoolconf) \| ``null``\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `__namedParameters` | [`UsersConf`](modules.md#usersconf) |

#### Returns

`Promise`<[`SchoolConf`](modules.md#schoolconf) \| ``null``\>

#### Defined in

[src/conf.ts:33](https://github.com/ceajs/cea/blob/d993e68/src/core/src/conf.ts#L33)

___

### handleCookie

**handleCookie**(): `Promise`<`void`\>

Iterate through all users: complete unified auth -> store cookie

#### Returns

`Promise`<`void`\>

#### Defined in

[src/index.ts:32](https://github.com/ceajs/cea/blob/d993e68/src/core/src/index.ts#L32)

___

### loadConfFromToml

**loadConfFromToml**(`customPath?`): [`UsersConf`](modules.md#usersconf) \| ``null``

#### Parameters

| Name | Type |
| :------ | :------ |
| `customPath?` | `string` |

#### Returns

[`UsersConf`](modules.md#usersconf) \| ``null``

#### Defined in

[src/conf.ts:17](https://github.com/ceajs/cea/blob/d993e68/src/core/src/conf.ts#L17)
Loading

0 comments on commit 32cf304

Please sign in to comment.