From 94f7ca5f3ce72dd928b06ff6b783f8417e3b8b73 Mon Sep 17 00:00:00 2001 From: OldHawk Date: Mon, 16 Oct 2017 11:46:54 +0800 Subject: [PATCH] feat(core): Code optimization with file download --- .../controllers/home.client.controller.js | 21 +----- .../core/client/views/home.client.view.html | 18 ++--- .../forums-topic.client.controller.js | 22 +----- .../client/views/topic.client.view.html | 4 +- .../admin/admin-list.client.controller.js | 21 +----- .../torrent-info.client.controller.js | 45 +----------- .../controllers/torrents.client.controller.js | 21 +----- .../torrent-download.client.service.js | 70 ++++++++++++++++++- .../views/admin/admin-list.client.view.html | 2 +- .../views/list-torrents.client.view.html | 2 +- .../views/view-torrent.client.view.html | 8 +-- .../admin/user-leeching.client.controller.js | 21 +----- .../admin/user-seeding.client.controller.js | 21 +----- .../admin/user-uploaded.client.controller.js | 21 +----- .../admin/user-warning.client.controller.js | 21 +----- .../status/downloading.client.controller.js | 21 +----- .../status/seeding.client.controller.js | 21 +----- .../status/uploaded.client.controller.js | 21 +----- .../status/warning.client.controller.js | 21 +----- .../admin/user-leeching.client.view.html | 2 +- .../views/admin/user-seeding.client.view.html | 2 +- .../views/admin/user-uplist.client.view.html | 2 +- .../views/admin/user-warning.client.view.html | 2 +- .../views/status/downloading.client.view.html | 2 +- .../views/status/seeding.client.view.html | 2 +- .../views/status/uploaded.client.view.html | 2 +- .../views/status/warning.client.view.html | 2 +- 27 files changed, 105 insertions(+), 313 deletions(-) diff --git a/modules/core/client/controllers/home.client.controller.js b/modules/core/client/controllers/home.client.controller.js index 9460e0fd..8b0421de 100644 --- a/modules/core/client/controllers/home.client.controller.js +++ b/modules/core/client/controllers/home.client.controller.js @@ -13,6 +13,7 @@ DownloadService, $timeout, localStorageService, ScrapeService, TorrentGetInfoServices, mtDebug, marked) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig; vm.appConfig = MeanTorrentConfig.meanTorrentConfig.app; @@ -543,26 +544,6 @@ window.open(url, '_blank'); }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * getOverviewMarkedContent * @param t diff --git a/modules/core/client/views/home.client.view.html b/modules/core/client/views/home.client.view.html index 12d644cb..adc2c1e2 100644 --- a/modules/core/client/views/home.client.view.html +++ b/modules/core/client/views/home.client.view.html @@ -14,7 +14,7 @@ ng-click="vm.openTorrentInfo(vm.movieTopOne._id);">
-
@@ -229,7 +229,7 @@ ng-click="vm.openTorrentInfo(vm.TVTopOne._id);">
-
@@ -455,7 +455,7 @@
-
@@ -631,7 +631,7 @@
-
@@ -799,7 +799,7 @@
-
@@ -967,7 +967,7 @@
-
@@ -1135,7 +1135,7 @@
-
@@ -1303,7 +1303,7 @@
-
@@ -1471,7 +1471,7 @@
-
diff --git a/modules/forums/client/controllers/forums-topic.client.controller.js b/modules/forums/client/controllers/forums-topic.client.controller.js index 81656a66..9bb652e1 100644 --- a/modules/forums/client/controllers/forums-topic.client.controller.js +++ b/modules/forums/client/controllers/forums-topic.client.controller.js @@ -13,6 +13,7 @@ marked, ModalConfirmService, $stateParams, TopicsService, localStorageService, $compile, RepliesService, $filter, Upload, DownloadService, mtDebug) { var vm = this; + vm.DLS = DownloadService vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig; vm.announce = MeanTorrentConfig.meanTorrentConfig.announce; vm.scoreConfig = MeanTorrentConfig.meanTorrentConfig.score; @@ -529,26 +530,5 @@ } }); }; - - /** - * downloadAttach - * @param t - * @param r - * @param af - */ - vm.downloadAttach = function (t, r, af) { - var url = '/api/attach/' + vm.topic._id.toString(); - url += r ? '/' + r._id.toString() : ''; - url += '?attachId=' + af._id.toString(); - - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - NotifycationService.showSuccessNotify('FORUMS.ATTACHE_DOWNLOAD_SUCCESSFULLY'); - } - }, function (err) { - mtDebug.info(err); - NotifycationService.showErrorNotify(err.data.message, 'FORUMS.ATTACHE_DOWNLOAD_FAILED'); - }); - }; } }()); diff --git a/modules/forums/client/views/topic.client.view.html b/modules/forums/client/views/topic.client.view.html index 7c53ed99..1dea3efc 100644 --- a/modules/forums/client/views/topic.client.view.html +++ b/modules/forums/client/views/topic.client.view.html @@ -122,7 +122,7 @@
  1. {{af.filename}} ( + ng-click="vm.DLS.downloadForumAttach(vm.topic._id, null, af._id);">{{af.filename}} ( {{'FORUMS.ATTACH_FILE_SIZE' | translate}} {{af.filesize | bytes}} {{'FORUMS.ATTACH_DOWN_COUNT' | translate}} {{af.downCount}} )
  2. @@ -198,7 +198,7 @@
    1. {{af.filename}} ( + ng-click="vm.DLS.downloadForumAttach(vm.topic._id, rep._id, af._id);">{{af.filename}} ( {{'FORUMS.ATTACH_FILE_SIZE' | translate}} {{af.filesize | bytes}} {{'FORUMS.ATTACH_DOWN_COUNT' | translate}} {{af.downCount}} )
    2. diff --git a/modules/torrents/client/controllers/admin/admin-list.client.controller.js b/modules/torrents/client/controllers/admin/admin-list.client.controller.js index 2d1c9260..18505a3a 100644 --- a/modules/torrents/client/controllers/admin/admin-list.client.controller.js +++ b/modules/torrents/client/controllers/admin/admin-list.client.controller.js @@ -14,6 +14,7 @@ DownloadService, $window, ModalConfirmService, NotifycationService, mtDebug, TorrentGetInfoServices, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -310,26 +311,6 @@ } }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * openTorrentInfo * @param id diff --git a/modules/torrents/client/controllers/torrent-info.client.controller.js b/modules/torrents/client/controllers/torrent-info.client.controller.js index 024299ee..23551ad5 100644 --- a/modules/torrents/client/controllers/torrent-info.client.controller.js +++ b/modules/torrents/client/controllers/torrent-info.client.controller.js @@ -15,6 +15,7 @@ getStorageLangService, ScrapeService, NotifycationService, mtDebug, TorrentGetInfoServices, localStorageService, $compile, SideOverlay, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -365,26 +366,6 @@ } }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * getVideoNfoHtml * @returns {*} @@ -745,30 +726,6 @@ }); }; - /** - * downloadSubtitle - * @param sub - */ - vm.downloadSubtitle = function (evt, sub) { - //evt.preventDefault(); - - var url = '/api/subtitles/' + vm.torrentLocalInfo._id.toString() + '/' + sub._id.toString(); - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('SUBTITLE_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - mtDebug.info(err); - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('SUBTITLE_DOWNLOAD_ERROR') - }); - }); - }; - - /** * openTorrentInfo * @param id diff --git a/modules/torrents/client/controllers/torrents.client.controller.js b/modules/torrents/client/controllers/torrents.client.controller.js index 5419ae28..694ef09b 100644 --- a/modules/torrents/client/controllers/torrents.client.controller.js +++ b/modules/torrents/client/controllers/torrents.client.controller.js @@ -11,6 +11,7 @@ function TorrentsController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, MeanTorrentConfig, DownloadService, $window, ScrapeService, mtDebug, TorrentGetInfoServices, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -267,26 +268,6 @@ } }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * openTorrentInfo * @param id diff --git a/modules/torrents/client/services/torrent-download.client.service.js b/modules/torrents/client/services/torrent-download.client.service.js index cfdc5f30..99b9cfcd 100644 --- a/modules/torrents/client/services/torrent-download.client.service.js +++ b/modules/torrents/client/services/torrent-download.client.service.js @@ -5,14 +5,78 @@ .module('torrents.services') .factory('DownloadService', DownloadService); - DownloadService.$inject = ['$http', 'FileSaver']; + DownloadService.$inject = ['$http', 'FileSaver', '$translate', 'Notification', 'NotifycationService']; - function DownloadService($http, FileSaver) { + function DownloadService($http, FileSaver, $translate, Notification, NotifycationService) { return { - downloadFile: downloadFile + downloadFile: downloadFile, + downloadTorrent: downloadTorrent, + downloadSubtitle: downloadSubtitle, + downloadForumAttach: downloadForumAttach }; + /** + * downloadTorrent + * @param id + */ + function downloadTorrent(id) { + var url = '/api/torrents/download/' + id; + downloadFile(url, null, function (status) { + if (status === 200) { + NotifycationService.showSuccessNotify('TORRENTS_DOWNLOAD_SUCCESSFULLY'); + } + }, function (err) { + mtDebug.info(err); + NotifycationService.showErrorNotify(err.data.message, 'TORRENT_DOWNLOAD_ERROR'); + }); + } + + /** + * downloadSubtitle + * @param tid + * @param sid + */ + function downloadSubtitle(tid, sid) { + var url = '/api/subtitles/' + tid + '/' + sid; + downloadFile(url, null, function (status) { + if (status === 200) { + NotifycationService.showSuccessNotify('SUBTITLE_DOWNLOAD_SUCCESSFULLY'); + } + }, function (err) { + mtDebug.info(err); + NotifycationService.showErrorNotify(err.data.message, 'SUBTITLE_DOWNLOAD_ERROR'); + }); + } + + /** + * downloadForumAttach + * @param tid + * @param rid + * @param aid + */ + function downloadForumAttach(tid, rid, aid) { + var url = '/api/attach/' + tid; + url += rid ? '/' + rid : ''; + url += '?attachId=' + aid; + + downloadFile(url, null, function (status) { + if (status === 200) { + NotifycationService.showSuccessNotify('FORUMS.ATTACHE_DOWNLOAD_SUCCESSFULLY'); + } + }, function (err) { + mtDebug.info(err); + NotifycationService.showErrorNotify(err.data.message, 'FORUMS.ATTACHE_DOWNLOAD_FAILED'); + }); + } + + /** + * downloadFile + * @param url + * @param request + * @param successcb + * @param errorcb + */ function downloadFile(url, request, successcb, errorcb) { $http({ url: url, diff --git a/modules/torrents/client/views/admin/admin-list.client.view.html b/modules/torrents/client/views/admin/admin-list.client.view.html index 5c3310e9..b93a173a 100644 --- a/modules/torrents/client/views/admin/admin-list.client.view.html +++ b/modules/torrents/client/views/admin/admin-list.client.view.html @@ -166,7 +166,7 @@
      diff --git a/modules/torrents/client/views/list-torrents.client.view.html b/modules/torrents/client/views/list-torrents.client.view.html index 11e47744..b44bfdb2 100644 --- a/modules/torrents/client/views/list-torrents.client.view.html +++ b/modules/torrents/client/views/list-torrents.client.view.html @@ -168,7 +168,7 @@
      diff --git a/modules/torrents/client/views/view-torrent.client.view.html b/modules/torrents/client/views/view-torrent.client.view.html index 937189f3..561c4536 100644 --- a/modules/torrents/client/views/view-torrent.client.view.html +++ b/modules/torrents/client/views/view-torrent.client.view.html @@ -11,7 +11,7 @@
      -
      @@ -521,7 +521,7 @@
      -
      @@ -576,7 +576,7 @@
      1. - {{s.subtitle_filename}} + {{s.subtitle_filename}} - {{s.subtitle_filesize | bytes: 2}} - {{s.createdat | date: 'yyyy-MM-dd HH:mm:ss'}} By @@ -754,7 +754,7 @@ + ng-click="vm.DLS.downloadTorrent(item._id); $event.stopPropagation();">
        diff --git a/modules/users/client/controllers/admin/user-leeching.client.controller.js b/modules/users/client/controllers/admin/user-leeching.client.controller.js index 638b44d7..ad7b1385 100644 --- a/modules/users/client/controllers/admin/user-leeching.client.controller.js +++ b/modules/users/client/controllers/admin/user-leeching.client.controller.js @@ -11,6 +11,7 @@ function UserLeechingController($scope, $state, $translate, $timeout, Authentication, Notification, PeersService, MeanTorrentConfig, $window, $filter, DownloadService, mtDebug, TorrentGetInfoServices, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -90,26 +91,6 @@ }); }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * openTorrentInfo * @param id diff --git a/modules/users/client/controllers/admin/user-seeding.client.controller.js b/modules/users/client/controllers/admin/user-seeding.client.controller.js index f74a6157..b32232aa 100644 --- a/modules/users/client/controllers/admin/user-seeding.client.controller.js +++ b/modules/users/client/controllers/admin/user-seeding.client.controller.js @@ -11,6 +11,7 @@ function UserSeedingController($scope, $state, $translate, $timeout, Authentication, Notification, PeersService, MeanTorrentConfig, $window, $filter, DownloadService, mtDebug, TorrentGetInfoServices, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -90,26 +91,6 @@ }); }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * openTorrentInfo * @param id diff --git a/modules/users/client/controllers/admin/user-uploaded.client.controller.js b/modules/users/client/controllers/admin/user-uploaded.client.controller.js index f20d6bb0..0bad50c9 100644 --- a/modules/users/client/controllers/admin/user-uploaded.client.controller.js +++ b/modules/users/client/controllers/admin/user-uploaded.client.controller.js @@ -11,6 +11,7 @@ function UserUploadedController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, MeanTorrentConfig, $window, $filter, DownloadService, mtDebug, TorrentGetInfoServices, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -89,26 +90,6 @@ }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * openTorrentInfo * @param id diff --git a/modules/users/client/controllers/admin/user-warning.client.controller.js b/modules/users/client/controllers/admin/user-warning.client.controller.js index bc77cb8a..ca24cb68 100644 --- a/modules/users/client/controllers/admin/user-warning.client.controller.js +++ b/modules/users/client/controllers/admin/user-warning.client.controller.js @@ -13,6 +13,7 @@ $window, $filter, DownloadService, mtDebug, TorrentGetInfoServices, ModalConfirmService, NotifycationService, CompleteService, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -92,26 +93,6 @@ }); }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * openTorrentInfo * @param id diff --git a/modules/users/client/controllers/status/downloading.client.controller.js b/modules/users/client/controllers/status/downloading.client.controller.js index 2e3b7e52..758d32d9 100644 --- a/modules/users/client/controllers/status/downloading.client.controller.js +++ b/modules/users/client/controllers/status/downloading.client.controller.js @@ -11,6 +11,7 @@ function DownloadingController($scope, $state, $translate, $timeout, Authentication, Notification, PeersService, MeanTorrentConfig, $window, $filter, DownloadService, mtDebug, TorrentGetInfoServices, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -89,26 +90,6 @@ }); }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * openTorrentInfo * @param id diff --git a/modules/users/client/controllers/status/seeding.client.controller.js b/modules/users/client/controllers/status/seeding.client.controller.js index 170dadce..b54e2bbd 100644 --- a/modules/users/client/controllers/status/seeding.client.controller.js +++ b/modules/users/client/controllers/status/seeding.client.controller.js @@ -11,6 +11,7 @@ function SeedingController($scope, $state, $translate, $timeout, Authentication, Notification, PeersService, MeanTorrentConfig, $window, $filter, DownloadService, mtDebug, TorrentGetInfoServices, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -88,26 +89,6 @@ }); }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * openTorrentInfo * @param id diff --git a/modules/users/client/controllers/status/uploaded.client.controller.js b/modules/users/client/controllers/status/uploaded.client.controller.js index 348249c7..1d6064e3 100644 --- a/modules/users/client/controllers/status/uploaded.client.controller.js +++ b/modules/users/client/controllers/status/uploaded.client.controller.js @@ -11,6 +11,7 @@ function UploadedController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, MeanTorrentConfig, $window, $filter, DownloadService, mtDebug, TorrentGetInfoServices, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -88,26 +89,6 @@ }); }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * openTorrentInfo * @param id diff --git a/modules/users/client/controllers/status/warning.client.controller.js b/modules/users/client/controllers/status/warning.client.controller.js index feeedb62..5e09af81 100644 --- a/modules/users/client/controllers/status/warning.client.controller.js +++ b/modules/users/client/controllers/status/warning.client.controller.js @@ -13,6 +13,7 @@ $window, $filter, DownloadService, NotifycationService, ModalConfirmService, getStorageLangService, mtDebug, TorrentGetInfoServices, ResourcesTagsServices) { var vm = this; + vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; vm.user = Authentication.user; vm.RTS = ResourcesTagsServices; @@ -48,26 +49,6 @@ }); }; - /** - * downloadTorrent - * @param id - */ - vm.downloadTorrent = function (id) { - var url = '/api/torrents/download/' + id; - DownloadService.downloadFile(url, null, function (status) { - if (status === 200) { - Notification.success({ - message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') - }); - } - }, function (err) { - Notification.error({ - title: 'ERROR', - message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') - }); - }); - }; - /** * openTorrentInfo * @param id diff --git a/modules/users/client/views/admin/user-leeching.client.view.html b/modules/users/client/views/admin/user-leeching.client.view.html index 51cba301..8a5e1883 100644 --- a/modules/users/client/views/admin/user-leeching.client.view.html +++ b/modules/users/client/views/admin/user-leeching.client.view.html @@ -56,7 +56,7 @@
        diff --git a/modules/users/client/views/admin/user-seeding.client.view.html b/modules/users/client/views/admin/user-seeding.client.view.html index 055fa4ef..e9ec2787 100644 --- a/modules/users/client/views/admin/user-seeding.client.view.html +++ b/modules/users/client/views/admin/user-seeding.client.view.html @@ -56,7 +56,7 @@
        diff --git a/modules/users/client/views/admin/user-uplist.client.view.html b/modules/users/client/views/admin/user-uplist.client.view.html index 2a3efeaa..8911253e 100644 --- a/modules/users/client/views/admin/user-uplist.client.view.html +++ b/modules/users/client/views/admin/user-uplist.client.view.html @@ -52,7 +52,7 @@
        diff --git a/modules/users/client/views/admin/user-warning.client.view.html b/modules/users/client/views/admin/user-warning.client.view.html index 3a52b412..4f279124 100644 --- a/modules/users/client/views/admin/user-warning.client.view.html +++ b/modules/users/client/views/admin/user-warning.client.view.html @@ -54,7 +54,7 @@
        diff --git a/modules/users/client/views/status/downloading.client.view.html b/modules/users/client/views/status/downloading.client.view.html index ea79c2ad..10f57bf1 100644 --- a/modules/users/client/views/status/downloading.client.view.html +++ b/modules/users/client/views/status/downloading.client.view.html @@ -56,7 +56,7 @@
        diff --git a/modules/users/client/views/status/seeding.client.view.html b/modules/users/client/views/status/seeding.client.view.html index 4307be10..66a8ff0c 100644 --- a/modules/users/client/views/status/seeding.client.view.html +++ b/modules/users/client/views/status/seeding.client.view.html @@ -56,7 +56,7 @@
        diff --git a/modules/users/client/views/status/uploaded.client.view.html b/modules/users/client/views/status/uploaded.client.view.html index 4a4121b4..1257065a 100644 --- a/modules/users/client/views/status/uploaded.client.view.html +++ b/modules/users/client/views/status/uploaded.client.view.html @@ -52,7 +52,7 @@
        diff --git a/modules/users/client/views/status/warning.client.view.html b/modules/users/client/views/status/warning.client.view.html index 90b9fe5a..d6a8be0a 100644 --- a/modules/users/client/views/status/warning.client.view.html +++ b/modules/users/client/views/status/warning.client.view.html @@ -48,7 +48,7 @@