diff --git a/package.json b/package.json index a587fdf..6e82cf8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "smartims", "private": true, - "version": "0.2.6", + "version": "0.2.7", "type": "module", "scripts": { "dev": "vite", diff --git a/server/index.js b/server/index.js index b790aef..8ebd75f 100644 --- a/server/index.js +++ b/server/index.js @@ -364,6 +364,9 @@ app.get('/api/health', (req, res) => { res.json({ status: 'ok', version: packageJson.version, + node_version: process.version, + platform: process.platform, + arch: process.arch, timestamp: new Date().toISOString().replace('T', ' ').split('.')[0] }); }); diff --git a/server/package.json b/server/package.json index 4585844..b69a6d5 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "server", - "version": "0.2.6", + "version": "0.2.7", "description": "", "main": "index.js", "scripts": { diff --git a/server/routes/system.js b/server/routes/system.js index a9d911a..dfc5f43 100644 --- a/server/routes/system.js +++ b/server/routes/system.js @@ -435,18 +435,30 @@ router.get('/version/remote', isAuthenticated, hasRole('admin'), async (req, res const currentVersion = packageJson.version; // Run git fetch to update tags from remote - exec('git fetch --tags', (err) => { + exec('git fetch --tags', (err, stdout, stderr) => { if (err) { console.error('Git fetch failed:', err); + console.error('Stderr:', stderr); return res.json({ current: currentVersion, latest: null, - error: '원격 저장소에 연결할 수 없습니다. Git 설정을 확인하세요.' + error: `원격 저장소 동기화 실패: ${stderr || err.message}` }); } - // Get the latest tag - exec('git describe --tags $(git rev-list --tags --max-count=1)', (err, stdout) => { + // Get the latest tag (Simplified for cross-platform compatibility) + // git describe --tags --abbrev=0 is more robust across shells + exec('git describe --tags --abbrev=0', (err, stdout, stderr) => { + if (err) { + console.error('Git describe failed:', err); + return res.json({ + current: currentVersion, + latest: null, + needsUpdate: false, + error: '태그 정보를 찾을 수 없습니다.' + }); + } + const latestTag = stdout ? stdout.trim() : null; res.json({ current: currentVersion, diff --git a/src/platform/pages/VersionPage.tsx b/src/platform/pages/VersionPage.tsx index 8e58abc..18532fb 100644 --- a/src/platform/pages/VersionPage.tsx +++ b/src/platform/pages/VersionPage.tsx @@ -6,6 +6,9 @@ import { Info, Cpu, Database, Server, Hash, Calendar, RefreshCw, AlertTriangle, interface VersionInfo { status: string; version: string; + node_version: string; + platform: string; + arch: string; timestamp: string; } @@ -27,7 +30,8 @@ export function VersionPage() { const fetchVersion = async () => { setLoading(true); try { - const res = await apiClient.get('/health'); + // Add timestamp to prevent caching + const res = await apiClient.get(`/health?t=${Date.now()}`); setHealthInfo(res.data); } catch (err) { console.error('Failed to fetch version info', err); @@ -75,10 +79,14 @@ export function VersionPage() { } }; - // Use values from healthIcon if available, otherwise fallback to local constants - const currentVersion = healthIcon?.version || '0.2.6'; + // Client/Frontend version fixed at build time + const frontendVersion = '0.2.7'; const buildDate = '2026-01-24'; + // Check if update is needed based on frontend version vs remote tag + const needsUpdate = remoteInfo?.latest ? + (remoteInfo.latest.replace(/^v/, '') !== frontendVersion) : false; + return (
@@ -96,8 +104,8 @@ export function VersionPage() {
- {/* Update Alert Banner */} - {remoteInfo?.needsUpdate && !updateResult && ( + {/* Update Alert Banner - Based on Frontend Version comparison */} + {needsUpdate && !updateResult && (
@@ -105,7 +113,7 @@ export function VersionPage() {

새로운 시스템 업데이트가 가능합니다!

-

현재 버전: v{currentVersion} → 최신 버전: {remoteInfo.latest}

+

현재 플랫폼 버전: v{frontendVersion} → 최신 배포 버전: {remoteInfo?.latest}