mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-23 22:58:14 -05:00
d3bb5caa83
#873,#806
23 lines
639 B
TypeScript
23 lines
639 B
TypeScript
import picgo from '@core/picgo'
|
|
|
|
const getPicBeds = () => {
|
|
const picBedTypes = picgo.helper.uploader.getIdList()
|
|
const picBedFromDB = picgo.getConfig<IPicBedType[]>('picBed.list') || []
|
|
const picBeds = picBedTypes.map((item: string) => {
|
|
const visible = picBedFromDB.find((i: IPicBedType) => i.type === item) // object or undefined
|
|
return {
|
|
type: item,
|
|
name: picgo.helper.uploader.get(item)!.name || item,
|
|
visible: visible ? visible.visible : true
|
|
}
|
|
}).sort((a) => {
|
|
if (a.type === 'tcyun') {
|
|
return -1
|
|
}
|
|
return 0
|
|
}) as IPicBedType[]
|
|
return picBeds
|
|
}
|
|
|
|
export default getPicBeds
|