diff --git a/app/index.html b/app/index.html index 29cd198..345cdaa 100644 --- a/app/index.html +++ b/app/index.html @@ -130,9 +130,24 @@
  • Basic Settings
  • +
  • + HTTP/FTP/SFTP Settings +
  • +
  • + HTTP Settings +
  • +
  • + FTP/SFTP Settings +
  • +
  • + BitTorrent/MegaLink Settings +
  • BitTorrent Settings
  • +
  • + MegaLink Settings +
  • RPC Settings
  • @@ -212,6 +227,7 @@ + diff --git a/app/scripts/controllers/settings-aria2.js b/app/scripts/controllers/settings-aria2.js index 9ef060d..cd538d3 100644 --- a/app/scripts/controllers/settings-aria2.js +++ b/app/scripts/controllers/settings-aria2.js @@ -1,7 +1,82 @@ (function () { 'use strict'; - angular.module('ariaNg').controller('Aria2SettingsController', ['$scope', 'SweetAlert', 'aria2RpcService', function ($scope, SweetAlert, aria2RpcService) { - + angular.module('ariaNg').controller('Aria2SettingsController', ['$scope', '$location', '$timeout', 'SweetAlert', 'translateFilter', 'ariaNgConstants', 'aria2AvailableOptions', 'aria2RpcService', function ($scope, $location, $timeout, SweetAlert, translateFilter, ariaNgConstants, aria2AvailableOptions, aria2RpcService) { + var location = $location.path().substring($location.path().lastIndexOf('/') + 1); + var pendingSaveRequest = {}; + + var getAvailableOptions = function (location) { + if (location == 'basic') { + return aria2AvailableOptions.basicOptions; + } else if (location == 'http-ftp-sftp') { + return aria2AvailableOptions.httpFtpSFtpOptions; + } else if (location == 'http') { + return aria2AvailableOptions.httpOptions; + } else if (location == 'ftp-sftp') { + return aria2AvailableOptions.ftpSFtpOptions; + } else if (location == 'bt-metalink') { + return aria2AvailableOptions.btMetalinkOptions; + } else if (location == 'bt') { + return aria2AvailableOptions.btOptions; + } else if (location == 'metalink') { + return aria2AvailableOptions.metalinkOptions; + } else if (location == 'rpc') { + return aria2AvailableOptions.rpcOptions; + } else if (location == 'advanced') { + return aria2AvailableOptions.advancedOptions; + } else { + SweetAlert.swal({ + title: translateFilter('Error'), + text: translateFilter('Type is illegal!'), + type: 'error', + confirmButtonText: translateFilter('OK') + }); + } + }; + + $scope.optionStatus = {}; + $scope.availableOptions = getAvailableOptions(location); + $scope.setGlobalOption = function (option, value, lazySave) { + if (!option || !option.key || option.readonly) { + return; + } + + var key = option.key; + var invoke = function () { + var data = {}; + data[key] = value; + + $scope.optionStatus[key] = 'saving'; + + return aria2RpcService.changeGlobalOption({ + params: [data], + callback: function () { + $scope.optionStatus[key] = 'saved'; + } + }); + }; + + delete $scope.optionStatus[key]; + + if (lazySave) { + if (pendingSaveRequest[key]) { + $timeout.cancel(pendingSaveRequest[key]); + } + + pendingSaveRequest[key] = $timeout(function () { + invoke(); + }, ariaNgConstants.lazySaveTimeout); + } else { + invoke(); + } + }; + + $scope.loadPromise = (function () { + return aria2RpcService.getGlobalOption({ + callback: function (result) { + $scope.globalOptions = result; + } + }) + })(); }]); })(); diff --git a/app/scripts/core/aria2options.js b/app/scripts/core/aria2options.js new file mode 100644 index 0000000..d960d59 --- /dev/null +++ b/app/scripts/core/aria2options.js @@ -0,0 +1,1022 @@ +(function () { + 'use strict'; + + angular.module('ariaNg').constant('aria2AvailableOptions', { + basicOptions: [ + { + key: 'dir', + name: 'Download Path', + type: 'string', + description: 'The directory to store the downloaded file.' + }, + { + key: 'log', + name: 'Log File', + type: 'string', + description: 'The file name of the log file. If - is specified, log is written to stdout. If empty string("") is specified, or this option is omitted, no log is written to disk at all.' + }, + { + key: 'max-concurrent-downloads', + name: 'Max Concurrent Downloads', + type: 'integer', + description: 'Set the maximum number of parallel downloads for every queue item.' + }, + { + key: 'check-integrity', + name: 'Check Integrity', + type: 'boolean', + description: 'Check file integrity by validating piece hashes or a hash of entire file. This option has effect only in BitTorrent, Metalink downloads with checksums or HTTP(S)/FTP downloads with --checksum option.' + }, + { + key: 'continue', + name: 'Resume Download', + type: 'boolean', + description: 'Continue downloading a partially downloaded file. Use this option to resume a download started by a web browser or another program which downloads files sequentially from the beginning. Currently this option is only applicable to HTTP(S)/FTP downloads.' + } + ], + httpFtpSFtpOptions: [ + { + key: 'all-proxy', + name: '', + type: 'string', + description: '' + }, + { + key: 'all-proxy-user', + name: '', + type: 'string', + description: '' + }, + { + key: 'all-proxy-passwd', + name: '', + type: 'string', + description: '' + }, + { + key: 'connect-timeout', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '' + }, + { + key: 'dry-run', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'lowest-speed-limit', + name: '', + type: 'string', + description: '' + }, + { + key: 'max-connection-per-server', + name: '', + type: 'integer', + description: '' + }, + { + key: 'max-file-not-found', + name: '', + type: 'integer', + description: '' + }, + { + key: 'max-tries', + name: '', + type: 'integer', + description: '' + }, + { + key: 'min-split-size', + name: '', + type: 'string', + suffix: 'Bytes', + description: '' + }, + { + key: 'netrc-path', + name: '', + type: 'string', + description: '', + readonly: true + }, + { + key: 'no-netrc', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'no-proxy', + name: '', + type: 'string', + description: '' + }, + { + key: 'proxy-method', + name: '', + type: 'option', + options: ['get', 'tunnel'], + description: '' + }, + { + key: 'remote-time', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'reuse-uri', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'retry-wait', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '' + }, + { + key: 'server-stat-of', + name: '', + type: 'string', + description: '' + }, + { + key: 'server-stat-timeout', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '', + readonly: true + }, + { + key: 'split', + name: '', + type: 'integer', + description: '' + }, + { + key: 'stream-piece-selector', + name: '', + type: 'option', + options: ['default', 'inorder', 'random', 'geom'], + description: '' + }, + { + key: 'timeout', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '' + }, + { + key: 'uri-selector', + name: '', + type: 'option', + options: ['inorder', 'feedback', 'adaptive'], + description: '' + } + ], + httpOptions: [ + { + key: 'check-certificate', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'http-accept-gzip', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'http-auth-challenge', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'http-no-cache', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'http-user', + name: '', + type: 'string', + description: '' + }, + { + key: 'http-passwd', + name: '', + type: 'string', + description: '' + }, + { + key: 'http-proxy', + name: '', + type: 'string', + description: '' + }, + { + key: 'http-proxy-user', + name: '', + type: 'string', + description: '' + }, + { + key: 'http-proxy-passwd', + name: '', + type: 'string', + description: '' + }, + { + key: 'https-proxy', + name: '', + type: 'string', + description: '' + }, + { + key: 'https-proxy-user', + name: '', + type: 'string', + description: '' + }, + { + key: 'https-proxy-passwd', + name: '', + type: 'string', + description: '' + }, + { + key: 'referer', + name: '', + type: 'string', + description: '' + }, + { + key: 'enable-http-keep-alive', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'enable-http-pipelining', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'header', + name: '', + type: 'string', + description: '' + }, + { + key: 'save-cookies', + name: '', + type: 'string', + description: '' + }, + { + key: 'use-head', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'user-agent', + name: '', + type: 'string', + description: '' + } + ], + ftpSFtpOptions: [ + { + key: 'ftp-user', + name: '', + type: 'string', + description: '' + }, + { + key: 'ftp-passwd', + name: '', + type: 'string', + description: '' + }, + { + key: 'ftp-pasv', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'ftp-proxy', + name: '', + type: 'string', + description: '' + }, + { + key: 'ftp-proxy-user', + name: '', + type: 'string', + description: '' + }, + { + key: 'ftp-proxy-passwd', + name: '', + type: 'string', + description: '' + }, + { + key: 'ftp-type', + name: '', + type: 'option', + options: ['binary', 'ascii'], + description: '' + }, + { + key: 'ftp-reuse-connection', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'ssh-host-key-md', + name: '', + type: 'string', + description: '' + } + ], + btMetalinkOptions: [ + { + key: 'show-files', + name: '', + type: 'boolean', + description: '', + readonly: true + } + ], + btOptions: [ + { + key: 'bt-detach-seed-only', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'bt-enable-hook-after-hash-check', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'bt-enable-lpd', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'bt-exclude-tracker', + name: '', + type: 'text', + description: '' + }, + { + key: 'bt-external-ip', + name: '', + type: 'string', + description: '' + }, + { + key: 'bt-force-encryption', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'bt-hash-check-seed', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'bt-max-open-files', + name: '', + type: 'integer', + description: '' + }, + { + key: 'bt-max-peers', + name: '', + type: 'integer', + description: '' + }, + { + key: 'bt-metadata-only', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'bt-min-crypto-level', + name: '', + type: 'option', + options: ['plain', 'arc4'], + description: '' + }, + { + key: 'bt-prioritize-piece', + name: '', + type: 'string', + description: '' + }, + { + key: 'bt-remove-unselected-file', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'bt-require-crypto', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'bt-request-peer-speed-limit', + name: '', + type: 'string', + description: '' + }, + { + key: 'bt-save-metadata', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'bt-seed-unverified', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'bt-stop-timeout', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '' + }, + { + key: 'bt-tracker', + name: '', + type: 'text', + description: '' + }, + { + key: 'bt-tracker-connect-timeout', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '' + }, + { + key: 'bt-tracker-interval', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '' + }, + { + key: 'bt-tracker-timeout', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '' + }, + { + key: 'dht-file-path', + name: '', + type: 'string', + description: '', + readonly: true + }, + { + key: 'dht-file-path6', + name: '', + type: 'string', + description: '', + readonly: true + }, + { + key: 'dht-listen-port', + name: '', + type: 'integer', + description: '', + readonly: true + }, + { + key: 'dht-message-timeout', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '', + readonly: true + }, + { + key: 'enable-dht', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'enable-dht6', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'enable-peer-exchange', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'follow-torrent', + name: '', + type: 'option', + options: ['true', 'false', 'mem'], + description: '' + }, + { + key: 'listen-port', + name: '', + type: 'integer', + description: '', + readonly: true + }, + { + key: 'max-overall-upload-limit', + name: '', + type: 'string', + description: '' + }, + { + key: 'max-upload-limit', + name: '', + type: 'string', + description: '' + }, + { + key: 'peer-id-prefix', + name: '', + type: 'string', + description: '', + readonly: true + }, + { + key: 'seed-ratio', + name: '', + type: 'float', + description: '' + }, + { + key: 'seed-time', + name: '', + type: 'integer', + suffix: 'Minutes', + description: '' + } + ], + metalinkOptions: [ + { + key: 'follow-metalink', + name: '', + type: 'option', + options: ['true', 'false', 'mem'], + description: '' + }, + { + key: 'metalink-base-uri', + name: '', + type: 'string', + description: '' + }, + { + key: 'metalink-language', + name: '', + type: 'string', + description: '' + }, + { + key: 'metalink-location', + name: '', + type: 'string', + description: '' + }, + { + key: 'metalink-os', + name: '', + type: 'string', + description: '' + }, + { + key: 'metalink-version', + name: '', + type: 'string', + description: '' + }, + { + key: 'metalink-preferred-protocol', + name: '', + type: 'option', + options: ['http', 'https', 'ftp', 'none'], + description: '' + }, + { + key: 'metalink-enable-unique-protocol', + name: '', + type: 'boolean', + description: '' + } + ], + rpcOptions: [ + { + key: 'enable-rpc', + name: 'Enable JSON-RPC/XML-RPC Server', + type: 'boolean', + description: 'Enable JSON-RPC/XML-RPC server.', + readonly: true + }, + { + key: 'pause-metadata', + name: 'Pause After Metadata Downloaded', + type: 'boolean', + description: 'Pause downloads created as a result of metadata download. There are 3 types of metadata downloads in aria2: (1) downloading .torrent file. (2) downloading torrent metadata using magnet link. (3) downloading metalink file. These metadata downloads will generate downloads using their metadata. This option pauses these subsequent downloads. This option is effective only when --enable-rpc=true is given.' + }, + { + key: 'rpc-allow-origin-all', + name: 'Allow All Origin Request', + type: 'boolean', + description: 'Add Access-Control-Allow-Origin header field with value * to the RPC response.', + readonly: true + }, + { + key: 'rpc-listen-all', + name: 'Listen on All Network Interfaces', + type: 'boolean', + description: 'Listen incoming JSON-RPC/XML-RPC requests on all network interfaces. If false is given, listen only on local loopback interface.', + readonly: true + }, + { + key: 'rpc-listen-port', + name: 'Listen Port', + type: 'integer', + description: 'Specify a port number for JSON-RPC/XML-RPC server to listen to.', + readonly: true + }, + { + key: 'rpc-max-request-size', + name: 'Max Request Size', + type: 'string', + suffix: 'Bytes', + description: 'Set max size of JSON-RPC/XML-RPC request. If aria2 detects the request is more than SIZE bytes, it drops connection.', + readonly: true + }, + { + key: 'rpc-save-upload-metadata', + name: 'Save Upload Metadata', + type: 'boolean', + description: 'Save the uploaded torrent or metalink meta data in the directory specified by --dir option. The file name consists of SHA-1 hash hex string of meta data plus extension. For torrent, the extension is \'.torrent\'. For metalink, it is \'.meta4\'. If false is given to this option, the downloads added by aria2.addTorrent() or aria2.addMetalink() will not be saved by --save-session option.' + }, + { + key: 'rpc-secure', + name: 'Enable SSL/TLS', + type: 'boolean', + description: 'RPC transport will be encrypted by SSL/TLS. The RPC clients must use https scheme to access the server. For WebSocket client, use wss scheme. Use --rpc-certificate and --rpc-private-key options to specify the server certificate and private key.', + readonly: true + } + ], + advancedOptions: [ + { + key: 'allow-overwrite', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'allow-piece-length-change', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'always-resume', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'async-dns', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'auto-file-renaming', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'auto-save-interval', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '', + readonly: true + }, + { + key: 'conditional-get', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'conf-path', + name: '', + type: 'string', + description: '', + readonly: true + }, + { + key: 'console-log-level', + name: '', + type: 'option', + options: ['debug', 'info', 'notice', 'warn', 'error'], + description: '', + readonly: true + }, + { + key: 'daemon', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'deferred-input', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'disable-ipv6', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'disk-cache', + name: '', + type: 'string', + suffix: 'Bytes', + description: '', + readonly: true + }, + { + key: 'download-result', + name: '', + type: 'option', + options: ['default', 'full', 'hide'], + description: '' + }, + { + key: 'dscp', + name: '', + type: 'string', + description: '', + readonly: true + }, + { + key: 'rlimit-nofile', + name: '', + type: 'string', + description: '', + readonly: true + }, + { + key: 'enable-color', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'enable-mmap', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'event-poll', + name: '', + type: 'option', + options: ['epoll', 'kqueue', 'port', 'poll', 'select'], + description: '', + readonly: true + }, + { + key: 'file-allocation', + name: '', + type: 'option', + options: ['none', 'prealloc', 'trunc', 'falloc'], + description: '' + }, + { + key: 'force-save', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'hash-check-only', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'human-readable', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'max-download-result', + name: '', + type: 'integer', + description: '' + }, + { + key: 'max-mmap-limit', + name: '', + type: 'string', + suffix: 'Bytes', + description: '' + }, + { + key: 'max-resume-failure-tries', + name: '', + type: 'integer', + description: '' + }, + { + key: 'min-tls-version', + name: '', + type: 'option', + options: ['SSLv3', 'TLSv1', 'TLSv1.1', 'TLSv1.2'], + description: '', + readonly: true + }, + { + key: 'log-level', + name: '', + type: 'option', + options: ['debug', 'info', 'notice', 'warn', 'error'], + description: '' + }, + { + key: 'piece-length', + name: '', + type: 'integer', + description: '' + }, + { + key: 'optimize-concurrent-downloads', + name: '', + type: 'string', + description: '' + }, + { + key: 'show-console-readout', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'summary-interval', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '', + readonly: true + }, + { + key: 'max-overall-download-limit', + name: '', + type: 'string', + description: '' + }, + { + key: 'max-download-limit', + name: '', + type: 'string', + description: '' + }, + { + key: 'no-conf', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'no-file-allocation-limit', + name: '', + type: 'string', + suffix: 'Bytes', + description: '' + }, + { + key: 'parameterized-uri', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'quiet', + name: '', + type: 'boolean', + description: '', + readonly: true + }, + { + key: 'realtime-chunk-checksum', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'remove-control-file', + name: '', + type: 'boolean', + description: '' + }, + { + key: 'save-session', + name: '', + type: 'string', + description: '' + }, + { + key: 'save-session-interval', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '', + readonly: true + }, + { + key: 'socket-recv-buffer-size', + name: '', + type: 'string', + suffix: 'Bytes', + description: '', + readonly: true + }, + { + key: 'stop', + name: '', + type: 'integer', + suffix: 'Seconds', + description: '', + readonly: true + }, + { + key: 'truncate-console-readout', + name: '', + type: 'boolean', + description: '', + readonly: true + } + ] + }); +})(); diff --git a/app/scripts/core/config.js b/app/scripts/core/config.js index b1de577..ead6a27 100644 --- a/app/scripts/core/config.js +++ b/app/scripts/core/config.js @@ -17,21 +17,21 @@ }); amMoment.changeLocale(ariaNgSettingService.getLanguage()); - }]).run(['$rootScope', '$location', '$document', 'SweetAlert', 'ariaNgConstants', function ($rootScope, $location, $document, SweetAlert, ariaNgConstants) { + }]).run(['$rootScope', '$location', '$document', 'SweetAlert', 'ariaNgConstants', 'utils', function ($rootScope, $location, $document, SweetAlert, ariaNgConstants, utils) { var setNavbarSelected = function (location) { angular.element('section.sidebar > ul li').removeClass('active'); angular.element('section.sidebar > ul > li[data-href-match]').each(function (index, element) { - var prefix = angular.element(element).attr('data-href-match'); + var match = angular.element(element).attr('data-href-match'); - if (location.indexOf(prefix) == 0) { + if (utils.isUrlMatchUrl2(match, location)) { angular.element(element).addClass('active'); } }); angular.element('section.sidebar > ul > li.treeview > ul.treeview-menu > li[data-href-match]').each(function (index, element) { - var prefix = angular.element(element).attr('data-href-match'); + var match = angular.element(element).attr('data-href-match'); - if (location.indexOf(prefix) == 0) { + if (utils.isUrlMatchUrl2(match, location)) { angular.element(element).addClass('active').parent().parent().addClass('active'); } }); diff --git a/app/scripts/core/constants.js b/app/scripts/core/constants.js index 372e0d2..b042886 100644 --- a/app/scripts/core/constants.js +++ b/app/scripts/core/constants.js @@ -4,7 +4,8 @@ angular.module('ariaNg').constant('ariaNgConstants', { title: 'Aria Ng', appPrefix: 'AriaNg', - optionStorageKey: 'Options' + optionStorageKey: 'Options', + lazySaveTimeout: 500 }).constant('ariaNgDefaultOptions', { language: 'en-US', rpcHost: '', diff --git a/app/scripts/core/router.js b/app/scripts/core/router.js index 10fe6ca..1b871e2 100644 --- a/app/scripts/core/router.js +++ b/app/scripts/core/router.js @@ -23,10 +23,30 @@ templateUrl: 'views/settings-aria2.html', controller: 'Aria2SettingsController' }) + .when('/settings/aria2/http-ftp-sftp', { + templateUrl: 'views/settings-aria2.html', + controller: 'Aria2SettingsController' + }) + .when('/settings/aria2/http', { + templateUrl: 'views/settings-aria2.html', + controller: 'Aria2SettingsController' + }) + .when('/settings/aria2/ftp-sftp', { + templateUrl: 'views/settings-aria2.html', + controller: 'Aria2SettingsController' + }) + .when('/settings/aria2/bt-metalink', { + templateUrl: 'views/settings-aria2.html', + controller: 'Aria2SettingsController' + }) .when('/settings/aria2/bt', { templateUrl: 'views/settings-aria2.html', controller: 'Aria2SettingsController' }) + .when('/settings/aria2/metalink', { + templateUrl: 'views/settings-aria2.html', + controller: 'Aria2SettingsController' + }) .when('/settings/aria2/rpc', { templateUrl: 'views/settings-aria2.html', controller: 'Aria2SettingsController' diff --git a/app/scripts/core/utils.js b/app/scripts/core/utils.js index 53cf65d..2303929 100644 --- a/app/scripts/core/utils.js +++ b/app/scripts/core/utils.js @@ -37,6 +37,25 @@ return path.substring(index + 1); }, + isUrlMatchUrl2: function (url, url2) { + if (url === url2) { + return true; + } + + var index = url2.indexOf(url); + + if (index !== 0) { + return false; + } + + var lastPart = url2.substring(url.length); + + if (lastPart.indexOf('/') == 0) { + return true; + } + + return false; + }, parseOrderType: function (value) { var values = value.split(':'); diff --git a/app/scripts/langs/en-US.js b/app/scripts/langs/en-US.js index 830c0c6..21d3331 100644 --- a/app/scripts/langs/en-US.js +++ b/app/scripts/langs/en-US.js @@ -4,6 +4,13 @@ angular.module('ariaNg').config(['$translateProvider', function ($translateProvider) { $translateProvider.translations('en-US', { 'English': 'English', + 'Error': 'Error', + 'OK': 'OK', + 'Cancel': 'Cancel', + 'True': 'True', + 'true': 'True', + 'False': 'False', + 'false': 'False', 'New': 'New', 'Start': 'Start', 'Pause': 'Pause', @@ -23,7 +30,12 @@ 'AriaNg Settings': 'AriaNg Settings', 'Aria2 Settings': 'Aria2 Settings', 'Basic Settings': 'Basic Settings', + 'HTTP/FTP/SFTP Settings': 'HTTP/FTP/SFTP Settings', + 'HTTP Settings': 'HTTP Settings', + 'FTP/SFTP Settings': 'FTP/SFTP Settings', + 'BitTorrent/MegaLink Settings': 'BitTorrent/MegaLink Settings', 'BitTorrent Settings': 'BitTorrent Settings', + 'MegaLink Settings': 'MegaLink Settings', 'RPC Settings': 'RPC Settings', 'Advanced Settings': 'Advanced Settings', 'Aria2 Status': 'Aria2 Status', @@ -45,10 +57,55 @@ 'Loading': 'Loading...', 'More Than One Day': 'More than 1 day', 'Unknown': 'Unknown', + 'Bytes': 'Bytes', + 'Minutes': 'Minutes', 'Seconds': 'Seconds', 'Milliseconds': 'Milliseconds', '(0 is disabled)': '(0 is disabled)', - 'Changes to the settings take effect after refreshing page.': 'Changes to the settings take effect after refreshing page.' + 'Changes to the settings take effect after refreshing page.': 'Changes to the settings take effect after refreshing page.', + 'Download Path': 'Download Path', + 'The directory to store the downloaded file.': '', + 'Input File': 'Input File', + 'The input file can contain a list of URIs for aria2 to download.': '', + 'Log File': 'Log File', + 'The file name of the log file. If - is specified, log is written to stdout. If empty string("") is specified, or this option is omitted, no log is written to disk at all.': 'The file name of the log file. If - is specified, log is written to stdout. If empty string("") is specified, or this option is omitted, no log is written to disk at all.', + 'Max Concurrent Downloads': 'Max Concurrent Downloads', + 'Set the maximum number of parallel downloads for every queue item.': '', + 'Check Integrity': 'Check Integrity', + 'Check file integrity by validating piece hashes or a hash of entire file. This option has effect only in BitTorrent, Metalink downloads with checksums or HTTP(S)/FTP downloads with --checksum option.': 'Check file integrity by validating piece hashes or a hash of entire file. This option has effect only in BitTorrent, Metalink downloads with checksums or HTTP(S)/FTP downloads with --checksum option.', + 'Resume Download': 'Resume Download', + 'Continue downloading a partially downloaded file. Use this option to resume a download started by a web browser or another program which downloads files sequentially from the beginning. Currently this option is only applicable to HTTP(S)/FTP downloads.': 'Continue downloading a partially downloaded file. Use this option to resume a download started by a web browser or another program which downloads files sequentially from the beginning. Currently this option is only applicable to HTTP(S)/FTP downloads.', + 'Enable JSON-RPC/XML-RPC Server': 'Enable JSON-RPC/XML-RPC Server', + 'Enable JSON-RPC/XML-RPC server.': '', + 'Pause After Metadata Downloaded': 'Pause After Metadata Downloaded', + 'Pause downloads created as a result of metadata download. There are 3 types of metadata downloads in aria2: (1) downloading .torrent file. (2) downloading torrent metadata using magnet link. (3) downloading metalink file. These metadata downloads will generate downloads using their metadata. This option pauses these subsequent downloads. This option is effective only when --enable-rpc=true is given.': 'Pause downloads created as a result of metadata download. There are 3 types of metadata downloads in aria2: (1) downloading .torrent file. (2) downloading torrent metadata using magnet link. (3) downloading metalink file. These metadata downloads will generate downloads using their metadata. This option pauses these subsequent downloads. This option is effective only when --enable-rpc=true is given.', + 'Allow All Origin Request': 'Allow All Origin Request', + 'Add Access-Control-Allow-Origin header field with value * to the RPC response.': 'Add Access-Control-Allow-Origin header field with value * to the RPC response.', + 'Listen on All Network Interfaces': 'Listen on All Network Interfaces', + 'Listen incoming JSON-RPC/XML-RPC requests on all network interfaces. If false is given, listen only on local loopback interface.': 'Listen incoming JSON-RPC/XML-RPC requests on all network interfaces. If false is given, listen only on local loopback interface.', + 'Listen Port': 'Listen Port', + 'Specify a port number for JSON-RPC/XML-RPC server to listen to.': '', + 'Max Request Size': 'Max Request Size', + 'Set max size of JSON-RPC/XML-RPC request. If aria2 detects the request is more than SIZE bytes, it drops connection.': 'Set max size of JSON-RPC/XML-RPC request. If aria2 detects the request is more than SIZE bytes, it drops connection.', + 'Save Upload Metadata': 'Save Upload Metadata', + 'Save the uploaded torrent or metalink meta data in the directory specified by --dir option. The file name consists of SHA-1 hash hex string of meta data plus extension. For torrent, the extension is \'.torrent\'. For metalink, it is \'.meta4\'. If false is given to this option, the downloads added by aria2.addTorrent() or aria2.addMetalink() will not be saved by --save-session option.': 'Save the uploaded torrent or metalink meta data in the directory specified by --dir option. The file name consists of SHA-1 hash hex string of meta data plus extension. For torrent, the extension is \'.torrent\'. For metalink, it is \'.meta4\'. If false is given to this option, the downloads added by aria2.addTorrent() or aria2.addMetalink() will not be saved by --save-session option.', + 'Enable SSL/TLS': 'Enable SSL/TLS', + 'RPC transport will be encrypted by SSL/TLS. The RPC clients must use https scheme to access the server. For WebSocket client, use wss scheme. Use --rpc-certificate and --rpc-private-key options to specify the server certificate and private key.': 'RPC transport will be encrypted by SSL/TLS. The RPC clients must use https scheme to access the server. For WebSocket client, use wss scheme. Use --rpc-certificate and --rpc-private-key options to specify the server certificate and private key.', + 'Type is illegal!': 'Type is illegal!', + 'none': 'None', + 'http': 'Http', + 'https': 'Https', + 'ftp': 'Ftp', + 'mem': 'Memory Only', + 'plain': 'Plain', + 'arc4': 'ARC4', + 'binary': 'Binary', + 'ascii': 'ASCII', + 'debug': 'Debug', + 'info': 'Info', + 'notice': 'Notice', + 'warn': 'Warn', + 'error': 'Error' }); }]) })(); diff --git a/app/scripts/langs/zh-CN.js b/app/scripts/langs/zh-CN.js index 1aae199..521b6b4 100644 --- a/app/scripts/langs/zh-CN.js +++ b/app/scripts/langs/zh-CN.js @@ -4,6 +4,13 @@ angular.module('ariaNg').config(['$translateProvider', function ($translateProvider) { $translateProvider.translations('zh-CN', { 'Simplified Chinese': '简体中文', + 'Error': '错误', + 'OK': '确定', + 'Cancel': '取消', + 'True': '是', + 'true': '是', + 'False': '否', + 'false': '否', 'New': '新建', 'Start': '开始下载任务', 'Pause': '暂停下载任务', @@ -23,7 +30,12 @@ 'AriaNg Settings': 'AriaNg 设置', 'Aria2 Settings': 'Aria2 设置', 'Basic Settings': '基本设置', + 'HTTP/FTP/SFTP Settings': 'HTTP/FTP/SFTP 设置', + 'HTTP Settings': 'HTTP 设置', + 'FTP/SFTP Settings': 'FTP/SFTP 设置', + 'BitTorrent/MegaLink Settings': 'BitTorrent/磁链设置', 'BitTorrent Settings': 'BitTorrent 设置', + 'MegaLink Settings': '磁链设置', 'RPC Settings': 'RPC 设置', 'Advanced Settings': '高级设置', 'Aria2 Status': 'Aria2 状态', @@ -45,10 +57,55 @@ 'Loading': '正在加载...', 'More Than One Day': '超过1天', 'Unknown': '未知', + 'Bytes': '字节', + 'Minutes': '分', 'Seconds': '秒', 'Milliseconds': '毫秒', '(0 is disabled)': '(0为禁用)', - 'Changes to the settings take effect after refreshing page.': '设置将在页面刷新后生效.' + 'Changes to the settings take effect after refreshing page.': '设置将在页面刷新后生效.', + 'Download Path': '下载路径', + 'The directory to store the downloaded file.': '', + 'Input File': '输入文件', + 'The input file can contain a list of URIs for aria2 to download.': '', + 'Log File': '日志文件', + 'The file name of the log file. If - is specified, log is written to stdout. If empty string("") is specified, or this option is omitted, no log is written to disk at all.': '日志文件的路径. 如果设置为 "-", 日志则写入到 stdout. 如果设置为空字符串(""), 日志将不会记录到磁盘上.', + 'Max Concurrent Downloads': '最大同时下载数', + 'Set the maximum number of parallel downloads for every queue item.': '', + 'Check Integrity': '检查完整性', + 'Check file integrity by validating piece hashes or a hash of entire file. This option has effect only in BitTorrent, Metalink downloads with checksums or HTTP(S)/FTP downloads with --checksum option.' : '通过对文件的每个分块或整个文件进行哈希验证来检查文件的完整性. 此选项仅对于BT、磁力链接及设置了 --checksum 选项的 HTTP(S)/FTP 链接.', + 'Resume Download': '断点续传', + 'Continue downloading a partially downloaded file. Use this option to resume a download started by a web browser or another program which downloads files sequentially from the beginning. Currently this option is only applicable to HTTP(S)/FTP downloads.': '继续下载部分完成的文件. 启用此选项可以继续下载从浏览器或其他程序按顺序下载的文件. 此选项目前只支持 HTTP(S)/FTP 下载的文件.', + 'Enable JSON-RPC/XML-RPC Server': '启用 JSON-RPC/XML-RPC 服务器', + 'Enable JSON-RPC/XML-RPC server.': '', + 'Pause After Metadata Downloaded': '元数据下载完后暂停', + 'Pause downloads created as a result of metadata download. There are 3 types of metadata downloads in aria2: (1) downloading .torrent file. (2) downloading torrent metadata using magnet link. (3) downloading metalink file. These metadata downloads will generate downloads using their metadata. This option pauses these subsequent downloads. This option is effective only when --enable-rpc=true is given.': '当元数据下载完成后暂停后续的下载. 在 aria2 中有三种类型的元数据下载: (1) 下载 .torrent 文件. (2) 通过磁链下载种子元数据. (3) 下载磁链文件. 这些元数据下载完后会根据元数据内容进行下载. 这个选项会暂停这些后续的下载. 此选项仅当 --enable-rpc 启用时生效.', + 'Allow All Origin Request': '接受所有远程请求', + 'Add Access-Control-Allow-Origin header field with value * to the RPC response.': '在 RPC 响应头增加 Access-Control-Allow-Origin 字段, 值为 * .', + 'Listen on All Network Interfaces': '在所有网卡上监听', + 'Listen incoming JSON-RPC/XML-RPC requests on all network interfaces. If false is given, listen only on local loopback interface.': '在所有网络适配器上监听 JSON-RPC/XML-RPC 的请求, 如果设置为否, 仅监听本地网络的请求.', + 'Listen Port': '监听端口', + 'Specify a port number for JSON-RPC/XML-RPC server to listen to.': '', + 'Max Request Size': '最大请求大小', + 'Set max size of JSON-RPC/XML-RPC request. If aria2 detects the request is more than SIZE bytes, it drops connection.': '设置 JSON-RPC/XML-RPC 最大的请求大小. 如果 aria2 检测到请求超过设定的字节数, 会直接取消连接.', + 'Save Upload Metadata': '保存上传的元数据', + 'Save the uploaded torrent or metalink meta data in the directory specified by --dir option. The file name consists of SHA-1 hash hex string of meta data plus extension. For torrent, the extension is \'.torrent\'. For metalink, it is \'.meta4\'. If false is given to this option, the downloads added by aria2.addTorrent() or aria2.addMetalink() will not be saved by --save-session option.': '在 dir 参数设置的目录中保存上传的种子文件或磁链的元数据. 文件名包括 SHA-1 哈希后的元数据和扩展名两部分. 对于种子文件, 扩展名为 \'.torrent\'. 对于磁链为 \'.meta4\'. 如果此选项设置为否, 通过 aria2.addTorrent() 或 aria2.addMetalink() 方法添加的下载将无法通过 --save-session 选项保存.', + 'Enable SSL/TLS': '启用 SSL/TLS', + 'RPC transport will be encrypted by SSL/TLS. The RPC clients must use https scheme to access the server. For WebSocket client, use wss scheme. Use --rpc-certificate and --rpc-private-key options to specify the server certificate and private key.': 'RPC 将通过 SSL/TLS 加密传输. RPC 客户端需要使用 https 协议连接服务器. 对于 WebSocket 客户端, 使用 wss 协议. 使用 --rpc-certificate 和 --rpc-private-key 选项设置服务器的证书和私钥.', + 'Type is illegal!': '类型错误!', + 'none': '无', + 'http': 'Http', + 'https': 'Https', + 'ftp': 'Ftp', + 'mem': '仅内存', + 'plain': '明文', + 'arc4': 'ARC4', + 'binary': '二进制', + 'ascii': 'ASCII', + 'debug': '调试 (Debug)', + 'info': '普通 (Info)', + 'notice': '一般 (Notice)', + 'warn': '警告 (Warn)', + 'error': '错误 (Error)' }); }]) })(); diff --git a/app/styles/aria-ng.css b/app/styles/aria-ng.css index 881916f..f438fbf 100644 --- a/app/styles/aria-ng.css +++ b/app/styles/aria-ng.css @@ -157,6 +157,10 @@ background-color: #208fe5; } +.skin-aria-ng .icon-primary { + color: #3c8dbc; +} + /* override */ td { vertical-align: middle !important; @@ -347,10 +351,6 @@ td { background-color: #eee; } -.settings-table .setting-key { - padding-top: 6px; -} - .settings-table .asterisk { color: red; } @@ -358,13 +358,32 @@ td { .settings-table .description { color: #888; font-size: 12px; + font-weight: normal; display: block; } +.settings-table em { + color: #888; + font-size: 12px; + font-weight: normal; +} + .settings-table .wholeline { display: block; } +.settings-table .setting-value .form-group { + margin-bottom: 0; +} + +.settings-table .setting-value .form-group .form-control-icon { + color: #3c8dbc; +} + +.settings-table .setting-value .form-group .form-control-feedback { + right: 10px; +} + .settings-table .tip { background-color: #fff !important; font-size: 12px; @@ -379,15 +398,17 @@ td { font-weight: bold; } - .settings-table .status-key { - font-weight: bold; - } - .settings-table .description { display: inline-block; } } +@media (min-width: 768px) { + .settings-table .setting-key-without-desc { + padding-top: 6px; + } +} + /* miscellaneous */ span.realtime-upload, span.realtime-download { padding: 0 15px 0 15px; diff --git a/app/views/settings-aria2.html b/app/views/settings-aria2.html index 465d0d9..4746e87 100644 --- a/app/views/settings-aria2.html +++ b/app/views/settings-aria2.html @@ -1,5 +1,72 @@
    +
    +
    + + + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    +
    +
    diff --git a/app/views/settings-ariang.html b/app/views/settings-ariang.html index 544452a..2f088d2 100644 --- a/app/views/settings-ariang.html +++ b/app/views/settings-ariang.html @@ -1,7 +1,7 @@
    -
    +
    Language
    @@ -12,7 +12,7 @@
    -
    +
    Aria2 RPC Host *
    @@ -21,12 +21,12 @@ : - +
    -
    +
    Aria2 RPC Port *
    @@ -35,7 +35,7 @@
    -
    +
    Aria2 RPC Protocol *
    @@ -56,7 +56,7 @@
    - Milliseconds + Milliseconds
    @@ -70,7 +70,7 @@
    - Milliseconds + Milliseconds
    diff --git a/app/views/status.html b/app/views/status.html index b29a689..71f5edf 100644 --- a/app/views/status.html +++ b/app/views/status.html @@ -1,18 +1,18 @@
    -
    +
    Aria2 Version
    -
    +
    -
    +
    Enabled Features
    -
    +