Added: upyun support

This commit is contained in:
Molunerfinn
2017-12-22 22:30:16 +08:00
parent d1602edf65
commit 2ecb33ccb0
9 changed files with 329 additions and 45 deletions

View File

@@ -1,16 +1,33 @@
import weiboUpload from './weiboUpload'
import qiniuUpload from './qiniuUpload'
import tcYunUpload from './tcYunUpload'
import upYunUpload from './upYunUpload'
import db from '../../datastore/index'
const checkUploader = (type) => {
const currentUploader = db.read().get(`picBed.${type}`).value()
if (currentUploader) {
return true
} else {
return false
}
}
const uploader = (img, type, webContents) => {
const uploadType = db.read().get('picBed.current').value()
switch (uploadType) {
case 'weibo':
return weiboUpload(img, type, webContents)
case 'qiniu':
return qiniuUpload(img, type, webContents)
case 'tcyun':
return tcYunUpload(img, type, webContents)
if (checkUploader(uploadType)) {
switch (uploadType) {
case 'weibo':
return weiboUpload(img, type, webContents)
case 'qiniu':
return qiniuUpload(img, type, webContents)
case 'tcyun':
return tcYunUpload(img, type, webContents)
case 'upyun':
return upYunUpload(img, type, webContents)
}
} else {
return false
}
}