🚧 WIP: shortcut setting page

This commit is contained in:
PiEgg
2019-09-11 15:31:27 +08:00
parent f491209bd6
commit 1274893154
8 changed files with 203 additions and 32 deletions

View File

@@ -1,17 +1,16 @@
// 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 (shortKeyConfig.upload) {
needUpgrade = true
shortKeyConfig['picgo:upload'] = {
enable: true,
key: shortKeyConfig.upload,
name: 'picgo:upload',
label: '快捷上传'
}
})
delete shortKeyConfig.upload
}
if (needUpgrade) {
db.read().set('settings.shortKey', shortKeyConfig).write()
return shortKeyConfig