diff options
| author | おさむのひと <46447427+samunohito@users.noreply.github.com> | 2024-03-21 18:46:42 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-21 18:46:42 +0900 |
| commit | 831c74a25b2db0ba3f6d43a9a1a9072d342b2822 (patch) | |
| tree | 5ad9371369ef6a346e0ca27bc6dea1682044df52 /packages/frontend/src/components/MkUrlPreview.vue | |
| parent | enhance(antenna): Botの投稿を除外できるように (#13603) (diff) | |
| download | misskey-831c74a25b2db0ba3f6d43a9a1a9072d342b2822.tar.gz misskey-831c74a25b2db0ba3f6d43a9a1a9072d342b2822.tar.bz2 misskey-831c74a25b2db0ba3f6d43a9a1a9072d342b2822.zip | |
fix: URLプレビューの動作改善+動作設定を可能にする (#13579)
* wip
* support new version
* URLプレビュー無効化時、フロント側も非表示にしてリクエストをしないようにする
* fix lint
* fix lint
* tweak preview request error handles
* fix: CHANGELOG.md
* fix
* fix
---------
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/components/MkUrlPreview.vue')
| -rw-r--r-- | packages/frontend/src/components/MkUrlPreview.vue | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/frontend/src/components/MkUrlPreview.vue b/packages/frontend/src/components/MkUrlPreview.vue index efc58b7e29..b3dc492616 100644 --- a/packages/frontend/src/components/MkUrlPreview.vue +++ b/packages/frontend/src/components/MkUrlPreview.vue @@ -110,7 +110,6 @@ const MOBILE_THRESHOLD = 500; const isMobile = ref(deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD); const self = props.url.startsWith(local); -const attr = self ? 'to' : 'href'; const target = self ? null : '_blank'; const fetching = ref(true); const title = ref<string | null>(null); @@ -152,15 +151,16 @@ requestUrl.hash = ''; window.fetch(`/url?url=${encodeURIComponent(requestUrl.href)}&lang=${versatileLang}`) .then(res => { if (!res.ok) { - fetching.value = false; - unknownUrl.value = true; - return; + if (_DEV_) { + console.warn(`[HTTP${res.status}] Failed to fetch url preview`); + } + return null; } return res.json(); }) - .then((info: SummalyResult) => { - if (info.url == null) { + .then((info: SummalyResult | null) => { + if (!info || info.url == null) { fetching.value = false; unknownUrl.value = true; return; |