fix(frontend-embed): URLエンコードされた文字列が正常に読み込めない問題を修正 (#14630)

* fix(frontend-embed): URLエンコードされた文字列が正常に読み込めない問題を修正

* fix(frontend-embed): bring back missing bits
This commit is contained in:
かっこかり 2024-09-25 16:12:34 +09:00 committed by GitHub
parent 5c62cbcca8
commit 8c3be57ab3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 2 deletions

View File

@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<a :href="`/@${user.username}`" target="_blank" rel="noopener noreferrer" :class="$style.avatarLink">
<EmAvatar :class="$style.avatar" :user="user"/>
</a>
<div :class="$style.headerTitle">
<div :class="$style.headerTitle" @click="top">
<I18n :src="i18n.ts.noteOf" tag="div" class="_nowrap">
<template #user>
<a v-if="user != null" :href="`/@${user.username}`" target="_blank" rel="noopener noreferrer">
@ -56,6 +56,8 @@ import EmUserName from '@/components/EmUserName.vue';
import I18n from '@/components/I18n.vue';
import XNotFound from '@/pages/not-found.vue';
import EmTimelineContainer from '@/components/EmTimelineContainer.vue';
import { scrollToTop } from '@@/js/scroll.js';
import { isLink } from '@@/js/is-link.js';
import { misskeyApi } from '@/misskey-api.js';
import { i18n } from '@/i18n.js';
import { assertServerContext } from '@/server-context.js';
@ -98,6 +100,15 @@ const pagination = computed(() => ({
} as Paging));
const notesEl = useTemplateRef('notesEl');
function top(ev: MouseEvent) {
const target = ev.target as HTMLElement | null;
if (target && isLink(target)) return;
if (notesEl.value) {
scrollToTop(notesEl.value.$el as HTMLElement, { behavior: 'smooth' });
}
}
</script>
<style lang="scss" module>

View File

@ -44,8 +44,16 @@ import EmTagPage from '@/pages/tag.vue';
import XNotFound from '@/pages/not-found.vue';
import EmLoading from '@/components/EmLoading.vue';
function safeURIDecode(str: string): string {
try {
return decodeURIComponent(str);
} catch {
return str;
}
}
const page = location.pathname.split('/')[2];
const contentId = location.pathname.split('/')[3];
const contentId = safeURIDecode(location.pathname.split('/')[3]);
if (_DEV_) console.log(page, contentId);
const embedParams = inject(DI.embedParams, defaultEmbedParams);