feat: インスタンスプロフィールレンダリング

Resolve #7788
This commit is contained in:
syuilo 2021-11-07 21:01:06 +09:00
parent 68192126e6
commit 24ef4d3da2
4 changed files with 54 additions and 165 deletions

View File

@ -11,6 +11,7 @@
### Improvements ### Improvements
- フォロー/フォロワーを非公開にできるように - フォロー/フォロワーを非公開にできるように
- インスタンスプロフィールレンダリング ready
- メールアドレスのバリデーションを強化 - メールアドレスのバリデーションを強化
### Bugfixes ### Bugfixes

View File

@ -358,28 +358,13 @@ router.get('/channels/:channel', async (ctx, next) => {
}); });
//#endregion //#endregion
router.get('/info', async ctx => { router.get('/_info_card_', async ctx => {
const meta = await fetchMeta(true); const meta = await fetchMeta(true);
const emojis = await Emojis.find({
where: { host: null }
});
const proxyAccount = meta.proxyAccountId ? await Users.pack(meta.proxyAccountId).catch(() => null) : null; await ctx.render('info-card', {
await ctx.render('info', {
version: config.version, version: config.version,
machine: os.hostname(), host: config.host,
os: os.platform(),
node: process.version,
psql: await getConnection().query('SHOW server_version').then(x => x[0].server_version),
redis: redisClient.server_info.redis_version,
cpu: {
model: os.cpus()[0].model,
cores: os.cpus().length
},
emojis: emojis,
meta: meta, meta: meta,
proxyAccountName: proxyAccount ? proxyAccount.username : null,
originalUsersCount: await Users.count({ host: null }), originalUsersCount: await Users.count({ host: null }),
originalNotesCount: await Notes.count({ userHost: null }) originalNotesCount: await Notes.count({ userHost: null })
}); });

View File

@ -0,0 +1,50 @@
doctype html
html
head
meta(charset='utf-8')
meta(name='application-name' content='Misskey')
title= meta.name || host
style.
html, body {
margin: 0;
padding: 0;
min-height: 100vh;
background: #fff;
}
#a {
display: block;
}
#banner {
background-size: cover;
background-position: center center;
}
#title {
display: inline-block;
margin: 24px;
padding: 0.5em 0.8em;
color: #fff;
background: rgba(0, 0, 0, 0.5);
font-weight: bold;
font-size: 1.3em;
}
#content {
overflow: auto;
color: #353c3e;
}
#description {
margin: 24px;
}
body
a#a(href=`https://${host}` target="_blank")
header#banner(style=`background-image: url(${meta.bannerUrl})`)
div#title= meta.name || host
div#content
div#description= meta.description

View File

@ -1,147 +0,0 @@
doctype html
html
head
meta(charset='utf-8')
meta(name='application-name' content='Misskey')
title Misskey
style.
html {
font-family: Roboto, HelveticaNeue, Arial, sans-serif;
}
main {
max-width: 934px;
margin: 0 auto;
}
header {
padding: 5px;
background: rgb(153, 153, 204);
border: 1px solid #000;
box-shadow: rgb(204, 204, 204) 1px 2px 3px;
}
header:after {
content: '';
display: block;
clear: both;
}
header > h1 {
float: left;
font-size: 2em;
}
header > img {
float: right;
width: 220px;
}
table {
margin: 1em 0;
width: 100%;
border-collapse: collapse;
box-shadow: rgb(204, 204, 204) 1px 2px 3px;
}
table tr th {
background-color: #ccf;
border: 1px solid #000;
width: 300px;
font-weight: bold;
padding: 4px 5px;
text-align: left;
}
table tr td {
background-color: #ddd;
border: 1px solid #000;
padding: 4px 5px;
}
footer {
text-align: center;
}
body
main
header
h1 Misskey Version #{version}
img(src='/static-assets/misskey-php-like-logo.png' alt='')
table
tr
th Instance
td= meta.name || 'Misskey'
tr
th Description
td= meta.description
tr
th Maintainer
td
= meta.maintainerName
| <#{meta.maintainerEmail}>
tr
th Proxy account name
td= proxyAccountName || '(none)'
tr
th System
td= os
tr
th Node version
td= node
tr
th PSQL version
td= psql
tr
th Redis version
td= redis
tr
th Machine
td= machine
tr
th CPU
td= cpu.model
tr
th Original users
td= originalUsersCount
tr
th Original notes
td= originalNotesCount
tr
th Registration
td= !meta.disableRegistration ? 'yes' : 'no'
tr
th hCaptcha enabled
td= meta.enableHcaptcha ? 'enabled' : 'disabled'
tr
th reCAPTCHA enabled
td= meta.enableRecaptcha ? 'enabled' : 'disabled'
tr
th LTL(STL) enabled
td= !meta.disableLocalTimeline ? 'enabled' : 'disabled'
tr
th GTL enabled
td= !meta.disableGlobalTimeline ? 'enabled' : 'disabled'
tr
th Cache remote files
td= meta.cacheRemoteFiles ? 'yes' : 'no'
tr
th Drive capacity per local user
td
= meta.localDriveCapacityMb
| MB
tr
th Drive capacity per remote user
td
= meta.remoteDriveCapacityMb
| MB
tr
th Max text length
td= meta.maxNoteTextLength
tr
th Emojis
td
each emoji in emojis
| :#{emoji.name}:
= ' '
footer
p Misskey is open-source software. <a href="https://github.com/misskey-dev/misskey">View source</a>