diff --git a/app/lib/RoomClient.js b/app/lib/RoomClient.js
index 6302710..0d1873b 100644
--- a/app/lib/RoomClient.js
+++ b/app/lib/RoomClient.js
@@ -248,10 +248,10 @@ export default class RoomClient
logger.error('getFileHistory() | failed: %o', error);
this._dispatch(requestActions.notify({
- type: 'error',
- text: 'Could not get file history'
+ type : 'error',
+ text : 'Could not get file history'
}));
- })
+ });
}
muteMic()
diff --git a/app/lib/components/FileSharing/FileEntry.jsx b/app/lib/components/FileSharing/FileEntry.jsx
index cbe5fc8..c35d09b 100644
--- a/app/lib/components/FileSharing/FileEntry.jsx
+++ b/app/lib/components/FileSharing/FileEntry.jsx
@@ -1,9 +1,10 @@
import React, { Component, Fragment } from 'react';
-import { connect } from 'react-redux';
+import PropTypes from 'prop-types';
+import { connect } from 'react-redux';
import magnet from 'magnet-uri';
import * as requestActions from '../../redux/requestActions';
import { saveAs } from 'file-saver/FileSaver';
-import { client } from './index';
+import { client } from './index';
const DEFAULT_PICTURE = 'resources/images/avatar-empty.jpeg';
@@ -71,13 +72,13 @@ class FileEntry extends Component
});
};
- download = () =>
+ handleDownload = () =>
{
this.setState({
active : true
});
- const magnet = this.props.data.file.magnet;
+ const magnetURI = this.props.data.file.magnet;
const existingTorrent = client.get(magnet);
@@ -87,7 +88,7 @@ class FileEntry extends Component
return this.handleTorrent(existingTorrent);
}
- client.add(magnet, this.handleTorrent);
+ client.add(magnetURI, this.handleTorrent);
}
render()
@@ -105,7 +106,7 @@ class FileEntry extends Component
{!this.state.active && !this.state.files && (
-
+
@@ -144,6 +145,20 @@ class FileEntry extends Component
}
}
+export const FileEntryProps = {
+ data : PropTypes.shape({
+ name : PropTypes.string.isRequired,
+ picture : PropTypes.string.isRequired,
+ file : PropTypes.shape({
+ magnet : PropTypes.string.isRequired
+ }).isRequired,
+ me : PropTypes.bool
+ }).isRequired,
+ notify : PropTypes.func.isRequired
+};
+
+FileEntry.propTypes = FileEntryProps;
+
const mapDispatchToProps = {
notify : requestActions.notify
};
diff --git a/app/lib/components/FileSharing/index.jsx b/app/lib/components/FileSharing/index.jsx
index b1a46b7..35c5cb1 100644
--- a/app/lib/components/FileSharing/index.jsx
+++ b/app/lib/components/FileSharing/index.jsx
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
+import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import WebTorrent from 'webtorrent';
import createTorrent from 'create-torrent';
@@ -8,7 +9,7 @@ import * as stateActions from '../../redux/stateActions';
import * as requestActions from '../../redux/requestActions';
import { store } from '../../store';
import config from '../../../config';
-import FileEntry from './FileEntry';
+import FileEntry, { FileEntryProps } from './FileEntry';
export const client = new WebTorrent({
tracker : {
@@ -130,6 +131,10 @@ class FileSharing extends Component
}
}
+FileSharing.propTypes = {
+ sharing : PropTypes.arrayOf(FileEntryProps.data).isRequired
+};
+
const mapStateToProps = (state) =>
({
sharing : state.sharing
diff --git a/app/lib/redux/stateActions.js b/app/lib/redux/stateActions.js
index 6843ed8..008d308 100644
--- a/app/lib/redux/stateActions.js
+++ b/app/lib/redux/stateActions.js
@@ -452,8 +452,8 @@ export const addFile = (payload) =>
export const addFileHistory = (fileHistory) =>
{
return {
- type: 'ADD_FILE_HISTORY',
- payload: { fileHistory }
+ type : 'ADD_FILE_HISTORY',
+ payload : { fileHistory }
};
};
diff --git a/server/lib/Room.js b/server/lib/Room.js
index 5cf87f0..ca95d1b 100644
--- a/server/lib/Room.js
+++ b/server/lib/Room.js
@@ -294,7 +294,7 @@ class Room extends EventEmitter
accept();
protooPeer.send('file-history-receive', {
- fileHistory: this._fileHistory
+ fileHistory : this._fileHistory
});
break;