Compare commits

...

7 Commits

Author SHA1 Message Date
抹茶大福
249f530db3
Merge e9e2e3c6b3 into 3c81926f71 2024-12-22 17:05:14 +09:00
かっこかり
3c81926f71
fix(frontend): serverContextの値を利用する条件が間違っていたのを修正 (#15166)
Some checks are pending
Check SPDX-License-Identifier / check-spdx-license-id (push) Waiting to run
Check copyright year / check_copyright_year (push) Waiting to run
Publish Docker image (develop) / Build (linux/amd64) (push) Waiting to run
Publish Docker image (develop) / Build (linux/arm64) (push) Waiting to run
Publish Docker image (develop) / merge (push) Blocked by required conditions
Dockle / dockle (push) Waiting to run
Lint / pnpm_install (push) Waiting to run
Lint / lint (backend) (push) Blocked by required conditions
Lint / lint (frontend) (push) Blocked by required conditions
Lint / lint (frontend-embed) (push) Blocked by required conditions
Lint / lint (frontend-shared) (push) Blocked by required conditions
Lint / lint (misskey-bubble-game) (push) Blocked by required conditions
Lint / lint (misskey-js) (push) Blocked by required conditions
Lint / lint (misskey-reversi) (push) Blocked by required conditions
Lint / lint (sw) (push) Blocked by required conditions
Lint / typecheck (backend) (push) Blocked by required conditions
Lint / typecheck (misskey-js) (push) Blocked by required conditions
Lint / typecheck (sw) (push) Blocked by required conditions
Storybook / build (push) Waiting to run
Test (frontend) / vitest (22.11.0) (push) Waiting to run
Test (frontend) / e2e (chrome, 22.11.0) (push) Waiting to run
Test (production install and build) / production (22.11.0) (push) Waiting to run
2024-12-22 13:36:17 +09:00
MattyaDaihuku
e9e2e3c6b3 Merge branch 'develop' into instanceicon 2024-11-17 05:31:20 +00:00
MattyaDaihuku
1368f58b96 fix(frontend): MkAvatar内にMkInstanceIconの内容を含めるように 2024-11-17 05:21:58 +00:00
MattyaDaihuku
8c1dfab195 fix(frontend): MkSelectにinstanceIconの設定を含めるように 2024-11-03 06:11:04 +00:00
MattyaDaihuku
40ac246e5b
Merge branch 'misskey-dev:develop' into instanceicon 2024-10-29 12:24:51 +09:00
MattyaDaihuku
2dcd9118e9 feat(frontend): サーバーの表示をアイコンのみに切り替えられるように 2024-10-23 12:52:20 +00:00
10 changed files with 67 additions and 7 deletions

8
locales/index.d.ts vendored
View File

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

View File

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

View File

@ -47,7 +47,7 @@ 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"/>
<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" :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 translating = ref(false);
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 renoteCollapsed = ref(
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!"/>
</div>
</div>
<MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/>
<MkInstanceTicker v-if="showTicker || showInstanceIcon" :instance="appearNote.user.instance"/>
</div>
</header>
<div :class="$style.noteContent">
@ -302,6 +302,7 @@ const translating = ref(false);
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 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 replies = ref<Misskey.entities.Note[]>([]);
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 v-if="showInstance">
<img v-if="faviconUrl" :class="$style.instanceIcon" :src="faviconUrl" :title="instance.name ?? undefined"/>
</div>
<template v-if="showDecoration">
<img
v-for="decoration in decorations ?? user.avatarDecorations"
@ -42,10 +45,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { watch, ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import { instanceName } from '@@/js/config.js';
import { extractAvgColorFromBlurhash } from '@@/js/extract-avg-color-from-blurhash.js';
import MkImgWithBlurhash from '../MkImgWithBlurhash.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 MkUserOnlineIndicator from '@/components/MkUserOnlineIndicator.vue';
import { defaultStore } from '@/store.js';
@ -62,6 +67,11 @@ const props = withDefaults(defineProps<{
indicator?: boolean;
decorations?: (Omit<Misskey.entities.UserDetailed['avatarDecorations'][number], 'id'> & { blink?: boolean; })[];
forceShowDecoration?: boolean;
showInstance?: boolean;
instance?: {
faviconUrl?: string | null,
name?: string | null,
};
}>(), {
target: null,
link: false,
@ -69,6 +79,8 @@ const props = withDefaults(defineProps<{
indicator: false,
decorations: undefined,
forceShowDecoration: false,
showInstance: false,
instance: undefined,
});
const emit = defineEmits<{
@ -77,6 +89,12 @@ const emit = defineEmits<{
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
? { to: userPage(props.user), target: props.target }
: {});
@ -343,4 +361,32 @@ watch(() => props.user.avatarBlurhash, () => {
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>

View File

@ -49,7 +49,7 @@ import { genEmbedCode } from '@/scripts/get-embed-code.js';
import { assertServerContext, serverContext } from '@/server-context.js';
// context
const CTX_CLIP = $i && assertServerContext(serverContext, 'clip') ? serverContext.clip : null;
const CTX_CLIP = !$i && assertServerContext(serverContext, 'clip') ? serverContext.clip : null;
const props = defineProps<{
clipId: string,

View File

@ -67,7 +67,7 @@ import { serverContext, assertServerContext } from '@/server-context.js';
import { $i } from '@/account.js';
// context
const CTX_NOTE = $i && assertServerContext(serverContext, 'note') ? serverContext.note : null;
const CTX_NOTE = !$i && assertServerContext(serverContext, 'note') ? serverContext.note : null;
const props = defineProps<{
noteId: string;

View File

@ -69,6 +69,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="none">{{ i18n.ts._instanceTicker.none }}</option>
<option value="remote">{{ i18n.ts._instanceTicker.remote }}</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 v-model="nsfw">

View File

@ -54,7 +54,7 @@ const XGallery = defineAsyncComponent(() => import('./gallery.vue'));
const XRaw = defineAsyncComponent(() => import('./raw.vue'));
// context
const CTX_USER = $i && assertServerContext(serverContext, 'user') ? serverContext.user : null;
const CTX_USER = !$i && assertServerContext(serverContext, 'user') ? serverContext.user : null;
const props = withDefaults(defineProps<{
acct: string;

View File

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