This commit is contained in:
syuilo 2024-08-26 09:24:39 +09:00
parent 1eca9b9fbd
commit 8775d9f707
5 changed files with 11 additions and 56 deletions

View file

@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<i class="ti ti-repeat" style="margin-right: 4px;"></i> <i class="ti ti-repeat" style="margin-right: 4px;"></i>
<I18n :src="i18n.ts.renotedBy" tag="span" :class="$style.renoteText"> <I18n :src="i18n.ts.renotedBy" tag="span" :class="$style.renoteText">
<template #user> <template #user>
<EmA v-user-preview="inEmbedPage ? undefined : note.userId" :class="$style.renoteUserName" :to="userPage(note.user)"> <EmA v-user-preview="true ? undefined : note.userId" :class="$style.renoteUserName" :to="userPage(note.user)">
<EmUserName :user="note.user"/> <EmUserName :user="note.user"/>
</EmA> </EmA>
</template> </template>
@ -61,7 +61,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:author="appearNote.user" :author="appearNote.user"
:nyaize="'respect'" :nyaize="'respect'"
:emojiUrls="appearNote.emojis" :emojiUrls="appearNote.emojis"
:enableEmojiMenu="!inEmbedPage" :enableEmojiMenu="!true"
:enableEmojiMenuReaction="true" :enableEmojiMenuReaction="true"
/> />
<div v-if="translating || translation" :class="$style.translation"> <div v-if="translating || translation" :class="$style.translation">
@ -75,7 +75,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="appearNote.files && appearNote.files.length > 0"> <div v-if="appearNote.files && appearNote.files.length > 0">
<EmMediaList :mediaList="appearNote.files" :originalEntityUrl="`${url}/notes/${appearNote.id}`"/> <EmMediaList :mediaList="appearNote.files" :originalEntityUrl="`${url}/notes/${appearNote.id}`"/>
</div> </div>
<EmPoll v-if="appearNote.poll" :noteId="appearNote.id" :poll="appearNote.poll" :readOnly="inEmbedPage" :class="$style.poll"/> <EmPoll v-if="appearNote.poll" :noteId="appearNote.id" :poll="appearNote.poll" :readOnly="true" :class="$style.poll"/>
<div v-if="appearNote.renote" :class="$style.quote"><EmNoteSimple :note="appearNote.renote" :class="$style.quoteNote"/></div> <div v-if="appearNote.renote" :class="$style.quote"><EmNoteSimple :note="appearNote.renote" :class="$style.quoteNote"/></div>
<button v-if="isLong && collapsed" :class="$style.collapsed" class="_button" @click="collapsed = false"> <button v-if="isLong && collapsed" :class="$style.collapsed" class="_button" @click="collapsed = false">
<span :class="$style.collapsedLabel">{{ i18n.ts.showMore }}</span> <span :class="$style.collapsedLabel">{{ i18n.ts.showMore }}</span>
@ -151,7 +151,6 @@ const emit = defineEmits<{
const inTimeline = inject<boolean>('inTimeline', false); const inTimeline = inject<boolean>('inTimeline', false);
const inChannel = inject('inChannel', null); const inChannel = inject('inChannel', null);
const currentClip = inject<Ref<Misskey.entities.Clip> | null>('currentClip', null); const currentClip = inject<Ref<Misskey.entities.Clip> | null>('currentClip', null);
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
const note = ref(deepClone(props.note)); const note = ref(deepClone(props.note));

View file

@ -41,35 +41,23 @@ SPDX-License-Identifier: AGPL-3.0-only
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, shallowRef, inject, onActivated } from 'vue'; import { ref, computed, shallowRef, inject, onActivated } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import type { Paging } from '@/components/MkPagination.vue';
import type { ParsedEmbedParams } from '@/embed-page.js';
import EmNotes from '@/embed/components/EmNotes.vue'; import EmNotes from '@/embed/components/EmNotes.vue';
import XNotFound from '@/pages/not-found.vue'; import XNotFound from '@/pages/not-found.vue';
import EmTimelineContainer from '@/embed/components/EmTimelineContainer.vue'; import EmTimelineContainer from '@/embed/components/EmTimelineContainer.vue';
import type { Paging } from '@/components/MkPagination.vue';
import { misskeyApi } from '@/scripts/misskey-api.js'; import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import { url, instanceName } from '@/config.js'; import { url, instanceName } from '@/config.js';
import { scrollToTop } from '@/scripts/scroll.js'; import { scrollToTop } from '@/scripts/scroll.js';
import { isLink } from '@/scripts/is-link.js'; import { isLink } from '@/scripts/is-link.js';
import { useRouter } from '@/router/supplier.js'; import { defaultEmbedParams } from '@/embed-page.js';
import { defaultEmbedParams } from '@/scripts/embed-page.js';
import type { ParsedEmbedParams } from '@/scripts/embed-page.js';
const props = defineProps<{ const props = defineProps<{
clipId: string; clipId: string;
}>(); }>();
function redirectIfNotEmbedPage() {
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
if (!inEmbedPage) {
const router = useRouter();
router.replace(`/clips/${props.clipId}`);
}
}
redirectIfNotEmbedPage();
onActivated(redirectIfNotEmbedPage); onActivated(redirectIfNotEmbedPage);
const embedParams = inject<ParsedEmbedParams>('embedParams', defaultEmbedParams); const embedParams = inject<ParsedEmbedParams>('embedParams', defaultEmbedParams);

