From 5bb619fe7b57e2494393f420aad30ebe7203d0ed Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 10 Aug 2021 19:19:02 +0900 Subject: [PATCH] Improve doc --- CHANGELOG.md | 9 ++++++++- src/docs/ja-JP/general/changelog.md | 5 +++++ src/server/web/index.ts | 18 +++++++++++++----- 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 src/docs/ja-JP/general/changelog.md diff --git a/CHANGELOG.md b/CHANGELOG.md index b60eb59313..753c37e134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,8 @@ -see [releases](https://github.com/misskey-dev/misskey/releases) +## 12.86.0 (unreleased) + +### Improvements +- ドキュメントにchangelogを追加 +- Vueを3.2.1に更新 + +### Bugfixes +- ハッシュタグ入力が空のときに#が付くのを修正 diff --git a/src/docs/ja-JP/general/changelog.md b/src/docs/ja-JP/general/changelog.md new file mode 100644 index 0000000000..6766a63b20 --- /dev/null +++ b/src/docs/ja-JP/general/changelog.md @@ -0,0 +1,5 @@ +# 更新履歴 +
ℹ️ このサーバーの更新履歴です。Misskeyの最新のリリースについては、GitHubをご確認ください。
+ + + diff --git a/src/server/web/index.ts b/src/server/web/index.ts index 30a53a703b..44ab2a997f 100644 --- a/src/server/web/index.ts +++ b/src/server/web/index.ts @@ -28,6 +28,13 @@ const markdown = MarkdownIt({ html: true }); +const changelog = fs.readFileSync(`${__dirname}/../../../CHANGELOG.md`, { encoding: 'utf8' }); +function genDoc(path: string): string { + let md = fs.readFileSync(path, { encoding: 'utf8' }); + md = md.replace('', changelog); + return md; +} + const staticAssets = `${__dirname}/../../../assets/`; const docAssets = `${__dirname}/../../../src/docs/`; const assets = `${__dirname}/../../assets/`; @@ -67,10 +74,11 @@ router.get('/static-assets/(.*)', async ctx => { }); router.get('/doc-assets/(.*)', async ctx => { - await send(ctx as any, ctx.path.replace('/doc-assets/', ''), { - root: docAssets, - maxage: ms('7 days'), - }); + if (ctx.path.includes('..')) return; + const path = `${__dirname}/../../../src/docs/${ctx.path.replace('/doc-assets/', '')}`; + const doc = genDoc(path); + ctx.set('Content-Type', 'text/plain; charset=utf-8'); + ctx.body = doc; }); router.get('/assets/(.*)', async ctx => { @@ -130,7 +138,7 @@ router.get('/docs.json', async ctx => { const paths = glob.sync(`${dirPath}/**/*.md`); const docs: { path: string; title: string; summary: string; }[] = []; for (const path of paths) { - const md = fs.readFileSync(path, { encoding: 'utf8' }); + const md = genDoc(path); if (query && query.length > 0) { // TODO: カタカナをひらがなにして比較するなどしたい