docs: 更新文档插件生成逻辑,增加源码地址与manifest地址

并增加了插件数量显示
pull/56/head
moonrailgun 2 years ago
parent b2056af1be
commit f297a7400f

@ -1,74 +1,116 @@
---
sidebar_position: 1
title: 纯前端插件
title: 纯前端插件 (14)
---
### com.msgbyte.bbcode BBCode 消息解释器
一个用于支持bbcode语法解释富文本消息的插件
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.bbcode)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.bbcode/manifest.json)
### com.msgbyte.draw 绘图插件
允许发送自定义绘图
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.draw)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.draw/manifest.json)
### com.msgbyte.filepizza file.pizza
快捷打开 filepizza 以支持p2p传输文件
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.filepizza)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.filepizza/manifest.json)
### com.msgbyte.filesfm files.fm
快捷打开 files.fm 以支持传输文件
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.filesfm)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.filesfm/manifest.json)
### com.msgbyte.genshin 原神工具箱
为Tailchat增加原神相关的娱乐能力
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.genshin)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.genshin/manifest.json)
### com.msgbyte.integration 第三方集成
用于在群组中集成第三方应用
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.integration)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.integration/manifest.json)
### com.msgbyte.intro 初始引导插件
为应用首次打开介绍应用的能力
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.intro)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.intro/manifest.json)
### com.msgbyte.miaolang 喵语言
允许发送喵语,安装插件后的双方加密对话,未安装插件的人看到的是 '喵'
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.miaolang)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.miaolang/manifest.json)
### com.msgbyte.notify 消息通知插件
为应用增加通知的能力
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.notify)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.notify/manifest.json)
### com.msgbyte.openapi 开放平台插件
为应用提供开放平台的操作能力
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.openapi)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.openapi/manifest.json)
### com.msgbyte.posthog Posthog
Posthog 数据统计
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.posthog)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.posthog/manifest.json)
### com.msgbyte.sentry Sentry
Sentry 错误处理
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.sentry)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.sentry/manifest.json)
### com.msgbyte.snapdrop 隔空投送
隔空投送 —— 在同一网络发送文件与消息
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.snapdrop)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.snapdrop/manifest.json)
### com.msgbyte.webview 网页面板插件
为群组提供创建网页面板的功能
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.webview)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.webview/manifest.json)

@ -1,34 +1,52 @@
---
sidebar_position: 3
title: 前后端插件
title: 前后端插件 (6)
---
### com.msgbyte.github Github 订阅
订阅Github项目动态到群组
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.github/web/plugins/com.msgbyte.github)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.github/web/plugins/com.msgbyte.github/manifest.json)
### com.msgbyte.linkmeta Url元数据展示
解析并获取在聊天信息中的url信息概述如标题/概述/缩略图, 支持媒体路径,直接显示媒体播放器(特殊支持bilibili自动加载b站iframe播放器)
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.linkmeta/web/plugins/com.msgbyte.linkmeta)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.linkmeta/web/plugins/com.msgbyte.linkmeta/manifest.json)
### com.msgbyte.meeting 音视频服务
为Tailchat提供音视频通讯的服务
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.meeting/web/plugins/com.msgbyte.meeting)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.meeting/web/plugins/com.msgbyte.meeting/manifest.json)
### com.msgbyte.simplenotify 简易机器人
一个简单的通用通知机器人, 用于直接向群组发送消息
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.simplenotify/web/plugins/com.msgbyte.simplenotify)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.simplenotify/web/plugins/com.msgbyte.simplenotify/manifest.json)
### com.msgbyte.tasks 任务管理
任务管理插件在个人面板中增加TODO面板用于个人待办事项的管理
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.tasks/web/plugins/com.msgbyte.tasks)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.tasks/web/plugins/com.msgbyte.tasks/manifest.json)
### com.msgbyte.topic 群组话题
为群组提供话题功能
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.topic/web/plugins/com.msgbyte.topic)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/server/plugins/com.msgbyte.topic/web/plugins/com.msgbyte.topic/manifest.json)

@ -1,14 +1,20 @@
---
sidebar_position: 2
title: 自定义主题
title: 自定义主题 (2)
---
### com.msgbyte.theme.genshin 原神主题
原神主题
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.theme.genshin)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.theme.genshin/manifest.json)
### com.msgbyte.theme.miku Miku初音未来主题
初音未来主题,支持亮色与暗色
- [插件源码](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.theme.miku)
- [manifest.json](https://github.com/msgbyte/tailchat/blob/master/client/web/plugins/com.msgbyte.theme.miku/manifest.json)

@ -1,5 +1,6 @@
import glob from 'glob';
import path from 'path';
import url from 'url';
import fs from 'fs-extra';
interface PluginMeta {
@ -13,6 +14,7 @@ interface PluginMeta {
requireRestart: boolean;
}
const githubRepoUrl = 'https://github.com/msgbyte/tailchat';
const rootDir = path.resolve(__dirname, '../../');
const feMD = path.resolve(__dirname, '../docs/plugin-list/fe.md');
const themeMD = path.resolve(__dirname, '../docs/plugin-list/theme.md');
@ -25,35 +27,47 @@ const beplugins = glob.sync(
path.join(rootDir, './server/plugins/*/web/plugins/*/manifest.json')
);
Promise.all(feplugins.map((path) => fs.readJson(path))).then(async (list) => {
Promise.all(
feplugins.map(async (path) => ({
path,
manifest: (await fs.readJson(path)) as PluginMeta,
}))
).then(async (list) => {
const list1 = list.filter((item) => !item.manifest.name.includes('.theme.'));
const list2 = list.filter((item) => item.manifest.name.includes('.theme.'));
await writeMarkdown(
feMD,
list.filter((item) => !item.name.includes('.theme.')),
list1,
`---
sidebar_position: 1
title:
title: (${list1.length})
---`
);
await writeMarkdown(
themeMD,
list.filter((item) => item.name.includes('.theme.')),
list2,
`---
sidebar_position: 2
title:
title: (${list2.length})
---`
);
console.log('纯前端插件文档自动生成完毕');
});
Promise.all(beplugins.map((path) => fs.readJson(path))).then(async (list) => {
Promise.all(
beplugins.map(async (path) => ({
path,
manifest: (await fs.readJson(path)) as PluginMeta,
}))
).then(async (list) => {
await writeMarkdown(
beMD,
list,
`---
sidebar_position: 3
title:
title: (${list.length})
---`
);
@ -63,7 +77,11 @@ title: 前后端插件
/**
* markdown
*/
async function writeMarkdown(path: string, list: PluginMeta[], header: string) {
async function writeMarkdown(
path: string,
list: { path: string; manifest: PluginMeta }[],
header: string
) {
const text = `${header}
${list.map(renderPluginDetail).join('\n\n')}
@ -72,9 +90,17 @@ ${list.map(renderPluginDetail).join('\n\n')}
await fs.writeFile(path, text);
}
function renderPluginDetail(meta: PluginMeta) {
return `### ${meta.name} ${meta.label}
function renderPluginDetail(info: { path: string; manifest: PluginMeta }) {
const sourceCodeUrl = url.resolve(
`${githubRepoUrl}/blob/master/`,
path.dirname(path.relative(rootDir, info.path))
);
return `### ${info.manifest.name} ${info.manifest.label}
${info.manifest.description}
${meta.description}
- [](${sourceCodeUrl})
- [manifest.json](${sourceCodeUrl}/manifest.json)
`;
}

Loading…
Cancel
Save