From 24ef4d3da2ffbb914931f5e173d6b3ebe21b0311 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 7 Nov 2021 21:01:06 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=82=A4=E3=83=B3=E3=82=B9=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=82=B9=E3=83=97=E3=83=AD=E3=83=95=E3=82=A3=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E3=83=AC=E3=83=B3=E3=83=80=E3=83=AA=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolve #7788 --- CHANGELOG.md | 1 + src/server/web/index.ts | 21 +---- src/server/web/views/info-card.pug | 50 ++++++++++ src/server/web/views/info.pug | 147 ----------------------------- 4 files changed, 54 insertions(+), 165 deletions(-) create mode 100644 src/server/web/views/info-card.pug delete mode 100644 src/server/web/views/info.pug diff --git a/CHANGELOG.md b/CHANGELOG.md index 67977fa1b..f1ec268b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Improvements - フォロー/フォロワーを非公開にできるように +- インスタンスプロフィールレンダリング ready - メールアドレスのバリデーションを強化 ### Bugfixes diff --git a/src/server/web/index.ts b/src/server/web/index.ts index 2af6ecb0b..7f7397adf 100644 --- a/src/server/web/index.ts +++ b/src/server/web/index.ts @@ -358,28 +358,13 @@ router.get('/channels/:channel', async (ctx, next) => { }); //#endregion -router.get('/info', async ctx => { +router.get('/_info_card_', async ctx => { 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', { + await ctx.render('info-card', { version: config.version, - machine: os.hostname(), - 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, + host: config.host, meta: meta, - proxyAccountName: proxyAccount ? proxyAccount.username : null, originalUsersCount: await Users.count({ host: null }), originalNotesCount: await Notes.count({ userHost: null }) }); diff --git a/src/server/web/views/info-card.pug b/src/server/web/views/info-card.pug new file mode 100644 index 000000000..1d62778ce --- /dev/null +++ b/src/server/web/views/info-card.pug @@ -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 diff --git a/src/server/web/views/info.pug b/src/server/web/views/info.pug deleted file mode 100644 index 61f9b7b9e..000000000 --- a/src/server/web/views/info.pug +++ /dev/null @@ -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. View source