Skip to content
Merged
16 changes: 16 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2450,6 +2450,13 @@ func (a *App) GetDownloadProgress() string {
return string(data)
}

// CancelDownload cancels the current download
func (a *App) CancelDownload() {
if a.updater != nil {
a.updater.CancelDownload()
}
}

// InstallUpdate installs the downloaded update
func (a *App) InstallUpdate(filePath string) string {
if a.updater == nil {
Expand All @@ -2468,6 +2475,15 @@ func (a *App) InstallUpdate(filePath string) string {
return string(data)
}

// ApplyUpdate 应用更新并退出程序
func (a *App) ApplyUpdate(newExePath string) string {
err := updater.ApplyUpdate(newExePath)
if err != nil {
return fmt.Sprintf(`{"success":false,"error":"%s"}`, err.Error())
}
return `{"success":true,"message":"update_applying"}`
}

// SendUpdateNotification sends a system notification for updates
func (a *App) SendUpdateNotification(title, message string) error {
err := updater.SendNotification(title, message)
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,13 @@ export default {
extractPath: 'File Location',
install_instructions_windows: '1. Close current ccNexus application<br>2. Run the new ccNexus.exe',
install_instructions_macos: '1. Close current ccNexus application<br>2. Drag the new ccNexus.app to Applications folder',
install_instructions_linux: '1. Close current ccNexus application<br>2. Run the new ccNexus executable'
install_instructions_linux: '1. Close current ccNexus application<br>2. Run the new ccNexus executable',
readyToUpdate: 'New version is ready, click the button below to update now',
applyUpdate: 'Update Now',
applying: 'Applying update...',
restartingApp: 'Restarting application...',
applyFailed: 'Failed to apply update',
install_ready_windows: 'Click Update Now button to complete the update automatically'
},
common: {
ok: 'OK',
Expand All @@ -308,7 +314,8 @@ export default {
confirm: 'Confirm',
delete: 'Delete',
confirmDeleteTitle: 'Confirm Deletion',
close: 'Close'
close: 'Close',
retry: 'Retry'
},
tips: [
'Tip: You can add multiple API endpoints for automatic failover',
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/i18n/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,13 @@ export default {
extractPath: '文件位置',
install_instructions_windows: '1. 关闭当前 ccNexus 应用<br>2. 运行新版本的 ccNexus.exe',
install_instructions_macos: '1. 关闭当前 ccNexus 应用<br>2. 将新版本的 ccNexus.app 拖到应用程序文件夹',
install_instructions_linux: '1. 关闭当前 ccNexus 应用<br>2. 运行新版本的 ccNexus 可执行文件'
install_instructions_linux: '1. 关闭当前 ccNexus 应用<br>2. 运行新版本的 ccNexus 可执行文件',
readyToUpdate: '新版本已准备就绪,点击下方按钮立即更新',
applyUpdate: '立即更新',
applying: '正在应用更新...',
restartingApp: '正在重启应用...',
applyFailed: '应用更新失败',
install_ready_windows: '点击立即更新按钮自动完成更新'
},
common: {
ok: '确定',
Expand All @@ -308,7 +314,8 @@ export default {
confirm: '确认',
delete: '删除',
confirmDeleteTitle: '确认删除',
close: '关闭'
close: '关闭',
retry: '重试'
},
tips: [
'小贴士:您可以添加多个 API 端点实现自动故障转移',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/modules/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { t } from '../i18n/index.js';
import { escapeHtml } from '../utils/format.js';
import { addEndpoint, updateEndpoint, removeEndpoint, testEndpoint, updatePort } from './config.js';
import { setTestState, clearTestState } from './endpoints.js';
import { hideAboutBadge } from './updater.js';

let currentEditIndex = -1;

Expand Down Expand Up @@ -365,6 +366,7 @@ export function closePortModal() {
// Welcome Modal
export async function showWelcomeModal() {
document.getElementById('welcomeModal').classList.add('active');
hideAboutBadge();

try {
const version = await window.go.main.App.GetVersion();
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/modules/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ export function initUI() {
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/>
</svg>
</button>
<button class="header-link" onclick="window.showWelcomeModal()" title="${t('header.about')}">
<button class="header-link about-btn" id="aboutBtn" onclick="window.showWelcomeModal()" title="${t('header.about')}">
📖
<span class="update-badge" id="updateBadge"></span>
</button>
<button class="header-link" onclick="window.showSettingsModal()" title="${t('settings.title')}">
⚙️
Expand Down Expand Up @@ -385,8 +386,9 @@ export function initUI() {
<button class="btn btn-secondary" onclick="window.showChangelogModal()">
${t('welcome.changelog')}
</button>
<button class="btn btn-secondary" onclick="window.checkForUpdates()">
<button class="btn btn-secondary check-update-btn" onclick="window.checkForUpdates()">
🔄 ${t('update.checkForUpdates')}
<span class="update-badge" id="checkUpdateBadge"></span>
</button>
</div>
</div>
Expand Down
Loading
Loading