Improve doc

This commit is contained in:
syuilo 2021-08-10 19:19:02 +09:00
parent fff3c552e2
commit 5bb619fe7b
3 changed files with 26 additions and 6 deletions

View file

@ -1 +1,8 @@
see [releases](https://github.com/misskey-dev/misskey/releases) ## 12.86.0 (unreleased)
### Improvements
- ドキュメントにchangelogを追加
- Vueを3.2.1に更新
### Bugfixes
- ハッシュタグ入力が空のときに#が付くのを修正

View file

@ -0,0 +1,5 @@
# 更新履歴
<div class="info"> このサーバーの更新履歴です。Misskeyの最新のリリースについては、<a href="https://github.com/misskey-dev/misskey/blob/master/CHANGELOG.md" target="_blank">GitHub</a>をご確認ください。</div>
<!-- For translators: Do not edit these comments. -->
<!--[CHANGELOG]-->

View file

@ -28,6 +28,13 @@ const markdown = MarkdownIt({
html: true 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]-->', changelog);
return md;
}
const staticAssets = `${__dirname}/../../../assets/`; const staticAssets = `${__dirname}/../../../assets/`;
const docAssets = `${__dirname}/../../../src/docs/`; const docAssets = `${__dirname}/../../../src/docs/`;
const assets = `${__dirname}/../../assets/`; const assets = `${__dirname}/../../assets/`;
@ -67,10 +74,11 @@ router.get('/static-assets/(.*)', async ctx => {
}); });
router.get('/doc-assets/(.*)', async ctx => { router.get('/doc-assets/(.*)', async ctx => {
await send(ctx as any, ctx.path.replace('/doc-assets/', ''), { if (ctx.path.includes('..')) return;
root: docAssets, const path = `${__dirname}/../../../src/docs/${ctx.path.replace('/doc-assets/', '')}`;
maxage: ms('7 days'), const doc = genDoc(path);
}); ctx.set('Content-Type', 'text/plain; charset=utf-8');
ctx.body = doc;
}); });
router.get('/assets/(.*)', async ctx => { router.get('/assets/(.*)', async ctx => {
@ -130,7 +138,7 @@ router.get('/docs.json', async ctx => {
const paths = glob.sync(`${dirPath}/**/*.md`); const paths = glob.sync(`${dirPath}/**/*.md`);
const docs: { path: string; title: string; summary: string; }[] = []; const docs: { path: string; title: string; summary: string; }[] = [];
for (const path of paths) { for (const path of paths) {
const md = fs.readFileSync(path, { encoding: 'utf8' }); const md = genDoc(path);
if (query && query.length > 0) { if (query && query.length > 0) {
// TODO: カタカナをひらがなにして比較するなどしたい // TODO: カタカナをひらがなにして比較するなどしたい