From 5d40bd8e06b26e3b185bfd0bd4ef1ad722dacd86 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sat, 21 Oct 2017 15:15:28 +0200 Subject: [PATCH 1/3] Added Pirate Search component. --- client/app/components/admin/AdminRequestInfo.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/app/components/admin/AdminRequestInfo.jsx b/client/app/components/admin/AdminRequestInfo.jsx index dd508de..f0de6f1 100644 --- a/client/app/components/admin/AdminRequestInfo.jsx +++ b/client/app/components/admin/AdminRequestInfo.jsx @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import PirateSearch from './PirateSearch.jsx' class AdminRequestInfo extends Component { @@ -54,6 +55,10 @@ class AdminRequestInfo extends Component { user_agent: {this.userAgent(request.user_agent)}
request_date: {request.requested_date}
+ + + ) } From 71e7f46927e8719794e26cbbac86e5879972a9cc Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sat, 21 Oct 2017 15:16:15 +0200 Subject: [PATCH 2/3] AdminRequestInfo is also passed listItemSelected variable --- client/app/components/admin/Admin.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/app/components/admin/Admin.jsx b/client/app/components/admin/Admin.jsx index 31a451d..47d941a 100644 --- a/client/app/components/admin/Admin.jsx +++ b/client/app/components/admin/Admin.jsx @@ -67,7 +67,10 @@ class AdminComponent extends React.Component { style={adminComponentStyle.sidebar} />
- +
) From 3d73000e92ff88325e188a691563a0c900411ffb Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sat, 21 Oct 2017 15:16:58 +0200 Subject: [PATCH 3/3] Displays a button that can be used to fetch search results and then each element has a magnet button to send it back. --- client/app/components/admin/PirateSearch.jsx | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 client/app/components/admin/PirateSearch.jsx diff --git a/client/app/components/admin/PirateSearch.jsx b/client/app/components/admin/PirateSearch.jsx new file mode 100644 index 0000000..b1d5191 --- /dev/null +++ b/client/app/components/admin/PirateSearch.jsx @@ -0,0 +1,57 @@ +import React, { Component } from 'react'; +import { fetchJSON } from '../http.jsx'; + +class PirateSearch extends Component { + constructor() { + super(); + this.state = { + response: [], + name: '', + } + } + + sendToDownload(torrent) { + console.log(torrent.magnet) + + let data = {magnet: torrent.magnet} + fetchJSON('https://apollo.kevinmidboe.com/api/v1/pirate/add', 'POST', data) + .then((response) => { + console.log(response) + }) + } + + searchTheBay() { + const query = this.props.name; + const type = this.props.type; + + fetchJSON('https://apollo.kevinmidboe.com/api/v1/pirate/search?query='+query+'&type='+type, 'GET') + .then((response) => { + console.log(response.torrents) + this.setState({ + response: response.torrents.map((torrent, index) => { + return ( +
+ {torrent.name}
+ {torrent.size}
+ {torrent.seed}
+ +

+
+ ) + }) + }) + }) + } + + render() { + return ( +
+ {this.props.name} + + {this.state.response} +
+ ) + } +} + +export default PirateSearch \ No newline at end of file