忽略预发布版本功能,只对正式版本生效。
parent
371fe4f735
commit
654f6dc503
|
@ -14,6 +14,9 @@ import DevSidecar from '@docmirror/dev-sidecar'
|
|||
const isMac = process.platform === 'darwin'
|
||||
const isLinux = process.platform === 'linux'
|
||||
|
||||
const curVersion = pkg.version
|
||||
const isPreRelease = curVersion.includes('-')
|
||||
|
||||
function downloadFile (uri, filePath, onProgress, onSuccess, onError) {
|
||||
log.info('download url', uri)
|
||||
progress(request(uri), {
|
||||
|
@ -78,7 +81,7 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
|||
// 检查更新
|
||||
const releasesApiUrl = 'https://api.github.com/repos/docmirror/dev-sidecar/releases'
|
||||
async function checkForUpdatesFromGitHub () {
|
||||
request(releasesApiUrl, { headers: { 'User-Agent': 'DS/' + pkg.version } }, (error, response, body) => {
|
||||
request(releasesApiUrl, { headers: { 'User-Agent': 'DS/' + curVersion } }, (error, response, body) => {
|
||||
try {
|
||||
if (error) {
|
||||
log.error('检查更新失败:', error)
|
||||
|
@ -118,17 +121,17 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
|||
if (!versionData.assets || versionData.assets.length === 0) {
|
||||
continue // 跳过空版本,即上传过安装包
|
||||
}
|
||||
if (DevSidecar.api.config.get().app.skipPreRelease && versionData.name.indexOf('Pre-release') >= 0) {
|
||||
if (!isPreRelease && DevSidecar.api.config.get().app.skipPreRelease && versionData.name.includes('-')) {
|
||||
continue // 跳过预发布版本
|
||||
}
|
||||
|
||||
// log.info('最近正式版本数据:', versionData)
|
||||
|
||||
let version = versionData.tag_name
|
||||
let version = versionData.name
|
||||
if (version.indexOf('v') === 0) {
|
||||
version = version.substring(1)
|
||||
}
|
||||
if (version !== pkg.version) {
|
||||
if (version !== curVersion) {
|
||||
log.info('检查更新-发现新版本:', version)
|
||||
win.webContents.send('update', {
|
||||
key: 'available',
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
不忽略
|
||||
</a-radio-button>
|
||||
<div class="form-help">
|
||||
预发布版本为版本号带有 “Pre-release” 的版本
|
||||
预发布版本为版本号带有 “-” 的版本。该配置只对正式版本有效,对预发布版本无效。
|
||||
</div>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
|
Loading…
Reference in New Issue