버전 관리 시스템 최종 안정화: 안내 배너 로직 및 가시성 문제 해결 (v0.4.0.1)

This commit is contained in:
choibk 2026-01-25 01:47:14 +09:00
parent 76f5bdc263
commit 68c25928e1
4 changed files with 40 additions and 49 deletions

View File

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

View File

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

View File

@ -548,10 +548,11 @@ router.get('/version/remote', isAuthenticated, hasRole('admin'), async (req, res
// Filter 1: History is ONLY versions <= current
const history = allTags.filter(t => compare(t.version, currentVersion) <= 0);
// Filter 2: Latest is the absolute newest tag available (could be > current)
const latestFromRemote = allTags[0] || null;
const needsUpdate = latestFromRemote ? (compare(latestFromRemote.version, currentVersion) > 0) : false;
console.log(`[VersionCheck] Current: "${currentVersion}", LatestTag: "${latestFromRemote?.version}", NeedsUpdate: ${needsUpdate}`);
res.json({
current: currentVersion,
latest: latestFromRemote ? `v${latestFromRemote.version}` : null,

View File

@ -113,11 +113,11 @@ export function VersionPage() {
};
// Source of truth for versioning comes from the API
const currentVersion = remoteInfo?.current || '0.4.0';
const currentVersion = remoteInfo?.current || healthIcon?.version || '0.4.0.0';
const buildDate = '2026-01-25';
// Check if update is needed based on API-supplied needsUpdate flag
const needsUpdate = remoteInfo?.needsUpdate || false;
// IMPORTANT: needsUpdate should be true if remote has a higher version than local
const needsUpdate = !!remoteInfo?.needsUpdate;
return (
<div className="page-container p-6 max-w-4xl mx-auto">
@ -136,52 +136,42 @@ export function VersionPage() {
</button>
</div>
{/* Update Alert Banner - Based on Frontend Version comparison */}
{needsUpdate && !updateResult && (
<div className={`mb-8 p-0 border rounded-xl overflow-hidden animate-in fade-in slide-in-from-top-4 duration-500 shadow-lg ${remoteInfo?.latestInfo?.type === 'urgent' ? 'border-red-200 bg-red-50' : 'border-amber-200 bg-amber-50'}`}>
<div className="p-5 flex flex-col md:flex-row md:items-center justify-between gap-4">
<div className="flex items-start gap-3">
<div className={`p-2 rounded-lg mt-0.5 ${remoteInfo?.latestInfo?.type === 'urgent' ? 'bg-red-100 text-red-600' : 'bg-amber-100 text-amber-600'}`}>
<AlertTriangle size={20} />
{/* Debug Info (Visible only for investigation) */}
<div className="mb-4 p-2 bg-slate-100 rounded text-[10px] text-slate-500 font-mono">
[Debug] Current: {currentVersion}, Latest: {remoteInfo?.latest}, NeedsUpdate: {String(needsUpdate)}, LatestInfo: {remoteInfo?.latestInfo ? 'Yes' : 'No'}
</div>
<div>
<div className="flex items-center gap-2 mb-1">
<h4 className={`font-black text-lg ${remoteInfo?.latestInfo?.type === 'urgent' ? 'text-red-900' : 'text-amber-900'}`}>
{remoteInfo?.latestInfo?.type === 'urgent' ? '🚨 긴급 보안/시스템 업데이트 발견' : '✨ 새로운 업데이트가 가능합니다'}
{/* Update Alert Banner - Enhanced Visibility */}
{needsUpdate && !updateResult && remoteInfo?.latestInfo && (
<div className={`mb-8 p-6 border-2 rounded-2xl shadow-xl flex flex-col md:flex-row items-center justify-between gap-6 ${remoteInfo.latestInfo.type === 'urgent' ? 'border-red-400 bg-red-50' : 'border-indigo-400 bg-indigo-50'}`}>
<div className="flex items-start gap-4">
<div className={`p-3 rounded-xl ${remoteInfo.latestInfo.type === 'urgent' ? 'bg-red-500 text-white' : 'bg-indigo-600 text-white'}`}>
<AlertTriangle size={24} />
</div>
<div className="space-y-1">
<div className="flex items-center gap-2">
<h4 className="text-xl font-black text-slate-900 leading-tight">
{remoteInfo.latestInfo.type === 'urgent' ? '신속한 시스템 업데이트가 필요합니다' : '새로운 플랫폼 기능이 준비되었습니다'}
</h4>
<span className={`px-2 py-0.5 rounded text-[10px] font-black uppercase tracking-wider ${remoteInfo?.latestInfo?.type === 'urgent' ? 'bg-red-600 text-white' : 'bg-amber-600 text-white'}`}>
{remoteInfo?.latestInfo?.type || 'patch'}
<span className={`px-2 py-0.5 rounded text-[10px] font-black uppercase tracking-wider ${remoteInfo.latestInfo.type === 'urgent' ? 'bg-red-600 text-white' : 'bg-indigo-600 text-white'}`}>
{remoteInfo.latestInfo.type}
</span>
</div>
<p className={`text-sm font-medium ${remoteInfo?.latestInfo?.type === 'urgent' ? 'text-red-700' : 'text-amber-700'}`}>
버전: v{currentVersion} : <span className="font-black underline underline-offset-4">{remoteInfo?.latest}</span>
<p className="text-slate-600 font-medium text-sm">
현재: v{currentVersion} <span className="mx-2"></span> : <span className="font-black text-indigo-700 underline underline-offset-4">{remoteInfo.latest}</span>
</p>
{remoteInfo?.latestInfo && (
<div className={`mt-3 p-3 rounded-lg border text-xs leading-relaxed ${remoteInfo?.latestInfo?.type === 'urgent' ? 'bg-white/50 border-red-100 text-red-800' : 'bg-white/50 border-amber-100 text-amber-800'}`}>
<p className="font-bold mb-1">[{remoteInfo.latestInfo.title}]</p>
<ul className="space-y-1 opacity-80">
{remoteInfo.latestInfo.changes.slice(0, 3).map((c, i) => (
<li key={i} className="flex items-start gap-1.5">
<span className="mt-1 w-1 h-1 rounded-full bg-current opacity-50 shrink-0"></span>
<span>{c}</span>
</li>
))}
{remoteInfo.latestInfo.changes.length > 3 && <li>... {remoteInfo.latestInfo.changes.length - 3}</li>}
</ul>
</div>
)}
</div>
</div>
<button
onClick={handleUpdate}
disabled={updating}
className={`px-6 py-3 rounded-xl font-black text-base transition-all shadow-md active:scale-95 disabled:opacity-50 flex items-center justify-center gap-2 whitespace-nowrap min-w-[160px] ${remoteInfo?.latestInfo?.type === 'urgent' ? 'bg-red-600 text-white hover:bg-red-700' : 'bg-amber-600 text-white hover:bg-amber-700'}`}
className={`px-8 py-4 rounded-xl font-black text-lg transition-all shadow-lg hover:scale-105 active:scale-95 disabled:opacity-50 flex items-center gap-2 whitespace-nowrap min-w-[180px] shadow-indigo-200 ${remoteInfo.latestInfo.type === 'urgent' ? 'bg-red-600 text-white hover:bg-red-700' : 'bg-indigo-600 text-white hover:bg-slate-900'}`}
>
{updating ? <RefreshCw size={20} className="animate-spin" /> : null}
{updating ? '업데이트 중...' : '지금 업데이트'}
{updating ? <RefreshCw size={22} className="animate-spin" /> : null}
{updating ? '설치 중...' : '지금 업데이트'}
</button>
</div>
</div>
)}
{/* Update Result Message */}