2021-07-25 11:25:36 -04:00
|
|
|
import db from '~/main/apis/core/datastore'
|
2022-08-14 08:45:16 -04:00
|
|
|
import { getLatestVersion } from '#/utils/getLatestVersion'
|
2023-04-06 00:50:07 -04:00
|
|
|
import { autoUpdater } from 'electron-updater'
|
2022-08-14 08:45:16 -04:00
|
|
|
// const releaseUrl = 'https://api.github.com/repos/Molunerfinn/PicGo/releases'
|
|
|
|
// const releaseUrlBackup = 'https://picgo-1251750343.cos.ap-chengdu.myqcloud.com'
|
2023-04-06 00:50:07 -04:00
|
|
|
// const downloadUrl = 'https://github.com/Kuingsmile/PicList/releases/latest'
|
2017-12-23 03:38:19 -05:00
|
|
|
|
|
|
|
const checkVersion = async () => {
|
2019-09-11 07:30:08 -04:00
|
|
|
let showTip = db.get('settings.showUpdateTip')
|
2017-12-23 03:38:19 -05:00
|
|
|
if (showTip === undefined) {
|
2019-09-11 07:30:08 -04:00
|
|
|
db.set('settings.showUpdateTip', true)
|
2017-12-23 03:38:19 -05:00
|
|
|
showTip = true
|
|
|
|
}
|
|
|
|
if (showTip) {
|
2023-02-15 10:36:47 -05:00
|
|
|
const res: string = await getLatestVersion()
|
2022-08-14 08:45:16 -04:00
|
|
|
if (res !== '') {
|
2023-04-06 00:50:07 -04:00
|
|
|
autoUpdater.checkForUpdatesAndNotify()
|
2017-12-23 03:38:19 -05:00
|
|
|
} else {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default checkVersion
|