diff --git a/README.md b/README.md
index 4310efe..b62bb27 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,10 @@ A hosted instance of FilePizza is available at [file.pizza](http://file.pizza).
## Installation
+The recommended way to deploy FilePizza is as a [Docker container](https://hub.docker.com/r/kern/filepizza).
+
+You can also install FilePizza via the command-line:
+
$ npm install filepizza -g
$ filepizza
diff --git a/package.json b/package.json
index c05cf30..874ded7 100644
--- a/package.json
+++ b/package.json
@@ -34,10 +34,12 @@
"dependencies": {
"alt": "^0.14.4",
"babel-cli": "^6.6.5",
+ "babel-core": "^6.14.0",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-transform-react-jsx": "^6.7.4",
- "babel-preset-es2015": "^6.6.0",
+ "babel-polyfill": "^6.16.0",
+ "babel-preset-es2015": "^6.14.0",
"babel-preset-stage-0": "^6.5.0",
"classnames": "^1.2.0",
"express": "^4.12.0",
@@ -56,12 +58,18 @@
"stylus": "^0.50.0",
"twilio": "^2.9.1",
"webpack": "^1.12.14",
- "webrtcsupport": "^2.1.2",
- "webtorrent": "^0.90.3",
+ "webrtcsupport": "^2.2.0",
"winston": "^1.0.1",
"xkcd-password": "^1.2.0"
},
"devDependencies": {
+ "babel-cli": "^6.16.0",
+ "babel-core": "^6.17.0",
+ "babel-loader": "^6.2.5",
+ "babel-plugin-add-module-exports": "^0.2.1",
+ "babel-plugin-transform-react-jsx": "^6.8.0",
+ "babel-preset-es2015": "^6.16.0",
+ "babel-preset-stage-0": "^6.16.0",
"json-loader": "^0.5.4",
"nodemon": "^1.4.1",
"webpack-dev-middleware": "^1.6.1"
diff --git a/src/client.js b/src/client.js
index 7a50e80..365d75a 100644
--- a/src/client.js
+++ b/src/client.js
@@ -1,3 +1,4 @@
+import 'babel-polyfill'
import React from 'react'
import ReactRouter from 'react-router'
import routes from './routes'
diff --git a/src/components/App.js b/src/components/App.js
index 304da2a..b3346c5 100644
--- a/src/components/App.js
+++ b/src/components/App.js
@@ -24,7 +24,7 @@ export default class App extends React.Component {
SupportStore.listen(this._onChange)
}
- componentDidUnmount() {
+ componentWillUnmount() {
SupportStore.unlisten(this._onChange)
}
@@ -39,12 +39,11 @@ export default class App extends React.Component {
FilePizza - Your files, delivered.
-
-
-
+
-
+
+
diff --git a/src/components/ChromeNotice.js b/src/components/ChromeNotice.js
index cc5fd66..4bd03ab 100644
--- a/src/components/ChromeNotice.js
+++ b/src/components/ChromeNotice.js
@@ -4,7 +4,7 @@ import SupportStore from '../stores/SupportStore'
function getState() {
return {
- active: SupportStore.getState().isChrome && DownloadStore.getState().fileSize >= 500000000
+ active: SupportStore.getState().isChrome && DownloadStore.getState().fileSize >= 500000000
}
}
@@ -24,7 +24,7 @@ export default class ChromeNotice extends React.Component {
SupportStore.listen(this._onChange)
}
- componentDidUnmount() {
+ componentWillUnmount() {
DownloadStore.unlisten(this._onChange)
SupportStore.unlisten(this._onChange)
}
diff --git a/src/components/DownloadButton.js b/src/components/DownloadButton.js
index 2a3e16c..20a6494 100644
--- a/src/components/DownloadButton.js
+++ b/src/components/DownloadButton.js
@@ -1,6 +1,10 @@
import React from 'react'
export default class DownloadButton extends React.Component {
+ constructor() {
+ super()
+ this.onClick = this.onClick.bind(this)
+ }
onClick(e) {
this.props.onClick(e)
@@ -9,7 +13,7 @@ export default class DownloadButton extends React.Component {
render() {
return
}
diff --git a/src/components/DownloadPage.js b/src/components/DownloadPage.js
index 5b02e12..8279246 100644
--- a/src/components/DownloadPage.js
+++ b/src/components/DownloadPage.js
@@ -17,13 +17,15 @@ export default class DownloadPage extends React.Component {
this._onChange = () => {
this.setState(DownloadStore.getState())
}
+
+ this.downloadFile = this.downloadFile.bind(this)
}
componentDidMount() {
DownloadStore.listen(this._onChange)
}
- componentDidUnmount() {
+ componentWillUnmount() {
DownloadStore.unlisten(this._onChange)
}
@@ -43,7 +45,7 @@ export default class DownloadPage extends React.Component {
Peers: {this.state.peers} · Up: {formatSize(this.state.speedUp)} · Down: {formatSize(this.state.speedDown)}
-
+
diff --git a/src/components/DropZone.js b/src/components/DropZone.js
index 33e3f99..538b447 100644
--- a/src/components/DropZone.js
+++ b/src/components/DropZone.js
@@ -5,6 +5,11 @@ export default class DropZone extends React.Component {
constructor() {
super()
this.state = { focus: false }
+
+ this.onDragEnter = this.onDragEnter.bind(this)
+ this.onDragLeave = this.onDragLeave.bind(this)
+ this.onDragOver = this.onDragOver.bind(this)
+ this.onDrop = this.onDrop.bind(this)
}
onDragEnter() {
@@ -31,10 +36,10 @@ export default class DropZone extends React.Component {
render() {
return
+ onDragEnter={this.onDragEnter}
+ onDragLeave={this.onDragLeave}
+ onDragOver={this.onDragOver}
+ onDrop={this.onDrop}>
{
this.setState(UploadStore.getState())
}
+
+ this.uploadFile = this.uploadFile.bind(this)
}
-
+
componentDidMount() {
UploadStore.listen(this._onChange)
}
-
- componentDidUnmount() {
+
+ componentWillUnmount() {
UploadStore.unlisten(this._onChange)
}
-
+
uploadFile(file) {
UploadActions.uploadFile(file)
}
-
+
handleSelectedFile(event) {
let files = event.target.files
if (files.length > 0) {
UploadActions.uploadFile(files[0])
}
}
-
+
render() {
switch (this.state.status) {
case 'ready':
-
- return
+
+ return
-
+
-
+
FilePizza
Free peer-to-peer file transfers in your browser.
We never store anything. Files only served fresh.
@@ -57,30 +59,30 @@ export default class UploadPage extends React.Component {
-
+
case 'processing':
return
-
+
-
+
FilePizza
Processing...
-
+
-
+
case 'uploading':
return
-
+
FilePizza
-
+
Send someone this link to download.
This link will work as long as this page is open.
Peers: {this.state.peers} · Up: {formatSize(this.state.speedUp)}
-
+
}
}
diff --git a/src/components/Uploader.js b/src/components/Uploader.js
index 449ec25..7e1af06 100644
--- a/src/components/Uploader.js
+++ b/src/components/Uploader.js
@@ -3,6 +3,10 @@ import React from 'react';
import UploadActions from '@app/actions/UploadActions';
export default class UploadPage extends React.Component {
+ constructor() {
+ super()
+ this.uploadFile = this.uploadFile.bind(this)
+ }
uploadFile(file) {
UploadActions.uploadFile(file);
@@ -12,7 +16,7 @@ export default class UploadPage extends React.Component {
switch (this.props.status) {
case 'ready':
return ;
break;
diff --git a/src/middleware/javascript.js b/src/middleware/javascript.js
index 47c8d33..444f7f8 100644
--- a/src/middleware/javascript.js
+++ b/src/middleware/javascript.js
@@ -10,7 +10,7 @@ if (process.env.NODE_ENV === 'production') {
const webpackMiddleware = require('webpack-dev-middleware')
const webpack = require('webpack')
const config = require('../../webpack.config.js')
- config.output.filename = '/js'
+ config.output.filename = '/app.js'
config.output.path = '/'
module.exports = webpackMiddleware(webpack(config))
}
diff --git a/src/middleware/react.js b/src/middleware/react.js
index abab556..b27f25e 100644
--- a/src/middleware/react.js
+++ b/src/middleware/react.js
@@ -20,6 +20,7 @@ module.exports = function (req, res) {
var html = React.renderToString()
alt.flush()
+ res.setHeader('Content-Type', 'text/html');
if (isNotFound(state)) res.status(404)
res.write('\n')
res.end(html)
diff --git a/src/server.js b/src/server.js
index b8e87d1..f302f4d 100644
--- a/src/server.js
+++ b/src/server.js
@@ -26,6 +26,7 @@ if (process.env.SECURE) {
}
var io = socketIO(server)
+io.set('transports', ['polling'])
var logDir = path.resolve(__dirname, '../log')
@@ -79,8 +80,8 @@ if (process.env.FORCE_SSL) {
app.use(forceSSL)
}
-app.get('/js', require('./middleware/javascript'))
-app.get('/css', require('./middleware/css'))
+app.get('/app.js', require('./middleware/javascript'))
+app.get('/app.css', require('./middleware/css'))
app.use(require('./middleware/static'))
app.use([
diff --git a/src/stores/DownloadStore.js b/src/stores/DownloadStore.js
index 8790dbf..3a7b4c6 100644
--- a/src/stores/DownloadStore.js
+++ b/src/stores/DownloadStore.js
@@ -40,9 +40,9 @@ export default alt.createStore(class DownloadStore {
const updateSpeed = () => {
this.setState({
- speedUp: torrent.swarm.uploadSpeed(),
- speedDown: torrent.swarm.downloadSpeed(),
- peers: torrent.swarm.wires.length
+ speedUp: torrent.uploadSpeed,
+ speedDown: torrent.downloadSpeed,
+ peers: torrent.numPeers
})
}
diff --git a/src/stores/UploadStore.js b/src/stores/UploadStore.js
index b9afe85..f048683 100644
--- a/src/stores/UploadStore.js
+++ b/src/stores/UploadStore.js
@@ -29,8 +29,8 @@ export default alt.createStore(class UploadStore {
const updateSpeed = () => {
this.setState({
- speedUp: torrent.swarm.uploadSpeed(),
- peers: torrent.swarm.wires.length
+ speedUp: torrent.uploadSpeed,
+ peers: torrent.numPeers
})
}
diff --git a/src/wt.js b/src/wt.js
index 0f7a20c..7e81e42 100644
--- a/src/wt.js
+++ b/src/wt.js
@@ -1,10 +1,11 @@
-import WebTorrent from 'webtorrent'
import socket from 'filepizza-socket'
export function getClient() {
return new Promise((resolve, reject) => {
socket.emit('rtcConfig', {}, (rtcConfig) => {
- const client = new WebTorrent({ rtcConfig: rtcConfig })
+ const client = new WebTorrent({
+ tracker: { rtcConfig }
+ })
resolve(client)
})
})