OGP向けにインスタンスのバナー画像を提供するように
This commit is contained in:
@ -32,7 +32,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import { themeColor } from '../../../config';
|
||||
import * as tinycolor from 'tinycolor2';
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
@ -75,7 +75,7 @@ export default Vue.extend({
|
||||
return this.dark ? '#fff' : '#777';
|
||||
},
|
||||
hHandColor(): string {
|
||||
return themeColor;
|
||||
return tinycolor(getComputedStyle(document.documentElement).getPropertyValue('--text')).toHexString();
|
||||
},
|
||||
|
||||
ms(): number {
|
||||
|
@ -16,7 +16,6 @@ export const wsUrl = url.replace('http://', 'ws://').replace('https://', 'wss://
|
||||
export const lang = window.lang;
|
||||
export const langs = _LANGS_;
|
||||
export const locale = JSON.parse(localStorage.getItem('locale'));
|
||||
export const themeColor = _THEME_COLOR_;
|
||||
export const copyright = _COPYRIGHT_;
|
||||
export const version = _VERSION_;
|
||||
export const clientVersion = _CLIENT_VERSION_;
|
||||
|
@ -1,5 +1,3 @@
|
||||
{
|
||||
"copyright": "Copyright (c) 2014-2018 syuilo",
|
||||
"themeColor": "#fb4e4e",
|
||||
"themeColorForeground": "#fff"
|
||||
"copyright": "Copyright (c) 2014-2018 syuilo"
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import parseAcct from '../../misc/acct/parse';
|
||||
import config from '../../config';
|
||||
import Note, { pack as packNote } from '../../models/note';
|
||||
import getNoteSummary from '../../misc/get-note-summary';
|
||||
const consts = require('../../const.json');
|
||||
import fetchMeta from '../../misc/fetch-meta';
|
||||
|
||||
const client = `${__dirname}/../../client/`;
|
||||
|
||||
@ -26,8 +26,7 @@ const app = new Koa();
|
||||
app.use(views(__dirname + '/views', {
|
||||
extension: 'pug',
|
||||
options: {
|
||||
config,
|
||||
themeColor: consts.themeColor
|
||||
config
|
||||
}
|
||||
}));
|
||||
|
||||
@ -120,10 +119,11 @@ router.get('/notes/:note', async ctx => {
|
||||
|
||||
// Render base html for all requests
|
||||
router.get('*', async ctx => {
|
||||
await send(ctx, `app/base.html`, {
|
||||
root: client,
|
||||
maxage: ms('5m')
|
||||
const meta = await fetchMeta();
|
||||
await ctx.render('base', {
|
||||
img: meta.bannerUrl
|
||||
});
|
||||
ctx.set('Cache-Control', 'public, max-age=86400');
|
||||
});
|
||||
|
||||
// Register router
|
||||
|
@ -9,7 +9,6 @@ html
|
||||
head
|
||||
meta(charset='utf-8')
|
||||
meta(name='application-name' content='Misskey')
|
||||
meta(name='theme-color' content=themeColor)
|
||||
meta(name='referrer' content='origin')
|
||||
meta(property='og:site_name' content='Misskey')
|
||||
link(rel='manifest' href='/manifest.json')
|
||||
@ -23,16 +22,16 @@ html
|
||||
|
||||
block meta
|
||||
|
||||
block og
|
||||
meta(property='og:image' content=img)
|
||||
|
||||
style
|
||||
include ./../../../built/client/assets/init.css
|
||||
include ./../../../../built/client/assets/init.css
|
||||
script
|
||||
include ./../../../built/client/assets/boot.js
|
||||
include ./../../../../built/client/assets/boot.js
|
||||
|
||||
script
|
||||
include ./../../../built/client/assets/safe.js
|
||||
|
||||
//- FontAwesome style
|
||||
style #{facss}
|
||||
include ./../../../../built/client/assets/safe.js
|
||||
|
||||
body
|
||||
noscript: p
|
||||
@ -41,5 +40,5 @@ html
|
||||
| Please turn on your JavaScript
|
||||
div#ini.
|
||||
<svg viewBox="0 0 50 50">
|
||||
<path fill=#{themeColor} d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" />
|
||||
<path fill=#fb4e4e d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" />
|
||||
</svg>
|
@ -1,4 +1,4 @@
|
||||
extends ../../../../src/client/app/base
|
||||
extends ./base
|
||||
|
||||
block vars
|
||||
- const user = note.user;
|
||||
@ -11,14 +11,16 @@ block title
|
||||
block desc
|
||||
meta(name='description' content= summary)
|
||||
|
||||
block meta
|
||||
meta(name='twitter:card' content='summary')
|
||||
block og
|
||||
meta(property='og:type' content='article')
|
||||
meta(property='og:title' content= title)
|
||||
meta(property='og:description' content= summary)
|
||||
meta(property='og:url' content= url)
|
||||
meta(property='og:image' content= user.avatarUrl)
|
||||
|
||||
block meta
|
||||
meta(name='twitter:card' content='summary')
|
||||
|
||||
if note.prev
|
||||
link(rel='prev' href=`${config.url}/notes/${note.prev}`)
|
||||
if note.next
|
||||
|
@ -1,4 +1,4 @@
|
||||
extends ../../../../src/client/app/base
|
||||
extends ./base
|
||||
|
||||
block vars
|
||||
- const title = user.name ? `${user.name} (@${user.username})` : `@${user.username}`;
|
||||
@ -11,14 +11,16 @@ block title
|
||||
block desc
|
||||
meta(name='description' content= user.description)
|
||||
|
||||
block meta
|
||||
meta(name='twitter:card' content='summary')
|
||||
block og
|
||||
meta(property='og:type' content='blog')
|
||||
meta(property='og:title' content= title)
|
||||
meta(property='og:description' content= user.description)
|
||||
meta(property='og:url' content= url)
|
||||
meta(property='og:image' content= img)
|
||||
|
||||
|
||||
block meta
|
||||
meta(name='twitter:card' content='summary')
|
||||
|
||||
if !user.host
|
||||
link(rel='alternate' href=`${config.url}/users/${user._id}` type='application/activity+json')
|
||||
if user.uri
|
||||
|
Reference in New Issue
Block a user