This commit is contained in:
MattyaDaihuku 2024-11-22 20:53:48 +09:00 committed by GitHub
commit e844401293
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 64 additions and 4 deletions

8
locales/index.d.ts vendored
View File

@ -7458,6 +7458,14 @@ export interface Locale extends ILocale {
* *
*/ */
"always": string; "always": string;
/**
* ()
*/
"remoteIcon": string;
/**
* ()
*/
"alwaysIcon": string;
}; };
"_serverDisconnectedBehavior": { "_serverDisconnectedBehavior": {
/** /**

View File

@ -1947,6 +1947,8 @@ _instanceTicker:
none: "表示しない" none: "表示しない"
remote: "リモートユーザーに表示" remote: "リモートユーザーに表示"
always: "常に表示" always: "常に表示"
remoteIcon: "リモートユーザーに表示(アイコンのみ)"
alwaysIcon: "常に表示(アイコンのみ)"
_serverDisconnectedBehavior: _serverDisconnectedBehavior:
reload: "自動でリロード" reload: "自動でリロード"

View File

@ -47,7 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
<article v-else :class="$style.article" @contextmenu.stop="onContextmenu"> <article v-else :class="$style.article" @contextmenu.stop="onContextmenu">
<div v-if="appearNote.channel" :class="$style.colorBar" :style="{ background: appearNote.channel.color }"></div> <div v-if="appearNote.channel" :class="$style.colorBar" :style="{ background: appearNote.channel.color }"></div>
<MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock"/> <MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock" :showInstance="showInstanceIcon && !showTicker"/>
<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" :instance="appearNote.user.instance"/>
@ -275,6 +275,7 @@ const hardMuted = ref(props.withHardMute && checkMute(appearNote.value, $i?.hard
const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null); const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null);
const translating = ref(false); const translating = ref(false);
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance); const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
const showInstanceIcon = (defaultStore.state.instanceTicker === 'alwaysIcon') || (defaultStore.state.instanceTicker === 'remoteIcon' && appearNote.value.user.instance);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id)); const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
const renoteCollapsed = ref( const renoteCollapsed = ref(
defaultStore.state.collapseRenotes && isRenote && ( defaultStore.state.collapseRenotes && isRenote && (

View File

@ -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 || showInstanceIcon" :instance="appearNote.user.instance"/>
</div> </div>
</header> </header>
<div :class="$style.noteContent"> <div :class="$style.noteContent">
@ -302,6 +302,7 @@ const translating = ref(false);
const parsed = appearNote.value.text ? mfm.parse(appearNote.value.text) : null; const parsed = appearNote.value.text ? mfm.parse(appearNote.value.text) : null;
const urls = parsed ? extractUrlFromMfm(parsed).filter((url) => appearNote.value.renote?.url !== url && appearNote.value.renote?.uri !== url) : null; const urls = parsed ? extractUrlFromMfm(parsed).filter((url) => appearNote.value.renote?.url !== url && appearNote.value.renote?.uri !== url) : null;
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance); const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
const showInstanceIcon = (defaultStore.state.instanceTicker === 'alwaysIcon') || (defaultStore.state.instanceTicker === 'remoteIcon' && appearNote.value.user.instance);
const conversation = ref<Misskey.entities.Note[]>([]); const conversation = ref<Misskey.entities.Note[]>([]);
const replies = ref<Misskey.entities.Note[]>([]); const replies = ref<Misskey.entities.Note[]>([]);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || appearNote.value.userId === $i?.id); const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || appearNote.value.userId === $i?.id);

View File

@ -23,6 +23,9 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
</div> </div>
</div> </div>
<div v-if="showInstance">
<img v-if="faviconUrl" :class="$style.instanceIcon" :src="faviconUrl" :title="instance.name ?? undefined"/>
</div>
<template v-if="showDecoration"> <template v-if="showDecoration">
<img <img
v-for="decoration in decorations ?? user.avatarDecorations" v-for="decoration in decorations ?? user.avatarDecorations"
@ -42,10 +45,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { watch, ref, computed } from 'vue'; import { watch, ref, computed } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { instanceName } from '@@/js/config.js';
import { extractAvgColorFromBlurhash } from '@@/js/extract-avg-color-from-blurhash.js'; import { extractAvgColorFromBlurhash } from '@@/js/extract-avg-color-from-blurhash.js';
import MkImgWithBlurhash from '../MkImgWithBlurhash.vue'; import MkImgWithBlurhash from '../MkImgWithBlurhash.vue';
import MkA from './MkA.vue'; import MkA from './MkA.vue';
import { getStaticImageUrl } from '@/scripts/media-proxy.js'; import { instance as Instance } from '@/instance.js';
import { getStaticImageUrl, getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
import { acct, userPage } from '@/filters/user.js'; import { acct, userPage } from '@/filters/user.js';
import MkUserOnlineIndicator from '@/components/MkUserOnlineIndicator.vue'; import MkUserOnlineIndicator from '@/components/MkUserOnlineIndicator.vue';
import { defaultStore } from '@/store.js'; import { defaultStore } from '@/store.js';
@ -62,6 +67,11 @@ const props = withDefaults(defineProps<{
indicator?: boolean; indicator?: boolean;
decorations?: (Omit<Misskey.entities.UserDetailed['avatarDecorations'][number], 'id'> & { blink?: boolean; })[]; decorations?: (Omit<Misskey.entities.UserDetailed['avatarDecorations'][number], 'id'> & { blink?: boolean; })[];
forceShowDecoration?: boolean; forceShowDecoration?: boolean;
showInstance?: boolean;
instance?: {
faviconUrl?: string | null,
name?: string | null,
};
}>(), { }>(), {
target: null, target: null,
link: false, link: false,
@ -69,6 +79,8 @@ const props = withDefaults(defineProps<{
indicator: false, indicator: false,
decorations: undefined, decorations: undefined,
forceShowDecoration: false, forceShowDecoration: false,
showInstance: false,
instance: undefined,
}); });
const emit = defineEmits<{ const emit = defineEmits<{
@ -77,6 +89,12 @@ const emit = defineEmits<{
const showDecoration = props.forceShowDecoration || defaultStore.state.showAvatarDecorations; const showDecoration = props.forceShowDecoration || defaultStore.state.showAvatarDecorations;
const instance = props.instance ?? {
name: instanceName,
};
const faviconUrl = computed(() => props.instance ? getProxiedImageUrlNullable(props.instance.faviconUrl, 'preview') : getProxiedImageUrlNullable(Instance.iconUrl, 'preview') ?? '/favicon.ico');
const bound = computed(() => props.link const bound = computed(() => props.link
? { to: userPage(props.user), target: props.target } ? { to: userPage(props.user), target: props.target }
: {}); : {});
@ -343,4 +361,32 @@ watch(() => props.user.avatarBlurhash, () => {
filter: brightness(1); filter: brightness(1);
} }
} }
.instanceIcon {
width: 25px;
height: 25px;
border-radius: 50%;
opacity: 0.65;
z-index: 2;
position: absolute;
left: 0;
bottom: 0;
background: var(--MI_THEME-panel);
box-shadow: 0 0 0 2px var(--MI_THEME-panel);
@container (max-width: 580px) {
width: 21px;
height: 21px;
}
@container (max-width: 450px) {
width: 19px;
height: 19px;
}
@container (max-width: 300px) {
width: 17px;
height: 17px;
}
}
</style> </style>

View File

@ -69,6 +69,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="none">{{ i18n.ts._instanceTicker.none }}</option> <option value="none">{{ i18n.ts._instanceTicker.none }}</option>
<option value="remote">{{ i18n.ts._instanceTicker.remote }}</option> <option value="remote">{{ i18n.ts._instanceTicker.remote }}</option>
<option value="always">{{ i18n.ts._instanceTicker.always }}</option> <option value="always">{{ i18n.ts._instanceTicker.always }}</option>
<option value="remoteIcon">{{ i18n.ts._instanceTicker.remoteIcon }}</option>
<option value="alwaysIcon">{{ i18n.ts._instanceTicker.alwaysIcon }}</option>
</MkSelect> </MkSelect>
<MkSelect v-model="nsfw"> <MkSelect v-model="nsfw">

View File

@ -296,7 +296,7 @@ export const defaultStore = markRaw(new Storage('base', {
}, },
instanceTicker: { instanceTicker: {
where: 'device', where: 'device',
default: 'remote' as 'none' | 'remote' | 'always', default: 'remote' as 'none' | 'remote' | 'always' | 'remoteIcon' | 'alwaysIcon',
}, },
emojiPickerScale: { emojiPickerScale: {
where: 'device', where: 'device',