From 313a195831b0a800e3092cb0e003c65125dc0ed4 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 29 Sep 2019 17:48:30 +0200 Subject: [PATCH] Support for torrent direct download through magnet link in web panel --- .../css/source/webpanel/plugins/media/torrents.scss | 11 +++++++++++ .../backend/http/static/js/plugins/media/torrents.js | 10 ++++++++++ .../backend/http/templates/plugins/media/index.html | 1 - .../http/templates/plugins/media/torrents.html | 9 +++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/platypush/backend/http/static/css/source/webpanel/plugins/media/torrents.scss b/platypush/backend/http/static/css/source/webpanel/plugins/media/torrents.scss index 70387bfb..b813c4a8 100644 --- a/platypush/backend/http/static/css/source/webpanel/plugins/media/torrents.scss +++ b/platypush/backend/http/static/css/source/webpanel/plugins/media/torrents.scss @@ -7,6 +7,17 @@ padding: 0; text-align: center; + .search { + input[type=text] { + width: 88%; + max-width: none; + } + + input[type=submit] { + width: 8%; + } + } + .head { font-weight: bold; padding: .5rem 0 2.5rem 0; diff --git a/platypush/backend/http/static/js/plugins/media/torrents.js b/platypush/backend/http/static/js/plugins/media/torrents.js index cdeebef0..8c734358 100644 --- a/platypush/backend/http/static/js/plugins/media/torrents.js +++ b/platypush/backend/http/static/js/plugins/media/torrents.js @@ -63,6 +63,16 @@ Vue.component('media-torrents', { this.selectedItem = item; openDropdown(this.$refs.menu); }, + + onMagnetDownload: async function() { + const magnet = this.$refs.magnetLink.value.trim(); + if (!magnet.length) + return; + + const ret = await request('torrent.download', { + torrent: magnet, + }); + } }, }); diff --git a/platypush/backend/http/templates/plugins/media/index.html b/platypush/backend/http/templates/plugins/media/index.html index 5c22e009..40760f37 100644 --- a/platypush/backend/http/templates/plugins/media/index.html +++ b/platypush/backend/http/templates/plugins/media/index.html @@ -27,7 +27,6 @@