릴리즈 v0.3.0: 윈도우 호환성 패치 및 업데이트 UI(카운트다운) 개선

This commit is contained in:
choibk 2026-01-24 20:54:33 +09:00
parent 3c657d90e9
commit 98cb8e13fa
4 changed files with 49 additions and 17 deletions

View File

@ -1,7 +1,7 @@
{
"name": "smartims",
"private": true,
"version": "0.2.9",
"version": "0.3.0",
"type": "module",
"scripts": {
"dev": "vite",

View File

@ -1,6 +1,6 @@
{
"name": "server",
"version": "0.2.9",
"version": "0.3.0",
"description": "",
"main": "index.js",
"scripts": {

View File

@ -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.');

View File

@ -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() {
<div className="space-y-4">
{[
{
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',