diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-11-15 17:40:49 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-11-15 17:40:49 +0900 |
| commit | ccd14e04623191db916bd5ba82b699fceddfc41f (patch) | |
| tree | 849d6896d680fe712dacab998e805dfe9f990487 /src/server/web/index.ts | |
| parent | 12.57.3 (diff) | |
| download | misskey-ccd14e04623191db916bd5ba82b699fceddfc41f.tar.gz misskey-ccd14e04623191db916bd5ba82b699fceddfc41f.tar.bz2 misskey-ccd14e04623191db916bd5ba82b699fceddfc41f.zip | |
クリップのOGP対応
Diffstat (limited to 'src/server/web/index.ts')
| -rw-r--r-- | src/server/web/index.ts | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/server/web/index.ts b/src/server/web/index.ts index 58e764ee17..f889374139 100644 --- a/src/server/web/index.ts +++ b/src/server/web/index.ts @@ -17,7 +17,7 @@ import packFeed from './feed'; import { fetchMeta } from '../../misc/fetch-meta'; import { genOpenapiSpec } from '../api/openapi/gen-spec'; import config from '../../config'; -import { Users, Notes, Emojis, UserProfiles, Pages, Channels } from '../../models'; +import { Users, Notes, Emojis, UserProfiles, Pages, Channels, Clips } from '../../models'; import parseAcct from '../../misc/acct/parse'; import getNoteSummary from '../../misc/get-note-summary'; import { ensure } from '../../prelude/ensure'; @@ -298,6 +298,28 @@ router.get('/@:user/pages/:page', async ctx => { ctx.status = 404; }); +// Clip +router.get('/clips/:clip', async ctx => { + const clip = await Clips.findOne({ + id: ctx.params.clip, + }); + + if (clip) { + const _clip = await Clips.pack(clip); + const meta = await fetchMeta(); + await ctx.render('clip', { + clip: _clip, + instanceName: meta.name || 'Misskey' + }); + + ctx.set('Cache-Control', 'public, max-age=180'); + + return; + } + + ctx.status = 404; +}); + // Channel router.get('/channels/:channel', async ctx => { const channel = await Channels.findOne({ |