diff --git a/src/datastore/pic-bed-handler.js b/src/datastore/pic-bed-handler.js index 31260d42..3110f392 100644 --- a/src/datastore/pic-bed-handler.js +++ b/src/datastore/pic-bed-handler.js @@ -3,13 +3,15 @@ import qiniuUpload from '../main/utils/qiniuUpload' import tcYunUpload from '../main/utils/tcYunUpload' import upYunUpload from '../main/utils/upYunUpload' import githubUpload from '../main/utils/githubUpload' +import smmsUpload from '../main/utils/smmsUpload' const picBedHandler = { weibo: weiboUpload, qiniu: qiniuUpload, tcyun: tcYunUpload, upyun: upYunUpload, - github: githubUpload + github: githubUpload, + smms: smmsUpload } export default picBedHandler diff --git a/src/main/utils/uploader.js b/src/main/utils/uploader.js index ed6f361d..f0d6d79b 100644 --- a/src/main/utils/uploader.js +++ b/src/main/utils/uploader.js @@ -1,11 +1,6 @@ -import weiboUpload from './weiboUpload' -import qiniuUpload from './qiniuUpload' -import tcYunUpload from './tcYunUpload' -import upYunUpload from './upYunUpload' -import githubUpload from './githubUpload' -import smmsUpload from './smmsUpload' import db from '../../datastore/index' import { Notification } from 'electron' +import picBeds from '../../datastore/pic-bed-handler' const checkUploader = (type) => { const currentUploader = db.read().get(`picBed.${type}`).value() @@ -24,20 +19,7 @@ const uploader = (img, type, webContents) => { notification.show() const uploadType = db.read().get('picBed.current').value() 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) - case 'github': - return githubUpload(img, type, webContents) - case 'smms': - return smmsUpload(img, type, webContents) - } + return picBeds[uploadType](img, type, webContents) } else { return false } diff --git a/src/renderer/components/SettingView/SMMS.vue b/src/renderer/components/SettingView/SMMS.vue index 5ecbc979..b5adc261 100644 --- a/src/renderer/components/SettingView/SMMS.vue +++ b/src/renderer/components/SettingView/SMMS.vue @@ -5,6 +5,9 @@