fix(MisskeyGateway): 処理をクライアント側で行うように

This commit is contained in:
kakkokari-gtyih 2024-03-13 23:42:36 +09:00
parent 65beae39a4
commit 27408b0d19
2 changed files with 37 additions and 23 deletions

View File

@ -1,5 +1,6 @@
<template> <template>
<GMisskeyGateway <GMisskeyGateway
v-if="path"
:action="actionConfig" :action="actionConfig"
:branding="{ :branding="{
heading: $t('_goToMisskey.heading'), heading: $t('_goToMisskey.heading'),
@ -10,6 +11,7 @@
<script setup lang="ts"> <script setup lang="ts">
import WindowIco from 'bi/window.svg'; import WindowIco from 'bi/window.svg';
import { parseQuery } from 'ufo';
definePageMeta({ definePageMeta({
layout: 'blank', layout: 'blank',
@ -21,19 +23,11 @@ useHead({
], ],
}); });
const { meta, query } = useRoute(); const { meta } = useRoute();
const { t } = useI18n(); const { t } = useI18n();
// //
const path = computed(() => { const path = ref<string | null>(null);
if (!query.path || query.path.length == 0) return undefined;
if (Array.isArray(query.path)) {
return query.path[0] as string;
} else {
return query.path;
}
});
const actionConfig = computed(() => { const actionConfig = computed(() => {
return { return {
@ -42,6 +36,15 @@ const actionConfig = computed(() => {
}; };
}); });
if (process.client) {
const query = parseQuery(location.search);
if (Array.isArray(query.path)) {
path.value = query.path[0] as string;
} else {
path.value = query.path;
}
}
meta.title = t('_goToMisskey.title'); meta.title = t('_goToMisskey.title');
meta.scrollButton = false; meta.scrollButton = false;
</script> </script>

View File

@ -7,6 +7,7 @@
></MkAnimBg> ></MkAnimBg>
<GMisskeyGateway <GMisskeyGateway
class="relative" class="relative"
v-if="filteredQuery"
:action="{ :action="{
type: 'link', type: 'link',
path: `/share?${stringifyQuery(filteredQuery)}`, path: `/share?${stringifyQuery(filteredQuery)}`,
@ -16,7 +17,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { stringifyQuery } from 'ufo'; import { stringifyQuery, parseQuery } from 'ufo';
definePageMeta({ definePageMeta({
layout: 'blank', layout: 'blank',
@ -28,25 +29,35 @@ useHead({
], ],
}); });
const { meta, query } = useRoute(); const { meta } = useRoute();
const manualInstance = (Array.isArray(query.manualInstance) ? query.manualInstance[0] : query.manualInstance) ?? undefined; const manualInstance = ref<string | undefined>();
const filteredQuery = computed(() => ({ const filteredQuery = ref<Record<string, any>>({});
const isCanvasLoaded = ref(false);
const showAnimBg = ref(false);
if (process.client) {
const query = parseQuery(location.search.slice(1));
filteredQuery.value = {
...query, ...query,
replyId: undefined, replyId: undefined,
renoteId: undefined, renoteId: undefined,
visibleUserIds: undefined, visibleUserIds: undefined,
fileIds: undefined, fileIds: undefined,
manualInstance: undefined, manualInstance: undefined,
})); };
const isCanvasLoaded = ref(false); manualInstance.value = Array.isArray(query.manualInstance) ? query.manualInstance[0] : query.manualInstance ?? undefined;
const showAnimBg = ref(false); }
if (process.client && window.innerWidth >= 768) { onMounted(() => {
if (window.innerWidth >= 768) {
showAnimBg.value = true; showAnimBg.value = true;
} }
});
const { t } = useI18n(); const { t } = useI18n();