This repository has been archived on 2022-01-02. You can view files and clone it, but cannot push or open issues or pull requests.
AriaNg/src/scripts/controllers/command.js

29 lines
989 B
JavaScript
Raw Normal View History

2016-06-25 13:47:02 +02:00
(function () {
'use strict';
angular.module('ariaNg').controller('CommandController', ['$rootScope', '$location', '$routeParams', 'base64', 'ariaNgCommonService', 'aria2TaskService', function ($rootScope, $location, $routeParams, base64, ariaNgCommonService, aria2TaskService) {
var path = $location.path();
var newUrlDownload = function (url) {
return aria2TaskService.newUriTask({
urls: [url],
options: {}
}, false, function (response) {
if (!response.success) {
return;
}
$location.path('/downloading');
});
};
if (path.indexOf('/new/') == 0) {
var base64Url = $routeParams.url;
var url = base64.urldecode(base64Url);
$rootScope.loadPromise = newUrlDownload(url);
} else {
ariaNgCommonService.error('Parameter is invalid!');
}
}]);
})();