From 7c9c175029840af9c30f46b857fabd5eb9863ec9 Mon Sep 17 00:00:00 2001 From: taiy <53635909+taiyme@users.noreply.github.com> Date: Thu, 2 May 2024 22:38:53 +0900 Subject: [PATCH] =?UTF-8?q?fix(InstanceTicker):=20=E3=83=AA=E3=83=A2?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=82=B5=E3=83=BC=E3=83=90=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=E3=81=8C=E5=88=9D=E6=9C=9F?= =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=81=AB=E3=81=AA=E3=82=8B=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=20(#211)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frontend/src/components/TmsInstanceTicker.vue | 3 ++- packages/frontend/src/scripts/tms/instance-ticker.ts | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/frontend/src/components/TmsInstanceTicker.vue b/packages/frontend/src/components/TmsInstanceTicker.vue index a23736221680..83b8effb7fda 100644 --- a/packages/frontend/src/components/TmsInstanceTicker.vue +++ b/packages/frontend/src/components/TmsInstanceTicker.vue @@ -28,7 +28,8 @@ import { type tmsStore } from '@/tms/store.js'; export type TickerProps = { readonly instance?: { readonly name?: string | null; - readonly iconUrl?: string | null; + // NOTE: リモートサーバーにおいてiconUrlを参照すると意図した画像にならない https://github.com/taiyme/misskey/issues/210 + // readonly iconUrl?: string | null; readonly faviconUrl?: string | null; readonly themeColor?: string | null; } | null; diff --git a/packages/frontend/src/scripts/tms/instance-ticker.ts b/packages/frontend/src/scripts/tms/instance-ticker.ts index f4cb9d562ffa..b7d760a35c40 100644 --- a/packages/frontend/src/scripts/tms/instance-ticker.ts +++ b/packages/frontend/src/scripts/tms/instance-ticker.ts @@ -22,27 +22,24 @@ export const getTickerInfo = (props: TickerProps): TickerInfo => { if (props.channel != null) { return { name: props.channel.name, - iconUrl: getProxiedIconUrl(localInstance) ?? '/favicon.ico', + iconUrl: getProxiedImageUrlNullable(localInstance.iconUrl, 'preview') ?? '/favicon.ico', themeColor: props.channel.color, } as const satisfies TickerInfo; } if (props.instance != null) { return { name: props.instance.name ?? '', - iconUrl: getProxiedIconUrl(props.instance) ?? '/client-assets/dummy.png', + // NOTE: リモートサーバーにおいてiconUrlを参照すると意図した画像にならない https://github.com/taiyme/misskey/issues/210 + iconUrl: getProxiedImageUrlNullable(props.instance.faviconUrl, 'preview') ?? '/client-assets/dummy.png', themeColor: props.instance.themeColor ?? TICKER_BG_COLOR_DEFAULT, } as const satisfies TickerInfo; } return { name: localInstance.name ?? host, - iconUrl: getProxiedIconUrl(localInstance) ?? '/favicon.ico', + iconUrl: getProxiedImageUrlNullable(localInstance.iconUrl, 'preview') ?? '/favicon.ico', themeColor: localInstance.themeColor ?? document.querySelector('meta[name="theme-color-orig"]')?.content ?? TICKER_BG_COLOR_DEFAULT, } as const satisfies TickerInfo; }; - -const getProxiedIconUrl = (instance: NonNullable): string | null => { - return getProxiedImageUrlNullable(instance.iconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? null; -}; //#endregion ticker info //#region ticker colors