From 6ed95f93987ec85e2a7f4e7ef298888c4104f11b Mon Sep 17 00:00:00 2001 From: Harry Hedger Date: Fri, 29 Jul 2016 18:02:38 -0400 Subject: [PATCH] Testing --- src/plugins/Tus10.js | 71 ++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/src/plugins/Tus10.js b/src/plugins/Tus10.js index 113617e7d..cd9599cb9 100644 --- a/src/plugins/Tus10.js +++ b/src/plugins/Tus10.js @@ -1,6 +1,6 @@ import Plugin from './Plugin' import tus from 'tus-js-client' -import UppySocket from '../core/UppySocket' +// import UppySocket from '../core/UppySocket' /** * Tus resumable file uploader @@ -83,41 +83,46 @@ export default class Tus10 extends Plugin { })) }) .then((res) => { - if (res.status < 200 && res.status > 300) { - return reject(res.statusText) - } - + console.log(res) res.json() .then((data) => { - // get the host domain - var regex = /^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/\n]+)/ - var host = regex.exec(file.remote.host)[1] - - var token = data.token - var socket = new UppySocket({ - target: `ws://${host}:3121/api/${token}` - }) - - socket.on('progress', (progressData) => { - if (progressData.complete) { - this.core.log(`Remote upload of '${file.name}' successful`) - this.core.emitter.emit('upload-success', file) - return resolve('Success') - } - - if (progressData.progress) { - this.core.log(`Upload progress: ${progressData.progress}`) - - // Dispatch progress event - this.core.emitter.emit('upload-progress', { - uploader: this, - id: file.id, - bytesUploaded: progressData.bytesUploaded, - bytesTotal: progressData.bytesTotal - }) - } - }) + console.log(data) }) + // if (res.status < 200 && res.status > 300) { + // return reject(res.statusText) + // } + + // res.json() + // .then((data) => { + // // get the host domain + // var regex = /^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/\n]+)/ + // var host = regex.exec(file.remote.host)[1] + + // var token = data.token + // var socket = new UppySocket({ + // target: `ws://${host}:3121/api/${token}` + // }) + + // socket.on('progress', (progressData) => { + // if (progressData.complete) { + // this.core.log(`Remote upload of '${file.name}' successful`) + // this.core.emitter.emit('upload-success', file) + // return resolve('Success') + // } + + // if (progressData.progress) { + // this.core.log(`Upload progress: ${progressData.progress}`) + + // // Dispatch progress event + // this.core.emitter.emit('upload-progress', { + // uploader: this, + // id: file.id, + // bytesUploaded: progressData.bytesUploaded, + // bytesTotal: progressData.bytesTotal + // }) + // } + // }) + // }) }) }) }