mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-02 09:26:12 +08:00
📝 好像可以用 zenuml 了 )
This commit is contained in:
parent
3773c77864
commit
7622d3da1e
@ -1,6 +1,5 @@
|
||||
import { defineUserConfig } from "vuepress";
|
||||
import theme from "./theme.js";
|
||||
import { mdEnhancePlugin } from "vuepress-plugin-md-enhance";
|
||||
|
||||
export default defineUserConfig({
|
||||
base: "/",
|
||||
@ -8,11 +7,6 @@ export default defineUserConfig({
|
||||
lang: "zh-CN",
|
||||
title: "NoneBot Bison",
|
||||
description: "NoneBot Bison 文档",
|
||||
plugins: [
|
||||
mdEnhancePlugin({
|
||||
mermaid: true,
|
||||
}),
|
||||
],
|
||||
|
||||
theme,
|
||||
|
||||
|
@ -80,6 +80,7 @@ export default hopeTheme({
|
||||
sup: true,
|
||||
tabs: true,
|
||||
vPre: true,
|
||||
mermaid: true,
|
||||
|
||||
// 在启用之前安装 chart.js
|
||||
// chart: true,
|
||||
|
@ -1,9 +1,16 @@
|
||||
---
|
||||
prev: /usage/
|
||||
#next: /dev/cookie
|
||||
---
|
||||
|
||||
# Cookie 开发须知
|
||||
|
||||
本项目将大部分 Cookie 相关逻辑提出到了 Site 及 Client Manger 模块中,你只需要继承相关类即可获得使用 Cookie 的能力。
|
||||
|
||||
:::tip
|
||||
::: tip
|
||||
|
||||
在开发Cookie功能之前,你应该对[基本开发](/dev/#基本开发)有一定的了解。
|
||||
|
||||
:::
|
||||
|
||||
## Cookie相关的基本概念
|
||||
@ -62,28 +69,61 @@ class WeiboSite(CookieSite):
|
||||
|
||||
```mermaid
|
||||
|
||||
zenuml
|
||||
title Cookie调度逻辑
|
||||
Scheduler #661ae6
|
||||
Platform #2b2d30
|
||||
CookieClientManager #FFEBE6
|
||||
DB #f26522
|
||||
Internet #0747A6
|
||||
@Starter(Scheduler)
|
||||
Scheduler.exec_fetch{
|
||||
Post = Platform.do_fetch_new_post(SubUnit) {
|
||||
Platform.get_sub_list(Target){
|
||||
client = CookieClientManager.get_client(Target){
|
||||
cookie = CookieClientManager._choose_cookie(Target) {
|
||||
cookies = DB.get_cookies()
|
||||
}
|
||||
client = CookieClientManager._assemble_client(Target, cookie)
|
||||
}
|
||||
res = Internet.client.get(Target)
|
||||
CookieClientManager._response_hook(){
|
||||
DB.update_cookie()
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
<script type="module">
|
||||
import mermaid from "mermaid";
|
||||
import zenuml from "@mermaid-js/mermaid-zenuml";
|
||||
async function initializeMermaid() {
|
||||
await mermaid.registerExternalDiagrams([zenuml]);
|
||||
}
|
||||
initializeMermaid();
|
||||
</script>
|
||||
|
||||
<pre class="mermaid">zenuml
|
||||
title Cookie调度逻辑
|
||||
Scheduler #661ae6
|
||||
Platform #2b2d30
|
||||
CookieClientManager #FFEBE6
|
||||
DB #f26522
|
||||
Internet #0747A6
|
||||
@Starter(Scheduler)
|
||||
Scheduler.exec_fetch{
|
||||
Post = Platform.do_fetch_new_post(SubUnit) {
|
||||
Platform.get_sub_list(Target){
|
||||
client = CookieClientManager.get_client(Target){
|
||||
cookie = CookieClientManager._choose_cookie(Target) {
|
||||
cookies = DB.get_cookies()
|
||||
}
|
||||
client = CookieClientManager._assemble_client(Target, cookie)
|
||||
}
|
||||
res = Internet.client.get(Target)
|
||||
CookieClientManager._response_hook(){
|
||||
DB.update_cookie()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
init[初始化] --> schedule_pool[调度池]
|
||||
schedule_pool((调度池)) --> choose_platform[选择Platform]
|
||||
choose_platform --> get_targets[获取Target列表]
|
||||
get_targets --> get_rawposts[获取Target的RawPost列表]
|
||||
get_rawposts --> compare_with_old[(与上次状态对比)]
|
||||
compare_with_old -- 有新增 --> dispatch[分发到对应用户]
|
||||
compare_with_old -- 无新增 --> schedule_pool
|
||||
dispatch --> user_filter[用户订阅过滤]
|
||||
user_filter -- 不匹配 --> schedule_pool
|
||||
user_filter -- 匹配 --> parse[选择Post解析方式]
|
||||
parse -.-> to_text((文本Post))
|
||||
parse -.-> to_pic((图片Post))
|
||||
parse -.-> to_other((...))
|
||||
to_text -.-> message_render[消息渲染]
|
||||
to_pic -.-> message_render
|
||||
to_other -.-> message_render
|
||||
message_render --> send_to[发送到对应用户]
|
||||
```
|
||||
|
10
package.json
10
package.json
@ -11,12 +11,14 @@
|
||||
"docs:update-package": "pnpm dlx vp-update"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vuepress/bundler-vite": "2.0.0-rc.15",
|
||||
"@vuepress/bundler-vite": "2.0.0-rc.17",
|
||||
"mermaid": "^11.3.0",
|
||||
"vue": "^3.5.6",
|
||||
"vuepress": "2.0.0-rc.15",
|
||||
"vuepress-theme-hope": "2.0.0-rc.52"
|
||||
"vuepress": "2.0.0-rc.17",
|
||||
"vuepress-plugin-md-enhance": "2.0.0-rc.57",
|
||||
"vuepress-theme-hope": "2.0.0-rc.58"
|
||||
},
|
||||
"dependencies": {
|
||||
"vuepress-plugin-md-enhance": "2.0.0-rc.57"
|
||||
"@mermaid-js/mermaid-zenuml": "0.2.0"
|
||||
}
|
||||
}
|
||||
|
4397
pnpm-lock.yaml
generated
4397
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user