PicList/src/main/migrate/shortKeyUpdateHelper.js

25 lines
537 B
JavaScript
Raw Normal View History

2019-09-10 02:38:08 -04:00
// from v2.1.2
const updateShortKeyFromVersion212 = (db, shortKeyConfig) => {
let needUpgrade = false
if (shortKeyConfig.upload) {
needUpgrade = true
shortKeyConfig['picgo:upload'] = {
enable: true,
key: shortKeyConfig.upload,
name: 'picgo:upload',
label: '快捷上传'
2019-09-10 02:38:08 -04:00
}
delete shortKeyConfig.upload
}
2019-09-10 02:38:08 -04:00
if (needUpgrade) {
db.read().set('settings.shortKey', shortKeyConfig).write()
return shortKeyConfig
} else {
return false
}
}
export {
updateShortKeyFromVersion212
}