PicList/src/main/migrate/shortKeyUpdateHelper.js

26 lines
584 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
Object.keys(shortKeyConfig).forEach(item => {
if (typeof shortKeyConfig[item] === 'string') {
needUpgrade = true
shortKeyConfig[item] = {
enable: true,
key: shortKeyConfig[item],
name: `picgo:${item}`,
lable: '快捷上传'
}
}
})
if (needUpgrade) {
db.read().set('settings.shortKey', shortKeyConfig).write()
return shortKeyConfig
} else {
return false
}
}
export {
updateShortKeyFromVersion212
}