mirror of
https://github.com/paricafe/misskey.git
synced 2025-01-22 05:08:40 -06:00
fix(frontend): Instanceの値が部分的に欠損していると、ローカルサーバーの情報にフォールバックする問題を修正 (#15319)
This commit is contained in:
parent
68175bc38d
commit
e8b633efec
3 changed files with 18 additions and 5 deletions
|
@ -17,6 +17,7 @@ import { instance as localInstance } from '@/instance.js';
|
||||||
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
host: string | null;
|
||||||
instance?: {
|
instance?: {
|
||||||
faviconUrl?: string | null
|
faviconUrl?: string | null
|
||||||
name?: string | null
|
name?: string | null
|
||||||
|
@ -25,12 +26,24 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// if no instance data is given, this is for the local instance
|
// if no instance data is given, this is for the local instance
|
||||||
const instanceName = computed(() => props.instance?.name ?? localInstanceName);
|
const instanceName = computed(() => props.host == null ? localInstanceName : props.instance?.name ?? props.host);
|
||||||
|
|
||||||
const faviconUrl = computed(() => getProxiedImageUrlNullable(props.instance?.faviconUrl ?? localInstance.iconUrl, 'preview') ?? '/favicon.ico');
|
const faviconUrl = computed(() => {
|
||||||
|
let imageSrc: string | null = null;
|
||||||
|
if (props.host == null) {
|
||||||
|
if (localInstance.iconUrl == null) {
|
||||||
|
return '/favicon.ico';
|
||||||
|
} else {
|
||||||
|
imageSrc = localInstance.iconUrl;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
imageSrc = props.instance?.faviconUrl ?? null;
|
||||||
|
}
|
||||||
|
return getProxiedImageUrlNullable(imageSrc);
|
||||||
|
});
|
||||||
|
|
||||||
const themeColorStyle = computed<CSSProperties>(() => {
|
const themeColorStyle = computed<CSSProperties>(() => {
|
||||||
const themeColor = props.instance?.themeColor ?? localInstance.themeColor ?? '#777777';
|
const themeColor = (props.host == null ? localInstance.themeColor : props.instance?.themeColor) ?? '#777777';
|
||||||
return {
|
return {
|
||||||
background: `linear-gradient(90deg, ${themeColor}, ${themeColor}00)`,
|
background: `linear-gradient(90deg, ${themeColor}, ${themeColor}00)`,
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,7 +50,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock"/>
|
<MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock"/>
|
||||||
<div :class="$style.main">
|
<div :class="$style.main">
|
||||||
<MkNoteHeader :note="appearNote" :mini="true"/>
|
<MkNoteHeader :note="appearNote" :mini="true"/>
|
||||||
<MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/>
|
<MkInstanceTicker v-if="showTicker" :host="appearNote.user.host" :instance="appearNote.user.instance"/>
|
||||||
<div style="container-type: inline-size;">
|
<div style="container-type: inline-size;">
|
||||||
<p v-if="appearNote.cw != null" :class="$style.cw">
|
<p v-if="appearNote.cw != null" :class="$style.cw">
|
||||||
<Mfm
|
<Mfm
|
||||||
|
|
|
@ -70,7 +70,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<img v-for="(role, i) in appearNote.user.badgeRoles" :key="i" v-tooltip="role.name" :class="$style.noteHeaderBadgeRole" :src="role.iconUrl!"/>
|
<img v-for="(role, i) in appearNote.user.badgeRoles" :key="i" v-tooltip="role.name" :class="$style.noteHeaderBadgeRole" :src="role.iconUrl!"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/>
|
<MkInstanceTicker v-if="showTicker" :host="appearNote.user.host" :instance="appearNote.user.instance"/>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div :class="$style.noteContent">
|
<div :class="$style.noteContent">
|
||||||
|
|
Loading…
Reference in a new issue