feat: ユーザーのサーバー情報をアイコンのみにする

This commit is contained in:
MattyaDaihuku 2024-10-19 03:12:32 +00:00 committed by hijiki
parent c52dab5e62
commit f7793de61b
12 changed files with 117 additions and 8 deletions

View File

@ -742,6 +742,7 @@ openInSideView: "Open in side view"
defaultNavigationBehaviour: "Default navigation behavior"
editTheseSettingsMayBreakAccount: "Editing these settings may damage your account."
instanceTicker: "Instance information of notes"
instanceIcon: "Display only the instance's logo on the timeline"
waitingFor: "Waiting for {x}"
random: "Random"
system: "System"

4
locales/index.d.ts vendored
View File

@ -2976,6 +2976,10 @@ export interface Locale extends ILocale {
*
*/
"instanceTicker": string;
/**
*
*/
"instanceIcon": string;
/**
* {x}
*/

View File

@ -740,6 +740,7 @@ openInSideView: "サイドビューで開く"
defaultNavigationBehaviour: "デフォルトのナビゲーション"
editTheseSettingsMayBreakAccount: "これらの設定を編集するとアカウントが破損する可能性があります。"
instanceTicker: "ノートのサーバー情報"
instanceIcon: "サーバー情報をアイコンのみにする"
waitingFor: "{x}を待っています"
random: "ランダム"
system: "システム"

View File

@ -721,6 +721,7 @@ openInSideView: "サイドビューで開く"
defaultNavigationBehaviour: "デフォルトのナビゲーション"
editTheseSettingsMayBreakAccount: "このへんの設定をようわからんままイジるとアカウントが壊れて使えんくなるかも知れへんで?"
instanceTicker: "ノートのサーバー情報"
instanceIcon: "サーバー情報をアイコンのみにするで"
waitingFor: "{x}を待っとるで"
random: "ランダム"
system: "システム"

View File

@ -711,6 +711,7 @@ openInSideView: "사이드뷰로 열기"
defaultNavigationBehaviour: "기본 탐색 동작"
editTheseSettingsMayBreakAccount: "이 설정을 변경하면 계정이 손상될 수 있습니다."
instanceTicker: "노트의 서버 정보"
instanceIcon: "타임라인에 인스턴스의 아이콘만 표시하기"
waitingFor: "{x}을(를) 기다리고 있습니다"
random: "무작위"
system: "시스템"

View File

@ -717,6 +717,7 @@ openInSideView: "在侧边栏中打开"
defaultNavigationBehaviour: "默认导航"
editTheseSettingsMayBreakAccount: "编辑这些设置可以会损坏您的账号"
instanceTicker: "帖子的服务器来源"
instanceIcon: "在时间轴上只显示实例图标"
waitingFor: "等待 {x}"
random: "随机"
system: "系统"

View File

@ -717,6 +717,7 @@ openInSideView: "在側欄中開啟"
defaultNavigationBehaviour: "預設導航"
editTheseSettingsMayBreakAccount: "修改這些設定可能會毀損您的帳戶"
instanceTicker: "貼文的伺服器資訊"
instanceIcon: "僅在時間軸上顯示實例的圖標"
waitingFor: "等待{x}"
random: "隨機"
system: "系統"

View File

@ -0,0 +1,53 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div>
<img v-if="faviconUrl" :class="$style.topleftIcon" :src="faviconUrl"/>
</div>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
const props = defineProps<{
instance?: {
faviconUrl?: string | null
}
}>();
const faviconUrl = computed(() => getProxiedImageUrlNullable(props.instance?.faviconUrl, 'preview') ?? '/favicon.ico');
</script>
<style lang="scss" module>
.topleftIcon {
width: 25px;
height: 25px;
border-radius: 50%;
opacity: 0.7;
background: var(--MI_THEME-panel);
box-shadow: 0 0 0 2px var(--MI_THEME-panel);
}
@container (max-width: 580px) {
.topleftIcon {
width: 21px;
height: 21px;
}
}
@container (max-width: 450px) {
.topleftIcon {
width: 19px;
height: 19px;
}
}
@container (max-width: 300px) {
.topleftIcon {
width: 17px;
height: 17px;
}
}
</style>

View File

@ -55,10 +55,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<article v-else :class="$style.article" @contextmenu.stop="onContextmenu">
<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"/>
<div :class="[$style.main, { [$style.clickToOpen]: defaultStore.state.clickToOpen }]" @click.stop="defaultStore.state.clickToOpen ? noteclick(appearNote.id) : undefined">
<MkNoteHeader :note="appearNote" :mini="true" @click.stop/>
<MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/>
<MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock" :showInstance="!!showInstanceIcon && !!showTicker"/>
<div :class="$style.main">
<MkNoteHeader :note="appearNote" :mini="true"/>
<MkInstanceTicker v-if="showTicker && !showInstanceIcon" :instance="appearNote.user.instance"/>
<div style="container-type: inline-size;">
<bdi>
<p v-if="appearNote.cw != null" :class="$style.cw">
@ -312,6 +312,7 @@ const hardMuted = ref(props.withHardMute && checkMute(appearNote.value, $i?.hard
const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null);
const translating = ref(false);
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
const showInstanceIcon = ref(defaultStore.state.instanceIcon);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
const renoteCollapsed = ref(
defaultStore.state.collapseRenotes && isRenote && (

View File

@ -35,6 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
}"
alt=""
>
<MkInstanceIcon v-if="showInstance" :class="$style.instanceicon" :instance="user.instance"/>
</template>
</component>
</template>
@ -49,6 +50,7 @@ import { extractAvgColorFromBlurhash } from '@/scripts/extract-avg-color-from-bl
import { acct, userPage } from '@/filters/user.js';
import MkUserOnlineIndicator from '@/components/MkUserOnlineIndicator.vue';
import { defaultStore } from '@/store.js';
import MkInstanceIcon from '@/components/MkInstanceIcon.vue';
const animation = ref(defaultStore.state.animation);
const squareAvatars = ref(defaultStore.state.squareAvatars);
@ -62,6 +64,7 @@ const props = withDefaults(defineProps<{
indicator?: boolean;
decorations?: Omit<Misskey.entities.UserDetailed['avatarDecorations'][number], 'id'>[];
forceShowDecoration?: boolean;
showInstance?: boolean;
}>(), {
target: null,
link: false,
@ -69,6 +72,7 @@ const props = withDefaults(defineProps<{
indicator: false,
decorations: undefined,
forceShowDecoration: false,
showInstance: false,
});
const emit = defineEmits<{
@ -330,4 +334,43 @@ watch(() => props.user.avatarBlurhash, () => {
width: 200%;
pointer-events: none;
}
.decorationBlink {
animation: blink 1s infinite;
}
@keyframes blink {
0%, 100% {
filter: brightness(2);
}
50% {
filter: brightness(1);
}
}
.instanceicon {
height: 25px;
z-index: 2;
position: absolute;
left: 0;
bottom: 0;
}
@container (max-width: 580px) {
.instanceicon {
height: 21px;
}
}
@container (max-width: 450px) {
.instanceicon {
height: 19px;
}
}
@container (max-width: 300px) {
.instanceicon {
height: 17px;
}
}
</style>

View File

@ -110,10 +110,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="remote">{{ i18n.ts._instanceTicker.remote }}</option>
<option value="always">{{ i18n.ts._instanceTicker.always }}</option>
</MkSelect>
<MkSwitch v-if="instanceTicker !== 'none'" v-model="instanceIcon">
{{ i18n.ts.instanceIcon }}
<span class="_beta">{{ i18n.ts.originalFeature }}</span>
</MkSwitch>
<MkSwitch v-if="instanceTicker !== 'none'" v-model="instanceIcon">{{ i18n.ts.instanceIcon }}</MkSwitch>
<MkSelect v-model="nsfw">
<template #label>{{ i18n.ts.displayOfSensitiveMedia }}</template>
<option value="respect">{{ i18n.ts._displayOfSensitiveMedia.respect }}</option>
@ -418,6 +415,7 @@ const showFixedPostFormInChannel = computed(defaultStore.makeGetterSetter('showF
const numberOfPageCache = computed(defaultStore.makeGetterSetter('numberOfPageCache'));
const numberOfReplies = computed(defaultStore.makeGetterSetter('numberOfReplies'));
const instanceTicker = computed(defaultStore.makeGetterSetter('instanceTicker'));
const instanceIcon = computed(defaultStore.makeGetterSetter('instanceIcon'));
const enableInfiniteScroll = computed(defaultStore.makeGetterSetter('enableInfiniteScroll'));
const useReactionPickerForContextMenu = computed(defaultStore.makeGetterSetter('useReactionPickerForContextMenu'));
const squareAvatars = computed(defaultStore.makeGetterSetter('squareAvatars'));

View File

@ -344,6 +344,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: 'remote' as 'none' | 'remote' | 'always',
},
instanceIcon: {
where: 'device',
default: false,
},
emojiPickerScale: {
where: 'device',
default: 1,