File prio code added, API rewrite completed, some core features rewritten for clarity

This commit is contained in:
2018-02-15 22:49:11 -05:00
parent b843cfc11b
commit c5b86597cb
22 changed files with 215 additions and 234 deletions

View File

@@ -60330,6 +60330,14 @@ var BasicLayout = function (_React$PureComponent) {
value: function onLayoutChange(layout) {
this.props.onLayoutChange(layout);
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
//if login not required log in automatically
if (LoginRequired == false) {
this.setState({ loggedin: true });
}
}
}, {
key: 'render',
value: function render() {
@@ -84243,7 +84251,7 @@ var IconButtons = function (_React$Component) {
console.log("Force starting Torrents", _this.props.selectionHashes);
var forceUploadTorrents = {
MessageType: "forceUploadTorrents",
Payload: _this.props.selectionHashes
Payload: { "TorrentHashes": _this.props.selectionHashes }
};
ws.send(JSON.stringify(forceUploadTorrents));
};
@@ -84252,7 +84260,7 @@ var IconButtons = function (_React$Component) {
console.log("Starting Torrents", _this.props.selectionHashes);
var startTorrentHashes = {
MessageType: "startTorrents",
Payload: _this.props.selectionHashes
Payload: { "TorrentHashes": _this.props.selectionHashes }
//console.log("Peers tab information requested", peerListHashes)
};ws.send(JSON.stringify(startTorrentHashes));
_this.props.setButtonState(_this.props.selection); //TODO this currently just forces a button refresh, should be a better way to do this
@@ -84261,7 +84269,7 @@ var IconButtons = function (_React$Component) {
_this.stopTorrent = function () {
var stopTorrentHashes = {
MessageType: "stopTorrents",
Payload: _this.props.selectionHashes
Payload: { "TorrentHashes": _this.props.selectionHashes }
};
console.log("Stopping Torrents", stopTorrentHashes);
ws.send(JSON.stringify(stopTorrentHashes));
@@ -91979,9 +91987,7 @@ var addTorrentPopup = function (_React$Component) {
console.log("MagnetLink", _this.state.magnetLinkValue);
var 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));
@@ -100257,10 +100263,7 @@ var addTorrentFilePopup = function (_React$Component) {
var 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));
@@ -102006,11 +102009,6 @@ var AddRSSModal = function (_React$Component) {
}
_createClass(AddRSSModal, [{
key: 'componentDidMount',
value: function componentDidMount() {//Immediatly request an update of the feed when loading app
}
}, {
key: 'render',
value: function render() {
var _props = this.props,
@@ -102212,7 +102210,7 @@ var RSSModalLayout = function (_React$Component) {
_this.handleAddRSSFeed = function () {
var RSSURLSubmit = {
MessageType: "addRSSFeed",
Payload: [_this.state.textValue]
Payload: { "RSSURL": _this.state.textValue }
};
ws.send(JSON.stringify(RSSURLSubmit));
var RSSRequest = {
@@ -102467,7 +102465,7 @@ var RSSFeedList = function (_React$Component) {
}, _this.showRSSFiles = function (key) {
var RSSTorrentsRequest = {
MessageType: "rssTorrentsRequest",
Payload: [_this.props.RSSList[key].RSSURL]
Payload: { "RSSURL": _this.props.RSSList[key].RSSURL }
};
ws.send(JSON.stringify(RSSTorrentsRequest));
@@ -102631,12 +102629,12 @@ var RSSTorrentList = function (_React$Component) {
console.log("element", element);
sendMagnetLinks.push(element.TorrentLink);
});
var magnetLinkSubmit = {
var magnetLinkMessage = {
MessageType: "magnetLinkSubmit",
Payload: sendMagnetLinks
Payload: { "MagnetLinks": [sendMagnetLinks], "Label": "RSS" }
};
console.log(JSON.stringify(magnetLinkSubmit));
ws.send(JSON.stringify(magnetLinkSubmit));
console.log(JSON.stringify(magnetLinkMessage));
ws.send(JSON.stringify(magnetLinkMessage));
};
_this.state = { //rows are stored in redux they are sent over from the server
@@ -121802,8 +121800,7 @@ var DeleteTorrentModal = function (_React$Component) {
var selection = [];
var 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));
@@ -121815,8 +121812,7 @@ var DeleteTorrentModal = function (_React$Component) {
var 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));
@@ -122023,12 +122019,11 @@ var ChangeStorageModal = function (_React$Component) {
_this.setState({ open: false });
}, _this.handleSubmit = function () {
_this.setState({ open: false });
//let magnetLinkSubmit = this.state.textValue;
var 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: '' });
@@ -122633,7 +122628,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++) {
@@ -122701,7 +122696,7 @@ var BackendSocket = function (_React$Component) {
case 1:
var peerListHashes = {
MessageType: "torrentPeerListRequest",
Payload: selectionHashes
Payload: { "PeerListHash": selectionHashes[0] }
};
console.log("Peers tab information requested", peerListHashes);
ws.send(JSON.stringify(peerListHashes));
@@ -122709,7 +122704,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));
@@ -122780,7 +122775,7 @@ var BackendSocket = function (_React$Component) {
case 1:
var peerListHashes = {
MessageType: "torrentPeerListRequest",
Payload: this.props.selectionHashes
Payload: { "PeerListHash": this.props.selectionHashes[0] }
};
ws.send(JSON.stringify(peerListHashes));
this.props.newPeerList(peerList);
@@ -122788,7 +122783,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);
@@ -135094,10 +135089,9 @@ var FileTab = function (_React$Component) {
});
var 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));
};
@@ -140525,15 +140519,12 @@ var Login = function (_React$Component) {
_this.handleSubmit();
}
}, _this.handleSubmit = function () {
console.log("Attempting authentication");
var hashedPass = sha256(_this.state.password);
console.log("Hashed Password", hashedPass, "Password", _this.state.password);
var hashedPass = sha256(_this.state.password); //hash the password to match it with the hashed one in the kickwebsocket
if (_this.state.username == ClientUsername && hashedPass == ClientPassword) {
_this.setState({ open: false, username: "", password: "" });
_this.props.changeLoggedin(true);
} else {
console.log("Wrong Username/Password", ClientUsername, ClientPassword, _this.state.username, _this.state.password);
_this.setState({ wrongPasswordMessage: "Wrong Username/Password!", username: "", password: "" });
_this.setState({ wrongPasswordMessage: "Wrong Username/Password!" });
}
}, _this.handleRequestClose = function () {
ws.close();

View File

@@ -2,7 +2,10 @@
IP = "192.168.1.100"
Port = "8000"
ClientAuthString = "" //String generated on first start and stored in the root as "clientAuth.txt"
ClientAuthString = "" //String generated on first start and stored in the root as "clientAuth.txt"
const LoginRequired = true
const ClientUsername = "admin"
const ClientPassword = "" //create a sha256 hash of your password and enter it here
//var ws = new WebSocket(`ws://${IP}:${Port}/websocket`); //for websockets not over an SSL reverse proxy