mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-07-12 16:11:27 +08:00
🚧 WIP: shortcut system
This commit is contained in:
25
src/main/migrate/shortKeyUpdateHelper.js
Normal file
25
src/main/migrate/shortKeyUpdateHelper.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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
|
||||
}
|
||||
Reference in New Issue
Block a user