summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-08-11 22:36:59 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-08-11 22:36:59 +0900
commit42c4ea38ccf09ba37ff552e37778ba1b702b781c (patch)
tree39bffcf6c87fe7f0b31778b71993be2a72c0881d /src/server
parentMerge branch 'develop' (diff)
parent12.86.0 (diff)
downloadmisskey-42c4ea38ccf09ba37ff552e37778ba1b702b781c.tar.gz
misskey-42c4ea38ccf09ba37ff552e37778ba1b702b781c.tar.bz2
misskey-42c4ea38ccf09ba37ff552e37778ba1b702b781c.zip
Merge branch 'develop'
Diffstat (limited to 'src/server')
-rw-r--r--src/server/web/index.ts18
-rw-r--r--src/server/web/views/base.pug15
2 files changed, 23 insertions, 10 deletions
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]-->', 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: カタカナをひらがなにして比較するなどしたい
diff --git a/src/server/web/views/base.pug b/src/server/web/views/base.pug
index 8992f96db9..42c068c403 100644
--- a/src/server/web/views/base.pug
+++ b/src/server/web/views/base.pug
@@ -2,11 +2,16 @@ block vars
doctype html
-!= '\n'
-!= '<!-- Thank you for using Misskey! -->\n'
-!= '<!-- If you are reading this message... how about joining the development of Misskey? -->\n'
-!= '<!-- https://github.com/misskey-dev/misskey -->'
-!= '\n'
+!= '<!--\n'
+!= ' _____ _ _ \n'
+!= ' | |_|___ ___| |_ ___ _ _ \n'
+!= ' | | | | |_ -|_ -| \'_| -_| | |\n'
+!= ' |_|_|_|_|___|___|_,_|___|_ |\n'
+!= ' |___|\n'
+!= ' Thank you for using Misskey!\n'
+!= ' If you are reading this message... how about joining the development?\n'
+!= ' https://github.com/misskey-dev/misskey'
+!= '\n-->\n'
html