Remove dependency,

master
Håvar Aambø Fosstveit 2019-11-05 09:46:12 +01:00
parent 51e4d6664d
commit 6d558be11c
2 changed files with 21 additions and 32 deletions

View File

@ -9,7 +9,6 @@
"@material-ui/core": "^4.5.1", "@material-ui/core": "^4.5.1",
"@material-ui/icons": "^4.5.1", "@material-ui/icons": "^4.5.1",
"bowser": "^2.7.0", "bowser": "^2.7.0",
"create-torrent": "^4.4.1",
"domready": "^1.0.8", "domready": "^1.0.8",
"file-saver": "^2.0.2", "file-saver": "^2.0.2",
"hark": "^1.2.3", "hark": "^1.2.3",

View File

@ -13,8 +13,6 @@ import * as stateActions from './actions/stateActions';
let WebTorrent; let WebTorrent;
let createTorrent;
let saveAs; let saveAs;
let mediasoupClient; let mediasoupClient;
@ -586,17 +584,8 @@ export default class RoomClient
text : 'Starting file share.' text : 'Starting file share.'
})); }));
createTorrent(files, (err, torrent) => this._webTorrent.seed(files, (torrent) =>
{ {
if (err)
{
return store.dispatch(requestActions.notify(
{
type : 'error',
text : 'Unable to upload file.'
}));
}
const existingTorrent = this._webTorrent.get(torrent); const existingTorrent = this._webTorrent.get(torrent);
if (existingTorrent) if (existingTorrent)
@ -604,20 +593,17 @@ export default class RoomClient
return this._sendFile(existingTorrent.magnetURI); return this._sendFile(existingTorrent.magnetURI);
} }
this._webTorrent.seed(files, (newTorrent) => store.dispatch(requestActions.notify(
{ {
store.dispatch(requestActions.notify( text : 'File successfully shared.'
{ }));
text : 'File successfully shared.'
}));
store.dispatch(stateActions.addFile( store.dispatch(stateActions.addFile(
this._peerId, this._peerId,
newTorrent.magnetURI torrent.magnetURI
)); ));
this._sendFile(newTorrent.magnetURI); this._sendFile(torrent.magnetURI);
});
}); });
} }
@ -1162,13 +1148,6 @@ export default class RoomClient
'webtorrent' 'webtorrent'
)); ));
({ default: createTorrent } = await import(
/* webpackPrefetch: true */
/* webpackChunkName: "create-torrent" */
'create-torrent'
));
({ default: saveAs } = await import( ({ default: saveAs } = await import(
/* webpackPrefetch: true */ /* webpackPrefetch: true */
@ -1219,6 +1198,17 @@ export default class RoomClient
} }
}); });
this._webTorrent.on('error', (error) =>
{
logger.error('Filesharing [error:"%o"]', error);
store.dispatch(requestActions.notify(
{
type : 'error',
text : `An error occured with file sharing`
}));
});
this._screenSharing = ScreenShare.create(this._device); this._screenSharing = ScreenShare.create(this._device);
this._signalingSocket = io(this._signalingUrl); this._signalingSocket = io(this._signalingUrl);