mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-07-12 08:01:26 +08:00
✨ Feature: add dist upload to cos & update checkupdate logic
This commit is contained in:
@@ -26,7 +26,8 @@ import {
|
||||
PICGO_REMOVE_BY_ID_DB,
|
||||
PICGO_OPEN_FILE,
|
||||
PASTE_TEXT,
|
||||
OPEN_WINDOW
|
||||
OPEN_WINDOW,
|
||||
DEFAULT_LOGO
|
||||
} from '#/events/constants'
|
||||
|
||||
import { GalleryDB } from 'apis/core/datastore'
|
||||
@@ -366,6 +367,12 @@ const handleOpenWindow = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleDefaultLogo = () => {
|
||||
ipcMain.on(DEFAULT_LOGO, (event: IpcMainEvent) => {
|
||||
event.sender.send(DEFAULT_LOGO, path.join(__static, 'roundLogo.png'))
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
listen () {
|
||||
handleGetPluginList()
|
||||
@@ -379,6 +386,7 @@ export default {
|
||||
handleImportLocalPlugin()
|
||||
handleOpenFile()
|
||||
handleOpenWindow()
|
||||
handleDefaultLogo()
|
||||
},
|
||||
// TODO: separate to single file
|
||||
handlePluginUninstall,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { dialog, shell } from 'electron'
|
||||
import db from '~/main/apis/core/datastore'
|
||||
import axios from 'axios'
|
||||
import pkg from 'root/package.json'
|
||||
import { lt } from 'semver'
|
||||
import { T } from '~/universal/i18n'
|
||||
import { getLatestVersion } from '#/utils/getLatestVersion'
|
||||
const version = pkg.version
|
||||
const releaseUrl = 'https://api.github.com/repos/Molunerfinn/PicGo/releases/latest'
|
||||
const releaseUrlBackup = 'https://cdn.jsdelivr.net/gh/Molunerfinn/PicGo@latest/package.json'
|
||||
// const releaseUrl = 'https://api.github.com/repos/Molunerfinn/PicGo/releases'
|
||||
// const releaseUrlBackup = 'https://picgo-1251750343.cos.ap-chengdu.myqcloud.com'
|
||||
const downloadUrl = 'https://github.com/Molunerfinn/PicGo/releases/latest'
|
||||
|
||||
const checkVersion = async () => {
|
||||
@@ -16,17 +16,10 @@ const checkVersion = async () => {
|
||||
showTip = true
|
||||
}
|
||||
if (showTip) {
|
||||
let res: any
|
||||
try {
|
||||
res = await axios.get(releaseUrl).catch(async () => {
|
||||
const result = await axios.get(releaseUrlBackup)
|
||||
return result
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
if (res.status === 200) {
|
||||
const latest = res.data.version || res.data.name
|
||||
const isCheckBetaUpdate = db.get('settings.checkBetaUpdate') !== false
|
||||
const res: string = await getLatestVersion(isCheckBetaUpdate)
|
||||
if (res !== '') {
|
||||
const latest = res
|
||||
const result = compareVersion2Update(version, latest)
|
||||
if (result) {
|
||||
dialog.showMessageBox({
|
||||
|
||||
Reference in New Issue
Block a user