File prio code added, API rewrite completed, some core features rewritten for clarity
This commit is contained in:
@@ -128,7 +128,7 @@ var torrentListRequest = {
|
||||
console.log("Logger data requested");
|
||||
break;
|
||||
|
||||
case "rssListRequest":
|
||||
case "rssList":
|
||||
console.log("RSSListRequest recieved", evt.data);
|
||||
RSSList = [];
|
||||
for (var i = 0; i < serverMessage.TotalRSSFeeds; i++) {
|
||||
@@ -191,7 +191,7 @@ var BackendSocket = function (_React$Component) {
|
||||
case 1:
|
||||
var peerListHashes = {
|
||||
MessageType: "torrentPeerListRequest",
|
||||
Payload: selectionHashes
|
||||
Payload: {"PeerListHash": selectionHashes}
|
||||
};
|
||||
console.log("Peers tab information requested", peerListHashes);
|
||||
ws.send(JSON.stringify(peerListHashes));
|
||||
@@ -199,7 +199,7 @@ var BackendSocket = function (_React$Component) {
|
||||
case 2:
|
||||
var fileListHashes = {
|
||||
MessageType: "torrentFileListRequest",
|
||||
Payload: selectionHashes
|
||||
Payload: {"FileListHash": selectionHashes[0]}
|
||||
};
|
||||
console.log("Files tab information requested", fileListHashes);
|
||||
ws.send(JSON.stringify(fileListHashes));
|
||||
@@ -256,7 +256,7 @@ var BackendSocket = function (_React$Component) {
|
||||
case 1:
|
||||
var peerListHashes = {
|
||||
MessageType: "torrentPeerListRequest",
|
||||
Payload: this.props.selectionHashes
|
||||
Payload: {"PeerListHash": this.props.selectionHashes}
|
||||
};
|
||||
ws.send(JSON.stringify(peerListHashes));
|
||||
this.props.newPeerList(peerList);
|
||||
@@ -264,7 +264,7 @@ var BackendSocket = function (_React$Component) {
|
||||
case 2:
|
||||
var fileListHashes = {
|
||||
MessageType: "torrentFileListRequest",
|
||||
Payload: this.props.selectionHashes
|
||||
Payload: {"FileListHash": this.props.selectionHashes[0]}
|
||||
};
|
||||
ws.send(JSON.stringify(fileListHashes));
|
||||
this.props.newFileList(fileList);
|
||||
|
@@ -104,7 +104,7 @@ ws.onmessage = function (evt) { //When we recieve a message from the websocket
|
||||
console.log("Logger data requested")
|
||||
break;
|
||||
|
||||
case "rssListRequest":
|
||||
case "rssList":
|
||||
console.log("RSSListRequest recieved", evt.data)
|
||||
RSSList = [];
|
||||
for (var i = 0; i < serverMessage.TotalRSSFeeds; i++){
|
||||
@@ -163,7 +163,7 @@ class BackendSocket extends React.Component {
|
||||
case 1:
|
||||
let peerListHashes = {
|
||||
MessageType: "torrentPeerListRequest",
|
||||
Payload: selectionHashes,
|
||||
Payload: {"PeerListHash": selectionHashes[0]}
|
||||
}
|
||||
console.log("Peers tab information requested", peerListHashes)
|
||||
ws.send(JSON.stringify(peerListHashes))
|
||||
@@ -171,7 +171,7 @@ class BackendSocket extends React.Component {
|
||||
case 2:
|
||||
let fileListHashes = {
|
||||
MessageType: "torrentFileListRequest",
|
||||
Payload: selectionHashes,
|
||||
Payload: {"FileListHash": selectionHashes[0]}
|
||||
}
|
||||
console.log("Files tab information requested", fileListHashes)
|
||||
ws.send(JSON.stringify(fileListHashes))
|
||||
@@ -222,7 +222,6 @@ class BackendSocket extends React.Component {
|
||||
this.props.newServerMessage(serverPushMessage)
|
||||
}
|
||||
|
||||
|
||||
ws.send(JSON.stringify(torrentListRequest))//talking to the server to get the torrent list
|
||||
if (ws.readyState === ws.CLOSED){ //if our websocket gets closed inform the user
|
||||
webSocketState = false
|
||||
@@ -236,7 +235,7 @@ class BackendSocket extends React.Component {
|
||||
case 1:
|
||||
let peerListHashes = {
|
||||
MessageType: "torrentPeerListRequest",
|
||||
Payload: this.props.selectionHashes,
|
||||
Payload: {"PeerListHash": this.props.selectionHashes[0]}
|
||||
}
|
||||
ws.send(JSON.stringify(peerListHashes))
|
||||
this.props.newPeerList(peerList)
|
||||
@@ -244,7 +243,7 @@ class BackendSocket extends React.Component {
|
||||
case 2:
|
||||
let fileListHashes = {
|
||||
MessageType: "torrentFileListRequest",
|
||||
Payload: this.props.selectionHashes,
|
||||
Payload: {"FileListHash": this.props.selectionHashes[0]}
|
||||
}
|
||||
ws.send(JSON.stringify(fileListHashes))
|
||||
this.props.newFileList(fileList)
|
||||
@@ -256,7 +255,6 @@ class BackendSocket extends React.Component {
|
||||
}
|
||||
|
||||
|
||||
|
||||
componentWillReceiveProps (nextProps) {
|
||||
console.log("Length", nextProps.selectionHashes.length, "value", nextProps.selectionHashes)
|
||||
if (nextProps.selectionHashes.length === 1){ //if we have a selection pass it on for the tabs to verify
|
||||
@@ -287,9 +285,6 @@ const mapStateToProps = state => {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
newTorrentList: (torrentList) => dispatch({type: actionTypes.TORRENT_LIST, torrentList }),
|
||||
@@ -305,6 +300,4 @@ const mapDispatchToProps = dispatch => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(BackendSocket);
|
@@ -66,10 +66,9 @@ class FileTab extends React.Component {
|
||||
})
|
||||
let setFilePriority = {
|
||||
MessageType: "setFilePriority",
|
||||
MessageDetail: priority,
|
||||
MessageDetailTwo: selectionHash,
|
||||
Payload: filePaths,
|
||||
Payload: {"TorrentHash": selectionHashes, "FilePriority": priority, "FilePaths": filePaths}
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(setFilePriority))
|
||||
ws.send(JSON.stringify(setFilePriority))
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@ const inlineStyle = {
|
||||
showRSSFiles = (key) => {
|
||||
let RSSTorrentsRequest = {
|
||||
MessageType: "rssTorrentsRequest",
|
||||
Payload: [this.props.RSSList[key].RSSURL]
|
||||
Payload: {"RSSURL": this.props.RSSList[key].RSSURL}
|
||||
}
|
||||
ws.send(JSON.stringify(RSSTorrentsRequest))
|
||||
|
||||
|
@@ -108,7 +108,7 @@ const inlineStyle = {
|
||||
handleAddRSSFeed = () => {
|
||||
let RSSURLSubmit = {
|
||||
MessageType: "addRSSFeed",
|
||||
Payload: [this.state.textValue]
|
||||
Payload: {"RSSURL": this.state.textValue}
|
||||
}
|
||||
ws.send(JSON.stringify(RSSURLSubmit));
|
||||
let RSSRequest = {
|
||||
|
@@ -65,12 +65,12 @@ class RSSTorrentList extends React.Component {
|
||||
console.log("element", element)
|
||||
sendMagnetLinks.push(element.TorrentLink)
|
||||
})
|
||||
let magnetLinkSubmit = {
|
||||
let magnetLinkMessage = {
|
||||
MessageType: "magnetLinkSubmit",
|
||||
Payload: sendMagnetLinks,
|
||||
}
|
||||
console.log(JSON.stringify(magnetLinkSubmit))
|
||||
ws.send(JSON.stringify(magnetLinkSubmit))
|
||||
Payload: {"MagnetLinks": [sendMagnetLinks], "Label": "RSS"}
|
||||
}
|
||||
console.log(JSON.stringify(magnetLinkMessage))
|
||||
ws.send(JSON.stringify(magnetLinkMessage))
|
||||
}
|
||||
|
||||
componentWillReceiveProps () {
|
||||
|
@@ -66,13 +66,10 @@ export default class addTorrentFilePopup extends React.Component {
|
||||
reader.onloadend = () => {
|
||||
let base64data = reader.result;
|
||||
console.log("Base64", base64data)
|
||||
|
||||
|
||||
let torrentFileMessage = {
|
||||
MessageType: "torrentFileSubmit",
|
||||
MessageDetail: this.state.torrentFileName, //filename
|
||||
MessageDetailTwo: this.state.storageValue, //storage path
|
||||
MessageDetailThree: this.state.torrentLabel, //torrent label
|
||||
Payload: [base64data],
|
||||
Payload: {"FileData": base64data, "FileName": this.state.torrentFileName, "StorageValue": this.state.storageValue, "Label": this.state.torrentLabel}
|
||||
}
|
||||
console.log("Sending Torrent File: ", torrentFileMessage);
|
||||
ws.send(JSON.stringify(torrentFileMessage));
|
||||
|
@@ -54,9 +54,7 @@ export default class addTorrentPopup extends React.Component {
|
||||
console.log("MagnetLink", this.state.magnetLinkValue)
|
||||
let magnetLinkMessage = {
|
||||
MessageType: "magnetLinkSubmit",
|
||||
MessageDetail: this.state.storageValue, //storage location
|
||||
MessageDetailTwo: this.state.torrentLabel, //label
|
||||
Payload: [this.state.magnetLinkValue]
|
||||
Payload: {"MagnetLinks": [this.state.magnetLinkValue], "StorageValue": this.state.storageValue, "Label": this.state.torrentLabel}
|
||||
}
|
||||
console.log("Sending magnet link: ", magnetLinkMessage);
|
||||
ws.send(JSON.stringify(magnetLinkMessage));
|
||||
|
@@ -48,12 +48,11 @@ class ChangeStorageModal extends React.Component {
|
||||
|
||||
handleSubmit = () => {
|
||||
this.setState({ open: false });
|
||||
//let magnetLinkSubmit = this.state.textValue;
|
||||
let changeStorageMessage = {
|
||||
MessageType: "changeStorageValue",
|
||||
MessageDetail: this.state.storageValue, //new storage value
|
||||
Payload: this.props.selectionHashes, //the selection hashes
|
||||
Payload: {"ChangeStorageHashes": this.props.selectionHashes, "StorageValue": this.state.storageValue} //the selection hashes and new store value
|
||||
}
|
||||
|
||||
console.log("Sending new Storage Location: ", changeStorageMessage);
|
||||
ws.send(JSON.stringify(changeStorageMessage));
|
||||
this.setState({storageValue: ``})
|
||||
|
@@ -41,8 +41,7 @@ class DeleteTorrentModal extends React.Component {
|
||||
let selection = []
|
||||
let deleteTorrentHashes = {
|
||||
MessageType: "deleteTorrents",
|
||||
MessageDetail: "false", //delete with data
|
||||
Payload: this.props.selectionHashes
|
||||
Payload: {"TorrentHashes": this.props.selectionHashes, "WithData": false}
|
||||
}
|
||||
console.log("Deleting Torrents", deleteTorrentHashes)
|
||||
ws.send(JSON.stringify(deleteTorrentHashes))
|
||||
@@ -56,8 +55,7 @@ class DeleteTorrentModal extends React.Component {
|
||||
|
||||
let deleteTorrentHashes = {
|
||||
MessageType: "deleteTorrents",
|
||||
MessageDetail: "true", //delete with data
|
||||
Payload: this.props.selectionHashes,
|
||||
Payload: {"TorrentHashes": this.props.selectionHashes, "WithData": true}
|
||||
}
|
||||
console.log("Deleting Torrents and Data", deleteTorrentHashes)
|
||||
ws.send(JSON.stringify(deleteTorrentHashes))
|
||||
|
@@ -82,7 +82,7 @@ class IconButtons extends React.Component {
|
||||
console.log("Force starting Torrents", this.props.selectionHashes)
|
||||
let forceUploadTorrents = {
|
||||
MessageType: "forceUploadTorrents",
|
||||
Payload: this.props.selectionHashes,
|
||||
Payload: {"TorrentHashes": this.props.selectionHashes}
|
||||
}
|
||||
ws.send(JSON.stringify(forceUploadTorrents))
|
||||
}
|
||||
@@ -91,7 +91,7 @@ class IconButtons extends React.Component {
|
||||
console.log("Starting Torrents", this.props.selectionHashes)
|
||||
let startTorrentHashes = {
|
||||
MessageType: "startTorrents",
|
||||
Payload: this.props.selectionHashes,
|
||||
Payload: {"TorrentHashes": this.props.selectionHashes}
|
||||
}
|
||||
//console.log("Peers tab information requested", peerListHashes)
|
||||
ws.send(JSON.stringify(startTorrentHashes))
|
||||
@@ -101,7 +101,7 @@ class IconButtons extends React.Component {
|
||||
stopTorrent = () => {
|
||||
let stopTorrentHashes = {
|
||||
MessageType: "stopTorrents",
|
||||
Payload: this.props.selectionHashes,
|
||||
Payload: {"TorrentHashes": this.props.selectionHashes}
|
||||
}
|
||||
console.log("Stopping Torrents", stopTorrentHashes)
|
||||
ws.send(JSON.stringify(stopTorrentHashes))
|
||||
|
@@ -70,6 +70,11 @@ class BasicLayout extends React.PureComponent {
|
||||
this.props.onLayoutChange(layout);
|
||||
}
|
||||
|
||||
componentWillMount() { //if login not required log in automatically
|
||||
if (LoginRequired == false){
|
||||
this.setState({loggedin: true})
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return [
|
||||
|
@@ -69,7 +69,7 @@ export default class Login extends React.Component {
|
||||
this.setState({ open: false, username: "", password: "" });
|
||||
this.props.changeLoggedin(true)
|
||||
} else {
|
||||
this.setState({wrongPasswordMessage: "Wrong Username/Password!", username: "", password: "" })
|
||||
this.setState({wrongPasswordMessage: "Wrong Username/Password!"})
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user