2019-12-19 06:17:21 -05:00
|
|
|
import DB from '#/datastore'
|
2019-09-10 02:38:08 -04:00
|
|
|
// from v2.1.2
|
2019-12-21 04:28:29 -05:00
|
|
|
const updateShortKeyFromVersion212 = (db: typeof DB, shortKeyConfig: IShortKeyConfigs | IOldShortKeyConfigs) => {
|
2019-09-10 02:38:08 -04:00
|
|
|
let needUpgrade = false
|
2019-09-11 03:31:27 -04:00
|
|
|
if (shortKeyConfig.upload) {
|
|
|
|
needUpgrade = true
|
2019-12-19 06:17:21 -05:00
|
|
|
// @ts-ignore
|
2019-09-11 03:31:27 -04:00
|
|
|
shortKeyConfig['picgo:upload'] = {
|
|
|
|
enable: true,
|
|
|
|
key: shortKeyConfig.upload,
|
2019-12-22 04:22:32 -05:00
|
|
|
name: 'upload',
|
2019-09-11 03:31:27 -04:00
|
|
|
label: '快捷上传'
|
2019-09-10 02:38:08 -04:00
|
|
|
}
|
2019-09-11 03:31:27 -04:00
|
|
|
delete shortKeyConfig.upload
|
|
|
|
}
|
2019-09-10 02:38:08 -04:00
|
|
|
if (needUpgrade) {
|
2019-09-11 07:30:08 -04:00
|
|
|
db.set('settings.shortKey', shortKeyConfig)
|
2019-09-10 02:38:08 -04:00
|
|
|
return shortKeyConfig
|
|
|
|
} else {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
updateShortKeyFromVersion212
|
|
|
|
}
|