Feature: only shows visible pic-beds

ISSUES CLOSED: #310
This commit is contained in:
Molunerfinn
2019-12-28 16:23:16 +08:00
parent cd30a6c70c
commit 9d4d605acf
4 changed files with 16 additions and 18 deletions

View File

@@ -1,9 +1,8 @@
import db from '#/datastore'
import picgo from './picgo'
const getPicBeds = () => {
const picBedTypes = picgo.helper.uploader.getIdList()
const picBedFromDB = db.get('picBed.list') || []
const picBedFromDB = picgo.getConfig('picBed.list') || []
const picBeds = picBedTypes.map((item: string) => {
const visible = picBedFromDB.find((i: IPicBedType) => i.type === item) // object or undefined
return {
@@ -12,7 +11,6 @@ const getPicBeds = () => {
visible: visible ? visible.visible : true
}
}) as IPicBedType[]
picgo.cmd.program.removeAllListeners()
return picBeds
}