diff --git a/.electron-vue/webpack.docs.config.js b/.electron-vue/webpack.docs.config.js index 205bdcf..5a7546f 100644 --- a/.electron-vue/webpack.docs.config.js +++ b/.electron-vue/webpack.docs.config.js @@ -1,9 +1,11 @@ const HtmlWebpackPlugin = require('html-webpack-plugin') -const ExtractTextPlugin = require('extract-text-webpack-plugin') +const MiniCssExtractPlugin = require('mini-css-extract-plugin') const path = require('path') +const { VueLoaderPlugin } = require('vue-loader') const webpack = require('webpack') module.exports = { + mode: 'development', context: path.resolve(__dirname, '../docs'), entry: './main.js', output: { @@ -28,12 +30,20 @@ module.exports = { } } }, + { + test: /\.styl(us)?$/, + use: [ + 'vue-style-loader', + 'css-loader', + 'stylus-loader' + ] + }, + { + test: /\.pug$/, loader: "pug-plain-loader" + }, { test: /\.css$/, - use: ExtractTextPlugin.extract({ - fallback: 'style-loader', - use: 'css-loader' - }) + use: ['vue-style-loader', 'css-loader'] }, { test: /\.html$/, @@ -85,28 +95,24 @@ module.exports = { ] }, plugins: [ + new VueLoaderPlugin(), new HtmlWebpackPlugin({ template: path.resolve(__dirname, '../docs/template.html') }), - new ExtractTextPlugin("styles.css") + new MiniCssExtractPlugin({filename: 'styles.css'}), ] } if (process.env.NODE_ENV === 'production') { // module.exports.devtool = '#source-map' // http://vue-loader.vuejs.org/en/workflow/production.html + module.exports.mode = 'production' module.exports.plugins = (module.exports.plugins || []).concat([ new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }), - new webpack.optimize.UglifyJsPlugin({ - sourceMap: true, - compress: { - warnings: false - } - }), new webpack.LoaderOptionsPlugin({ minimize: true }) diff --git a/package.json b/package.json index 6b6a5ea..3545bb9 100644 --- a/package.json +++ b/package.json @@ -83,8 +83,6 @@ "melody.css": "^1.0.2", "picgo": "^1.1.15", "qiniu": "^7.1.1", - "request": "^2.83.0", - "request-promise": "^4.2.2", "vue": "^2.3.3", "vue-electron": "^1.0.6", "vue-gallery": "^1.2.4", @@ -96,7 +94,6 @@ "babel-core": "^6.25.0", "babel-eslint": "^7.2.3", "babel-loader": "^7.1.1", - "babel-minify-webpack-plugin": "^0.2.0", "babel-plugin-istanbul": "^4.1.1", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.6.0", @@ -124,7 +121,6 @@ "eslint-plugin-node": "^5.1.1", "eslint-plugin-promise": "^3.5.0", "eslint-plugin-standard": "^3.0.1", - "extract-text-webpack-plugin": "^3.0.0", "file-loader": "^3.0.1", "html-webpack-plugin": "^3.2.0", "inject-loader": "^3.0.0", @@ -142,6 +138,7 @@ "node-loader": "^0.6.0", "pug": "^2.0.0-rc.4", "pug-loader": "^2.3.0", + "pug-plain-loader": "^1.0.0", "require-dir": "^0.3.0", "spectron": "^3.7.1", "style-loader": "^0.23.1", diff --git a/src/main/index.js b/src/main/index.js index a8e9b63..8d22545 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -359,6 +359,7 @@ const uploadClipboardFiles = async () => { picgoCoreIPC(app, ipcMain) +// from macOS tray ipcMain.on('uploadClipboardFiles', async (evt, file) => { const img = await new Uploader(file, 'imgFromClipboard', window.webContents).upload() if (img !== false) { diff --git a/src/main/utils/aliYunUpload.js b/src/main/utils/aliYunUpload.js deleted file mode 100644 index 0573f49..0000000 --- a/src/main/utils/aliYunUpload.js +++ /dev/null @@ -1,81 +0,0 @@ -import request from 'request-promise' -import * as img2Base64 from './img2base64' -import db from '../../datastore/index' -import { Notification } from 'electron' -import crypto from 'crypto' -import mime from 'mime-types' - -// generate OSS signature -const generateSignature = (fileName) => { - const options = db.read().get('picBed.aliyun').value() - const date = new Date().toGMTString() - const signString = `PUT\n\n${mime.lookup(fileName)}\n${date}\n/${options.bucket}/${options.path}${fileName}` - - const signature = crypto.createHmac('sha1', options.accessKeySecret).update(signString).digest('base64') - return `OSS ${options.accessKeyId}:${signature}` -} - -const postOptions = (fileName, signature, imgBase64) => { - const options = db.read().get('picBed.aliyun').value() - return { - method: 'PUT', - url: `https://${options.bucket}.${options.area}.aliyuncs.com/${encodeURI(options.path)}${encodeURI(fileName)}`, - headers: { - Host: `${options.bucket}.${options.area}.aliyuncs.com`, - Authorization: signature, - Date: new Date().toGMTString(), - 'content-type': mime.lookup(fileName) - }, - body: Buffer.from(imgBase64, 'base64'), - resolveWithFullResponse: true - } -} - -const aliYunUpload = async (img, type, webContents) => { - try { - webContents.send('uploadProgress', 0) - const imgList = await img2Base64[type](img) - webContents.send('uploadProgress', 30) - const aliYunOptions = db.read().get('picBed.aliyun').value() - const customUrl = aliYunOptions.customUrl - const path = aliYunOptions.path - const length = imgList.length - for (let i in imgList) { - const signature = generateSignature(imgList[i].fileName) - const options = postOptions(imgList[i].fileName, signature, imgList[i].base64Image) - let body = await request(options) - if (body.statusCode === 200) { - delete imgList[i].base64Image - if (customUrl) { - imgList[i]['imgUrl'] = `${customUrl}/${path}${imgList[i].fileName}` - } else { - imgList[i]['imgUrl'] = `https://${aliYunOptions.bucket}.${aliYunOptions.area}.aliyuncs.com/${path}${imgList[i].fileName}` - } - imgList[i]['type'] = 'aliyun' - if (i - length === -1) { - webContents.send('uploadProgress', 60) - } - } else { - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: '上传失败!' - }) - notification.show() - return false - } - } - webContents.send('uploadProgress', 100) - return imgList - } catch (err) { - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: `请检查你的配置项是否正确` - }) - notification.show() - throw new Error(err) - } -} - -export default aliYunUpload diff --git a/src/main/utils/githubUpload.js b/src/main/utils/githubUpload.js deleted file mode 100644 index cb82f93..0000000 --- a/src/main/utils/githubUpload.js +++ /dev/null @@ -1,66 +0,0 @@ -import request from 'request-promise' -import * as img2Base64 from './img2base64' -import db from '../../datastore/index' -import { Notification } from 'electron' - -const postOptions = (fileName, options, data) => { - const path = options.path || '' - const {token, repo} = options - return { - method: 'PUT', - url: `https://api.github.com/repos/${repo}/contents/${encodeURI(path)}${encodeURI(fileName)}`, - headers: { - Authorization: `token ${token}`, - 'User-Agent': 'PicGo' - }, - body: data, - json: true - } -} - -const githubUpload = async function (img, type, webContents) { - try { - webContents.send('uploadProgress', 0) - const imgList = await img2Base64[type](img) - const length = imgList.length - const githubOptions = db.read().get('picBed.github').value() - webContents.send('uploadProgress', 30) - for (let i in imgList) { - const data = { - message: 'Upload by PicGo', - branch: githubOptions.branch, - content: imgList[i].base64Image, - path: githubOptions.path + encodeURI(imgList[i].fileName) - } - const postConfig = postOptions(imgList[i].fileName, githubOptions, data) - const body = await request(postConfig) - if (body) { - delete imgList[i].base64Image - if (githubOptions.customUrl) { - imgList[i]['imgUrl'] = `${githubOptions.customUrl}/${githubOptions.path}${imgList[i].fileName}` - } else { - imgList[i]['imgUrl'] = body.content.download_url - } - imgList[i]['type'] = 'github' - if (i - length === -1) { - webContents.send('uploadProgress', 60) - } - } else { - webContents.send('uploadProgress', -1) - return new Error() - } - } - webContents.send('uploadProgress', 100) - return imgList - } catch (err) { - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: '服务端出错,请重试' - }) - notification.show() - throw new Error(err) - } -} - -export default githubUpload diff --git a/src/main/utils/img2base64.js b/src/main/utils/img2base64.js deleted file mode 100644 index f4bba7e..0000000 --- a/src/main/utils/img2base64.js +++ /dev/null @@ -1,146 +0,0 @@ -import fs from 'fs-extra' -import path from 'path' -import sizeOf from 'image-size' -import fecha from 'fecha' -import { BrowserWindow, ipcMain } from 'electron' -import db from '../../datastore/index.js' -const renameURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080/#rename-page` : `file://${__dirname}/index.html#rename-page` - -const createRenameWindow = () => { - let options = { - height: 175, - width: 300, - show: true, - fullscreenable: false, - resizable: false, - vibrancy: 'ultra-dark', - webPreferences: { - backgroundThrottling: false - } - } - - if (process.platform !== 'darwin') { - options.show = true - options.backgroundColor = '#3f3c37' - options.autoHideMenuBar = true - options.transparent = false - } - - const window = new BrowserWindow(options) - window.loadURL(renameURL) - return window -} - -const imgFromPath = async (imgPath) => { - let results = [] - const rename = db.read().get('picBed.rename').value() - const autoRename = db.read().get('picBed.autoRename').value() - await Promise.all(imgPath.map(async item => { - let name - let fileName - if (autoRename) { - fileName = fecha.format(new Date(), 'YYYYMMDDHHmmss') + path.extname(item) - } else { - fileName = path.basename(item) - } - if (rename) { - const window = createRenameWindow() - await waitForShow(window.webContents) - window.webContents.send('rename', fileName, window.webContents.id) - name = await waitForRename(window, window.webContents.id) - } - let buffer = await fs.readFile(item) - let base64Image = Buffer.from(buffer).toString('base64') - let imgSize = sizeOf(item) - results.push({ - base64Image, - fileName: name || fileName, - width: imgSize.width, - height: imgSize.height, - extname: path.extname(item) - }) - })) - return results -} - -const imgFromClipboard = async (file) => { - let result = [] - let rename = db.read().get('picBed.rename').value() - if (file !== null) { - let name - const today = fecha.format(new Date(), 'YYYYMMDDHHmmss') + '.png' - if (rename) { - const window = createRenameWindow() - await waitForShow(window.webContents) - window.webContents.send('rename', today, window.webContents.id) - name = await waitForRename(window, window.webContents.id) - } - result.push({ - base64Image: file.imgUrl.replace(/^data\S+,/, ''), - fileName: name || today, - width: file.width, - height: file.height, - extname: '.png' - }) - } - return result -} - -const imgFromUploader = async (files) => { - let results = [] - const rename = db.read().get('picBed.rename').value() - const autoRename = db.read().get('picBed.autoRename').value() - await Promise.all(files.map(async item => { - let name - let fileName - if (autoRename) { - fileName = fecha.format(new Date(), 'YYYYMMDDHHmmss') + path.extname(item.name) - } else { - fileName = path.basename(item.path) - } - if (rename) { - const window = createRenameWindow() - await waitForShow(window.webContents) - window.webContents.send('rename', fileName, window.webContents.id) - name = await waitForRename(window, window.webContents.id) - } - let buffer = await fs.readFile(item.path) - let base64Image = Buffer.from(buffer).toString('base64') - let imgSize = sizeOf(item.path) - results.push({ - base64Image, - fileName: name || fileName, - width: imgSize.width, - height: imgSize.height, - extname: path.extname(item.name) - }) - })) - return results -} - -const waitForShow = (webcontent) => { - return new Promise((resolve, reject) => { - webcontent.on('dom-ready', () => { - resolve() - }) - }) -} - -const waitForRename = (window, id) => { - return new Promise((resolve, reject) => { - ipcMain.once(`rename${id}`, (evt, newName) => { - resolve(newName) - window.hide() - }) - window.on('close', () => { - resolve(null) - ipcMain.removeAllListeners(`rename${id}`) - }) - }) -} - -export { - imgFromPath, - imgFromClipboard, - imgFromUploader -} diff --git a/src/main/utils/imgurUpload.js b/src/main/utils/imgurUpload.js deleted file mode 100644 index 8da68c2..0000000 --- a/src/main/utils/imgurUpload.js +++ /dev/null @@ -1,65 +0,0 @@ -import request from 'request-promise' -import * as img2Base64 from './img2base64' -import db from '../../datastore/index' -import { Notification, clipboard } from 'electron' - -const postOptions = (fileName, imgBase64) => { - const options = db.read().get('picBed.imgur').value() - const clientId = options.clientId - let obj = { - method: 'POST', - url: `https://api.imgur.com/3/image`, - headers: { - Authorization: 'Client-ID ' + clientId, - 'content-type': 'multipart/form-data', - 'User-Agent': 'PicGo' - }, - formData: { - image: imgBase64, - type: 'base64', - name: fileName - } - } - if (options.proxy) { - obj.proxy = options.proxy - } - return obj -} - -const imgurUpload = async (img, type, webContents) => { - try { - webContents.send('uploadProgress', 0) - const imgList = await img2Base64[type](img) - webContents.send('uploadProgress', 30) - const length = imgList.length - for (let i in imgList) { - const options = postOptions(imgList[i].fileName, imgList[i].base64Image) - let body = await request(options) - body = JSON.parse(body) - if (body.success) { - delete imgList[i].base64Image - imgList[i]['imgUrl'] = `${body.data.link}` - imgList[i]['type'] = 'imgur' - if (i - length === -1) { - webContents.send('uploadProgress', 60) - } - } else { - webContents.send('uploadProgress', -1) - return new Error() - } - } - webContents.send('uploadProgress', 100) - return imgList - } catch (err) { - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: `请检查你的配置以及网络!` - }) - notification.show() - clipboard.writeText('http://docs.imgur.com/api/errno/') - throw new Error(err) - } -} - -export default imgurUpload diff --git a/src/main/utils/qiniuUpload.js b/src/main/utils/qiniuUpload.js deleted file mode 100644 index fabd62b..0000000 --- a/src/main/utils/qiniuUpload.js +++ /dev/null @@ -1,79 +0,0 @@ -import request from 'request-promise' -import * as img2Base64 from './img2base64' -import db from '../../datastore/index' -import * as qiniu from 'qiniu' -import { Notification } from 'electron' - -function postOptions (fileName, token, imgBase64) { - const area = selectArea(db.read().get('picBed.qiniu.area').value() || 'z0') - const path = db.read().get('picBed.qiniu.path').value() || '' - const base64FileName = Buffer.from(path + fileName, 'utf-8').toString('base64').replace(/\+/g, '-').replace(/\//g, '_') - return { - method: 'POST', - url: `http://upload${area}.qiniu.com/putb64/-1/key/${base64FileName}`, - headers: { - Authorization: `UpToken ${token}`, - contentType: 'application/octet-stream' - }, - body: imgBase64 - } -} - -function selectArea (area) { - return area === 'z0' ? '' : '-' + area -} - -function getToken () { - const accessKey = db.read().get('picBed.qiniu.accessKey').value() - const secretKey = db.read().get('picBed.qiniu.secretKey').value() - const mac = new qiniu.auth.digest.Mac(accessKey, secretKey) - const options = { - scope: db.read().get('picBed.qiniu.bucket').value() - } - const putPolicy = new qiniu.rs.PutPolicy(options) - return putPolicy.uploadToken(mac) -} - -const qiniuUpload = async function (img, type, webContents) { - try { - webContents.send('uploadProgress', 0) - const imgList = await img2Base64[type](img) - webContents.send('uploadProgress', 30) - const length = imgList.length - for (let i in imgList) { - const options = postOptions(imgList[i].fileName, getToken(), imgList[i].base64Image) - const res = await request(options) - const body = JSON.parse(res) - if (body.key) { - delete imgList[i].base64Image - const baseUrl = db.get('picBed.qiniu.url').value() - const options = db.get('picBed.qiniu.options').value() - imgList[i]['imgUrl'] = `${baseUrl}/${body.key}${options}` - imgList[i]['type'] = 'qiniu' - if (i - length === -1) { - webContents.send('uploadProgress', 60) - } - } else { - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: res.body.msg - }) - notification.show() - } - } - webContents.send('uploadProgress', 100) - return imgList - } catch (err) { - webContents.send('uploadProgress', -1) - const error = JSON.parse(err.response.body) - const notification = new Notification({ - title: '上传失败!', - body: error.error - }) - notification.show() - throw new Error(err) - } -} - -export default qiniuUpload diff --git a/src/main/utils/smmsUpload.js b/src/main/utils/smmsUpload.js deleted file mode 100644 index 6d66179..0000000 --- a/src/main/utils/smmsUpload.js +++ /dev/null @@ -1,56 +0,0 @@ -import request from 'request-promise' -import * as img2Base64 from './img2base64' -import { Notification } from 'electron' - -const postOptions = (fileName, imgBase64) => { - return { - method: 'POST', - url: `https://sm.ms/api/upload`, - headers: { - contentType: 'multipart/form-data', - 'User-Agent': 'PicGo' - }, - formData: { - smfile: { - value: Buffer.from(imgBase64, 'base64'), - options: { - filename: fileName - } - }, - ssl: 'true' - } - } -} - -const smmsUpload = async function (img, type, webContents) { - try { - webContents.send('uploadProgress', 0) - const imgList = await img2Base64[type](img) - webContents.send('uploadProgress', 30) - for (let i in imgList) { - const postConfig = postOptions(imgList[i].fileName, imgList[i].base64Image) - let body = await request(postConfig) - body = JSON.parse(body) - if (body.code === 'success') { - delete imgList[i].base64Image - imgList[i]['imgUrl'] = body.data.url - imgList[i]['type'] = 'smms' - } else { - webContents.send('uploadProgress', -1) - return new Error() - } - } - webContents.send('uploadProgress', 100) - return imgList - } catch (err) { - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: '服务端出错,请重试' - }) - notification.show() - throw new Error(err) - } -} - -export default smmsUpload diff --git a/src/main/utils/tcYunUpload.js b/src/main/utils/tcYunUpload.js deleted file mode 100644 index 0a217b6..0000000 --- a/src/main/utils/tcYunUpload.js +++ /dev/null @@ -1,166 +0,0 @@ -import request from 'request-promise' -import * as img2Base64 from './img2base64' -import db from '../../datastore/index' -import { Notification, clipboard } from 'electron' -import crypto from 'crypto' -import mime from 'mime-types' - -// generate COS signature string -const generateSignature = (fileName) => { - const options = db.read().get('picBed.tcyun').value() - const secretId = options.secretId - const secretKey = options.secretKey - const appId = options.appId - const bucket = options.bucket - let signature - let signTime - if (!options.version || options.version === 'v4') { - const random = Math.floor(Math.random() * 10000000000) - const current = parseInt(new Date().getTime() / 1000) - 1 - const expired = current + 3600 - - const multiSignature = `a=${appId}&b=${bucket}&k=${secretId}&e=${expired}&t=${current}&r=${random}&f=` - - const signHexKey = crypto.createHmac('sha1', secretKey).update(multiSignature).digest() - const tempString = Buffer.concat([signHexKey, Buffer.from(multiSignature)]) - signature = Buffer.from(tempString).toString('base64') - } else { - // https://cloud.tencent.com/document/product/436/7778#signature - const today = Math.floor(new Date().getTime() / 1000) - const tomorrow = today + 86400 - signTime = `${today};${tomorrow}` - const signKey = crypto.createHmac('sha1', secretKey).update(signTime).digest('hex') - const httpString = `put\n/${options.path}${fileName}\n\nhost=${options.bucket}.cos.${options.area}.myqcloud.com\n` - const sha1edHttpString = crypto.createHash('sha1').update(httpString).digest('hex') - const stringToSign = `sha1\n${signTime}\n${sha1edHttpString}\n` - signature = crypto.createHmac('sha1', signKey).update(stringToSign).digest('hex') - } - return { - signature, - appId, - bucket, - signTime - } -} - -const postOptions = (fileName, signature, imgBase64) => { - const options = db.read().get('picBed.tcyun').value() - const area = options.area - const path = options.path - if (!options.version || options.version === 'v4') { - return { - method: 'POST', - url: `http://${area}.file.myqcloud.com/files/v2/${signature.appId}/${signature.bucket}/${encodeURI(path)}${fileName}`, - headers: { - Host: `${area}.file.myqcloud.com`, - Authorization: signature.signature, - contentType: 'multipart/form-data' - }, - formData: { - op: 'upload', - filecontent: Buffer.from(imgBase64, 'base64') - } - } - } else { - return { - method: 'PUT', - url: `http://${options.bucket}.cos.${options.area}.myqcloud.com/${encodeURI(path)}${encodeURI(fileName)}`, - headers: { - Host: `${options.bucket}.cos.${options.area}.myqcloud.com`, - Authorization: `q-sign-algorithm=sha1&q-ak=${options.secretId}&q-sign-time=${signature.signTime}&q-key-time=${signature.signTime}&q-header-list=host&q-url-param-list=&q-signature=${signature.signature}`, - contentType: mime.lookup(fileName) - }, - body: Buffer.from(imgBase64, 'base64'), - resolveWithFullResponse: true - } - } -} - -const tcYunUpload = async (img, type, webContents) => { - try { - webContents.send('uploadProgress', 0) - const imgList = await img2Base64[type](img) - webContents.send('uploadProgress', 30) - const length = imgList.length - const tcYunOptions = db.read().get('picBed.tcyun').value() - const customUrl = tcYunOptions.customUrl - const path = tcYunOptions.path - const useV4 = !tcYunOptions.version || tcYunOptions.version === 'v4' - for (let i in imgList) { - const signature = generateSignature(imgList[i].fileName) - const options = postOptions(imgList[i].fileName, signature, imgList[i].base64Image) - const res = await request(options) - .then(res => res) - .catch(err => { - console.log(err.response.body) - return { - statusCode: 400, - body: { - msg: '认证失败!' - } - } - }) - let body - if (useV4) { - body = JSON.parse(res) - } else { - body = res - } - if (useV4 && body.message === 'SUCCESS') { - delete imgList[i].base64Image - if (customUrl) { - imgList[i]['imgUrl'] = `${customUrl}/${path}${imgList[i].fileName}` - } else { - imgList[i]['imgUrl'] = body.data.source_url - } - imgList[i]['type'] = 'tcyun' - if (i - length === -1) { - webContents.send('uploadProgress', 60) - } - } else if (!useV4 && body && body.statusCode === 200) { - delete imgList[i].base64Image - if (customUrl) { - imgList[i]['imgUrl'] = `${customUrl}/${path}${imgList[i].fileName}` - } else { - imgList[i]['imgUrl'] = `https://${tcYunOptions.bucket}.cos.${tcYunOptions.area}.myqcloud.com/${path}${imgList[i].fileName}` - } - imgList[i]['type'] = 'tcyun' - if (i - length === -1) { - webContents.send('uploadProgress', 60) - } - } else { - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: res.body.msg - }) - notification.show() - return false - } - } - webContents.send('uploadProgress', 100) - return imgList - } catch (err) { - const options = db.read().get('picBed.tcyun').value() - let body - if (!options.version || options.version === 'v4') { - body = JSON.parse(err.error) - const notification = new Notification({ - title: '上传失败!', - body: `错误码:${body.code},请打开浏览器粘贴地址查看相关原因。` - }) - notification.show() - clipboard.writeText('https://cloud.tencent.com/document/product/436/8432') - } else { - const notification = new Notification({ - title: '上传失败!', - body: `请检查你的配置项是否正确` - }) - notification.show() - } - webContents.send('uploadProgress', -1) - throw new Error(err) - } -} - -export default tcYunUpload diff --git a/src/main/utils/upYunUpload.js b/src/main/utils/upYunUpload.js deleted file mode 100644 index 0506ab4..0000000 --- a/src/main/utils/upYunUpload.js +++ /dev/null @@ -1,78 +0,0 @@ -import request from 'request-promise' -import * as img2Base64 from './img2base64' -import db from '../../datastore/index' -import { Notification, clipboard } from 'electron' -import crypto from 'crypto' -import MD5 from 'md5' - -// generate COS signature string -const generateSignature = (fileName) => { - const options = db.read().get('picBed.upyun').value() - const path = options.path || '' - const operator = options.operator - const password = options.password - const md5Password = MD5(password) - const date = new Date().toGMTString() - const uri = `/${options.bucket}/${encodeURI(path)}${encodeURI(fileName)}` - const value = `PUT&${uri}&${date}` - const sign = crypto.createHmac('sha1', md5Password).update(value).digest('base64') - return `UPYUN ${operator}:${sign}` -} - -const postOptions = (fileName, signature, imgBase64) => { - const options = db.read().get('picBed.upyun').value() - const bucket = options.bucket - const path = options.path || '' - return { - method: 'PUT', - url: `https://v0.api.upyun.com/${bucket}/${encodeURI(path)}${encodeURI(fileName)}`, - headers: { - Authorization: signature, - Date: new Date().toGMTString() - }, - body: Buffer.from(imgBase64, 'base64'), - resolveWithFullResponse: true - } -} - -const upYunUpload = async (img, type, webContents) => { - try { - webContents.send('uploadProgress', 0) - const imgList = await img2Base64[type](img) - webContents.send('uploadProgress', 30) - const length = imgList.length - const upyunOptions = db.read().get('picBed.upyun').value() - const path = upyunOptions.path || '' - for (let i in imgList) { - const singature = generateSignature(imgList[i].fileName) - const options = postOptions(imgList[i].fileName, singature, imgList[i].base64Image) - const body = await request(options) - if (body.statusCode === 200) { - delete imgList[i].base64Image - imgList[i]['imgUrl'] = `${upyunOptions.url}/${path}${imgList[i].fileName}${upyunOptions.options}` - imgList[i]['type'] = 'upyun' - if (i - length === -1) { - webContents.send('uploadProgress', 60) - } - } else { - webContents.send('uploadProgress', -1) - return new Error() - } - } - webContents.send('uploadProgress', 100) - return imgList - } catch (err) { - console.log(err) - const body = JSON.parse(err.error) - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: `错误码:${body.code},请打开浏览器粘贴地址查看相关原因。` - }) - notification.show() - clipboard.writeText('http://docs.upyun.com/api/errno/') - // throw new Error(err) - } -} - -export default upYunUpload diff --git a/src/main/utils/weiboUpload.js b/src/main/utils/weiboUpload.js deleted file mode 100644 index 1c6f3c6..0000000 --- a/src/main/utils/weiboUpload.js +++ /dev/null @@ -1,99 +0,0 @@ -import request from 'request-promise' -import * as img2Base64 from './img2base64' -import db from '../../datastore/index' -import { Notification } from 'electron' -const j = request.jar() -const rp = request.defaults({jar: j}) -const UPLOAD_URL = 'http://picupload.service.weibo.com/interface/pic_upload.php?ori=1&mime=image%2Fjpeg&data=base64&url=0&markpos=1&logo=&nick=0&marks=1&app=miniblog' - -const postOptions = (formData) => { - return { - method: 'POST', - url: 'https://passport.weibo.cn/sso/login', - headers: { - Referer: 'https://passport.weibo.cn/signin/login', - contentType: 'application/x-www-form-urlencoded' - }, - formData, - json: true, - resolveWithFullResponse: true - } -} - -const weiboUpload = async function (img, type, webContents) { - try { - webContents.send('uploadProgress', 0) - const formData = { - username: db.read().get('picBed.weibo.username').value(), - password: db.read().get('picBed.weibo.password').value() - } - const quality = db.read().get('picBed.weibo.quality').value() - const cookie = db.read().get('picBed.weibo.cookie').value() - const chooseCookie = db.read().get('picBed.weibo.chooseCookie').value() - const options = postOptions(formData) - let res - if (!chooseCookie) { - res = await rp(options) - } - webContents.send('uploadProgress', 30) - if (chooseCookie || res.body.retcode === 20000000) { - if (res) { - for (let i in res.body.data.crossdomainlist) { - await rp.get(res.body.data.crossdomainlist[i]) - } - } - webContents.send('uploadProgress', 60) - const imgList = await img2Base64[type](img) - for (let i in imgList) { - let opt = { - formData: { - b64_data: imgList[i].base64Image - } - } - if (chooseCookie) { - opt.headers = { - Cookie: cookie - } - } - let result = await rp.post(UPLOAD_URL, opt) - result = result.replace(/<.*?\/>/, '').replace(/<(\w+).*?>.*?<\/\1>/, '') - delete imgList[i].base64Image - const resTextJson = JSON.parse(result) - if (resTextJson.data.pics.pic_1.pid === undefined) { - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: '微博Cookie失效,请在网页版重新登录一遍' - }) - notification.show() - return new Error() - } else { - const extname = imgList[i].extname === '.gif' ? '.gif' : '.jpg' - imgList[i]['imgUrl'] = `https://ws1.sinaimg.cn/${quality}/${resTextJson.data.pics.pic_1.pid}${extname}` - imgList[i]['type'] = 'weibo' - } - delete imgList[i].extname - } - webContents.send('uploadProgress', 100) - return imgList - } else { - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: res.body.msg - }) - notification.show() - return new Error() - } - } catch (err) { - webContents.send('uploadProgress', -1) - const notification = new Notification({ - title: '上传失败!', - body: '服务端出错,请重试' - }) - notification.show() - throw new Error(err) - } -} - -export default weiboUpload diff --git a/src/renderer/pages/Upload.vue b/src/renderer/pages/Upload.vue index 329d492..9344765 100644 --- a/src/renderer/pages/Upload.vue +++ b/src/renderer/pages/Upload.vue @@ -160,6 +160,8 @@ export default { text-align center margin 10px auto #upload-view + .view-title + margin 20px auto #upload-area height 220px border 2px dashed #dddddd diff --git a/yarn.lock b/yarn.lock index 1735e82..adc7141 100644 --- a/yarn.lock +++ b/yarn.lock @@ -253,7 +253,7 @@ ajv-keywords@^3.1.0: version "3.2.0" resolved "http://registry.npm.taobao.org/ajv-keywords/download/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" -ajv@^5.0.0, ajv@^5.2.3, ajv@^5.3.0, ajv@^5.5.0: +ajv@^5.2.3, ajv@^5.3.0, ajv@^5.5.0: version "5.5.2" resolved "http://registry.npm.taobao.org/ajv/download/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" dependencies: @@ -515,7 +515,7 @@ async@1.x, async@^1.5.2: version "1.5.2" resolved "http://registry.npm.taobao.org/async/download/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" -async@^2.0.0, async@^2.4.1, async@^2.5.0: +async@^2.0.0, async@^2.5.0: version "2.6.1" resolved "http://registry.npm.taobao.org/async/download/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610" dependencies: @@ -651,10 +651,6 @@ babel-helper-evaluate-path@^0.1.0: version "0.1.0" resolved "http://registry.npm.taobao.org/babel-helper-evaluate-path/download/babel-helper-evaluate-path-0.1.0.tgz#95d98c4ea36150483db2e7d3ec9e1954a72629cb" -babel-helper-evaluate-path@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-helper-evaluate-path/download/babel-helper-evaluate-path-0.2.0.tgz#0bb2eb01996c0cef53c5e8405e999fe4a0244c08" - babel-helper-explode-assignable-expression@^6.24.1: version "6.24.1" resolved "http://registry.npm.taobao.org/babel-helper-explode-assignable-expression/download/babel-helper-explode-assignable-expression-6.24.1.tgz#f25b82cf7dc10433c55f70592d5746400ac22caa" @@ -676,10 +672,6 @@ babel-helper-flip-expressions@^0.1.2: version "0.1.2" resolved "http://registry.npm.taobao.org/babel-helper-flip-expressions/download/babel-helper-flip-expressions-0.1.2.tgz#77f6652f9de9c42401d827bd46ebd2109e3ef18a" -babel-helper-flip-expressions@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-helper-flip-expressions/download/babel-helper-flip-expressions-0.2.0.tgz#160d2090a3d9f9c64a750905321a0bc218f884ec" - babel-helper-function-name@^6.24.1: version "6.24.1" resolved "http://registry.npm.taobao.org/babel-helper-function-name/download/babel-helper-function-name-6.24.1.tgz#d3475b8c03ed98242a25b48351ab18399d3580a9" @@ -712,18 +704,10 @@ babel-helper-is-void-0@^0.1.1: version "0.1.1" resolved "http://registry.npm.taobao.org/babel-helper-is-void-0/download/babel-helper-is-void-0-0.1.1.tgz#72f21a3abba0bef3837f9174fca731aed9a02888" -babel-helper-is-void-0@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-helper-is-void-0/download/babel-helper-is-void-0-0.2.0.tgz#6ed0ada8a9b1c5b6e88af6b47c1b3b5c080860eb" - babel-helper-mark-eval-scopes@^0.1.1: version "0.1.1" resolved "http://registry.npm.taobao.org/babel-helper-mark-eval-scopes/download/babel-helper-mark-eval-scopes-0.1.1.tgz#4554345edf9f2549427bd2098e530253f8af2992" -babel-helper-mark-eval-scopes@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-helper-mark-eval-scopes/download/babel-helper-mark-eval-scopes-0.2.0.tgz#7648aaf2ec92aae9b09a20ad91e8df5e1fcc94b2" - babel-helper-optimise-call-expression@^6.24.1: version "6.24.1" resolved "http://registry.npm.taobao.org/babel-helper-optimise-call-expression/download/babel-helper-optimise-call-expression-6.24.1.tgz#f7a13427ba9f73f8f4fa993c54a97882d1244257" @@ -753,10 +737,6 @@ babel-helper-remove-or-void@^0.1.1: version "0.1.1" resolved "http://registry.npm.taobao.org/babel-helper-remove-or-void/download/babel-helper-remove-or-void-0.1.1.tgz#9d7e1856dc6fafcb41b283a416730dc1844f66d7" -babel-helper-remove-or-void@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-helper-remove-or-void/download/babel-helper-remove-or-void-0.2.0.tgz#8e46ad5b30560d57d7510b3fd93f332ee7c67386" - babel-helper-replace-supers@^6.24.1: version "6.24.1" resolved "http://registry.npm.taobao.org/babel-helper-replace-supers/download/babel-helper-replace-supers-6.24.1.tgz#bf6dbfe43938d17369a213ca8a8bf74b6a90ab1a" @@ -772,10 +752,6 @@ babel-helper-to-multiple-sequence-expressions@^0.1.1: version "0.1.1" resolved "http://registry.npm.taobao.org/babel-helper-to-multiple-sequence-expressions/download/babel-helper-to-multiple-sequence-expressions-0.1.1.tgz#5f1b832b39e4acf954e9137f0251395c71196b35" -babel-helper-to-multiple-sequence-expressions@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-helper-to-multiple-sequence-expressions/download/babel-helper-to-multiple-sequence-expressions-0.2.0.tgz#d1a419634c6cb301f27858c659167cfee0a9d318" - babel-helper-vue-jsx-merge-props@^2.0.0: version "2.0.3" resolved "http://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz#22aebd3b33902328e513293a8e4992b384f9f1b6" @@ -801,14 +777,6 @@ babel-messages@^6.23.0: dependencies: babel-runtime "^6.22.0" -babel-minify-webpack-plugin@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-minify-webpack-plugin/download/babel-minify-webpack-plugin-0.2.0.tgz#ef9694d11a1b8ab8f3204d89f5c9278dd28fc2a9" - dependencies: - babel-core "^6.24.1" - babel-preset-minify "^0.2.0" - webpack-sources "^1.0.1" - babel-plugin-check-es2015-constants@^6.22.0: version "6.22.0" resolved "http://registry.npm.taobao.org/babel-plugin-check-es2015-constants/download/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a" @@ -830,24 +798,12 @@ babel-plugin-minify-builtins@^0.1.3: dependencies: babel-helper-evaluate-path "^0.1.0" -babel-plugin-minify-builtins@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-builtins/download/babel-plugin-minify-builtins-0.2.0.tgz#317f824b0907210b6348671bb040ca072e2e0c82" - dependencies: - babel-helper-evaluate-path "^0.2.0" - babel-plugin-minify-constant-folding@^0.1.3: version "0.1.3" resolved "http://registry.npm.taobao.org/babel-plugin-minify-constant-folding/download/babel-plugin-minify-constant-folding-0.1.3.tgz#57bd172adf8b8d74ad7c99612eb950414ebea3ca" dependencies: babel-helper-evaluate-path "^0.1.0" -babel-plugin-minify-constant-folding@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-constant-folding/download/babel-plugin-minify-constant-folding-0.2.0.tgz#8c70b528b2eb7c13e94d95c8789077d4cdbc3970" - dependencies: - babel-helper-evaluate-path "^0.2.0" - babel-plugin-minify-dead-code-elimination@^0.1.7: version "0.1.7" resolved "http://registry.npm.taobao.org/babel-plugin-minify-dead-code-elimination/download/babel-plugin-minify-dead-code-elimination-0.1.7.tgz#774f536f347b98393a27baa717872968813c342c" @@ -856,75 +812,36 @@ babel-plugin-minify-dead-code-elimination@^0.1.7: babel-helper-remove-or-void "^0.1.1" lodash.some "^4.6.0" -babel-plugin-minify-dead-code-elimination@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-dead-code-elimination/download/babel-plugin-minify-dead-code-elimination-0.2.0.tgz#e8025ee10a1e5e4f202633a6928ce892c33747e3" - dependencies: - babel-helper-evaluate-path "^0.2.0" - babel-helper-mark-eval-scopes "^0.2.0" - babel-helper-remove-or-void "^0.2.0" - lodash.some "^4.6.0" - babel-plugin-minify-flip-comparisons@^0.1.2: version "0.1.2" resolved "http://registry.npm.taobao.org/babel-plugin-minify-flip-comparisons/download/babel-plugin-minify-flip-comparisons-0.1.2.tgz#e286b40b7599b18dfea195071e4279465cfc1884" dependencies: babel-helper-is-void-0 "^0.1.1" -babel-plugin-minify-flip-comparisons@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-flip-comparisons/download/babel-plugin-minify-flip-comparisons-0.2.0.tgz#0c9c8e93155c8f09dedad8118b634c259f709ef5" - dependencies: - babel-helper-is-void-0 "^0.2.0" - babel-plugin-minify-guarded-expressions@^0.1.2: version "0.1.2" resolved "http://registry.npm.taobao.org/babel-plugin-minify-guarded-expressions/download/babel-plugin-minify-guarded-expressions-0.1.2.tgz#dfc3d473b0362d9605d3ce0ac1e22328c60d1007" dependencies: babel-helper-flip-expressions "^0.1.2" -babel-plugin-minify-guarded-expressions@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-guarded-expressions/download/babel-plugin-minify-guarded-expressions-0.2.0.tgz#8a8c950040fce3e258a12e6eb21eab94ad7235ab" - dependencies: - babel-helper-flip-expressions "^0.2.0" - babel-plugin-minify-infinity@^0.1.2: version "0.1.2" resolved "http://registry.npm.taobao.org/babel-plugin-minify-infinity/download/babel-plugin-minify-infinity-0.1.2.tgz#5f1cf67ddedcba13c8a00da832542df0091a1cd4" -babel-plugin-minify-infinity@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-infinity/download/babel-plugin-minify-infinity-0.2.0.tgz#30960c615ddbc657c045bb00a1d8eb4af257cf03" - babel-plugin-minify-mangle-names@^0.1.3: version "0.1.3" resolved "http://registry.npm.taobao.org/babel-plugin-minify-mangle-names/download/babel-plugin-minify-mangle-names-0.1.3.tgz#bfa24661a6794fb03833587e55828b65449e06fe" dependencies: babel-helper-mark-eval-scopes "^0.1.1" -babel-plugin-minify-mangle-names@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-mangle-names/download/babel-plugin-minify-mangle-names-0.2.0.tgz#719892297ff0106a6ec1a4b0fc062f1f8b6a8529" - dependencies: - babel-helper-mark-eval-scopes "^0.2.0" - babel-plugin-minify-numeric-literals@^0.1.1: version "0.1.1" resolved "http://registry.npm.taobao.org/babel-plugin-minify-numeric-literals/download/babel-plugin-minify-numeric-literals-0.1.1.tgz#d4b8b0c925f874714ee33ee4b26678583d7ce7fb" -babel-plugin-minify-numeric-literals@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-numeric-literals/download/babel-plugin-minify-numeric-literals-0.2.0.tgz#5746e851700167a380c05e93f289a7070459a0d1" - babel-plugin-minify-replace@^0.1.2: version "0.1.2" resolved "http://registry.npm.taobao.org/babel-plugin-minify-replace/download/babel-plugin-minify-replace-0.1.2.tgz#b90b9e71ab4d3b36325629a91beabe13b0b16ac1" -babel-plugin-minify-replace@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-replace/download/babel-plugin-minify-replace-0.2.0.tgz#3c1f06bc4e6d3e301eacb763edc1be611efc39b0" - babel-plugin-minify-simplify@^0.1.2: version "0.1.2" resolved "http://registry.npm.taobao.org/babel-plugin-minify-simplify/download/babel-plugin-minify-simplify-0.1.2.tgz#a968f1658fdeb2fc759e81fe331d89829df0f6b9" @@ -933,26 +850,12 @@ babel-plugin-minify-simplify@^0.1.2: babel-helper-is-nodes-equiv "^0.0.1" babel-helper-to-multiple-sequence-expressions "^0.1.1" -babel-plugin-minify-simplify@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-simplify/download/babel-plugin-minify-simplify-0.2.0.tgz#21ceec4857100c5476d7cef121f351156e5c9bc0" - dependencies: - babel-helper-flip-expressions "^0.2.0" - babel-helper-is-nodes-equiv "^0.0.1" - babel-helper-to-multiple-sequence-expressions "^0.2.0" - babel-plugin-minify-type-constructors@^0.1.2: version "0.1.2" resolved "http://registry.npm.taobao.org/babel-plugin-minify-type-constructors/download/babel-plugin-minify-type-constructors-0.1.2.tgz#db53c5b76cb8e2fcd45d862f17104c78761337ee" dependencies: babel-helper-is-void-0 "^0.1.1" -babel-plugin-minify-type-constructors@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-minify-type-constructors/download/babel-plugin-minify-type-constructors-0.2.0.tgz#7f3b6458be0863cfd59e9985bed6d134aa7a2e17" - dependencies: - babel-helper-is-void-0 "^0.2.0" - babel-plugin-syntax-async-functions@^6.8.0: version "6.13.0" resolved "http://registry.npm.taobao.org/babel-plugin-syntax-async-functions/download/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" @@ -1245,19 +1148,15 @@ babel-plugin-transform-inline-consecutive-adds@^0.1.2: version "0.1.2" resolved "http://registry.npm.taobao.org/babel-plugin-transform-inline-consecutive-adds/download/babel-plugin-transform-inline-consecutive-adds-0.1.2.tgz#5442e9f1c19c78a7899f8a4dee6fd481f61001f5" -babel-plugin-transform-inline-consecutive-adds@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-inline-consecutive-adds/download/babel-plugin-transform-inline-consecutive-adds-0.2.0.tgz#15dae78921057f4004f8eafd79e15ddc5f12f426" - -babel-plugin-transform-member-expression-literals@^6.8.4, babel-plugin-transform-member-expression-literals@^6.8.5: +babel-plugin-transform-member-expression-literals@^6.8.4: version "6.9.4" resolved "http://registry.npm.taobao.org/babel-plugin-transform-member-expression-literals/download/babel-plugin-transform-member-expression-literals-6.9.4.tgz#37039c9a0c3313a39495faac2ff3a6b5b9d038bf" -babel-plugin-transform-merge-sibling-variables@^6.8.5, babel-plugin-transform-merge-sibling-variables@^6.8.6: +babel-plugin-transform-merge-sibling-variables@^6.8.5: version "6.9.4" resolved "http://registry.npm.taobao.org/babel-plugin-transform-merge-sibling-variables/download/babel-plugin-transform-merge-sibling-variables-6.9.4.tgz#85b422fc3377b449c9d1cde44087203532401dae" -babel-plugin-transform-minify-booleans@^6.8.2, babel-plugin-transform-minify-booleans@^6.8.3: +babel-plugin-transform-minify-booleans@^6.8.2: version "6.9.4" resolved "http://registry.npm.taobao.org/babel-plugin-transform-minify-booleans/download/babel-plugin-transform-minify-booleans-6.9.4.tgz#acbb3e56a3555dd23928e4b582d285162dd2b198" @@ -1268,7 +1167,7 @@ babel-plugin-transform-object-rest-spread@^6.22.0: babel-plugin-syntax-object-rest-spread "^6.8.0" babel-runtime "^6.26.0" -babel-plugin-transform-property-literals@^6.8.4, babel-plugin-transform-property-literals@^6.8.5: +babel-plugin-transform-property-literals@^6.8.4: version "6.9.4" resolved "http://registry.npm.taobao.org/babel-plugin-transform-property-literals/download/babel-plugin-transform-property-literals-6.9.4.tgz#98c1d21e255736573f93ece54459f6ce24985d39" dependencies: @@ -1284,15 +1183,11 @@ babel-plugin-transform-regexp-constructors@^0.1.1: version "0.1.1" resolved "http://registry.npm.taobao.org/babel-plugin-transform-regexp-constructors/download/babel-plugin-transform-regexp-constructors-0.1.1.tgz#312ab7487cc88a1c62ee25ea1b6087e89b87799c" -babel-plugin-transform-regexp-constructors@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-regexp-constructors/download/babel-plugin-transform-regexp-constructors-0.2.0.tgz#6aa5dd0acc515db4be929bbcec4ed4c946c534a3" - -babel-plugin-transform-remove-console@^6.8.4, babel-plugin-transform-remove-console@^6.8.5: +babel-plugin-transform-remove-console@^6.8.4: version "6.9.4" resolved "http://registry.npm.taobao.org/babel-plugin-transform-remove-console/download/babel-plugin-transform-remove-console-6.9.4.tgz#b980360c067384e24b357a588d807d3c83527780" -babel-plugin-transform-remove-debugger@^6.8.4, babel-plugin-transform-remove-debugger@^6.8.5: +babel-plugin-transform-remove-debugger@^6.8.4: version "6.9.4" resolved "http://registry.npm.taobao.org/babel-plugin-transform-remove-debugger/download/babel-plugin-transform-remove-debugger-6.9.4.tgz#42b727631c97978e1eb2d199a7aec84a18339ef2" @@ -1300,19 +1195,13 @@ babel-plugin-transform-remove-undefined@^0.1.2: version "0.1.2" resolved "http://registry.npm.taobao.org/babel-plugin-transform-remove-undefined/download/babel-plugin-transform-remove-undefined-0.1.2.tgz#e1ebf51110f6b1e0665f28382ef73f95e5023652" -babel-plugin-transform-remove-undefined@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-remove-undefined/download/babel-plugin-transform-remove-undefined-0.2.0.tgz#94f052062054c707e8d094acefe79416b63452b1" - dependencies: - babel-helper-evaluate-path "^0.2.0" - babel-plugin-transform-runtime@^6.23.0: version "6.23.0" resolved "http://registry.npm.taobao.org/babel-plugin-transform-runtime/download/babel-plugin-transform-runtime-6.23.0.tgz#88490d446502ea9b8e7efb0fe09ec4d99479b1ee" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-simplify-comparison-operators@^6.8.4, babel-plugin-transform-simplify-comparison-operators@^6.8.5: +babel-plugin-transform-simplify-comparison-operators@^6.8.4: version "6.9.4" resolved "http://registry.npm.taobao.org/babel-plugin-transform-simplify-comparison-operators/download/babel-plugin-transform-simplify-comparison-operators-6.9.4.tgz#f62afe096cab0e1f68a2d753fdf283888471ceb9" @@ -1323,7 +1212,7 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" -babel-plugin-transform-undefined-to-void@^6.8.2, babel-plugin-transform-undefined-to-void@^6.8.3: +babel-plugin-transform-undefined-to-void@^6.8.2: version "6.9.4" resolved "http://registry.npm.taobao.org/babel-plugin-transform-undefined-to-void/download/babel-plugin-transform-undefined-to-void-6.9.4.tgz#be241ca81404030678b748717322b89d0c8fe280" @@ -1390,34 +1279,6 @@ babel-preset-env@^1.6.0: invariant "^2.2.2" semver "^5.3.0" -babel-preset-minify@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/babel-preset-minify/download/babel-preset-minify-0.2.0.tgz#006566552d9b83834472273f306c0131062a0acc" - dependencies: - babel-plugin-minify-builtins "^0.2.0" - babel-plugin-minify-constant-folding "^0.2.0" - babel-plugin-minify-dead-code-elimination "^0.2.0" - babel-plugin-minify-flip-comparisons "^0.2.0" - babel-plugin-minify-guarded-expressions "^0.2.0" - babel-plugin-minify-infinity "^0.2.0" - babel-plugin-minify-mangle-names "^0.2.0" - babel-plugin-minify-numeric-literals "^0.2.0" - babel-plugin-minify-replace "^0.2.0" - babel-plugin-minify-simplify "^0.2.0" - babel-plugin-minify-type-constructors "^0.2.0" - babel-plugin-transform-inline-consecutive-adds "^0.2.0" - babel-plugin-transform-member-expression-literals "^6.8.5" - babel-plugin-transform-merge-sibling-variables "^6.8.6" - babel-plugin-transform-minify-booleans "^6.8.3" - babel-plugin-transform-property-literals "^6.8.5" - babel-plugin-transform-regexp-constructors "^0.2.0" - babel-plugin-transform-remove-console "^6.8.5" - babel-plugin-transform-remove-debugger "^6.8.5" - babel-plugin-transform-remove-undefined "^0.2.0" - babel-plugin-transform-simplify-comparison-operators "^6.8.5" - babel-plugin-transform-undefined-to-void "^6.8.3" - lodash.isplainobject "^4.0.6" - babel-preset-stage-0@^6.24.1: version "6.24.1" resolved "http://registry.npm.taobao.org/babel-preset-stage-0/download/babel-preset-stage-0-6.24.1.tgz#5642d15042f91384d7e5af8bc88b1db95b039e6a" @@ -3831,15 +3692,6 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extract-text-webpack-plugin@^3.0.0: - version "3.0.2" - resolved "http://registry.npm.taobao.org/extract-text-webpack-plugin/download/extract-text-webpack-plugin-3.0.2.tgz#5f043eaa02f9750a9258b78c0a6e0dc1408fb2f7" - dependencies: - async "^2.4.1" - loader-utils "^1.1.0" - schema-utils "^0.3.0" - webpack-sources "^1.0.1" - extract-zip@^1.0.3, extract-zip@^1.6.5: version "1.6.7" resolved "http://registry.npm.taobao.org/extract-zip/download/extract-zip-1.6.7.tgz#a840b4b8af6403264c8db57f4f1a74333ef81fe9" @@ -7217,6 +7069,12 @@ pug-parser@^5.0.0: pug-error "^1.3.2" token-stream "0.0.1" +pug-plain-loader@^1.0.0: + version "1.0.0" + resolved "http://registry.npm.taobao.org/pug-plain-loader/download/pug-plain-loader-1.0.0.tgz#cef2a984c90251882109ec2d417a6b433aa6b42a" + dependencies: + loader-utils "^1.1.0" + pug-runtime@^2.0.4: version "2.0.4" resolved "http://registry.npm.taobao.org/pug-runtime/download/pug-runtime-2.0.4.tgz#e178e1bda68ab2e8c0acfc9bced2c54fd88ceb58" @@ -7610,15 +7468,6 @@ request-promise-native@^1.0.5: stealthy-require "^1.1.0" tough-cookie ">=2.3.3" -request-promise@^4.2.2: - version "4.2.2" - resolved "http://registry.npm.taobao.org/request-promise/download/request-promise-4.2.2.tgz#d1ea46d654a6ee4f8ee6a4fea1018c22911904b4" - dependencies: - bluebird "^3.5.0" - request-promise-core "1.1.1" - stealthy-require "^1.1.0" - tough-cookie ">=2.3.3" - request@^2.45.0, request@^2.81.0, request@^2.83.0, request@^2.87.0: version "2.88.0" resolved "http://registry.npm.taobao.org/request/download/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" @@ -7796,12 +7645,6 @@ sax@^1.2.4, sax@~1.2.1: version "1.2.4" resolved "http://registry.npm.taobao.org/sax/download/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" -schema-utils@^0.3.0: - version "0.3.0" - resolved "http://registry.npm.taobao.org/schema-utils/download/schema-utils-0.3.0.tgz#f5877222ce3e931edae039f17eb3716e7137f8cf" - dependencies: - ajv "^5.0.0" - schema-utils@^0.4.4: version "0.4.7" resolved "http://registry.npm.taobao.org/schema-utils/download/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"