mirror of
https://github.com/byulmaru/quesdon
synced 2024-11-27 06:18:02 +09:00
haed에 rel="me"와 프로필 주소가 포함된 link 태그 추가
This commit is contained in:
parent
c89e4ce158
commit
d73a2db8ed
@ -26,7 +26,8 @@ router.use('/api', apiRouter.routes());
|
||||
|
||||
router.get('/*', async (ctx: Koa.ParameterizedContext) =>
|
||||
{
|
||||
let user;
|
||||
let user, mastodonUrl;
|
||||
const path = ctx.request.path.toString();
|
||||
if (ctx.session.user)
|
||||
{
|
||||
user = await User.findById(ctx.session.user);
|
||||
@ -34,11 +35,19 @@ router.get('/*', async (ctx: Koa.ParameterizedContext) =>
|
||||
user = new Buffer(user, 'binary').toString('base64');
|
||||
}
|
||||
if (!ctx.session.csrfToken)
|
||||
{
|
||||
ctx.session.csrfToken = rndstr();
|
||||
}
|
||||
if (path.match(/@/g)?.length as number === 2)
|
||||
{
|
||||
const profile = await User.findOne({acctLower: path.substring(2).toLowerCase()});
|
||||
mastodonUrl = profile?.url;
|
||||
}
|
||||
return ctx.render('index',
|
||||
{
|
||||
GIT_COMMIT,
|
||||
user,
|
||||
mastodonUrl,
|
||||
csrfToken: ctx.session.csrfToken
|
||||
});
|
||||
});
|
||||
|
@ -8,6 +8,8 @@ html
|
||||
script window.USER=undefined
|
||||
script window.CSRF_TOKEN="#{csrfToken}"
|
||||
script window.GIT_VERSION="#{GIT_COMMIT}"
|
||||
if mastodonUrl
|
||||
link(rel="me",href=mastodonUrl)
|
||||
script(src="https://cdn.polyfill.io/v2/polyfill.js?features=fetch")
|
||||
script(src="/assets/bundle.js?version="+GIT_COMMIT)
|
||||
body
|
||||
|
Loading…
Reference in New Issue
Block a user