Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(InstanceTicker): リモートサーバーのアイコンが初期画像になる問題 #211

Merged
merged 1 commit into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/frontend/src/components/TmsInstanceTicker.vue
Original file line number Diff line number Diff line change
@@ -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;
11 changes: 4 additions & 7 deletions packages/frontend/src/scripts/tms/instance-ticker.ts
Original file line number Diff line number Diff line change
@@ -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<HTMLMetaElement>('meta[name="theme-color-orig"]')?.content ?? TICKER_BG_COLOR_DEFAULT,
} as const satisfies TickerInfo;
};

const getProxiedIconUrl = (instance: NonNullable<TickerProps['instance']>): string | null => {
return getProxiedImageUrlNullable(instance.iconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? null;
};
//#endregion ticker info

//#region ticker colors