From f3d359d5b76f6309392a89863a38a8ac4cd6ac7e Mon Sep 17 00:00:00 2001 From: miteruzo Date: Thu, 12 Feb 2026 12:46:11 +0900 Subject: [PATCH 1/3] #130 --- frontend/src/components/PostEmbed.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/PostEmbed.tsx b/frontend/src/components/PostEmbed.tsx index c375ca1..d5e7cba 100644 --- a/frontend/src/components/PostEmbed.tsx +++ b/frontend/src/components/PostEmbed.tsx @@ -18,17 +18,26 @@ export default (({ post }: Props) => { { case 'nicovideo.jp': { - const [videoId] = url.pathname.match (/(?<=\/watch\/)[a-zA-Z0-9]+?(?=\/|$)/)! + const mVideoId = url.pathname.match (/(?<=\/watch\/)[a-zA-Z0-9]+?(?=\/|$)/) + if (!(mVideoId)) + break + const [videoId] = mVideoId return } case 'twitter.com': case 'x.com': - const [userId] = url.pathname.match (/(?<=\/)[^\/]+?(?=\/|$|\?)/)! - const [statusId] = url.pathname.match (/(?<=\/status\/)\d+?(?=\/|$|\?)/)! + const mUserId = url.pathname.match (/(?<=\/)[^\/]+?(?=\/|$|\?)/) + const mStatusId = url.pathname.match (/(?<=\/status\/)\d+?(?=\/|$|\?)/) + if (!(mUserId) || !(mStatusId)) + break + const [userId] = mUserId + const [statusId] = mStatusId return case 'youtube.com': { - const videoId = url.searchParams.get ('v')! + const videoId = url.searchParams.get ('v') + if (!(videoId)) + break return ( Date: Fri, 13 Feb 2026 03:44:31 +0900 Subject: [PATCH 2/3] #130 --- frontend/src/components/PostEmbed.tsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/PostEmbed.tsx b/frontend/src/components/PostEmbed.tsx index d5e7cba..70d596b 100644 --- a/frontend/src/components/PostEmbed.tsx +++ b/frontend/src/components/PostEmbed.tsx @@ -21,23 +21,30 @@ export default (({ post }: Props) => { const mVideoId = url.pathname.match (/(?<=\/watch\/)[a-zA-Z0-9]+?(?=\/|$)/) if (!(mVideoId)) break + const [videoId] = mVideoId + return } case 'twitter.com': case 'x.com': - const mUserId = url.pathname.match (/(?<=\/)[^\/]+?(?=\/|$|\?)/) - const mStatusId = url.pathname.match (/(?<=\/status\/)\d+?(?=\/|$|\?)/) - if (!(mUserId) || !(mStatusId)) - break - const [userId] = mUserId - const [statusId] = mStatusId - return + { + const mUserId = url.pathname.match (/(?<=\/)[^\/]+?(?=\/|$|\?)/) + const mStatusId = url.pathname.match (/(?<=\/status\/)\d+?(?=\/|$|\?)/) + if (!(mUserId) || !(mStatusId)) + break + + const [userId] = mUserId + const [statusId] = mStatusId + + return + } case 'youtube.com': { const videoId = url.searchParams.get ('v') if (!(videoId)) break + return ( Date: Fri, 13 Feb 2026 03:46:11 +0900 Subject: [PATCH 3/3] #130 --- frontend/src/components/PostEmbed.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/components/PostEmbed.tsx b/frontend/src/components/PostEmbed.tsx index 70d596b..e229666 100644 --- a/frontend/src/components/PostEmbed.tsx +++ b/frontend/src/components/PostEmbed.tsx @@ -26,6 +26,7 @@ export default (({ post }: Props) => { return } + case 'twitter.com': case 'x.com': { @@ -39,6 +40,7 @@ export default (({ post }: Props) => { return } + case 'youtube.com': { const videoId = url.searchParams.get ('v') -- 2.34.1