1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 07:35:35 +02:00
Files
misskey/packages/backend/src/server/web/views/user.tsx
かっこかり f222d7e24d enhance(backend): pugをやめ、JSXベースのテンプレートに変更 (#16908)
* enhance(backend): pugをやめ、JSXベースのテンプレートに変更 (to misskey-dev dev branch) (#16889)

* wip

* wip

* wip

* wip

* fix lint

* attempt to fix test

* fix

* fix

* fix: oauthページの描画がおかしい問題を修正

* typo [ci skip]

* fix

* fix

* fix

* fix

* fix

* refactor

* fix

* fix

* fix broken lockfile

* fix: expose supported languages as global variable

* remove i18n package from root as it is no longer required [ci skip]

* fix

* fix: add i18n package.json to Docker target-builder stage for federation tests (#16909)

* Initial plan

* fix: add i18n package.json to Docker target-builder stage for federation tests

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>

* fix: followup-test-federation for enh-remove-pug (#16910)

* fix: followup-test-federation for enh-remove-pug

* Revert "fix: add i18n package.json to Docker target-builder stage for federation tests (#16909)"

This reverts commit 14313468d3.

* fix: CSSが読み込まれない場合がある問題を修正

* fix [ci skip]

* fix: propsのデフォルト値をnull合体演算子から論理和演算子に変更(空文字に対処するため)

* remove @types/pug

* enhance: bootloaderを埋め込むように

* fix possible race condition

* remove esbuild

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Co-authored-by: おさむのひと <46447427+samunohito@users.noreply.github.com>
2025-12-01 18:36:55 +09:00

75 lines
2.5 KiB
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { Packed } from '@/misc/json-schema.js';
import type { MiUserProfile } from '@/models/UserProfile.js';
import type { CommonProps } from '@/server/web/views/_.js';
import { Layout } from '@/server/web/views/base.js';
export function UserPage(props: CommonProps<{
user: Packed<'UserDetailed'>;
profile: MiUserProfile;
sub?: string;
}>) {
const title = props.user.name ? `${props.user.name} (@${props.user.username}${props.user.host ? `@${props.user.host}` : ''})` : `@${props.user.username}${props.user.host ? `@${props.user.host}` : ''}`;
const me = props.profile.fields
? props.profile.fields
.filter(field => field.value != null && field.value.match(/^https?:/))
.map(field => field.value)
: [];
function ogBlock() {
return (
<>
<meta property="og:type" content="blog" />
<meta property="og:title" content={title} />
{props.user.description != null ? <meta property="og:description" content={props.user.description} /> : null}
<meta property="og:url" content={`${props.config.url}/@${props.user.username}`} />
<meta property="og:image" content={props.user.avatarUrl} />
<meta property="twitter:card" content="summary" />
</>
);
}
function metaBlock() {
return (
<>
{props.user.host != null || props.profile.noCrawle ? <meta name="robots" content="noindex" /> : null}
{props.profile.preventAiLearning ? (
<>
<meta name="robots" content="noimageai" />
<meta name="robots" content="noai" />
</>
) : null}
<meta name="misskey:user-username" content={props.user.username} />
<meta name="misskey:user-id" content={props.user.id} />
{props.sub == null && props.federationEnabled ? (
<>
{props.user.host == null ? <link rel="alternate" type="application/activity+json" href={`${props.config.url}/users/${props.user.id}`} /> : null}
{props.user.uri != null ? <link rel="alternate" type="application/activity+json" href={props.user.uri} /> : null}
{props.profile.url != null ? <link rel="alternate" type="text/html" href={props.profile.url} /> : null}
</>
) : null}
{me.map((url) => (
<link rel="me" href={url} />
))}
</>
);
}
return (
<Layout
{...props}
title={`${props.user.name || props.user.username} (@${props.user.username}) | ${props.instanceName}`}
desc={props.user.description ?? ''}
metaSlot={metaBlock()}
ogSlot={ogBlock()}
>
</Layout>
);
}