From f297a7400fff473e83d0d165290304eac332d4ce Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Wed, 30 Nov 2022 01:14:42 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=BA=90=E7=A0=81=E5=9C=B0=E5=9D=80=E4=B8=8E?= =?UTF-8?q?manifest=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 并增加了插件数量显示 --- website/docs/plugin-list/fe.md | 44 ++++++++++++++++++++++- website/docs/plugin-list/full.md | 20 ++++++++++- website/docs/plugin-list/theme.md | 8 ++++- website/scripts/generate-plugin-list.ts | 48 +++++++++++++++++++------ 4 files changed, 106 insertions(+), 14 deletions(-) diff --git a/website/docs/plugin-list/fe.md b/website/docs/plugin-list/fe.md index 77c31307..f34b6871 100644 --- a/website/docs/plugin-list/fe.md +++ b/website/docs/plugin-list/fe.md @@ -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) + diff --git a/website/docs/plugin-list/full.md b/website/docs/plugin-list/full.md index 38a0401d..7585b48c 100644 --- a/website/docs/plugin-list/full.md +++ b/website/docs/plugin-list/full.md @@ -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) + diff --git a/website/docs/plugin-list/theme.md b/website/docs/plugin-list/theme.md index 11cc10ad..984c4002 100644 --- a/website/docs/plugin-list/theme.md +++ b/website/docs/plugin-list/theme.md @@ -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) + diff --git a/website/scripts/generate-plugin-list.ts b/website/scripts/generate-plugin-list.ts index 9d332b64..82ef4199 100644 --- a/website/scripts/generate-plugin-list.ts +++ b/website/scripts/generate-plugin-list.ts @@ -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) `; }