From 98cb8e13fa223f9b628fa69715ea2547aef73a45 Mon Sep 17 00:00:00 2001 From: choibk Date: Sat, 24 Jan 2026 20:54:33 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A6=B4=EB=A6=AC=EC=A6=88=20v0.3.0:=20?= =?UTF-8?q?=EC=9C=88=EB=8F=84=EC=9A=B0=20=ED=98=B8=ED=99=98=EC=84=B1=20?= =?UTF-8?q?=ED=8C=A8=EC=B9=98=20=EB=B0=8F=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20UI(=EC=B9=B4=EC=9A=B4=ED=8A=B8=EB=8B=A4=EC=9A=B4)?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- server/package.json | 2 +- server/routes/system.js | 20 +++++--------- src/platform/pages/VersionPage.tsx | 42 ++++++++++++++++++++++++++++-- 4 files changed, 49 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index cbbd848..63fe24b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "smartims", "private": true, - "version": "0.2.9", + "version": "0.3.0", "type": "module", "scripts": { "dev": "vite", diff --git a/server/package.json b/server/package.json index a8d233a..66df0a0 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "server", - "version": "0.2.9", + "version": "0.3.0", "description": "", "main": "index.js", "scripts": { diff --git a/server/routes/system.js b/server/routes/system.js index 78529de..5b41cf3 100644 --- a/server/routes/system.js +++ b/server/routes/system.js @@ -541,27 +541,21 @@ router.post('/version/update', isAuthenticated, hasRole('admin'), async (req, re authPrefix = `git remote set-url origin ${auth.url} && `; } - const updateScript = ` - ${authPrefix} - git fetch --tags && - git checkout ${targetTag} && - npm install && - npm run build && - cd server && - npm install && - pm2 reload smartims-api - `; + const updateScript = `${authPrefix} git fetch --tags --force && git checkout -f ${targetTag} && npm install && npm run build && cd server && npm install && pm2 reload smartims-api`; - // Note: On Windows, we might need a different script or use a shell + // Note: On Windows, use cmd.exe /c which supports '&&' better than default PowerShell const isWindows = process.platform === 'win32'; - const shellCommand = isWindows ? `powershell.exe -Command "${updateScript.replace(/\n/g, '')}"` : updateScript; + const shellCommand = isWindows ? `cmd.exe /c "${updateScript}"` : updateScript; console.log(`πŸš€ Starting system update to ${targetTag}...`); + console.log(`Executing: ${shellCommand}`); exec(shellCommand, { cwd: path.join(__dirname, '../..') }, (err, stdout, stderr) => { if (err) { console.error('❌ Update Failed:', err); - console.error(stderr); + // Sanitize output for logs + const sanitizedErr = stderr.replace(/:[^@]+@/g, ':****@'); + console.error(sanitizedErr); return; } console.log('βœ… Update completed successfully.'); diff --git a/src/platform/pages/VersionPage.tsx b/src/platform/pages/VersionPage.tsx index 18532fb..a730431 100644 --- a/src/platform/pages/VersionPage.tsx +++ b/src/platform/pages/VersionPage.tsx @@ -65,22 +65,39 @@ export function VersionPage() { } setUpdating(true); + setUpdateResult(null); + try { const res = await apiClient.post('/system/version/update', { targetTag: remoteInfo.latest }); setUpdateResult({ success: true, message: res.data.message }); + + // Success: Wait a bit for server to settle, then refresh + let countdown = 5; + const timer = setInterval(() => { + countdown -= 1; + if (countdown <= 0) { + clearInterval(timer); + window.location.reload(); + } else { + setUpdateResult({ + success: true, + message: `${res.data.message} (${countdown}초 ν›„ νŽ˜μ΄μ§€κ°€ μƒˆλ‘œκ³ μΉ¨λ©λ‹ˆλ‹€.)` + }); + } + }, 1000); + } catch (err: any) { console.error('Update failed', err); setUpdateResult({ success: false, message: err.response?.data?.error || 'μ—…λ°μ΄νŠΈ μš”μ²­ 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.' }); - } finally { setUpdating(false); } }; // Client/Frontend version fixed at build time - const frontendVersion = '0.2.7'; + const frontendVersion = '0.3.0'; const buildDate = '2026-01-24'; // Check if update is needed based on frontend version vs remote tag @@ -232,6 +249,27 @@ export function VersionPage() {
{[ + { + version: '0.3.0', + date: '2026-01-24', + title: 'μ‹œμŠ€ν…œ μ—…λ°μ΄νŠΈ μ—”μ§„ ν˜Έν™˜μ„± 및 UI κ°œμ„ ', + changes: [ + 'Windows ν™˜κ²½(CMD)μ—μ„œλ„ μžλ™ μ—…λ°μ΄νŠΈκ°€ μž‘λ™ν•˜λ„λ‘ μ‰˜ ν˜Έν™˜μ„± 패치', + 'μ—…λ°μ΄νŠΈ 성곡 μ‹œ 5초 μΉ΄μš΄νŠΈλ‹€μš΄ ν›„ μžλ™ νŽ˜μ΄μ§€ μƒˆλ‘œκ³ μΉ¨ κΈ°λŠ₯ μΆ”κ°€', + 'Gitea μ„€μ • μ‹œ λΈŒλΌμš°μ € 계정 μžλ™ μ™„μ„±(Auto-fill) λ°©μ§€ 둜직 적용' + ], + type: 'fix' + }, + { + version: '0.2.8', + date: '2026-01-24', + title: 'CCTV λͺ¨λ“ˆ 관리 κΆŒν•œ κ°•ν™”', + changes: [ + 'Supervisor 계정도 CCTV μΆ”κ°€, μ„€μ •, μ‚­μ œκ°€ κ°€λŠ₯ν•˜λ„λ‘ κΆŒν•œ ν™•μž₯', + '카메라 λ“œλž˜κ·Έ μ•€ λ“œλ‘­ μˆœμ„œ λ³€κ²½ κΆŒν•œ 보완' + ], + type: 'fix' + }, { version: '0.2.7', date: '2026-01-24',