mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-03-13 08:28:13 -04:00
✨ Feature(custom): optimize upload api
This commit is contained in:
parent
ec92be8cfb
commit
e4c4a6f8d2
@ -46,6 +46,7 @@ router.post('/upload', async ({
|
|||||||
urlparams?: URLSearchParams
|
urlparams?: URLSearchParams
|
||||||
}): Promise<void> => {
|
}): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
|
const picbed = urlparams?.get('picbed')
|
||||||
const passedKey = urlparams?.get('key')
|
const passedKey = urlparams?.get('key')
|
||||||
const serverKey = picgo.getConfig<string>(configPaths.settings.serverKey) || ''
|
const serverKey = picgo.getConfig<string>(configPaths.settings.serverKey) || ''
|
||||||
if (serverKey && passedKey !== serverKey) {
|
if (serverKey && passedKey !== serverKey) {
|
||||||
@ -58,17 +59,16 @@ router.post('/upload', async ({
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const picbed = urlparams?.get('picbed')
|
|
||||||
let currentPicBedType = ''
|
let currentPicBedType = ''
|
||||||
let currentPicBedConfig = {} as IStringKeyMap
|
let currentPicBedConfig = {} as IStringKeyMap
|
||||||
let currentPicBedConfigId = ''
|
let currentPicBedConfigId = ''
|
||||||
let needRestore = false
|
let needRestore = false
|
||||||
if (picbed) {
|
if (picbed) {
|
||||||
const configName = urlparams?.get('configName') || 'Default'
|
|
||||||
const currentPicBed = picgo.getConfig<IStringKeyMap>('picBed') || {} as IStringKeyMap
|
const currentPicBed = picgo.getConfig<IStringKeyMap>('picBed') || {} as IStringKeyMap
|
||||||
currentPicBedType = currentPicBed?.current
|
currentPicBedType = currentPicBed.current || ''
|
||||||
currentPicBedConfig = currentPicBed?.[currentPicBedType]
|
currentPicBedConfig = currentPicBed[currentPicBedType] || {} as IStringKeyMap
|
||||||
currentPicBedConfigId = currentPicBedConfig?._id
|
currentPicBedConfigId = currentPicBedConfig._id
|
||||||
|
const configName = urlparams?.get('configName') || currentPicBed[picbed]?._configName
|
||||||
if (picbed === currentPicBedType && configName === currentPicBedConfig._configName) {
|
if (picbed === currentPicBedType && configName === currentPicBedConfig._configName) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user