mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-23 14:48:13 -05:00
parent
92ff282d2f
commit
7b5e5ef2ed
@ -1,9 +1,18 @@
|
||||
import DB from '#/datastore'
|
||||
// from v2.1.2
|
||||
const updateShortKeyFromVersion212 = (db: typeof DB, shortKeyConfig: IShortKeyConfigs | IOldShortKeyConfigs) => {
|
||||
let needUpgrade = false
|
||||
// #557 极端情况可能会出现配置不存在,需要重新写入
|
||||
if (shortKeyConfig === undefined) {
|
||||
const defaultShortKeyConfig = {
|
||||
enable: true,
|
||||
key: 'CommandOrControl+Shift+P',
|
||||
name: 'upload',
|
||||
label: '快捷上传'
|
||||
}
|
||||
db.set('settings.shortKey[picgo:upload]', defaultShortKeyConfig)
|
||||
return true
|
||||
}
|
||||
if (shortKeyConfig.upload) {
|
||||
needUpgrade = true
|
||||
// @ts-ignore
|
||||
shortKeyConfig['picgo:upload'] = {
|
||||
enable: true,
|
||||
@ -12,13 +21,10 @@ const updateShortKeyFromVersion212 = (db: typeof DB, shortKeyConfig: IShortKeyCo
|
||||
label: '快捷上传'
|
||||
}
|
||||
delete shortKeyConfig.upload
|
||||
}
|
||||
if (needUpgrade) {
|
||||
db.set('settings.shortKey', shortKeyConfig)
|
||||
return shortKeyConfig
|
||||
} else {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export {
|
||||
|
Loading…
Reference in New Issue
Block a user