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> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, shallowRef } from 'vue'; import { ref, computed, shallowRef, inject } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkNotes from '@/components/MkNotes.vue'; import MkNotes from '@/components/MkNotes.vue';
import XNotFound from '@/pages/not-found.vue'; import XNotFound from '@/pages/not-found.vue';
@ -52,6 +52,7 @@ 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';
const props = defineProps<{ const props = defineProps<{
clipId: string; clipId: string;
@ -59,6 +60,13 @@ const props = defineProps<{
enableAutoLoad?: string; enableAutoLoad?: string;
}>(); }>();
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
if (!inEmbedPage) {
const router = useRouter();
router.replace(`/clips/${props.clipId}`);
}
// : true // : true
const normalizedShowHeader = computed(() => props.showHeader !== 'false'); const normalizedShowHeader = computed(() => props.showHeader !== 'false');

View file

@ -12,17 +12,25 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, provide } from 'vue'; import { ref, provide, inject } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkNoteDetailed from '@/components/MkNoteDetailed.vue'; import MkNoteDetailed from '@/components/MkNoteDetailed.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 { url } from '@/config.js'; import { url } from '@/config.js';
import { useRouter } from '@/router/supplier.js';
const props = defineProps<{ const props = defineProps<{
noteId: string; 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}`); provide('EMBED_ORIGINAL_ENTITY_URL', `${url}/notes/${props.noteId}`);
const note = ref<Misskey.entities.Note | null>(null); const note = ref<Misskey.entities.Note | null>(null);

View file

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