View file

@ -17,23 +17,11 @@ import * as Misskey from 'misskey-js';
import EmNoteDetailed from '@/embed/components/EmNoteDetailed.vue'; import EmNoteDetailed from '@/embed/components/EmNoteDetailed.vue';
import XNotFound from '@/pages/not-found.vue'; import XNotFound from '@/pages/not-found.vue';
import { misskeyApi } from '@/scripts/misskey-api.js'; import { misskeyApi } from '@/scripts/misskey-api.js';
import { useRouter } from '@/router/supplier.js';
const props = defineProps<{ const props = defineProps<{
noteId: string; noteId: string;
}>(); }>();
function redirectIfNotEmbedPage() {
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
if (!inEmbedPage) {
const router = useRouter();
router.replace(`/notes/${props.noteId}`);
}
}
redirectIfNotEmbedPage();
onActivated(redirectIfNotEmbedPage); onActivated(redirectIfNotEmbedPage);
provide('EMBED_ORIGINAL_ENTITY_URL', `/notes/${props.noteId}`); provide('EMBED_ORIGINAL_ENTITY_URL', `/notes/${props.noteId}`);

View file

@ -39,32 +39,22 @@ SPDX-License-Identifier: AGPL-3.0-only
<script setup lang="ts"> <script setup lang="ts">
import { computed, shallowRef, inject, onActivated } from 'vue'; import { computed, shallowRef, inject, onActivated } from 'vue';
import type { Paging } from '@/components/MkPagination.vue';
import type { ParsedEmbedParams } from '@/embed-page.js';
import EmNotes from '@/embed/components/EmNotes.vue'; import EmNotes from '@/embed/components/EmNotes.vue';
import XNotFound from '@/pages/not-found.vue'; import XNotFound from '@/pages/not-found.vue';
import EmTimelineContainer from '@/embed/components/EmTimelineContainer.vue'; import EmTimelineContainer from '@/embed/components/EmTimelineContainer.vue';
import type { Paging } from '@/components/MkPagination.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import { url, instanceName } from '@/config.js'; import { url, instanceName } from '@/config.js';
import { scrollToTop } from '@/scripts/scroll.js'; import { scrollToTop } from '@/scripts/scroll.js';
import { isLink } from '@/scripts/is-link.js'; import { isLink } from '@/scripts/is-link.js';
import { useRouter } from '@/router/supplier.js'; import { defaultEmbedParams } from '@/embed-page.js';
import { defaultEmbedParams } from '@/scripts/embed-page.js';
import type { ParsedEmbedParams } from '@/scripts/embed-page.js';
const props = defineProps<{ const props = defineProps<{
tag: string; tag: string;
}>(); }>();
function redirectIfNotEmbedPage() {
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
if (!inEmbedPage) {
const router = useRouter();
router.replace(`/tags/${props.tag}`);
}
}
redirectIfNotEmbedPage(); redirectIfNotEmbedPage();
onActivated(redirectIfNotEmbedPage); onActivated(redirectIfNotEmbedPage);

View file

@ -49,7 +49,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { ref, computed, shallowRef, inject, onActivated } from 'vue'; import { ref, computed, shallowRef, inject, onActivated } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import type { Paging } from '@/components/MkPagination.vue'; import type { Paging } from '@/components/MkPagination.vue';
import type { ParsedEmbedParams } from '@/scripts/embed-page.js'; import type { ParsedEmbedParams } from '@/embed-page.js';
import EmNotes from '@/embed/components/EmNotes.vue'; import EmNotes from '@/embed/components/EmNotes.vue';
import XNotFound from '@/pages/not-found.vue'; import XNotFound from '@/pages/not-found.vue';
import EmTimelineContainer from '@/embed/components/EmTimelineContainer.vue'; import EmTimelineContainer from '@/embed/components/EmTimelineContainer.vue';
@ -59,22 +59,12 @@ import { instance } from '@/instance.js';
import { url, instanceName } from '@/config.js'; import { url, instanceName } from '@/config.js';
import { scrollToTop } from '@/scripts/scroll.js'; import { scrollToTop } from '@/scripts/scroll.js';
import { isLink } from '@/scripts/is-link.js'; import { isLink } from '@/scripts/is-link.js';
import { useRouter } from '@/router/supplier.js'; import { defaultEmbedParams } from '@/embed-page.js';
import { defaultEmbedParams } from '@/scripts/embed-page.js';
const props = defineProps<{ const props = defineProps<{
username: string; username: string;
}>(); }>();
function redirectIfNotEmbedPage() {
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
if (!inEmbedPage) {
const router = useRouter();
router.replace(`/@${props.username}`);
}
}
redirectIfNotEmbedPage(); redirectIfNotEmbedPage();
onActivated(redirectIfNotEmbedPage); onActivated(redirectIfNotEmbedPage);