embedページとして読み込まれてない場合は非embedページにリダイレクトされるように

This commit is contained in:
kakkokari-gtyih 2024-06-06 19:57:52 +09:00
parent 51366e2940
commit 9a61944331
3 changed files with 27 additions and 3 deletions

View File

@ -40,7 +40,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script setup lang="ts">
import { ref, computed, shallowRef } from 'vue';
import { ref, computed, shallowRef, inject } from 'vue';
import * as Misskey from 'misskey-js';
import MkNotes from '@/components/MkNotes.vue';
import XNotFound from '@/pages/not-found.vue';
@ -52,6 +52,7 @@ import { instance } from '@/instance.js';
import { url, instanceName } from '@/config.js';
import { scrollToTop } from '@/scripts/scroll.js';
import { isLink } from '@/scripts/is-link.js';
import { useRouter } from '@/router/supplier.js';
const props = defineProps<{
clipId: string;
@ -59,6 +60,13 @@ const props = defineProps<{
enableAutoLoad?: string;
}>();
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
if (!inEmbedPage) {
const router = useRouter();
router.replace(`/clips/${props.clipId}`);
}
// : true
const normalizedShowHeader = computed(() => props.showHeader !== 'false');

View File

@ -12,17 +12,25 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script setup lang="ts">
import { ref, provide } from 'vue';
import { ref, provide, inject } from 'vue';
import * as Misskey from 'misskey-js';
import MkNoteDetailed from '@/components/MkNoteDetailed.vue';
import XNotFound from '@/pages/not-found.vue';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { url } from '@/config.js';
import { useRouter } from '@/router/supplier.js';
const props = defineProps<{
noteId: string;
}>();
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
if (!inEmbedPage) {
const router = useRouter();
router.replace(`/notes/${props.noteId}`);
}
provide('EMBED_ORIGINAL_ENTITY_URL', `${url}/notes/${props.noteId}`);
const note = ref<Misskey.entities.Note | null>(null);

View File

@ -46,7 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script setup lang="ts">
import { ref, computed, shallowRef } from 'vue';
import { ref, computed, shallowRef, inject } from 'vue';
import * as Misskey from 'misskey-js';
import MkNotes from '@/components/MkNotes.vue';
import XNotFound from '@/pages/not-found.vue';
@ -58,6 +58,7 @@ import { instance } from '@/instance.js';
import { url, instanceName } from '@/config.js';
import { scrollToTop } from '@/scripts/scroll.js';
import { isLink } from '@/scripts/is-link.js';
import { useRouter } from '@/router/supplier.js';
const props = defineProps<{
username: string;
@ -65,6 +66,13 @@ const props = defineProps<{
enableAutoLoad?: string;
}>();
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
if (!inEmbedPage) {
const router = useRouter();
router.replace(`/@${props.username}`);
}
// : true
const normalizedShowHeader = computed(() => props.showHeader !== 'false');