From 7e633c70ab4abcc50651d150599a28d393d447cc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 15:25:17 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=89=20Address=20code=20review:=20extra?= =?UTF-8?q?ct=20URL=20constant,=20localize=20fallback,=20improve=20variabl?= =?UTF-8?q?e=20naming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- backend/routes/feishu.js | 6 +++--- scripts/bridge/fetch-broadcast.js | 2 +- scripts/bridge/upload-pdf.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/routes/feishu.js b/backend/routes/feishu.js index 687cdc80..3450048d 100644 --- a/backend/routes/feishu.js +++ b/backend/routes/feishu.js @@ -117,9 +117,9 @@ router.post('/syslog-receive', async (req, res) => { }); } - const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19); - const safeDevId = String(devId).replace(/[^a-zA-Z0-9_-]/g, ''); - const filename = `SYSLOG-${safeDevId}-${timestamp}.json`; + const timestampStr = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19); + const safeDevId = String(devId).replace(/[^a-zA-Z0-9_-]/g, ''); + const filename = `SYSLOG-${safeDevId}-${timestampStr}.json`; const filePath = `syslog-inbox/${filename}`; const content = Buffer.from(JSON.stringify(syslog, null, 2)).toString('base64'); diff --git a/scripts/bridge/fetch-broadcast.js b/scripts/bridge/fetch-broadcast.js index 1420573a..5e05326c 100644 --- a/scripts/bridge/fetch-broadcast.js +++ b/scripts/bridge/fetch-broadcast.js @@ -137,7 +137,7 @@ async function getPageTitle(pageId, token) { return props[key].title.map(t => t.plain_text).join(''); } } - return 'Untitled'; + return '未命名广播'; } // ══════════════════════════════════════════════════════════ diff --git a/scripts/bridge/upload-pdf.js b/scripts/bridge/upload-pdf.js index a897d09e..d5f8e071 100644 --- a/scripts/bridge/upload-pdf.js +++ b/scripts/bridge/upload-pdf.js @@ -22,6 +22,7 @@ const fs = require('fs'); const path = require('path'); const OUTPUT_DIR = path.join('data', 'broadcasts', 'pdf'); +const SITE_BASE_URL = 'https://guanghulab.com'; // ══════════════════════════════════════════════════════════ // 上传模式 @@ -49,10 +50,10 @@ async function uploadToServer(pdfFiles) { const filename = path.basename(pdfPath); const destPath = path.join(serverDir, filename); + const downloadUrl = `${SITE_BASE_URL}/broadcasts/${filename}`; if (isCI) { // CI 环境:仅记录,由部署脚本负责实际复制 - const downloadUrl = `https://guanghulab.com/broadcasts/${filename}`; results.push({ ...item, download_url: downloadUrl }); console.log(` 📋 ${filename} → ${downloadUrl} (CI模式·待部署)`); } else { @@ -61,7 +62,6 @@ async function uploadToServer(pdfFiles) { fs.mkdirSync(serverDir, { recursive: true }); } fs.copyFileSync(pdfPath, destPath); - const downloadUrl = `https://guanghulab.com/broadcasts/${filename}`; results.push({ ...item, download_url: downloadUrl }); console.log(` ✅ ${filename} → ${destPath}`); } catch (e) {