发现新版本后的更新内容展示优化。
parent
6f52440ab9
commit
623fc19f09
|
@ -134,7 +134,9 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
key: 'available',
|
key: 'available',
|
||||||
value: {
|
value: {
|
||||||
version,
|
version,
|
||||||
releaseNotes: '发布公告:' + (versionData.html_url || ('https://github.com/docmirror/dev-sidecar/releases/tag/' + versionData.tag_name))
|
releaseNotes: versionData.body
|
||||||
|
? (versionData.body.replace(/\r\n/g, '\n').replace(/https:\/\/github.com\/docmirror\/dev-sidecar/g, '').replace(/(?<=(^|\n))[ \t]*[ #]+/g, '') || '无')
|
||||||
|
: '无'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -144,17 +144,31 @@ function install (app, api) {
|
||||||
title: '发现新版本:v' + value.version,
|
title: '发现新版本:v' + value.version,
|
||||||
cancelText: '暂不升级',
|
cancelText: '暂不升级',
|
||||||
okText: '升级',
|
okText: '升级',
|
||||||
width: 710,
|
width: 550,
|
||||||
content: h => {
|
content: h => {
|
||||||
if (value.releaseNotes) {
|
if (value.releaseNotes) {
|
||||||
|
const notes = []
|
||||||
if (typeof value.releaseNotes === 'string') {
|
if (typeof value.releaseNotes === 'string') {
|
||||||
return <div>{value.releaseNotes}</div>
|
const releaseNotes = value.releaseNotes.replace(/\r?\n/g, '\n').split('\n')
|
||||||
|
for (const note of releaseNotes) {
|
||||||
|
notes.push(<div>{note}</div>)
|
||||||
|
}
|
||||||
|
return <div>
|
||||||
|
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
||||||
|
<div>更新内容:</div>
|
||||||
|
<div style="max-height:350px;overflow-y:auto">
|
||||||
|
{notes}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
} else {
|
} else {
|
||||||
const notes = []
|
|
||||||
for (const note of value.releaseNotes) {
|
for (const note of value.releaseNotes) {
|
||||||
notes.push(<li>{note}</li>)
|
notes.push(<li>{note}</li>)
|
||||||
}
|
}
|
||||||
return <div><div>更新内容:</div><ol>{notes}</ol></div>
|
return <div>
|
||||||
|
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
||||||
|
<div>更新内容:</div>
|
||||||
|
<ol>{notes}</ol>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -175,16 +189,31 @@ function install (app, api) {
|
||||||
title: `新版本(v${value.version})已准备好,是否立即升级?`,
|
title: `新版本(v${value.version})已准备好,是否立即升级?`,
|
||||||
cancelText: '暂不升级',
|
cancelText: '暂不升级',
|
||||||
okText: '立即升级',
|
okText: '立即升级',
|
||||||
|
width: 550,
|
||||||
content: h => {
|
content: h => {
|
||||||
if (value.releaseNotes) {
|
if (value.releaseNotes) {
|
||||||
|
const notes = []
|
||||||
if (typeof value.releaseNotes === 'string') {
|
if (typeof value.releaseNotes === 'string') {
|
||||||
return <div>{value.releaseNotes}</div>
|
const releaseNotes = value.releaseNotes.replace(/\r?\n/g, '\n').split('\n')
|
||||||
|
for (const note of releaseNotes) {
|
||||||
|
notes.push(<div>{note}</div>)
|
||||||
|
}
|
||||||
|
return <div>
|
||||||
|
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
||||||
|
<div>更新内容:</div>
|
||||||
|
<div style="max-height:350px;overflow-y:auto">
|
||||||
|
{notes}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
} else {
|
} else {
|
||||||
const notes = []
|
|
||||||
for (const note of value.releaseNotes) {
|
for (const note of value.releaseNotes) {
|
||||||
notes.push(<li>{note}</li>)
|
notes.push(<li>{note}</li>)
|
||||||
}
|
}
|
||||||
return <div><div>更新内容:</div><ol>{notes}</ol></div>
|
return <div>
|
||||||
|
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
||||||
|
<div>更新内容:</div>
|
||||||
|
<ol>{notes}</ol>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue