mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-30 04:40:18 +08:00
chore(release): v0.13.3
- 修复 #212 AI 消息气泡空白 - 修复 #215 HTTPS 下 WebSocket Mixed Content - 修复 #219 多实例版本检测错误 - 修复引擎切换后仪表盘无限加载 - 修复热更新假更新循环(macOS/Linux) - CI release 构建前自动同步版本号
This commit is contained in:
32
src/main.js
32
src/main.js
@@ -813,6 +813,9 @@ async function checkGlobalUpdate() {
|
||||
if (dismissed === ver) return
|
||||
|
||||
const changelog = info.manifest?.changelog || ''
|
||||
const canHotUpdate = isTauriRuntime()
|
||||
&& info.manifest?.downloadUrl
|
||||
&& info.manifest?.hash
|
||||
|
||||
banner.classList.remove('update-banner-hidden')
|
||||
banner.innerHTML = `
|
||||
@@ -822,6 +825,7 @@ async function checkGlobalUpdate() {
|
||||
<span class="update-banner-ver">${t('about.versionAvailable', { version: ver })}</span>
|
||||
${changelog ? `<span class="update-banner-changelog">· ${changelog}</span>` : ''}
|
||||
</div>
|
||||
${canHotUpdate ? `<button class="btn btn-sm btn-primary" id="btn-hot-update">${t('about.hotUpdateNow')}</button>` : ''}
|
||||
<a class="btn btn-sm" href="https://claw.qt.cool" target="_blank" rel="noopener">${t('about.downloadFromWebsite')}</a>
|
||||
<a class="btn btn-sm" href="https://github.com/qingchencloud/clawpanel/releases" target="_blank" rel="noopener">${t('about.downloadFromGitHub')}</a>
|
||||
<button class="update-banner-close" id="btn-update-dismiss" title="${t('about.dismissVersion')}">✕</button>
|
||||
@@ -833,6 +837,34 @@ async function checkGlobalUpdate() {
|
||||
localStorage.setItem('clawpanel_update_dismissed', ver)
|
||||
banner.classList.add('update-banner-hidden')
|
||||
})
|
||||
|
||||
// 热更新按钮
|
||||
const hotUpdateBtn = banner.querySelector('#btn-hot-update')
|
||||
if (hotUpdateBtn && canHotUpdate) {
|
||||
hotUpdateBtn.addEventListener('click', async () => {
|
||||
hotUpdateBtn.disabled = true
|
||||
hotUpdateBtn.textContent = t('about.hotUpdateDownloading')
|
||||
try {
|
||||
await api.downloadFrontendUpdate(
|
||||
info.manifest.downloadUrl,
|
||||
info.manifest.hash,
|
||||
ver
|
||||
)
|
||||
hotUpdateBtn.style.display = 'none'
|
||||
toast(t('about.hotUpdateDone'), 'success')
|
||||
// 在 banner 中插入重启按钮
|
||||
const rebootBtn = document.createElement('button')
|
||||
rebootBtn.className = 'btn btn-sm btn-primary'
|
||||
rebootBtn.textContent = t('about.restartApp')
|
||||
rebootBtn.onclick = () => api.relaunchApp().catch(() => {})
|
||||
banner.querySelector('.update-banner-text').after(rebootBtn)
|
||||
} catch (err) {
|
||||
hotUpdateBtn.disabled = false
|
||||
hotUpdateBtn.textContent = t('about.hotUpdateNow')
|
||||
toast(t('about.hotUpdateFailed') + ': ' + (err.message || err), 'error')
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch {
|
||||
// 检查失败静默忽略
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user