From 4f6be0a21eb5077c30fa73f6fe95743b31595688 Mon Sep 17 00:00:00 2001 From: posimai Date: Wed, 22 Apr 2026 12:54:58 +0900 Subject: [PATCH] =?UTF-8?q?fix(together):=20=E3=82=A2=E3=83=BC=E3=82=AB?= =?UTF-8?q?=E3=82=A4=E3=83=96SQL=E6=A7=8B=E6=96=87=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E4=BF=AE=E6=AD=A3=EF=BC=88JS=E5=81=B4=E3=81=A7?= =?UTF-8?q?=E3=83=9B=E3=82=B9=E3=83=88=E5=90=8D=E5=88=A4=E5=AE=9A=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/server.js b/server.js index a2314a68..1b5a95eb 100644 --- a/server.js +++ b/server.js @@ -2632,17 +2632,16 @@ ${excerpt} } } catch (_) {} - // x.com など既存タイトルがドメイン名のみの場合は Jina タイトルで上書き + // 既存タイトルがドメイン名のみの場合は Jina タイトルで上書き(JS 側で判定) + let hostname = ''; + try { hostname = new URL(url).hostname.replace('www.', ''); } catch (_) {} + const titleOverwrite = jinaTitle && hostname && jinaTitle !== hostname; await pool.query( `UPDATE together_shares SET full_content=$1, - title=CASE - WHEN title IS NULL THEN $2::text - WHEN $2::text IS NOT NULL AND title = regexp_replace($3::text, '^https?://(www\.)?([^/]+).*$', '\2') THEN $2::text - ELSE title - END - WHERE id=$4`, - [fullContent, jinaTitle, url, shareId] + title=CASE WHEN title IS NULL OR ($2::boolean AND title=$3::text) THEN $4::text ELSE title END + WHERE id=$5`, + [fullContent, titleOverwrite, hostname, jinaTitle, shareId] ); function parseGeminiJson(raw) {