小调整。

pull/303/head
王良 2024-04-23 16:23:14 +08:00
parent 1bd12d3b6e
commit ec1b90882a
2 changed files with 6 additions and 7 deletions

View File

@ -78,7 +78,6 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
// 检查更新
const releasesApiUrl = 'https://api.github.com/repos/docmirror/dev-sidecar/releases'
async function checkForUpdatesFromGitHub () {
log.info('DevSidecar.api.config.app.skipPreRelease:', DevSidecar.api.config.get().app.skipPreRelease)
request(releasesApiUrl, { headers: { 'User-Agent': 'DS/' + pkg.version } }, (error, response, body) => {
try {
if (error) {
@ -109,7 +108,7 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
return
}
log.info('github api返回的release数据', JSON.stringify(data, null, '\t'))
// log.info('github api返回的release数据', JSON.stringify(data, null, '\t'))
// 检查更新
for (let i = 0; i < data.length; i++) {
@ -118,7 +117,7 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
if (!versionData.assets || versionData.assets.length === 0) {
continue // 跳过空版本,即上传过安装包
}
if (DevSidecar.api.config.app.skipPreRelease && versionData.name.indexOf('Pre-release') >= 0) {
if (DevSidecar.api.config.get().app.skipPreRelease && versionData.name.indexOf('Pre-release') >= 0) {
continue // 跳过预发布版本
}
@ -134,9 +133,7 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
key: 'available',
value: {
version: versionData.tag_name,
releaseNotes: [
'请查看发布公告:' + versionData.html_url
]
releaseNotes: '发布公告:' + (versionData.html_url || ('https://github.com/docmirror/dev-sidecar/releases/tag/' + versionData.tag_name))
}
})
} else {

View File

@ -68,6 +68,7 @@ function install (app, api) {
title: '暂不提供自动升级',
cancelText: '取消',
okText: '确定',
width: 420,
content: h => {
function openGithubUrl () {
api.ipc.openExternal('https://github.com/docmirror/dev-sidecar/releases')
@ -129,10 +130,11 @@ function install (app, api) {
title: '发现新版本:' + value.version,
cancelText: '暂不升级',
okText: '升级',
width: 710,
content: h => {
if (value.releaseNotes) {
if (typeof value.releaseNotes === 'string') {
return <div><div>更新内容</div><div>{value.releaseNotes}</div></div>
return <div>{value.releaseNotes}</div>
} else {
const notes = []
for (const note of value.releaseNotes) {