Skip to content

Commit 5db787c

Browse files
committed
#84 electron 을 이용한 데스크톱 앱 개발 : mac 자동업데이트 zip ad-hoc 서명 추가 및 다운로드 시 progressbar 추가
1 parent 0f59ce7 commit 5db787c

8 files changed

Lines changed: 209 additions & 20 deletions

File tree

‎.github/workflows/chatforyou_release_by_tag.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,35 @@ jobs:
5656
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5757
CSC_IDENTITY_AUTO_DISCOVERY: false
5858

59+
- name: Sign macOS ZIP contents (for macOS)
60+
if: matrix.platform == 'mac'
61+
run: |
62+
cd chatforyou-desktop
63+
# Find and sign all .app bundles in ZIP files
64+
for zipfile in dist/*.zip; do
65+
if [ -f "$zipfile" ]; then
66+
echo "Processing ZIP file: $zipfile"
67+
# Create temp directory
68+
temp_dir=$(mktemp -d)
69+
# Extract ZIP
70+
unzip -q "$zipfile" -d "$temp_dir"
71+
# Find .app bundles and sign them
72+
find "$temp_dir" -name "*.app" -type d | while read -r app_path; do
73+
echo "Signing app: $app_path"
74+
codesign --force --deep --sign - "$app_path"
75+
codesign --verify --verbose "$app_path"
76+
done
77+
# Re-create ZIP with signed apps
78+
cd "$temp_dir"
79+
zip -r -q "../$(basename "$zipfile")" .
80+
cd - > /dev/null
81+
mv "$temp_dir/../$(basename "$zipfile")" "$zipfile"
82+
# Cleanup
83+
rm -rf "$temp_dir"
84+
echo "Re-signed ZIP: $zipfile"
85+
fi
86+
done
87+
5988
- name: Upload artifacts
6089
uses: actions/upload-artifact@v4
6190
with:

‎.github/workflows/chatforyou_release_major.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,35 @@ jobs:
9898
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9999
CSC_IDENTITY_AUTO_DISCOVERY: false
100100

101+
- name: Sign macOS ZIP contents (for macOS)
102+
if: matrix.platform == 'mac'
103+
run: |
104+
cd chatforyou-desktop
105+
# Find and sign all .app bundles in ZIP files
106+
for zipfile in dist/*.zip; do
107+
if [ -f "$zipfile" ]; then
108+
echo "Processing ZIP file: $zipfile"
109+
# Create temp directory
110+
temp_dir=$(mktemp -d)
111+
# Extract ZIP
112+
unzip -q "$zipfile" -d "$temp_dir"
113+
# Find .app bundles and sign them
114+
find "$temp_dir" -name "*.app" -type d | while read -r app_path; do
115+
echo "Signing app: $app_path"
116+
codesign --force --deep --sign - "$app_path"
117+
codesign --verify --verbose "$app_path"
118+
done
119+
# Re-create ZIP with signed apps
120+
cd "$temp_dir"
121+
zip -r -q "../$(basename "$zipfile")" .
122+
cd - > /dev/null
123+
mv "$temp_dir/../$(basename "$zipfile")" "$zipfile"
124+
# Cleanup
125+
rm -rf "$temp_dir"
126+
echo "Re-signed ZIP: $zipfile"
127+
fi
128+
done
129+
101130
- name: Upload artifacts
102131
uses: actions/upload-artifact@v4
103132
with:

‎chatforyou-desktop/auto-update/update_popup.html‎

Lines changed: 135 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,25 +103,97 @@
103103

104104
.progress-bar {
105105
width: 100%;
106-
height: 8px;
106+
height: 12px;
107107
background: #e9ecef;
108-
border-radius: 4px;
108+
border-radius: 6px;
109109
overflow: hidden;
110-
margin-bottom: 10px;
110+
margin-bottom: 15px;
111+
position: relative;
112+
box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
111113
}
112114

113115
.progress-fill {
114116
height: 100%;
115117
background: linear-gradient(90deg, #667eea, #764ba2);
116118
width: 0%;
117-
transition: width 0.3s ease;
119+
transition: width 0.5s ease;
120+
position: relative;
121+
overflow: hidden;
122+
}
123+
124+
.progress-fill::after {
125+
content: '';
126+
position: absolute;
127+
top: 0;
128+
left: 0;
129+
bottom: 0;
130+
right: 0;
131+
background: linear-gradient(
132+
90deg,
133+
transparent,
134+
rgba(255,255,255,0.2),
135+
transparent
136+
);
137+
animation: shimmer 2s infinite;
138+
}
139+
140+
@keyframes shimmer {
141+
0% { transform: translateX(-100%); }
142+
100% { transform: translateX(100%); }
143+
}
144+
145+
.progress-info {
146+
display: grid;
147+
grid-template-columns: 1fr auto;
148+
gap: 10px;
149+
font-size: 13px;
150+
color: #666;
151+
margin-bottom: 10px;
152+
}
153+
154+
.progress-details {
155+
display: grid;
156+
grid-template-columns: 1fr 1fr 1fr;
157+
gap: 15px;
158+
text-align: center;
159+
padding: 10px 0;
160+
border-top: 1px solid #eee;
161+
margin-top: 10px;
162+
}
163+
164+
.progress-detail-item {
165+
display: flex;
166+
flex-direction: column;
167+
align-items: center;
168+
}
169+
170+
.progress-detail-label {
171+
font-size: 11px;
172+
color: #999;
173+
text-transform: uppercase;
174+
letter-spacing: 0.5px;
175+
margin-bottom: 4px;
176+
}
177+
178+
.progress-detail-value {
179+
font-size: 14px;
180+
font-weight: 600;
181+
color: #2c3e50;
182+
font-family: 'Courier New', monospace;
118183
}
119184

120185
.progress-text {
121186
font-size: 14px;
122187
color: #666;
123188
display: flex;
124189
justify-content: space-between;
190+
align-items: center;
191+
}
192+
193+
.progress-percent {
194+
font-weight: 600;
195+
color: #667eea;
196+
font-size: 16px;
125197
}
126198

127199
.button-group {
@@ -275,12 +347,26 @@ <h4>새로운 기능</h4>
275347
<div class="status-message" id="statusMessage"></div>
276348

277349
<div class="progress-section" id="progressSection">
350+
<div class="progress-info">
351+
<span id="progressText">다운로드 준비 중...</span>
352+
<span class="progress-percent" id="progressPercent">0%</span>
353+
</div>
278354
<div class="progress-bar">
279355
<div class="progress-fill" id="progressFill"></div>
280356
</div>
281-
<div class="progress-text">
282-
<span id="progressText">다운로드 중...</span>
283-
<span id="progressPercent">0%</span>
357+
<div class="progress-details">
358+
<div class="progress-detail-item">
359+
<div class="progress-detail-label">속도</div>
360+
<div class="progress-detail-value" id="downloadSpeed">0 MB/s</div>
361+
</div>
362+
<div class="progress-detail-item">
363+
<div class="progress-detail-label">남은 시간</div>
364+
<div class="progress-detail-value" id="timeRemaining">계산 중...</div>
365+
</div>
366+
<div class="progress-detail-item">
367+
<div class="progress-detail-label">파일 크기</div>
368+
<div class="progress-detail-value" id="fileSize">0 MB</div>
369+
</div>
284370
</div>
285371
</div>
286372

@@ -385,14 +471,54 @@ <h4>새로운 기능</h4>
385471
const progressFill = document.getElementById('progressFill');
386472
const progressPercent = document.getElementById('progressPercent');
387473
const progressText = document.getElementById('progressText');
474+
const downloadSpeed = document.getElementById('downloadSpeed');
475+
const timeRemaining = document.getElementById('timeRemaining');
476+
const fileSize = document.getElementById('fileSize');
388477

389478
const percent = Math.round(data.percent || 0);
390479
progressFill.style.width = percent + '%';
391480
progressPercent.textContent = percent + '%';
392481

482+
// 다운로드 속도 표시
393483
if (data.bytesPerSecond) {
394-
const speed = (data.bytesPerSecond / 1024 / 1024).toFixed(1);
395-
progressText.textContent = `다운로드 중... ${speed} MB/s`;
484+
const speedMB = (data.bytesPerSecond / 1024 / 1024).toFixed(1);
485+
downloadSpeed.textContent = `${speedMB} MB/s`;
486+
487+
// 남은 시간 계산
488+
if (data.total && data.transferred && data.bytesPerSecond > 0) {
489+
const remainingBytes = data.total - data.transferred;
490+
const remainingSeconds = remainingBytes / data.bytesPerSecond;
491+
timeRemaining.textContent = this.formatTime(remainingSeconds);
492+
}
493+
} else {
494+
downloadSpeed.textContent = '0 MB/s';
495+
}
496+
497+
// 파일 크기 표시
498+
if (data.total) {
499+
const totalMB = (data.total / 1024 / 1024).toFixed(1);
500+
fileSize.textContent = `${totalMB} MB`;
501+
}
502+
503+
// 상태 텍스트 업데이트
504+
if (percent > 0) {
505+
progressText.textContent = '다운로드 중...';
506+
} else {
507+
progressText.textContent = '다운로드 시작 중...';
508+
}
509+
}
510+
511+
formatTime(seconds) {
512+
if (seconds < 60) {
513+
return `${Math.round(seconds)}초`;
514+
} else if (seconds < 3600) {
515+
const minutes = Math.floor(seconds / 60);
516+
const remainingSeconds = Math.round(seconds % 60);
517+
return `${minutes}분 ${remainingSeconds}초`;
518+
} else {
519+
const hours = Math.floor(seconds / 3600);
520+
const minutes = Math.floor((seconds % 3600) / 60);
521+
return `${hours}시간 ${minutes}분`;
396522
}
397523
}
398524

‎chatforyou-desktop/package.json‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chatforyou-desktop",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "ChatForYou Desktop Application built with Electron",
55
"main": "src/main/electron-main.js",
66
"scripts": {
@@ -91,7 +91,12 @@
9191
],
9292
"icon": "src/static/images/logo/chatforyou_logo_512.png",
9393
"entitlements": "build/entitlements.mac.plist",
94-
"entitlementsInherit": "build/entitlements.mac.inherit.plist"
94+
"entitlementsInherit": "build/entitlements.mac.inherit.plist",
95+
"extendInfo": {
96+
"NSAppleEventsUsageDescription": "ChatForYou가 시스템 이벤트에 접근하여 원활한 업데이트를 제공합니다.",
97+
"NSCameraUsageDescription": "ChatForYou가 화상 채팅을 위해 카메라에 접근합니다.",
98+
"NSMicrophoneUsageDescription": "ChatForYou가 음성 채팅을 위해 마이크에 접근합니다."
99+
}
95100
},
96101
"win": {
97102
"target": {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"syncedAt": "2025-08-01T13:01:05.362Z",
3-
"sourceCommit": "49186713",
4-
"version": "0.1.4",
2+
"syncedAt": "2025-08-01T13:25:28.351Z",
3+
"sourceCommit": "0f59ce77",
4+
"version": "0.1.5",
55
"environment": "prod"
66
}

‎chatforyou-desktop/src/config/config.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ChatForYou Electron Configuration
2-
// Auto-generated from web config on 2025-08-01T13:01:05.362Z
2+
// Auto-generated from web config on 2025-08-01T13:25:28.351Z
33

44
window.__CONFIG__ = {
55
"API_BASE_URL": "https://hjproject.kro.kr/chatforyou/api",
@@ -13,7 +13,7 @@ window.__CONFIG__ = {
1313
"APP_VERSION": "1.0.0",
1414
"PLATFORM_TYPE": "desktop",
1515
"CONVERTED_FROM": "web",
16-
"CONVERSION_DATE": "2025-08-01T13:01:05.362Z"
16+
"CONVERSION_DATE": "2025-08-01T13:25:28.351Z"
1717
};
1818

1919
// Electron specific utilities

‎chatforyou-desktop/src/config/config.local.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ChatForYou Electron Configuration
2-
// Auto-generated from web config on 2025-08-01T13:01:05.361Z
2+
// Auto-generated from web config on 2025-08-01T13:25:28.351Z
33

44
window.__CONFIG__ = {
55
"API_BASE_URL": "http://localhost:8080/chatforyou/api",
@@ -13,7 +13,7 @@ window.__CONFIG__ = {
1313
"APP_VERSION": "1.0.0",
1414
"PLATFORM_TYPE": "desktop",
1515
"CONVERTED_FROM": "web",
16-
"CONVERSION_DATE": "2025-08-01T13:01:05.361Z"
16+
"CONVERSION_DATE": "2025-08-01T13:25:28.351Z"
1717
};
1818

1919
// Electron specific utilities

‎chatforyou-desktop/src/config/config.prod.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ChatForYou Electron Configuration
2-
// Auto-generated from web config on 2025-08-01T13:01:05.361Z
2+
// Auto-generated from web config on 2025-08-01T13:25:28.351Z
33

44
window.__CONFIG__ = {
55
"API_BASE_URL": "https://hjproject.kro.kr/chatforyou/api",
@@ -13,7 +13,7 @@ window.__CONFIG__ = {
1313
"APP_VERSION": "1.0.0",
1414
"PLATFORM_TYPE": "desktop",
1515
"CONVERTED_FROM": "web",
16-
"CONVERSION_DATE": "2025-08-01T13:01:05.361Z"
16+
"CONVERSION_DATE": "2025-08-01T13:25:28.351Z"
1717
};
1818

1919
// Electron specific utilities

0 commit comments

Comments
 (0)