From b1203e3e8be8545392be004cb6e31728ff158cc6 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 10 Dec 2016 23:14:11 +0800 Subject: [PATCH 001/120] add tooltip --- src/index.html | 4 ++-- src/langs/zh_CN.txt | 1 + src/scripts/config/defaultLanguage.js | 1 + src/scripts/directives/chart.js | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.html b/src/index.html index 5549771..460c2e1 100644 --- a/src/index.html +++ b/src/index.html @@ -233,8 +233,8 @@  
- + diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index 1586b71..ce0362a 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -44,6 +44,7 @@ Error Occurred=发生错误 Removed=已删除 Downloaded / Stopped=已完成 / 已停止 Uncompleted=未完成 +Click to pin=点击固定 Settings=系统设置 AriaNg Settings=AriaNg 设置 Aria2 Settings=Aria2 设置 diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 5ce4146..5013ade 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -48,6 +48,7 @@ 'Removed': 'Removed', 'Downloaded / Stopped': 'Downloaded / Stopped', 'Uncompleted': 'Uncompleted', + 'Click to pin': 'Click to pin', 'Settings': 'Settings', 'AriaNg Settings': 'AriaNg Settings', 'Aria2 Settings': 'Aria2 Settings', diff --git a/src/scripts/directives/chart.js b/src/scripts/directives/chart.js index 40d9046..daebc71 100644 --- a/src/scripts/directives/chart.js +++ b/src/scripts/directives/chart.js @@ -65,7 +65,7 @@ content: '
' + loadingIcon +'
', html: true, placement: options.ngPlacement, - template: '', + template: '', trigger: options.ngTrigger }).on('shown.bs.popover', function () { var wrapper = angular.element('.chart-pop'); From d03de0dc5c513373b62d2e3e6ef6b7810795782c Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 00:09:29 +0800 Subject: [PATCH 002/120] log message when show error dialog --- src/scripts/services/ariaNgCommonService.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scripts/services/ariaNgCommonService.js b/src/scripts/services/ariaNgCommonService.js index 6c840dd..aecfa4d 100644 --- a/src/scripts/services/ariaNgCommonService.js +++ b/src/scripts/services/ariaNgCommonService.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('ariaNg').factory('ariaNgCommonService', ['$location', '$timeout', 'base64', 'SweetAlert', '$translate', 'ariaNgConstants', function ($location, $timeout, base64, SweetAlert, $translate, ariaNgConstants) { + angular.module('ariaNg').factory('ariaNgCommonService', ['$location', '$timeout', 'base64', 'SweetAlert', '$translate', 'ariaNgConstants', 'ariaNgLogService', function ($location, $timeout, base64, SweetAlert, $translate, ariaNgConstants, ariaNgLogService) { return { generateUniqueId: function () { var sourceId = ariaNgConstants.appPrefix + '_' + Math.round(new Date().getTime() / 1000) + '_' + Math.random(); @@ -20,6 +20,7 @@ }, 100); }, showError: function (text) { + ariaNgLogService.error("[Error Dialog] " + text); this.showDialog('Error', text, 'error'); }, showOperationSucceeded: function (text) { From 74e3b8f6147240643bceb831f542cf8310b1ed90 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 00:25:19 +0800 Subject: [PATCH 003/120] support restart task --- src/langs/zh_CN.txt | 4 + src/scripts/config/defaultLanguage.js | 4 + src/scripts/controllers/main.js | 37 +++++++-- src/scripts/services/aria2TaskService.js | 96 +++++++++++++++++++++++- src/views/list.html | 1 + 5 files changed, 133 insertions(+), 9 deletions(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index ce0362a..e85fc77 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -15,6 +15,7 @@ RPC=RPC New=新建 Start=开始任务 Pause=暂停任务 +Restart=重试 Delete=删除任务 Select All=全选 Select None=不选 @@ -96,6 +97,9 @@ Speed=速度 No Data=无数据 No connected peers=没有连接到其他节点 Failed to change some tasks state.=修改一些任务状态时失败. +Confirm Restart=确认重试 +Are you sure you want to restart this task? AriaNg will create a same task after clicking OK.=您是否要重试这个任务? 点击 "确定" 后, AriaNg 将会创建一个相同的任务. +Failed to restart this task.=该任务重试失败. Confirm Remove=确认删除 Are you sure you want to remove the selected task?=您是否要删除选中的任务? Failed to remove some task(s).=删除一些任务时失败. diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 5013ade..8646390 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -19,6 +19,7 @@ 'New': 'New', 'Start': 'Start', 'Pause': 'Pause', + 'Restart': 'Restart', 'Delete': 'Delete', 'Select All': 'Select All', 'Select None': 'Select None', @@ -100,6 +101,9 @@ 'No Data': 'No Data', 'No connected peers': 'No connected peers', 'Failed to change some tasks state.': 'Failed to change some tasks state.', + 'Confirm Restart': 'Confirm Restart', + 'Are you sure you want to restart this task? AriaNg will create a same task after clicking OK.': 'Are you sure you want to restart this task? AriaNg will create a same task after clicking OK.', + 'Failed to restart this task.': 'Failed to restart this task.', 'Confirm Remove': 'Confirm Remove', 'Are you sure you want to remove the selected task?': 'Are you sure you want to remove the selected task?', 'Failed to remove some task(s).': 'Failed to remove some task(s).', diff --git a/src/scripts/controllers/main.js b/src/scripts/controllers/main.js index 44cd091..c4d3579 100644 --- a/src/scripts/controllers/main.js +++ b/src/scripts/controllers/main.js @@ -119,13 +119,13 @@ refreshGlobalStat(true); if (!response.hasError && state === 'start') { - if ($location.path() === '/waiting') { + if ($location.path() !== '/downloading') { $location.path('/downloading'); } else { $route.reload(); } } else if (!response.hasError && state === 'pause') { - if ($location.path() === '/downloading') { + if ($location.path() !== '/waiting') { $location.path('/waiting'); } else { $route.reload(); @@ -134,6 +134,27 @@ }, (gids.length > 1)); }; + $scope.restart = function (task) { + ariaNgCommonService.confirm('Confirm Restart', 'Are you sure you want to restart this task? AriaNg will create a same task after clicking OK.', 'info', function () { + $rootScope.loadPromise = aria2TaskService.restartTask(task.gid, function (response) { + if (!response.success) { + ariaNgCommonService.showError('Failed to restart this task.'); + return; + } + + refreshGlobalStat(true); + + if (response.success) { + if ($location.path() !== '/downloading') { + $location.path('/downloading'); + } else { + $route.reload(); + } + } + }, false); + }); + }; + $scope.removeTasks = function () { var tasks = $rootScope.taskContext.getSelectedTasks(); @@ -154,10 +175,10 @@ refreshGlobalStat(true); if (!response.hasError) { - if ($location.path() === '/stopped') { - $route.reload(); - } else { + if ($location.path() !== '/stopped') { $location.path('/stopped'); + } else { + $route.reload(); } } }, (tasks.length > 1)); @@ -173,10 +194,10 @@ refreshGlobalStat(true); - if ($location.path() === '/stopped') { - $route.reload(); - } else { + if ($location.path() !== '/stopped') { $location.path('/stopped'); + } else { + $route.reload(); } }); }); diff --git a/src/scripts/services/aria2TaskService.js b/src/scripts/services/aria2TaskService.js index 8138b0a..44733fe 100644 --- a/src/scripts/services/aria2TaskService.js +++ b/src/scripts/services/aria2TaskService.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('ariaNg').factory('aria2TaskService', ['$q', '$translate', 'bittorrentPeeridService', 'aria2Errors', 'aria2RpcService', 'ariaNgCommonService', function ($q, $translate, bittorrentPeeridService, aria2Errors, aria2RpcService, ariaNgCommonService) { + angular.module('ariaNg').factory('aria2TaskService', ['$q', '$translate', 'bittorrentPeeridService', 'aria2Errors', 'aria2RpcService', 'ariaNgCommonService', 'ariaNgLogService', function ($q, $translate, bittorrentPeeridService, aria2Errors, aria2RpcService, ariaNgCommonService, ariaNgLogService) { var getFileName = function (file) { if (!file) { return ''; @@ -423,6 +423,100 @@ callback: callback }); }, + restartTask: function (gid, callback, silent) { + var deferred = $q.defer(); + + var methods = [ + aria2RpcService.tellStatus({gid: gid}, true), + aria2RpcService.getOption({gid: gid}, true) + ]; + + var task = null, options = null; + + aria2RpcService.multicall({ + methods: methods, + silent: !!silent, + callback: function (response) { + if (!callback) { + ariaNgLogService.warn("[aria2TaskService.restartTask] callback is null"); + return; + } + + if (!response.success) { + ariaNgLogService.warn("[aria2TaskService.restartTask] response is not success"); + deferred.reject(response); + callback(response); + return; + } + + if (response.data.length > 0) { + task = response.data[0][0]; + } + + if (response.data.length > 1) { + options = response.data[1][0]; + } + + if (!task || !options || !task.files || task.files.length != 1 || task.bittorrent) { + if (!task) { + ariaNgLogService.warn("[aria2TaskService.restartTask] task is null"); + } + + if (!options) { + ariaNgLogService.warn("[aria2TaskService.restartTask] options is null"); + } + + if (!task.files) { + ariaNgLogService.warn("[aria2TaskService.restartTask] task file is null"); + } + + if (task.files.length != 1) { + ariaNgLogService.warn("[aria2TaskService.restartTask] task file length is not equal 1"); + } + + if (task.bittorrent) { + ariaNgLogService.warn("[aria2TaskService.restartTask] task is bittorrent"); + } + + deferred.reject(gid); + callback({ + success: false + }); + return; + } + + var file = task.files[0]; + var urls = []; + + for (var i = 0; i < file.uris.length; i++) { + var uriObj = file.uris[i]; + urls.push(uriObj.uri); + } + + aria2RpcService.addUri({ + task: { + urls: urls, + options: options + }, + pauseOnAdded: false, + silent: !!silent, + callback: function (response) { + if (!response.success) { + ariaNgLogService.warn("[aria2TaskService.restartTask] addUri response is not success"); + deferred.reject(response); + callback(response); + return; + } + + deferred.resolve(response); + callback(response); + } + }); + } + }); + + return deferred.promise; + }, removeTasks: function (tasks, callback, silent) { var runningTaskGids = []; var stoppedTaskGids = []; diff --git a/src/views/list.html b/src/views/list.html index dd2876f..97c3986 100644 --- a/src/views/list.html +++ b/src/views/list.html @@ -46,6 +46,7 @@
+ Restart
From f02c5556b76a010928794c7b3238affa7043f6dd Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 01:01:28 +0800 Subject: [PATCH 004/120] add more log --- src/scripts/controllers/command.js | 3 ++- src/scripts/services/aria2HttpRpcService.js | 6 +++--- src/scripts/services/aria2SettingService.js | 3 ++- src/scripts/services/aria2TaskService.js | 13 +++++++++++++ src/scripts/services/aria2WebSocketRpcService.js | 6 +++--- src/scripts/services/ariaNgCommonService.js | 2 +- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/scripts/controllers/command.js b/src/scripts/controllers/command.js index 98a393f..d283d62 100644 --- a/src/scripts/controllers/command.js +++ b/src/scripts/controllers/command.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('ariaNg').controller('CommandController', ['$rootScope', '$location', '$routeParams', 'base64', 'ariaNgCommonService', 'aria2TaskService', function ($rootScope, $location, $routeParams, base64, ariaNgCommonService, aria2TaskService) { + angular.module('ariaNg').controller('CommandController', ['$rootScope', '$location', '$routeParams', 'base64', 'ariaNgCommonService', 'aria2TaskService', 'ariaNgLogService', function ($rootScope, $location, $routeParams, base64, ariaNgCommonService, aria2TaskService, ariaNgLogService) { var path = $location.path(); var newUrlDownload = function (url) { @@ -21,6 +21,7 @@ var base64Url = $routeParams.url; var url = base64.urldecode(base64Url); $rootScope.loadPromise = newUrlDownload(url); + ariaNgLogService.info("[CommandController] new download: " + url); } else { ariaNgCommonService.error('Parameter is invalid!'); } diff --git a/src/scripts/services/aria2HttpRpcService.js b/src/scripts/services/aria2HttpRpcService.js index 70d3ce3..c01d725 100644 --- a/src/scripts/services/aria2HttpRpcService.js +++ b/src/scripts/services/aria2HttpRpcService.js @@ -16,10 +16,10 @@ data: context.requestBody }; - ariaNgLogService.debug('Http Request Start', requestContext); + ariaNgLogService.debug('[aria2HttpRpcService.request] request start', requestContext); return $http(requestContext).success(function (data) { - ariaNgLogService.debug('Http Response Success', data); + ariaNgLogService.debug('[aria2HttpRpcService.request] response success', data); if (!data) { return; @@ -29,7 +29,7 @@ context.successCallback(data.id, data.result); } }).error(function (data) { - ariaNgLogService.debug('Http Response Error', data); + ariaNgLogService.debug('[aria2HttpRpcService.request] response error', data); if (!data) { data = { diff --git a/src/scripts/services/aria2SettingService.js b/src/scripts/services/aria2SettingService.js index 17cc367..e49486e 100644 --- a/src/scripts/services/aria2SettingService.js +++ b/src/scripts/services/aria2SettingService.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('ariaNg').factory('aria2SettingService', ['aria2AllOptions', 'aria2GlobalAvailableOptions', 'aria2TaskAvailableOptions', 'ariaNgCommonService', 'aria2RpcService', function (aria2AllOptions, aria2GlobalAvailableOptions, aria2TaskAvailableOptions, ariaNgCommonService, aria2RpcService) { + angular.module('ariaNg').factory('aria2SettingService', ['aria2AllOptions', 'aria2GlobalAvailableOptions', 'aria2TaskAvailableOptions', 'ariaNgCommonService', 'aria2RpcService', 'ariaNgLogService', function (aria2AllOptions, aria2GlobalAvailableOptions, aria2TaskAvailableOptions, ariaNgCommonService, aria2RpcService, ariaNgLogService) { var processStatResult = function (stat) { if (!stat) { return stat; @@ -161,6 +161,7 @@ silent: !!silent, callback: function (response) { if (!callback) { + ariaNgLogService.warn("[aria2SettingService.getGlobalStat] callback is null"); return; } diff --git a/src/scripts/services/aria2TaskService.js b/src/scripts/services/aria2TaskService.js index 44733fe..51e2678 100644 --- a/src/scripts/services/aria2TaskService.js +++ b/src/scripts/services/aria2TaskService.js @@ -4,6 +4,7 @@ angular.module('ariaNg').factory('aria2TaskService', ['$q', '$translate', 'bittorrentPeeridService', 'aria2Errors', 'aria2RpcService', 'ariaNgCommonService', 'ariaNgLogService', function ($q, $translate, bittorrentPeeridService, aria2Errors, aria2RpcService, ariaNgCommonService, ariaNgLogService) { var getFileName = function (file) { if (!file) { + ariaNgLogService.warn("[aria2TaskService.getFileName] file is null"); return ''; } @@ -122,6 +123,7 @@ var processDownloadTask = function (task) { if (!task) { + ariaNgLogService.warn("[aria2TaskService.processDownloadTask] task is null"); return task; } @@ -174,6 +176,7 @@ var processBtPeers = function (peers, task, includeLocalPeer) { if (!peers) { + ariaNgLogService.warn("[aria2TaskService.processBtPeers] peers is null"); return peers; } @@ -272,6 +275,7 @@ silent: !!silent, callback: function (response) { if (!callback) { + ariaNgLogService.warn("[aria2TaskService.getTaskList] callback is null"); return; } @@ -285,6 +289,7 @@ silent: !!silent, callback: function (response) { if (!callback) { + ariaNgLogService.warn("[aria2TaskService.getTaskStatus] callback is null"); return; } @@ -333,6 +338,7 @@ silent: !!silent, callback: function (response) { if (!callback) { + ariaNgLogService.warn("[aria2TaskService.getBtTaskPeers] callback is null"); return; } @@ -358,6 +364,7 @@ silent: !!silent, callback: function (response) { if (!callback) { + ariaNgLogService.warn("[aria2TaskService.getTaskStatusAndBtPeers] callback is null"); return; } @@ -586,6 +593,7 @@ }, onFirstSuccess: function (callback) { if (!callback) { + ariaNgLogService.warn("[aria2TaskService.onFirstSuccess] callback is null"); return; } @@ -595,6 +603,7 @@ }, onTaskCompleted: function (callback) { if (!callback) { + ariaNgLogService.warn("[aria2TaskService.onTaskCompleted] callback is null"); return; } @@ -604,6 +613,7 @@ }, onBtTaskCompleted: function (callback) { if (!callback) { + ariaNgLogService.warn("[aria2TaskService.onBtTaskCompleted] callback is null"); return; } @@ -613,6 +623,7 @@ }, onTaskErrorOccur: function (callback) { if (!callback) { + ariaNgLogService.warn("[aria2TaskService.onTaskErrorOccur] callback is null"); return; } @@ -622,6 +633,7 @@ }, processDownloadTasks: function (tasks) { if (!angular.isArray(tasks)) { + ariaNgLogService.warn("[aria2TaskService.processDownloadTasks] tasks is not array"); return; } @@ -637,6 +649,7 @@ }, estimateHealthPercentFromPeers: function (task, peers) { if (!task || task.numPieces < 1 || peers.length < 1) { + ariaNgLogService.warn("[aria2TaskService.estimateHealthPercentFromPeers] tasks is null or numPieces < 1 or peers < 1"); return task.completePercent; } diff --git a/src/scripts/services/aria2WebSocketRpcService.js b/src/scripts/services/aria2WebSocketRpcService.js index bda56f7..47a7faf 100644 --- a/src/scripts/services/aria2WebSocketRpcService.js +++ b/src/scripts/services/aria2WebSocketRpcService.js @@ -29,13 +29,13 @@ }); if (content.result && context.successCallback) { - ariaNgLogService.debug('WebSocket Response Success', content); + ariaNgLogService.debug('[aria2WebSocketRpcService.request] response uccess', content); context.successCallback(context.id, content.result); } if (content.error && context.errorCallback) { - ariaNgLogService.debug('WebSocket Response Error', content); + ariaNgLogService.debug('[aria2WebSocketRpcService.request] response error', content); context.errorCallback(context.id, content.error); } @@ -99,7 +99,7 @@ var uniqueId = context.uniqueId; var requestBody = angular.toJson(context.requestBody); - ariaNgLogService.debug('WebSocket Request Start', context); + ariaNgLogService.debug('[aria2WebSocketRpcService.request] request start', context); var deferred = $q.defer(); diff --git a/src/scripts/services/ariaNgCommonService.js b/src/scripts/services/ariaNgCommonService.js index aecfa4d..6c87ab3 100644 --- a/src/scripts/services/ariaNgCommonService.js +++ b/src/scripts/services/ariaNgCommonService.js @@ -20,7 +20,7 @@ }, 100); }, showError: function (text) { - ariaNgLogService.error("[Error Dialog] " + text); + ariaNgLogService.info("[ariaNgCommonService.showError] " + text); this.showDialog('Error', text, 'error'); }, showOperationSucceeded: function (text) { From faf32a42b6c7c9ef7f1710fb54c66fc2bcf01e48 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 01:07:31 +0800 Subject: [PATCH 005/120] add tooltip --- src/langs/zh_CN.txt | 1 + src/scripts/config/defaultLanguage.js | 1 + src/views/list.html | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index e85fc77..67a745e 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -28,6 +28,7 @@ Expand=展开 Collapse=折叠 Remove Task=删除任务 Clear Stopped Tasks=清空已结束任务 +Click to view task detail=点击查看任务详情 By File Name=按文件名 By File Size=按文件大小 By Progress=按进度 diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 8646390..1a4a87a 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -32,6 +32,7 @@ 'Collapse': 'Collapse', 'Remove Task': 'Remove Task', 'Clear Stopped Tasks': 'Clear Stopped Tasks', + 'Click to view task detail': 'Click to view task detail', 'By File Name': 'By File Name', 'By File Size': 'By File Size', 'By Progress': 'By Progress', diff --git a/src/views/list.html b/src/views/list.html index 97c3986..5204b8f 100644 --- a/src/views/list.html +++ b/src/views/list.html @@ -43,7 +43,7 @@
- + Restart From cd3d92f3647aea5701bf1c3202871c38089c4da0 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 01:10:56 +0800 Subject: [PATCH 006/120] fix --- src/scripts/controllers/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/controllers/main.js b/src/scripts/controllers/main.js index c4d3579..446acce 100644 --- a/src/scripts/controllers/main.js +++ b/src/scripts/controllers/main.js @@ -119,13 +119,13 @@ refreshGlobalStat(true); if (!response.hasError && state === 'start') { - if ($location.path() !== '/downloading') { + if ($location.path() === '/waiting') { $location.path('/downloading'); } else { $route.reload(); } } else if (!response.hasError && state === 'pause') { - if ($location.path() !== '/waiting') { + if ($location.path() === '/downloading') { $location.path('/waiting'); } else { $route.reload(); From 74067b459ab308c6e41d464c6112a2bcbd69a459 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 01:30:51 +0800 Subject: [PATCH 007/120] update third party dependencies --- bower.json | 4 ++-- src/index.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index c57efb4..e0b04de 100644 --- a/bower.json +++ b/bower.json @@ -25,7 +25,7 @@ "bootstrap": "^3.3.7", "moment": "^2.17.1", "moment-timezone": "^0.5.10", - "echarts": "^3.3.1", + "echarts": "^3.3.2", "font-awesome": "font-awsome#^4.7.0", "AdminLTE": "admin-lte#^2.3.8", "sweetalert": "^1.1.3", @@ -38,7 +38,7 @@ "angular-messages": "1.4.10", "angular-cookies": "1.4.10", "angular-animate": "1.4.10", - "angular-translate": "^2.13.0", + "angular-translate": "^2.13.1", "angular-moment": "1.0.0-beta.6", "angular-websocket": "^1.1.0", "angular-utf8-base64": "^0.0.5", diff --git a/src/index.html b/src/index.html index 460c2e1..783f51f 100644 --- a/src/index.html +++ b/src/index.html @@ -269,7 +269,7 @@ - + From e0cddfde33e44bfb9622829c49a85838ded35cb8 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 01:41:17 +0800 Subject: [PATCH 008/120] update npm packages --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 510a38f..260d2ba 100644 --- a/package.json +++ b/package.json @@ -4,15 +4,15 @@ "node": ">=4" }, "devDependencies": { - "browser-sync": "^2.14.0", - "del": "^2.2.1", + "browser-sync": "^2.18.2", + "del": "^2.2.2", "gulp": "^3.9.1", "gulp-angular-templatecache": "^2.0.0", - "gulp-autoprefixer": "^3.1.0", + "gulp-autoprefixer": "^3.1.1", "gulp-cssnano": "^2.1.2", - "gulp-eslint": "^2.1.0", - "gulp-htmlmin": "^2.0.0", - "gulp-if": "^2.0.1", + "gulp-eslint": "^3.0.1", + "gulp-htmlmin": "^3.0.0", + "gulp-if": "^2.0.2", "gulp-inject-version": "^1.0.1", "gulp-load-plugins": "^1.2.4", "gulp-manifest": "^0.1.1", @@ -20,10 +20,10 @@ "gulp-replace": "^0.5.4", "gulp-rev": "^7.1.0", "gulp-rev-replace": "^0.4.3", - "gulp-sequence": "^0.4.5", + "gulp-sequence": "^0.4.6", "gulp-size": "^2.1.0", - "gulp-sourcemaps": "^1.6.0", - "gulp-uglify": "^1.5.4", + "gulp-sourcemaps": "^1.9.1", + "gulp-uglify": "^2.0.0", "gulp-useref": "^3.1.0" }, "name": "aria-ng", From 088fd42e78b272adb7cf52c39f6ef2a288fe38fc Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 01:50:25 +0800 Subject: [PATCH 009/120] code refactor --- src/scripts/config/defaultLanguage.js | 2 +- src/scripts/controllers/command.js | 2 +- src/scripts/controllers/main.js | 2 +- src/scripts/controllers/task-detail.js | 2 +- src/scripts/filters/dateDuration.js | 2 +- src/scripts/filters/fileOrderBy.js | 2 +- src/scripts/filters/longDate.js | 2 +- src/scripts/filters/peerOrderBy.js | 2 +- src/scripts/filters/percent.js | 2 +- src/scripts/filters/taskOrderBy.js | 2 +- src/scripts/filters/taskStatus.js | 2 +- src/scripts/filters/volumn.js | 2 +- src/scripts/services/aria2SettingService.js | 8 ++-- src/scripts/services/aria2TaskService.js | 46 +++++++++---------- src/scripts/services/ariaNgCommonService.js | 6 +-- src/scripts/services/ariaNgFileService.js | 2 +- src/scripts/services/ariaNgLanguageLoader.js | 2 +- src/scripts/services/ariaNgMonitorService.js | 2 +- .../services/ariaNgNotificationService.js | 2 +- src/scripts/services/ariaNgSettingService.js | 2 +- 20 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 1a4a87a..76638a6 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -579,5 +579,5 @@ }; $translateProvider.translations(ariaNgConstants.defaultLanguage, defaultLanguageResource); - }]) + }]); }()); diff --git a/src/scripts/controllers/command.js b/src/scripts/controllers/command.js index d283d62..92af294 100644 --- a/src/scripts/controllers/command.js +++ b/src/scripts/controllers/command.js @@ -21,7 +21,7 @@ var base64Url = $routeParams.url; var url = base64.urldecode(base64Url); $rootScope.loadPromise = newUrlDownload(url); - ariaNgLogService.info("[CommandController] new download: " + url); + ariaNgLogService.info('[CommandController] new download: ' + url); } else { ariaNgCommonService.error('Parameter is invalid!'); } diff --git a/src/scripts/controllers/main.js b/src/scripts/controllers/main.js index 446acce..2162744 100644 --- a/src/scripts/controllers/main.js +++ b/src/scripts/controllers/main.js @@ -17,7 +17,7 @@ stoppedCount: globalStat.numStopped, downloadSpeed: globalStat.downloadSpeed, uploadSpeed: globalStat.uploadSpeed - } + }; })($scope.globalStat); $document[0].title = ariaNgSettingService.getFinalTitle(context); diff --git a/src/scripts/controllers/task-detail.js b/src/scripts/controllers/task-detail.js index c0634b2..b1d963a 100644 --- a/src/scripts/controllers/task-detail.js +++ b/src/scripts/controllers/task-detail.js @@ -59,7 +59,7 @@ var refreshDownloadTask = function (silent) { if (pauseDownloadTaskRefresh) { return; - } + } var processError = function (message) { if (message === aria2RpcErrors.Unauthorized.message) { diff --git a/src/scripts/filters/dateDuration.js b/src/scripts/filters/dateDuration.js index fb51fc8..5069029 100644 --- a/src/scripts/filters/dateDuration.js +++ b/src/scripts/filters/dateDuration.js @@ -6,6 +6,6 @@ var timespan = moment.duration(duration, sourceUnit); var time = moment.utc(timespan.asMilliseconds()); return time.format(format); - } + }; }]); }()); diff --git a/src/scripts/filters/fileOrderBy.js b/src/scripts/filters/fileOrderBy.js index f4941f9..7296fe7 100644 --- a/src/scripts/filters/fileOrderBy.js +++ b/src/scripts/filters/fileOrderBy.js @@ -22,6 +22,6 @@ } else { return array; } - } + }; }]); }()); diff --git a/src/scripts/filters/longDate.js b/src/scripts/filters/longDate.js index 77dc5a2..7d29d47 100644 --- a/src/scripts/filters/longDate.js +++ b/src/scripts/filters/longDate.js @@ -5,6 +5,6 @@ return function (time) { var format = $translate.instant('format.longdate'); return moment(time).format(format); - } + }; }]); }()); diff --git a/src/scripts/filters/peerOrderBy.js b/src/scripts/filters/peerOrderBy.js index 3ce2b7f..1760cb2 100644 --- a/src/scripts/filters/peerOrderBy.js +++ b/src/scripts/filters/peerOrderBy.js @@ -26,6 +26,6 @@ } else { return array; } - } + }; }]); }()); diff --git a/src/scripts/filters/percent.js b/src/scripts/filters/percent.js index ac46cbd..87145a8 100644 --- a/src/scripts/filters/percent.js +++ b/src/scripts/filters/percent.js @@ -7,6 +7,6 @@ var result = parseInt(value * ratio) / ratio; return $filter('number')(result, precision); - } + }; }]); }()); diff --git a/src/scripts/filters/taskOrderBy.js b/src/scripts/filters/taskOrderBy.js index 61ac3f6..855f946 100644 --- a/src/scripts/filters/taskOrderBy.js +++ b/src/scripts/filters/taskOrderBy.js @@ -28,6 +28,6 @@ } else { return array; } - } + }; }]); }()); diff --git a/src/scripts/filters/taskStatus.js b/src/scripts/filters/taskStatus.js index fcbe1d6..8029d38 100644 --- a/src/scripts/filters/taskStatus.js +++ b/src/scripts/filters/taskStatus.js @@ -26,6 +26,6 @@ } else { return ''; } - } + }; }); }()); diff --git a/src/scripts/filters/volumn.js b/src/scripts/filters/volumn.js index 943c944..5e340b9 100644 --- a/src/scripts/filters/volumn.js +++ b/src/scripts/filters/volumn.js @@ -32,6 +32,6 @@ value = $filter('number')(value, fractionSize); return value + ' ' + unit; - } + }; }]); }()); diff --git a/src/scripts/services/aria2SettingService.js b/src/scripts/services/aria2SettingService.js index e49486e..093436e 100644 --- a/src/scripts/services/aria2SettingService.js +++ b/src/scripts/services/aria2SettingService.js @@ -154,14 +154,14 @@ return aria2RpcService.getVersion({ silent: !!silent, callback: callback - }) + }); }, getGlobalStat: function (callback, silent) { return aria2RpcService.getGlobalStat({ silent: !!silent, callback: function (response) { if (!callback) { - ariaNgLogService.warn("[aria2SettingService.getGlobalStat] callback is null"); + ariaNgLogService.warn('[aria2SettingService.getGlobalStat] callback is null'); return; } @@ -174,13 +174,13 @@ return aria2RpcService.saveSession({ silent: !!silent, callback: callback - }) + }); }, shutdown: function (callback, silent) { return aria2RpcService.shutdown({ silent: !!silent, callback: callback - }) + }); } }; }]); diff --git a/src/scripts/services/aria2TaskService.js b/src/scripts/services/aria2TaskService.js index 51e2678..e658e42 100644 --- a/src/scripts/services/aria2TaskService.js +++ b/src/scripts/services/aria2TaskService.js @@ -4,7 +4,7 @@ angular.module('ariaNg').factory('aria2TaskService', ['$q', '$translate', 'bittorrentPeeridService', 'aria2Errors', 'aria2RpcService', 'ariaNgCommonService', 'ariaNgLogService', function ($q, $translate, bittorrentPeeridService, aria2Errors, aria2RpcService, ariaNgCommonService, ariaNgLogService) { var getFileName = function (file) { if (!file) { - ariaNgLogService.warn("[aria2TaskService.getFileName] file is null"); + ariaNgLogService.warn('[aria2TaskService.getFileName] file is null'); return ''; } @@ -123,7 +123,7 @@ var processDownloadTask = function (task) { if (!task) { - ariaNgLogService.warn("[aria2TaskService.processDownloadTask] task is null"); + ariaNgLogService.warn('[aria2TaskService.processDownloadTask] task is null'); return task; } @@ -176,7 +176,7 @@ var processBtPeers = function (peers, task, includeLocalPeer) { if (!peers) { - ariaNgLogService.warn("[aria2TaskService.processBtPeers] peers is null"); + ariaNgLogService.warn('[aria2TaskService.processBtPeers] peers is null'); return peers; } @@ -240,7 +240,7 @@ } else { callback(context); } - } + }; }; var createLocalPeerFromTask = function (task) { @@ -275,7 +275,7 @@ silent: !!silent, callback: function (response) { if (!callback) { - ariaNgLogService.warn("[aria2TaskService.getTaskList] callback is null"); + ariaNgLogService.warn('[aria2TaskService.getTaskList] callback is null'); return; } @@ -289,7 +289,7 @@ silent: !!silent, callback: function (response) { if (!callback) { - ariaNgLogService.warn("[aria2TaskService.getTaskStatus] callback is null"); + ariaNgLogService.warn('[aria2TaskService.getTaskStatus] callback is null'); return; } @@ -338,7 +338,7 @@ silent: !!silent, callback: function (response) { if (!callback) { - ariaNgLogService.warn("[aria2TaskService.getBtTaskPeers] callback is null"); + ariaNgLogService.warn('[aria2TaskService.getBtTaskPeers] callback is null'); return; } @@ -364,7 +364,7 @@ silent: !!silent, callback: function (response) { if (!callback) { - ariaNgLogService.warn("[aria2TaskService.getTaskStatusAndBtPeers] callback is null"); + ariaNgLogService.warn('[aria2TaskService.getTaskStatusAndBtPeers] callback is null'); return; } @@ -445,12 +445,12 @@ silent: !!silent, callback: function (response) { if (!callback) { - ariaNgLogService.warn("[aria2TaskService.restartTask] callback is null"); + ariaNgLogService.warn('[aria2TaskService.restartTask] callback is null'); return; } if (!response.success) { - ariaNgLogService.warn("[aria2TaskService.restartTask] response is not success"); + ariaNgLogService.warn('[aria2TaskService.restartTask] response is not success'); deferred.reject(response); callback(response); return; @@ -466,23 +466,23 @@ if (!task || !options || !task.files || task.files.length != 1 || task.bittorrent) { if (!task) { - ariaNgLogService.warn("[aria2TaskService.restartTask] task is null"); + ariaNgLogService.warn('[aria2TaskService.restartTask] task is null'); } if (!options) { - ariaNgLogService.warn("[aria2TaskService.restartTask] options is null"); + ariaNgLogService.warn('[aria2TaskService.restartTask] options is null'); } if (!task.files) { - ariaNgLogService.warn("[aria2TaskService.restartTask] task file is null"); + ariaNgLogService.warn('[aria2TaskService.restartTask] task file is null'); } if (task.files.length != 1) { - ariaNgLogService.warn("[aria2TaskService.restartTask] task file length is not equal 1"); + ariaNgLogService.warn('[aria2TaskService.restartTask] task file length is not equal 1'); } if (task.bittorrent) { - ariaNgLogService.warn("[aria2TaskService.restartTask] task is bittorrent"); + ariaNgLogService.warn('[aria2TaskService.restartTask] task is bittorrent'); } deferred.reject(gid); @@ -509,7 +509,7 @@ silent: !!silent, callback: function (response) { if (!response.success) { - ariaNgLogService.warn("[aria2TaskService.restartTask] addUri response is not success"); + ariaNgLogService.warn('[aria2TaskService.restartTask] addUri response is not success'); deferred.reject(response); callback(response); return; @@ -583,7 +583,7 @@ how: 'POS_SET', silent: !!silent, callback: callback - }) + }); }, clearStoppedTasks: function (callback, silent) { return aria2RpcService.purgeDownloadResult({ @@ -593,7 +593,7 @@ }, onFirstSuccess: function (callback) { if (!callback) { - ariaNgLogService.warn("[aria2TaskService.onFirstSuccess] callback is null"); + ariaNgLogService.warn('[aria2TaskService.onFirstSuccess] callback is null'); return; } @@ -603,7 +603,7 @@ }, onTaskCompleted: function (callback) { if (!callback) { - ariaNgLogService.warn("[aria2TaskService.onTaskCompleted] callback is null"); + ariaNgLogService.warn('[aria2TaskService.onTaskCompleted] callback is null'); return; } @@ -613,7 +613,7 @@ }, onBtTaskCompleted: function (callback) { if (!callback) { - ariaNgLogService.warn("[aria2TaskService.onBtTaskCompleted] callback is null"); + ariaNgLogService.warn('[aria2TaskService.onBtTaskCompleted] callback is null'); return; } @@ -623,7 +623,7 @@ }, onTaskErrorOccur: function (callback) { if (!callback) { - ariaNgLogService.warn("[aria2TaskService.onTaskErrorOccur] callback is null"); + ariaNgLogService.warn('[aria2TaskService.onTaskErrorOccur] callback is null'); return; } @@ -633,7 +633,7 @@ }, processDownloadTasks: function (tasks) { if (!angular.isArray(tasks)) { - ariaNgLogService.warn("[aria2TaskService.processDownloadTasks] tasks is not array"); + ariaNgLogService.warn('[aria2TaskService.processDownloadTasks] tasks is not array'); return; } @@ -649,7 +649,7 @@ }, estimateHealthPercentFromPeers: function (task, peers) { if (!task || task.numPieces < 1 || peers.length < 1) { - ariaNgLogService.warn("[aria2TaskService.estimateHealthPercentFromPeers] tasks is null or numPieces < 1 or peers < 1"); + ariaNgLogService.warn('[aria2TaskService.estimateHealthPercentFromPeers] tasks is null or numPieces < 1 or peers < 1'); return task.completePercent; } diff --git a/src/scripts/services/ariaNgCommonService.js b/src/scripts/services/ariaNgCommonService.js index 6c87ab3..8d2a667 100644 --- a/src/scripts/services/ariaNgCommonService.js +++ b/src/scripts/services/ariaNgCommonService.js @@ -20,7 +20,7 @@ }, 100); }, showError: function (text) { - ariaNgLogService.info("[ariaNgCommonService.showError] " + text); + ariaNgLogService.info('[ariaNgCommonService.showError] ' + text); this.showDialog('Error', text, 'error'); }, showOperationSucceeded: function (text) { @@ -174,7 +174,7 @@ } }, getValue: function () { - return this.type + ":" + this.order; + return this.type + ':' + this.order; } }; @@ -227,7 +227,7 @@ name: name, value: value, optionValue: time - }) + }); } return options; diff --git a/src/scripts/services/ariaNgFileService.js b/src/scripts/services/ariaNgFileService.js index da902a0..6655f5c 100644 --- a/src/scripts/services/ariaNgFileService.js +++ b/src/scripts/services/ariaNgFileService.js @@ -87,6 +87,6 @@ reader.readAsDataURL(file); }).trigger('click'); } - } + }; }]); }()); diff --git a/src/scripts/services/ariaNgLanguageLoader.js b/src/scripts/services/ariaNgLanguageLoader.js index b121368..d146300 100644 --- a/src/scripts/services/ariaNgLanguageLoader.js +++ b/src/scripts/services/ariaNgLanguageLoader.js @@ -9,7 +9,7 @@ return { key: line.substring(0, equalSignPos), value: line.substring(equalSignPos + 1, line.length) - } + }; } else { return { value: line diff --git a/src/scripts/services/ariaNgMonitorService.js b/src/scripts/services/ariaNgMonitorService.js index 3e99780..465d1cf 100644 --- a/src/scripts/services/ariaNgMonitorService.js +++ b/src/scripts/services/ariaNgMonitorService.js @@ -154,6 +154,6 @@ getGlobalStatsData: function () { return this.getStatsData(globalStorageKey); } - } + }; }]); }()); diff --git a/src/scripts/services/ariaNgNotificationService.js b/src/scripts/services/ariaNgNotificationService.js index e1c73d6..318a12b 100644 --- a/src/scripts/services/ariaNgNotificationService.js +++ b/src/scripts/services/ariaNgNotificationService.js @@ -82,6 +82,6 @@ clearNotificationInPage: function () { Notification.clearAll(); } - } + }; }]); }()); diff --git a/src/scripts/services/ariaNgSettingService.js b/src/scripts/services/ariaNgSettingService.js index 43265ea..9486dc5 100644 --- a/src/scripts/services/ariaNgSettingService.js +++ b/src/scripts/services/ariaNgSettingService.js @@ -25,7 +25,7 @@ return ariaNgDefaultOptions.language; } - browserLang = browserLang.replace(/\-/g, "_"); + browserLang = browserLang.replace(/\-/g, '_'); if (!ariaNgLanguages[browserLang]) { return ariaNgDefaultOptions.language; From 9f31ad65c6b69d1ef70befc1bb2c6f02d7a5399d Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 02:11:27 +0800 Subject: [PATCH 010/120] update eslint --- .editorconfig | 5 -- .eslintrc.json | 31 ++++++++ gulpfile.js | 189 ++++++++++++++++++++++++------------------------- package.json | 2 + 4 files changed, 127 insertions(+), 100 deletions(-) create mode 100644 .eslintrc.json diff --git a/.editorconfig b/.editorconfig index c0dc5f9..951742a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -23,8 +23,3 @@ trim_trailing_whitespace = false [{package,bower}.json] indent_style = space indent_size = 2 - -[gulpfile.js] -indent_style = space -indent_size = 2 - diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..886fcf0 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,31 @@ +{ + "env": { + "browser": true, + "node": true + }, + "extends": [ + "angular", + "eslint:recommended" + ], + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "indent": [ + "error", + 4 + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ] + } +} diff --git a/gulpfile.js b/gulpfile.js index 1baec86..8661682 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,144 +7,143 @@ var $ = gulpLoadPlugins(); var reload = browserSync.reload; gulp.task('styles', function () { - return gulp.src([ - 'src/styles/**/*.css' - ]).pipe($.autoprefixer({browsers: ['> 1%', 'last 2 versions', 'Firefox ESR']})) - .pipe(gulp.dest('.tmp/styles')) - .pipe(reload({stream: true})); + return gulp.src([ + 'src/styles/**/*.css' + ]).pipe($.autoprefixer({browsers: ['> 1%', 'last 2 versions', 'Firefox ESR']})) + .pipe(gulp.dest('.tmp/styles')) + .pipe(reload({stream: true})); }); gulp.task('scripts', function () { - return gulp.src([ - 'src/scripts/**/*.js' - ]).pipe($.plumber()) - .pipe(gulp.dest('.tmp/scripts')) - .pipe(reload({stream: true})); + return gulp.src([ + 'src/scripts/**/*.js' + ]).pipe($.plumber()) + .pipe(gulp.dest('.tmp/scripts')) + .pipe(reload({stream: true})); }); gulp.task('views', function () { - return gulp.src([ - 'src/views/**/*.html' - ]).pipe($.htmlmin({collapseWhitespace: true})) - .pipe($.angularTemplatecache({module: 'ariaNg', filename: 'views/templates.js', root: 'views/'})) - .pipe(gulp.dest('.tmp/scripts')); + return gulp.src([ + 'src/views/**/*.html' + ]).pipe($.htmlmin({collapseWhitespace: true})) + .pipe($.angularTemplatecache({module: 'ariaNg', filename: 'views/templates.js', root: 'views/'})) + .pipe(gulp.dest('.tmp/scripts')); }); gulp.task('lint', function () { - return gulp.src([ - 'src/scripts/**/*.js' - ]).pipe(reload({stream: true, once: true})) - .pipe($.eslint({fix: true})) - .pipe($.eslint.format()) - .pipe($.if(!browserSync.active, $.eslint.failAfterError())) - .pipe(gulp.dest('src/scripts')); + return gulp.src([ + 'src/scripts/**/*.js' + ]).pipe(reload({stream: true, once: true})) + .pipe($.eslint.format()) + .pipe($.if(!browserSync.active, $.eslint.failAfterError())) + .pipe(gulp.dest('src/scripts')); }); gulp.task('html', ['styles', 'scripts', 'views'], function () { - return gulp.src([ - 'src/*.html' - ]).pipe($.useref({searchPath: ['.tmp', 'src', '.']})) - .pipe($.injectVersion()) - .pipe($.if('js/*.js', $.replace(/\/\/# sourceMappingURL=.*/g, ''))) - .pipe($.if('css/*.css', $.replace(/\/\*# sourceMappingURL=.* \*\/$/g, ''))) - .pipe($.if(['js/moment-with-locales-*.min.js', 'js/plugins.min.js', 'js/aria-ng.min.js'], $.uglify({preserveComments: 'license'}))) - .pipe($.if(['css/plugins.min.css', 'css/aria-ng.min.css'], $.cssnano({safe: true, autoprefixer: false}))) - .pipe($.if(['js/plugins.min.js', 'js/aria-ng.min.js', 'css/plugins.min.css', 'css/aria-ng.min.css'], $.rev())) - .pipe($.if('*.html', $.htmlmin({collapseWhitespace: true}))) - .pipe($.revReplace()) - .pipe(gulp.dest('dist')); + return gulp.src([ + 'src/*.html' + ]).pipe($.useref({searchPath: ['.tmp', 'src', '.']})) + .pipe($.injectVersion()) + .pipe($.if('js/*.js', $.replace(/\/\/# sourceMappingURL=.*/g, ''))) + .pipe($.if('css/*.css', $.replace(/\/\*# sourceMappingURL=.* \*\/$/g, ''))) + .pipe($.if(['js/moment-with-locales-*.min.js', 'js/plugins.min.js', 'js/aria-ng.min.js'], $.uglify({preserveComments: 'license'}))) + .pipe($.if(['css/plugins.min.css', 'css/aria-ng.min.css'], $.cssnano({safe: true, autoprefixer: false}))) + .pipe($.if(['js/plugins.min.js', 'js/aria-ng.min.js', 'css/plugins.min.css', 'css/aria-ng.min.css'], $.rev())) + .pipe($.if('*.html', $.htmlmin({collapseWhitespace: true}))) + .pipe($.revReplace()) + .pipe(gulp.dest('dist')); }); gulp.task('langs', function () { - return gulp.src([ - 'src/langs/**/*' - ]).pipe(gulp.dest('dist/langs')); + return gulp.src([ + 'src/langs/**/*' + ]).pipe(gulp.dest('dist/langs')); }); gulp.task('images', function () { - return gulp.src([ - 'src/imgs/**/*' - ]).pipe(gulp.dest('dist/imgs')); + return gulp.src([ + 'src/imgs/**/*' + ]).pipe(gulp.dest('dist/imgs')); }); gulp.task('fonts', function () { - return gulp.src([ - 'bower_components/font-awesome/fonts/fontawesome-webfont.*' - ]).pipe(gulp.dest('.tmp/fonts')) - .pipe(gulp.dest('dist/fonts')); + return gulp.src([ + 'bower_components/font-awesome/fonts/fontawesome-webfont.*' + ]).pipe(gulp.dest('.tmp/fonts')) + .pipe(gulp.dest('dist/fonts')); }); gulp.task('manifest', function () { - return gulp.src([ - 'dist/css/**', - 'dist/js/**', - 'dist/fonts/fontawesome-webfont.woff2', - 'dist/*.html' - ], {base: 'dist/'}) - .pipe($.manifest({ - hash: true, - preferOnline: true, - network: ['*'], - filename: 'index.manifest', - exclude: 'index.manifest' - })) - .pipe(gulp.dest('dist')); + return gulp.src([ + 'dist/css/**', + 'dist/js/**', + 'dist/fonts/fontawesome-webfont.woff2', + 'dist/*.html' + ], {base: 'dist/'}) + .pipe($.manifest({ + hash: true, + preferOnline: true, + network: ['*'], + filename: 'index.manifest', + exclude: 'index.manifest' + })) + .pipe(gulp.dest('dist')); }); gulp.task('extras', function () { - return gulp.src([ - 'src/*.*', - '!src/*.html' - ], { - dot: true - }).pipe(gulp.dest('dist')); + return gulp.src([ + 'src/*.*', + '!src/*.html' + ], { + dot: true + }).pipe(gulp.dest('dist')); }); gulp.task('clean', del.bind(null, ['.tmp', 'dist'])); gulp.task('serve', ['styles', 'scripts', 'fonts'], function () { - browserSync({ - notify: false, - port: 9000, - server: { - baseDir: ['.tmp', 'src'], - routes: { - '/bower_components': 'bower_components' - } - } - }); + browserSync({ + notify: false, + port: 9000, + server: { + baseDir: ['.tmp', 'src'], + routes: { + '/bower_components': 'bower_components' + } + } + }); - gulp.watch([ - 'src/*.html', - 'src/langs/*.txt', - 'src/views/*.html', - 'src/imgs/**/*', - '.tmp/fonts/**/*' - ]).on('change', reload); + gulp.watch([ + 'src/*.html', + 'src/langs/*.txt', + 'src/views/*.html', + 'src/imgs/**/*', + '.tmp/fonts/**/*' + ]).on('change', reload); - gulp.watch('src/styles/**/*.css', ['styles']); - gulp.watch('src/scripts/**/*.js', ['scripts']); - gulp.watch('src/fonts/**/*', ['fonts']); + gulp.watch('src/styles/**/*.css', ['styles']); + gulp.watch('src/scripts/**/*.js', ['scripts']); + gulp.watch('src/fonts/**/*', ['fonts']); }); gulp.task('serve:dist', function () { - browserSync({ - notify: false, - port: 9000, - server: { - baseDir: ['dist'] - } - }); + browserSync({ + notify: false, + port: 9000, + server: { + baseDir: ['dist'] + } + }); }); gulp.task('info', function () { - return gulp.src([ - 'dist/**/*' - ]).pipe($.size({title: 'build', gzip: true})); + return gulp.src([ + 'dist/**/*' + ]).pipe($.size({title: 'build', gzip: true})); }); gulp.task('build', $.sequence('lint', 'html', 'langs', 'images', 'fonts', 'manifest', 'extras', 'info')); gulp.task('default', ['clean'], function () { - gulp.start('build'); + gulp.start('build'); }); diff --git a/package.json b/package.json index 260d2ba..ea2bdcc 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "devDependencies": { "browser-sync": "^2.18.2", "del": "^2.2.2", + "eslint-config-angular": "^0.5.0", + "eslint-plugin-angular": "^1.4.1", "gulp": "^3.9.1", "gulp-angular-templatecache": "^2.0.0", "gulp-autoprefixer": "^3.1.1", From dbe9bf09b631cf9fbd3392e049f9788e7b7d1f7b Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 02:26:14 +0800 Subject: [PATCH 011/120] update publish script --- scripts/publish_dailybuild.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/publish_dailybuild.sh b/scripts/publish_dailybuild.sh index 28b2a80..91e4ad9 100644 --- a/scripts/publish_dailybuild.sh +++ b/scripts/publish_dailybuild.sh @@ -1,7 +1,9 @@ if [ $CI == "true" ] && [ $CIRCLE_BRANCH == "master" ]; then echo "Packaging daily build..."; cd dist; + cp ../LICENSE ./; zip $CIRCLE_ARTIFACTS/dist.zip * -r -9; + rm -f LICENSE; cd ..; echo "Publishing online demo..."; From 492a115e2b74dc9b676aab24109b225becac9c69 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Dec 2016 14:35:38 +0800 Subject: [PATCH 012/120] update publish script --- gulpfile.js | 1 + scripts/publish_dailybuild.sh | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 8661682..d396352 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -92,6 +92,7 @@ gulp.task('manifest', function () { gulp.task('extras', function () { return gulp.src([ + 'LICENSE', 'src/*.*', '!src/*.html' ], { diff --git a/scripts/publish_dailybuild.sh b/scripts/publish_dailybuild.sh index 91e4ad9..28b2a80 100644 --- a/scripts/publish_dailybuild.sh +++ b/scripts/publish_dailybuild.sh @@ -1,9 +1,7 @@ if [ $CI == "true" ] && [ $CIRCLE_BRANCH == "master" ]; then echo "Packaging daily build..."; cd dist; - cp ../LICENSE ./; zip $CIRCLE_ARTIFACTS/dist.zip * -r -9; - rm -f LICENSE; cd ..; echo "Publishing online demo..."; From c5e5fe49dc10d1fee5d374f12e68304645ef9e51 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 24 Dec 2016 22:31:31 +0800 Subject: [PATCH 013/120] http request support GET method (for aria2 v1.15.1 and below) --- src/langs/zh_CN.txt | 4 ++ src/scripts/config/constants.js | 1 + src/scripts/config/defaultLanguage.js | 4 ++ src/scripts/services/aria2HttpRpcService.js | 56 ++++++++++++++++++-- src/scripts/services/ariaNgSettingService.js | 6 +++ src/views/settings-ariang.html | 17 ++++++ 6 files changed, 85 insertions(+), 3 deletions(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index 67a745e..48d0805 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -126,6 +126,8 @@ Enable Browser Notification=启用浏览器通知 Aria2 RPC Host=Aria2 RPC 主机 Aria2 RPC Port=Aria2 RPC 端口 Aria2 RPC Protocol=Aria2 RPC 协议 +Aria2 RPC Http Request Method=Aria2 RPC Http 请求方法 +POST method only supports aria2 v1.15.2 and above.=POST 方法仅支持 Aria2 v1.15.2 及以上. Aria2 RPC Secret Token=Aria2 RPC 密钥 Aria2 RPC Address=Aria2 RPC 地址 Global Stat Refresh Interval=全局状态刷新间隔 @@ -160,6 +162,8 @@ Http=Http Https=Https WebSocket=WebSocket WebSocket (Security)=WebSocket (安全) +POST=POST +GET=GET Disabled=禁用 Changes to the settings take effect after refreshing page.=设置将在页面刷新后生效. Type is illegal!=类型错误! diff --git a/src/scripts/config/constants.js b/src/scripts/config/constants.js index d851cf9..8bfdb0d 100644 --- a/src/scripts/config/constants.js +++ b/src/scripts/config/constants.js @@ -23,6 +23,7 @@ rpcHost: '', rpcPort: '6800', protocol: 'http', + httpMethod: 'POST', secret: '', globalStatRefreshInterval: 1000, downloadTaskRefreshInterval: 1000 diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 76638a6..7ed9f2d 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -130,6 +130,8 @@ 'Aria2 RPC Host': 'Aria2 RPC Host', 'Aria2 RPC Port': 'Aria2 RPC Port', 'Aria2 RPC Protocol': 'Aria2 RPC Protocol', + 'Aria2 RPC Http Request Method': 'Aria2 RPC Http Request Method', + 'POST method only supports aria2 v1.15.2 and above.': 'POST method only supports aria2 v1.15.2 and above.', 'Aria2 RPC Secret Token': 'Aria2 RPC Secret Token', 'Aria2 RPC Address': 'Aria2 RPC Address', 'Global Stat Refresh Interval': 'Global Stat Refresh Interval', @@ -164,6 +166,8 @@ 'Https': 'Https', 'WebSocket': 'WebSocket', 'WebSocket (Security)': 'WebSocket (Security)', + 'POST': 'POST', + 'GET': 'GET', 'Disabled': 'Disabled', 'Changes to the settings take effect after refreshing page.': 'Changes to the settings take effect after refreshing page.', 'Type is illegal!': 'Type is illegal!', diff --git a/src/scripts/services/aria2HttpRpcService.js b/src/scripts/services/aria2HttpRpcService.js index c01d725..c247dfb 100644 --- a/src/scripts/services/aria2HttpRpcService.js +++ b/src/scripts/services/aria2HttpRpcService.js @@ -1,8 +1,53 @@ (function () { 'use strict'; - angular.module('ariaNg').factory('aria2HttpRpcService', ['$http', 'ariaNgSettingService', 'ariaNgLogService', function ($http, ariaNgSettingService, ariaNgLogService) { + angular.module('ariaNg').factory('aria2HttpRpcService', ['$http', 'base64', 'ariaNgSettingService', 'ariaNgLogService', function ($http, base64, ariaNgSettingService, ariaNgLogService) { var rpcUrl = ariaNgSettingService.getJsonRpcUrl(); + var method = ariaNgSettingService.getHttpMethod(); + + var getUrlWithQueryString = function (url, parameters) { + if (!url || url.length < 1) { + return url; + } + + var queryString = ''; + + for (var key in parameters) { + if (!parameters.hasOwnProperty(key)) { + continue; + } + + var value = parameters[key]; + + if (value === null || angular.isUndefined(value)) { + continue; + } + + if (queryString.length > 0) { + queryString += '&'; + } + + if (angular.isObject(value) || angular.isArray(value)) { + value = angular.toJson(value); + value = base64.encode(value); + value = encodeURIComponent(value); + } + + queryString += key + '=' + value; + } + + if (queryString.length < 1) { + return url; + } + + if (url.indexOf('?') < 0) { + queryString = '?' + queryString; + } else { + queryString = '&' + queryString; + } + + return url + queryString; + }; return { request: function (context) { @@ -12,10 +57,15 @@ var requestContext = { url: rpcUrl, - method: 'POST', - data: context.requestBody + method: method }; + if (requestContext.method === 'POST') { + requestContext.data = context.requestBody; + } else if (requestContext.method === 'GET') { + requestContext.url = getUrlWithQueryString(requestContext.url, context.requestBody); + } + ariaNgLogService.debug('[aria2HttpRpcService.request] request start', requestContext); return $http(requestContext).success(function (data) { diff --git a/src/scripts/services/ariaNgSettingService.js b/src/scripts/services/ariaNgSettingService.js index 9486dc5..7a28493 100644 --- a/src/scripts/services/ariaNgSettingService.js +++ b/src/scripts/services/ariaNgSettingService.js @@ -182,6 +182,12 @@ setProtocol: function (value) { setOption('protocol', value); }, + getHttpMethod: function () { + return getOption('httpMethod'); + }, + setHttpMethod: function (value) { + setOption('httpMethod', value); + }, isUseWebSocket: function (protocol) { if (!protocol) { protocol = this.getProtocol(); diff --git a/src/views/settings-ariang.html b/src/views/settings-ariang.html index e5ed1b6..ccfc892 100644 --- a/src/views/settings-ariang.html +++ b/src/views/settings-ariang.html @@ -116,6 +116,8 @@ ng-change="settingService.setRpcHost(context.settings.rpcHost)"/> : + / + jsonrpc
@@ -144,6 +146,21 @@ +
+
+ Aria2 RPC Http Request Method + * + +
+
+ +
+
Aria2 RPC Secret Token From faeada5cfa77bbeb8edd371dc2e96efd9f157a83 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 24 Dec 2016 22:33:58 +0800 Subject: [PATCH 014/120] hide error message icon when response does not contain error message --- src/views/task-detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/task-detail.html b/src/views/task-detail.html index c9d029b..e1fb361 100644 --- a/src/views/task-detail.html +++ b/src/views/task-detail.html @@ -48,7 +48,7 @@
-
From 1e61c78a6ff306ac43f97687d07acd68d9bcd53a Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 24 Dec 2016 22:39:42 +0800 Subject: [PATCH 015/120] update translation --- src/langs/zh_CN.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index 48d0805..2452046 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -127,7 +127,7 @@ Aria2 RPC Host=Aria2 RPC 主机 Aria2 RPC Port=Aria2 RPC 端口 Aria2 RPC Protocol=Aria2 RPC 协议 Aria2 RPC Http Request Method=Aria2 RPC Http 请求方法 -POST method only supports aria2 v1.15.2 and above.=POST 方法仅支持 Aria2 v1.15.2 及以上. +POST method only supports aria2 v1.15.2 and above.=POST 方法仅支持 aria2 v1.15.2 及以上. Aria2 RPC Secret Token=Aria2 RPC 密钥 Aria2 RPC Address=Aria2 RPC 地址 Global Stat Refresh Interval=全局状态刷新间隔 @@ -146,7 +146,7 @@ Functions=方法 Save Session=保存会话 Shutdown Aria2=关闭 Aria2 Confirm Shutdown=确认关闭 -Are you sure you want to shutdown aria2?=您是否要关闭 Aria2? +Are you sure you want to shutdown aria2?=您是否要关闭 aria2? Session has been saved successfully.=会话已经成功保存. Aria2 has been shutdown successfully.=Aria2 已经成功关闭. Toggle Navigation=切换导航 From 81a1ef16e72319304ac1b65a667cc6d813934f88 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 24 Dec 2016 23:24:19 +0800 Subject: [PATCH 016/120] add file name and http header option in new task page --- src/langs/zh_CN.txt | 4 +++- src/scripts/config/aria2Options.js | 13 +++++++++++++ src/scripts/config/defaultLanguage.js | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index 2452046..ba9ac17 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -285,6 +285,8 @@ netrc-path.description= no-netrc.name=禁用 netrc no-netrc.description= no-proxy.name=不使用代理服务器列表 +out.name=文件名 +out.description=下载文件的文件名. 其总是相对于 --dir 选项中设置的路径. 当使用 --force-sequential 参数是, 此选项无效. no-proxy.description=设置不使用代理服务器的主机名, 域名, 包含或不包含子网掩码的网络地址, 多个使用逗号分隔. proxy-method.name=代理服务器请求方法 proxy-method.description=设置用来请求代理服务器的方法. 方法可设置为 GET 或 TUNNEL. HTTPS 下载将忽略此选项并总是使用 TUNNEL. @@ -397,7 +399,7 @@ bt-save-metadata.description=保存种子文件为 ".torrent" 文件. 此选项 bt-seed-unverified.name=不检查已经下载的文件 bt-seed-unverified.description=不检查之前下载文件中每个分片的哈希值. bt-stop-timeout.name=无速度时自动停止时间 -bt-stop-timeout.description=当 BT 任务F下载速度持续为 0, 达到本选项设置的时间后停止下载. 如果设置为 0, 此功能将禁用. +bt-stop-timeout.description=当 BT 任务F下载速度持续为 0, 达到此选项设置的时间后停止下载. 如果设置为 0, 此功能将禁用. bt-tracker.name=BT 服务器地址 bt-tracker.description=逗号分隔的 BT 服务器地址. 如果服务器地址在 --bt-exclude-tracker 选项中, 其将不会生效. bt-tracker-connect-timeout.name=BT 服务器连接超时时间 diff --git a/src/scripts/config/aria2Options.js b/src/scripts/config/aria2Options.js index 94dfd31..63ce42f 100644 --- a/src/scripts/config/aria2Options.js +++ b/src/scripts/config/aria2Options.js @@ -108,6 +108,9 @@ split: ',', showCount: true }, + 'out': { + type: 'string' + }, 'proxy-method': { type: 'option', options: ['get', 'tunnel'], @@ -820,6 +823,11 @@ key: 'dir', newOnly: true }, + { + key: 'out', + httpOnly: true, + newOnly: true + }, { key: 'allow-overwrite', newOnly: true @@ -871,6 +879,11 @@ httpOnly: true, activeReadonly: true }, + { + key: 'header', + httpOnly: true, + newOnly: true + }, { key: 'bt-max-peers', btOnly: true diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 7ed9f2d..946c652 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -305,6 +305,8 @@ 'no-netrc.description': '', 'no-proxy.name': 'No Proxy List', 'no-proxy.description': 'Specify a comma separated list of host names, domains and network addresses with or without a subnet mask where no proxy should be used.', + 'out.name': 'File Name', + 'out.description': 'The file name of the downloaded file. It is always relative to the directory given in --dir option. When the --force-sequential option is used, this option is ignored.', 'proxy-method.name': 'Proxy Method', 'proxy-method.description': 'Set the method to use in proxy request. METHOD is either GET or TUNNEL. HTTPS downloads always use TUNNEL regardless of this option.', 'remote-time.name': 'Remote File Timestamp', From 6323fe2ae8f3bdedf3db9c680139f35bed3c5f33 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 24 Dec 2016 23:29:22 +0800 Subject: [PATCH 017/120] format code --- src/scripts/config/aria2Options.js | 56 +++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/src/scripts/config/aria2Options.js b/src/scripts/config/aria2Options.js index 63ce42f..4fcb0aa 100644 --- a/src/scripts/config/aria2Options.js +++ b/src/scripts/config/aria2Options.js @@ -809,14 +809,54 @@ defaultValue: 'true' } }).constant('aria2GlobalAvailableOptions', { - basicOptions: ['dir', 'log', 'max-concurrent-downloads', 'check-integrity', 'continue'], - httpFtpSFtpOptions: ['all-proxy', 'all-proxy-user', 'all-proxy-passwd', 'connect-timeout', 'dry-run', 'lowest-speed-limit', 'max-connection-per-server', 'max-file-not-found', 'max-tries', 'min-split-size', 'netrc-path', 'no-netrc', 'no-proxy', 'proxy-method', 'remote-time', 'reuse-uri', 'retry-wait', 'server-stat-of', 'server-stat-timeout', 'split', 'stream-piece-selector', 'timeout', 'uri-selector'], - httpOptions: ['check-certificate', 'http-accept-gzip', 'http-auth-challenge', 'http-no-cache', 'http-user', 'http-passwd', 'http-proxy', 'http-proxy-user', 'http-proxy-passwd', 'https-proxy', 'https-proxy-user', 'https-proxy-passwd', 'referer', 'enable-http-keep-alive', 'enable-http-pipelining', 'header', 'save-cookies', 'use-head', 'user-agent'], - ftpSFtpOptions: ['ftp-user', 'ftp-passwd', 'ftp-pasv', 'ftp-proxy', 'ftp-proxy-user', 'ftp-proxy-passwd', 'ftp-type', 'ftp-reuse-connection', 'ssh-host-key-md'], - btOptions: ['bt-detach-seed-only', 'bt-enable-hook-after-hash-check', 'bt-enable-lpd', 'bt-exclude-tracker', 'bt-external-ip', 'bt-force-encryption', 'bt-hash-check-seed', 'bt-max-open-files', 'bt-max-peers', 'bt-metadata-only', 'bt-min-crypto-level', 'bt-prioritize-piece', 'bt-remove-unselected-file', 'bt-require-crypto', 'bt-request-peer-speed-limit', 'bt-save-metadata', 'bt-seed-unverified', 'bt-stop-timeout', 'bt-tracker', 'bt-tracker-connect-timeout', 'bt-tracker-interval', 'bt-tracker-timeout', 'dht-file-path', 'dht-file-path6', 'dht-listen-port', 'dht-message-timeout', 'enable-dht', 'enable-dht6', 'enable-peer-exchange', 'follow-torrent', 'listen-port', 'max-overall-upload-limit', 'max-upload-limit', 'peer-id-prefix', 'seed-ratio', 'seed-time'], - metalinkOptions: ['follow-metalink', 'metalink-base-uri', 'metalink-language', 'metalink-location', 'metalink-os', 'metalink-version', 'metalink-preferred-protocol', 'metalink-enable-unique-protocol'], - rpcOptions: ['enable-rpc', 'pause-metadata', 'rpc-allow-origin-all', 'rpc-listen-all', 'rpc-listen-port', 'rpc-max-request-size', 'rpc-save-upload-metadata', 'rpc-secure'], - advancedOptions: ['allow-overwrite', 'allow-piece-length-change', 'always-resume', 'async-dns', 'auto-file-renaming', 'auto-save-interval', 'conditional-get', 'conf-path', 'console-log-level', 'daemon', 'deferred-input', 'disable-ipv6', 'disk-cache', 'download-result', 'dscp', 'rlimit-nofile', 'enable-color', 'enable-mmap', 'event-poll', 'file-allocation', 'force-save', 'save-not-found', 'hash-check-only', 'human-readable', 'keep-unfinished-download-result', 'max-download-result', 'max-mmap-limit', 'max-resume-failure-tries', 'min-tls-version', 'log-level', 'optimize-concurrent-downloads', 'piece-length', 'show-console-readout', 'summary-interval', 'max-overall-download-limit', 'max-download-limit', 'no-conf', 'no-file-allocation-limit', 'parameterized-uri', 'quiet', 'realtime-chunk-checksum', 'remove-control-file', 'save-session', 'save-session-interval', 'socket-recv-buffer-size', 'stop', 'truncate-console-readout'] + basicOptions: [ + 'dir', 'log', 'max-concurrent-downloads', 'check-integrity', 'continue' + ], + httpFtpSFtpOptions: [ + 'all-proxy', 'all-proxy-user', 'all-proxy-passwd', 'connect-timeout', 'dry-run', 'lowest-speed-limit', + 'max-connection-per-server', 'max-file-not-found', 'max-tries', 'min-split-size', 'netrc-path', 'no-netrc', + 'no-proxy', 'proxy-method', 'remote-time', 'reuse-uri', 'retry-wait', 'server-stat-of', + 'server-stat-timeout', 'split', 'stream-piece-selector', 'timeout', 'uri-selector' + ], + httpOptions: [ + 'check-certificate', 'http-accept-gzip', 'http-auth-challenge', 'http-no-cache', 'http-user', + 'http-passwd', 'http-proxy', 'http-proxy-user', 'http-proxy-passwd', 'https-proxy', 'https-proxy-user', + 'https-proxy-passwd', 'referer', 'enable-http-keep-alive', 'enable-http-pipelining', 'header', + 'save-cookies', 'use-head', 'user-agent' + ], + ftpSFtpOptions: [ + 'ftp-user', 'ftp-passwd', 'ftp-pasv', 'ftp-proxy', 'ftp-proxy-user', 'ftp-proxy-passwd', + 'ftp-type', 'ftp-reuse-connection', 'ssh-host-key-md' + ], + btOptions: [ + 'bt-detach-seed-only', 'bt-enable-hook-after-hash-check', 'bt-enable-lpd', 'bt-exclude-tracker', + 'bt-external-ip', 'bt-force-encryption', 'bt-hash-check-seed', 'bt-max-open-files', 'bt-max-peers', + 'bt-metadata-only', 'bt-min-crypto-level', 'bt-prioritize-piece', 'bt-remove-unselected-file', + 'bt-require-crypto', 'bt-request-peer-speed-limit', 'bt-save-metadata', 'bt-seed-unverified', + 'bt-stop-timeout', 'bt-tracker', 'bt-tracker-connect-timeout', 'bt-tracker-interval', 'bt-tracker-timeout', + 'dht-file-path', 'dht-file-path6', 'dht-listen-port', 'dht-message-timeout', 'enable-dht', 'enable-dht6', + 'enable-peer-exchange', 'follow-torrent', 'listen-port', 'max-overall-upload-limit', 'max-upload-limit', + 'peer-id-prefix', 'seed-ratio', 'seed-time' + ], + metalinkOptions: [ + 'follow-metalink', 'metalink-base-uri', 'metalink-language', 'metalink-location', 'metalink-os', + 'metalink-version', 'metalink-preferred-protocol', 'metalink-enable-unique-protocol' + ], + rpcOptions: [ + 'enable-rpc', 'pause-metadata', 'rpc-allow-origin-all', 'rpc-listen-all', 'rpc-listen-port', + 'rpc-max-request-size', 'rpc-save-upload-metadata', 'rpc-secure' + ], + advancedOptions: [ + 'allow-overwrite', 'allow-piece-length-change', 'always-resume', 'async-dns', 'auto-file-renaming', + 'auto-save-interval', 'conditional-get', 'conf-path', 'console-log-level', 'daemon', 'deferred-input', + 'disable-ipv6', 'disk-cache', 'download-result', 'dscp', 'rlimit-nofile', 'enable-color', 'enable-mmap', + 'event-poll', 'file-allocation', 'force-save', 'save-not-found', 'hash-check-only', 'human-readable', + 'keep-unfinished-download-result', 'max-download-result', 'max-mmap-limit', 'max-resume-failure-tries', + 'min-tls-version', 'log-level', 'optimize-concurrent-downloads', 'piece-length', 'show-console-readout', + 'summary-interval', 'max-overall-download-limit', 'max-download-limit', 'no-conf', + 'no-file-allocation-limit', 'parameterized-uri', 'quiet', 'realtime-chunk-checksum', 'remove-control-file', + 'save-session', 'save-session-interval', 'socket-recv-buffer-size', 'stop', 'truncate-console-readout' + ] }).constant('aria2TaskAvailableOptions', { taskOptions: [ { From ec839b3ecd8757915e5cae91f554c176acc5996e Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 25 Dec 2016 01:07:16 +0800 Subject: [PATCH 018/120] code refactor and add option filter in new task page --- src/langs/zh_CN.txt | 2 + src/scripts/config/aria2Options.js | 100 ++++++++++++-------- src/scripts/config/defaultLanguage.js | 2 + src/scripts/controllers/new.js | 7 +- src/scripts/services/aria2SettingService.js | 28 ++++-- src/styles/controls/new-task-table.css | 4 + src/styles/controls/settings-table.css | 10 ++ src/views/new.html | 25 ++++- 8 files changed, 127 insertions(+), 51 deletions(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index ba9ac17..802ea9c 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -35,6 +35,7 @@ By Progress=按进度 By Remain Time=按剩余时间 By Download Speed=按下载速度 By Upload Speed=按上传速度 +Filters=过滤器 Download=下载 Upload=上传 Downloading=正在下载 @@ -165,6 +166,7 @@ WebSocket (Security)=WebSocket (安全) POST=POST GET=GET Disabled=禁用 +BitTorrent=BitTorrent Changes to the settings take effect after refreshing page.=设置将在页面刷新后生效. Type is illegal!=类型错误! Parameter is invalid!=请求参数无效 diff --git a/src/scripts/config/aria2Options.js b/src/scripts/config/aria2Options.js index 4fcb0aa..69b8426 100644 --- a/src/scripts/config/aria2Options.js +++ b/src/scripts/config/aria2Options.js @@ -1,7 +1,7 @@ (function () { 'use strict'; angular.module('ariaNg').constant('aria2AllOptions', { - // EXAMPLE: + // Aria2 Option Defination EXAMPLE: // 'option key': { // [since: '',] //This option is supported by this or higher aria2 version // type: 'string|integer|float|text|boolean|option', @@ -809,6 +809,10 @@ defaultValue: 'true' } }).constant('aria2GlobalAvailableOptions', { + // Aria2 Setting Page Defination EXAMPLE: + // 'category key': [ + // 'option key 1', 'option key 2', // more options if possible + // ] basicOptions: [ 'dir', 'log', 'max-concurrent-downloads', 'check-integrity', 'continue' ], @@ -858,118 +862,132 @@ 'save-session', 'save-session-interval', 'socket-recv-buffer-size', 'stop', 'truncate-console-readout' ] }).constant('aria2TaskAvailableOptions', { + // Aria2 Task Option Defination EXAMPLE: + // { + // key: 'option key', + // category: 'global|http|bittorrent', + // [canShow: 'new|active|waiting|paused',] // possible to show in specific status, supporting multiple choice. if not set, always show + // [canUpdate: 'new|active|waiting|paused',] // possible to write in specific status, supporting multiple choice. if not set, always writable + // } taskOptions: [ { key: 'dir', - newOnly: true + category: 'global', + canUpdate: 'new' }, { key: 'out', - httpOnly: true, - newOnly: true + category: 'http', + canUpdate: 'new' }, { key: 'allow-overwrite', - newOnly: true + category: 'global', + canShow: 'new' }, { - key: 'max-download-limit' + key: 'max-download-limit', + category: 'global' }, { key: 'max-upload-limit', - btOnly: true + category: 'bittorrent' }, { key: 'split', - httpOnly: true, - activeReadonly: true + category: 'http', + canUpdate: 'new|waiting|paused' }, { key: 'min-split-size', - httpOnly: true, - activeReadonly: true + category: 'http', + canUpdate: 'new|waiting|paused' }, { key: 'max-connection-per-server', - httpOnly: true, - activeReadonly: true + category: 'http', + canUpdate: 'new|waiting|paused' }, { key: 'lowest-speed-limit', - httpOnly: true, - activeReadonly: true + category: 'http', + canUpdate: 'new|waiting|paused' }, { key: 'stream-piece-selector', - httpOnly: true, - activeReadonly: true + category: 'http', + canUpdate: 'new|waiting|paused' }, { key: 'all-proxy', - httpOnly: true, - activeReadonly: true + category: 'http', + canUpdate: 'new|waiting|paused' }, { key: 'all-proxy-user', - httpOnly: true, - activeReadonly: true + category: 'http', + canUpdate: 'new|waiting|paused' }, { key: 'all-proxy-passwd', - httpOnly: true, - activeReadonly: true + category: 'http', + canUpdate: 'new|waiting|paused' }, { key: 'header', - httpOnly: true, - newOnly: true + category: 'http', + canUpdate: 'new' }, { key: 'bt-max-peers', - btOnly: true + category: 'bittorrent' }, { key: 'bt-request-peer-speed-limit', - btOnly: true + category: 'bittorrent' }, { key: 'bt-remove-unselected-file', - btOnly: true + category: 'bittorrent' }, { key: 'bt-stop-timeout', - btOnly: true, - activeReadonly: true + category: 'bittorrent', + canUpdate: 'new|waiting|paused' }, { key: 'bt-tracker', - btOnly: true, - activeReadonly: true + category: 'bittorrent', + canUpdate: 'new|waiting|paused' }, { key: 'seed-ratio', - btOnly: true, - activeReadonly: true + category: 'bittorrent', + canUpdate: 'new|waiting|paused' }, { key: 'seed-time', - btOnly: true, - activeReadonly: true + category: 'bittorrent', + canUpdate: 'new|waiting|paused' }, { key: 'conditional-get', - newOnly: true + category: 'global', + canShow: 'new' }, { key: 'file-allocation', - newOnly: true + category: 'global', + canShow: 'new' }, { - key: 'parameterized-uri ', - newOnly: true + key: 'parameterized-uri', + category: 'global', + canShow: 'new' }, { - key: 'force-save' + key: 'force-save', + category: 'global' } ] }); diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 946c652..052000c 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -39,6 +39,7 @@ 'By Remain Time': 'By Remain Time', 'By Download Speed': 'By Download Speed', 'By Upload Speed': 'By Upload Speed', + 'Filters': 'Filters', 'Download': 'Download', 'Upload': 'Upload', 'Downloading': 'Downloading', @@ -169,6 +170,7 @@ 'POST': 'POST', 'GET': 'GET', 'Disabled': 'Disabled', + 'BitTorrent': 'BitTorrent', 'Changes to the settings take effect after refreshing page.': 'Changes to the settings take effect after refreshing page.', 'Type is illegal!': 'Type is illegal!', 'Parameter is invalid!': 'Parameter is invalid!', diff --git a/src/scripts/controllers/new.js b/src/scripts/controllers/new.js index 361ada1..7d0143d 100644 --- a/src/scripts/controllers/new.js +++ b/src/scripts/controllers/new.js @@ -13,7 +13,12 @@ return aria2SettingService.getSpecifiedOptions(keys); })(), globalOptions: null, - options: {} + options: {}, + optionFilter: { + global: true, + http: true, + bittorrent: true + } }; $scope.changeTab = function (tabName) { diff --git a/src/scripts/services/aria2SettingService.js b/src/scripts/services/aria2SettingService.js index 093436e..4510456 100644 --- a/src/scripts/services/aria2SettingService.js +++ b/src/scripts/services/aria2SettingService.js @@ -45,20 +45,21 @@ for (var i = 0; i < allOptions.length; i++) { var option = allOptions[i]; var optionKey = { - key: option.key + key: option.key, + category: option.category }; - if (option.newOnly) { + if (option.canShow && option.canShow.indexOf(status) < 0) { continue; } - if (option.httpOnly && isBittorrent) { + if (option.category === 'http' && isBittorrent) { continue; - } else if (option.btOnly && !isBittorrent) { + } else if (option.category === 'bittorrent' && !isBittorrent) { continue; } - if (option.activeReadonly && status === 'active') { + if (option.canUpdate && option.canUpdate.indexOf(status) < 0) { optionKey.readonly = true; } @@ -74,9 +75,18 @@ for (var i = 0; i < allOptions.length; i++) { var option = allOptions[i]; var optionKey = { - key: option.key + key: option.key, + category: option.category }; + if (option.canShow && option.canShow.indexOf('new') < 0) { + continue; + } + + if (option.canUpdate && option.canUpdate.indexOf('new') < 0) { + optionKey.readonly = true; + } + availableOptions.push(optionKey); } @@ -88,12 +98,14 @@ for (var i = 0; i < keys.length; i++) { var key = keys[i]; var readonly = false; + var category = null; if (angular.isObject(key)) { var optionKey = key; key = optionKey.key; readonly = !!optionKey.readonly; + category = optionKey.category; } var option = aria2AllOptions[key]; @@ -108,6 +120,10 @@ descriptionKey: 'options.' + key + '.description' }, option); + if (category) { + option.category = category; + } + if (option.type === 'boolean') { option.options = ['true', 'false']; } diff --git a/src/styles/controls/new-task-table.css b/src/styles/controls/new-task-table.css index 06472f4..8a16ee6 100644 --- a/src/styles/controls/new-task-table.css +++ b/src/styles/controls/new-task-table.css @@ -22,3 +22,7 @@ display: block; } } + +.settings-table .new-task-filter-title { + padding-top: 6px; +} diff --git a/src/styles/controls/settings-table.css b/src/styles/controls/settings-table.css index 61a20fd..923d3d0 100644 --- a/src/styles/controls/settings-table.css +++ b/src/styles/controls/settings-table.css @@ -4,6 +4,16 @@ margin-right: 15px; } +.settings-table .settings-table-title { + font-size: 12px; + padding-top: 4px; + padding-bottom: 4px; +} + +.settings-table .settings-table-title a { + color: #000; +} + .settings-table > div.row { padding-top: 8px; padding-bottom: 8px; diff --git a/src/views/new.html b/src/views/new.html index 4a72b53..65c7a7e 100644 --- a/src/views/new.html +++ b/src/views/new.html @@ -23,7 +23,7 @@ +   - From abe74c4ac18e7aa84ef6c9dac7da9ac8991c18cf Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 19 Mar 2017 21:57:29 +0800 Subject: [PATCH 040/120] optimize dependency --- src/scripts/services/aria2RpcService.js | 4 +++- src/scripts/services/ariaNgCommonService.js | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scripts/services/aria2RpcService.js b/src/scripts/services/aria2RpcService.js index 8983439..e6b4448 100644 --- a/src/scripts/services/aria2RpcService.js +++ b/src/scripts/services/aria2RpcService.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('ariaNg').factory('aria2RpcService', ['$q', 'aria2RpcConstants', 'aria2RpcErrors', 'ariaNgCommonService', 'ariaNgSettingService', 'aria2HttpRpcService', 'aria2WebSocketRpcService', function ($q, aria2RpcConstants, aria2RpcErrors, ariaNgCommonService, ariaNgSettingService, aria2HttpRpcService, aria2WebSocketRpcService) { + angular.module('ariaNg').factory('aria2RpcService', ['$q', 'aria2RpcConstants', 'aria2RpcErrors', 'ariaNgCommonService', 'ariaNgSettingService', 'ariaNgLogService', 'aria2HttpRpcService', 'aria2WebSocketRpcService', function ($q, aria2RpcConstants, aria2RpcErrors, ariaNgCommonService, ariaNgSettingService, ariaNgLogService, aria2HttpRpcService, aria2WebSocketRpcService) { var rpcImplementService = ariaNgSettingService.isUseWebSocket() ? aria2WebSocketRpcService : aria2HttpRpcService; var isConnected = false; var secret = ariaNgSettingService.getSecret(); @@ -112,6 +112,8 @@ return false; } + ariaNgLogService.error('[aria2RpcService.processError] ' + error.message, error); + if (aria2RpcErrors[error.message] && aria2RpcErrors[error.message].tipTextKey) { ariaNgCommonService.showError(aria2RpcErrors[error.message].tipTextKey); return true; diff --git a/src/scripts/services/ariaNgCommonService.js b/src/scripts/services/ariaNgCommonService.js index 8d2a667..657fe32 100644 --- a/src/scripts/services/ariaNgCommonService.js +++ b/src/scripts/services/ariaNgCommonService.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('ariaNg').factory('ariaNgCommonService', ['$location', '$timeout', 'base64', 'SweetAlert', '$translate', 'ariaNgConstants', 'ariaNgLogService', function ($location, $timeout, base64, SweetAlert, $translate, ariaNgConstants, ariaNgLogService) { + angular.module('ariaNg').factory('ariaNgCommonService', ['$location', '$timeout', 'base64', 'SweetAlert', '$translate', 'ariaNgConstants', function ($location, $timeout, base64, SweetAlert, $translate, ariaNgConstants) { return { generateUniqueId: function () { var sourceId = ariaNgConstants.appPrefix + '_' + Math.round(new Date().getTime() / 1000) + '_' + Math.random(); @@ -20,7 +20,6 @@ }, 100); }, showError: function (text) { - ariaNgLogService.info('[ariaNgCommonService.showError] ' + text); this.showDialog('Error', text, 'error'); }, showOperationSucceeded: function (text) { From b4faa50dca31b33908cf30bf79d85cd75e61e5fc Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 19 Mar 2017 23:17:56 +0800 Subject: [PATCH 041/120] fix null pointer bug --- src/scripts/services/ariaNgTitleService.js | 10 ++-- src/views/settings-ariang.html | 58 ++++++++++++++-------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/src/scripts/services/ariaNgTitleService.js b/src/scripts/services/ariaNgTitleService.js index 8b1b71a..5770c69 100644 --- a/src/scripts/services/ariaNgTitleService.js +++ b/src/scripts/services/ariaNgTitleService.js @@ -129,11 +129,11 @@ }, getFinalTitleByGlobalStat: function (globalStat) { var context = { - downloadingCount: globalStat.numActive, - waitingCount: globalStat.numWaiting, - stoppedCount: globalStat.numStopped, - downloadSpeed: globalStat.downloadSpeed, - uploadSpeed: globalStat.uploadSpeed + downloadingCount: (globalStat ? globalStat.numActive : 0), + waitingCount: (globalStat ? globalStat.numWaiting : 0), + stoppedCount: (globalStat ? globalStat.numStopped : 0), + downloadSpeed: (globalStat ? globalStat.downloadSpeed : 0), + uploadSpeed: (globalStat ? globalStat.uploadSpeed : 0) }; return this.getFinalTitle(context); diff --git a/src/views/settings-ariang.html b/src/views/settings-ariang.html index 4cfe5fb..60f41b3 100644 --- a/src/views/settings-ariang.html +++ b/src/views/settings-ariang.html @@ -1,15 +1,20 @@
- Aria2 RPC Host + Aria2 RPC Address *
- : - - / - + : +
+ +
+ / +
+ +
-
-
- Aria2 RPC Port - * -
-
- -
-
-
-
- Aria2 RPC Interface - * -
-
- -
-
Aria2 RPC Protocol From 68ba08f5e20e7f34006f919c4822fcff7fb77036 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 26 Mar 2017 13:41:47 +0800 Subject: [PATCH 060/120] update readme --- README-CHS.md | 54 --------------------------------------------------- README.md | 11 +++++------ 2 files changed, 5 insertions(+), 60 deletions(-) delete mode 100644 README-CHS.md diff --git a/README-CHS.md b/README-CHS.md deleted file mode 100644 index b3d02fb..0000000 --- a/README-CHS.md +++ /dev/null @@ -1,54 +0,0 @@ -# AriaNg -[![许可协议](https://img.shields.io/github/license/mayswind/AriaNg.svg?style=flat)](https://github.com/mayswind/AriaNg/blob/master/LICENSE) -[![最后构建](https://img.shields.io/circleci/project/mayswind/AriaNg.svg?style=flat)](https://circleci.com/gh/mayswind/AriaNg/tree/master) -[![最新版本](https://img.shields.io/github/release/mayswind/AriaNg.svg?style=flat)](https://github.com/mayswind/AriaNg/releases) - -## 介绍 -面向 [aria2](https://github.com/aria2/aria2) 的更好用的 Web 前端. AriaNg 使用纯 html & javascript 开发, 所以既不需要编译也不依赖于任何运行环境, 您只需要打开您的游览器就可以使用. 通过借助响应式布局设计, 您可以在任何计算机或移动设备上使用. - -## 特性 -1. 纯 Html & Javascript 实现, 不依赖任何运行时 -2. 响应式布局设计, 兼容计算机与移动设备 -3. 友好的界面交互 - * 任务排序 (按文件名, 文件大小, 进度, 剩余时间, 下载速度等.), 文件排序, 连接节点排序 - * 任务搜索 - * 拖拽调整下载顺序 - * 更详细的任务信息 (健康度, 连接节点客户端信息等.) - * 根据文件类型过滤任务中的文件 (按视频, 音频, 图片, 文档, 应用程序, 存档文件等.) - * 全局以及单任务的上传/下载图表 - * 完整支持 aria2 设置选项 -4. 支持网页地址命令行 API -5. 下载完成消息通知 -6. 多语言支持 -7. 支持配置多个 aria2 RPC -8. 节省带宽, 仅请求增量数据 - -## 截图 -#### 计算机 -![AriaNg](https://raw.githubusercontent.com/mayswind/AriaNg-WebSite/master/screenshots/desktop.png) -#### 移动设备 -![AriaNg](https://raw.githubusercontent.com/mayswind/AriaNg-WebSite/master/screenshots/mobile.png) - -## 安装 -#### 下载即用 -最新发布版本: [https://github.com/mayswind/AriaNg/releases](https://github.com/mayswind/AriaNg/releases) - -最新每日构建: [https://github.com/mayswind/AriaNg-DailyBuild/archive/master.zip](https://github.com/mayswind/AriaNg-DailyBuild/archive/master.zip) - -#### 从源代码中构建 -首先请确保您已经安装 [Node.js](https://nodejs.org/), [NPM](https://www.npmjs.com/) 和 [Bower](https://bower.io/). 然后下载源代码并执行以下步骤. - - $ npm install - $ bower install - $ gulp clean build - -构建后的内容将放置在 dist 目录中. - -## Demo -请访问 [http://ariang.mayswind.net/latest](http://ariang.mayswind.net/latest) - -## 命令行 API -请访问 [http://ariang.mayswind.net/command-api.html](http://ariang.mayswind.net/command-api.html) 获取更多信息. - -## 协议 -[MIT](https://github.com/mayswind/AriaNg/blob/master/LICENSE) diff --git a/README.md b/README.md index bc79302..d44ce36 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,8 @@ [![Lastest Build](https://img.shields.io/circleci/project/mayswind/AriaNg.svg?style=flat)](https://circleci.com/gh/mayswind/AriaNg/tree/master) [![Lastest Release](https://img.shields.io/github/release/mayswind/AriaNg.svg?style=flat)](https://github.com/mayswind/AriaNg/releases) -[简体中文说明 (Simplified Chinese README)](https://github.com/mayswind/AriaNg/blob/master/README-CHS.md) - ## Introduction -A Better Web Frontend for [aria2](https://github.com/aria2/aria2). AriaNg is written in pure html & javascript, so it does not need to be compiled and not need any runtime environment, and you just need to open it in your browser. By using responsive layout, you can open it on any desktop or mobile devices. +AriaNg is a web frontend making [aria2](https://github.com/aria2/aria2) better. AriaNg is written in pure html & javascript, thus it does not need any compilers or runtime environment. You can just put AriaNg in your web server and open it in your browser. AriaNg uses responsive layout, and supports any desktop or mobile devices. ## Features 1. Pure Html & Javascript, no runtime required @@ -46,11 +44,12 @@ Make sure you have [Node.js](https://nodejs.org/), [NPM](https://www.npmjs.com/) The builds will be placed in the dist directory. +## Documents +1. [English](http://ariang.mayswind.net) +2. [Simplified Chinese (简体中文)](http://ariang.mayswind.net/zh_Hans) + ## Demo Please visit [http://ariang.mayswind.net/latest](http://ariang.mayswind.net/latest) -## Command API -Please visit [http://ariang.mayswind.net/command-api.html](http://ariang.mayswind.net/command-api.html) for more information. - ## License [MIT](https://github.com/mayswind/AriaNg/blob/master/LICENSE) From fb62d4fee26f14e02ca19cdef5b6bdc01de170cd Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 26 Mar 2017 14:58:27 +0800 Subject: [PATCH 061/120] modify package info --- bower.json | 8 ++++---- package.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bower.json b/bower.json index 067223e..546ed46 100644 --- a/bower.json +++ b/bower.json @@ -1,18 +1,18 @@ { "private": true, - "name": "aria-ng", - "description": "Aria2 Ng Frontend", + "name": "ariang", + "description": "AriaNg, a web frontend making aria2 better", "main": "index.html", "authors": [ "MaysWind " ], "license": "MIT", "keywords": [ - "Aria2", + "aria2", "Web", "Frontend" ], - "homepage": "https://github.com/mayswind/AriaNg", + "homepage": "http://ariang.mayswind.net/", "ignore": [ "**/.*", "node_modules", diff --git a/package.json b/package.json index ea2bdcc..92988bd 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,8 @@ "gulp-uglify": "^2.0.0", "gulp-useref": "^3.1.0" }, - "name": "aria-ng", - "description": "AriaNg, A Better Frontend for aria2", + "name": "ariang", + "description": "AriaNg, a web frontend making aria2 better", "version": "0.1.0", "main": "index.html", "scripts": { @@ -40,7 +40,7 @@ "url": "git+https://github.com/mayswind/AriaNg.git" }, "keywords": [ - "Aria2", + "aria2", "Web", "Frontend" ], @@ -49,5 +49,5 @@ "bugs": { "url": "https://github.com/mayswind/AriaNg/issues" }, - "homepage": "https://github.com/mayswind/AriaNg#readme" + "homepage": "http://ariang.mayswind.net/" } From 1268ff75e75ffa796ad64632768aad4f54bb8d72 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 26 Mar 2017 15:21:49 +0800 Subject: [PATCH 062/120] update ignore file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 69ede80..f21f327 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ $RECYCLE.BIN/ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 .idea/ +*.iml # Mongo Explorer plugin: .idea/mongoSettings.xml From 12ff89523020ebe91c855487e11979b3f1dec43c Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 26 Mar 2017 16:06:59 +0800 Subject: [PATCH 063/120] modify style --- src/styles/core/core.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/styles/core/core.css b/src/styles/core/core.css index d6aa00a..9291c50 100644 --- a/src/styles/core/core.css +++ b/src/styles/core/core.css @@ -4,7 +4,14 @@ */ /* basic */ +html { + margin: 0; + padding: 0; +} + body { + margin: 0; + padding: 0; -ms-user-select: none; -webkit-user-select: none; -moz-user-select: none; From 8168fa950fef0bd14d3d4424a0c0b5870cca3a25 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 26 Mar 2017 19:32:17 +0800 Subject: [PATCH 064/120] fix bug --- src/scripts/services/ariaNgCommonService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/services/ariaNgCommonService.js b/src/scripts/services/ariaNgCommonService.js index 67d718f..79463bb 100644 --- a/src/scripts/services/ariaNgCommonService.js +++ b/src/scripts/services/ariaNgCommonService.js @@ -28,7 +28,7 @@ confirm: function (title, text, type, callback, notClose, extendSettings) { var options = { title: $translate.instant(title), - text: $translate.instant(text, (extendSettings !== null ? extendSettings.textParams : null)), + text: $translate.instant(text, (angular.isObject(extendSettings) ? extendSettings.textParams : null)), type: type, showCancelButton: true, showLoaderOnConfirm: !!notClose, From 9c8ea2f9bf8d770e9f5a2876a180dba82fd9e411 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 27 Mar 2017 08:50:50 +0800 Subject: [PATCH 065/120] fix style bug --- src/styles/core/extend.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/styles/core/extend.css b/src/styles/core/extend.css index 3fe7aff..393d35b 100644 --- a/src/styles/core/extend.css +++ b/src/styles/core/extend.css @@ -17,6 +17,19 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + vertical-align: bottom; +} + +@media (max-width: 991px) { + .nav-tabs-custom .nav-tabs > li.nav-tab-title-rpcname > a { + max-width: 150px; + } +} + +@media (max-width: 767px) { + .nav-tabs-custom .nav-tabs > li.nav-tab-title-rpcname > a { + max-width: 120px; + } } .input-group.input-group-multiple > .input-group-addon { From 75f5ea0cc9ed6bc718bdb405878ec45416893433 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 27 Mar 2017 22:16:16 +0800 Subject: [PATCH 066/120] update third-party dependencies --- bower.json | 6 +++--- package.json | 10 +++++----- src/index.html | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bower.json b/bower.json index 546ed46..c51496a 100644 --- a/bower.json +++ b/bower.json @@ -23,9 +23,9 @@ "dependencies": { "jquery": "^2.2.4", "bootstrap": "^3.3.7", - "moment": "^2.17.1", + "moment": "^2.18.1", "moment-timezone": "^0.5.11", - "echarts": "^3.4.0", + "echarts": "^3.5.0", "font-awesome": "font-awsome#^4.7.0", "AdminLTE": "admin-lte#^2.3.11", "sweetalert": "^1.1.3", @@ -47,7 +47,7 @@ "angular-ui-notification": "^0.2.0", "angular-bittorrent-peerid": "^1.1.1", "angular-busy": "^4.1.4", - "angular-promise-buttons": "^0.1.19", + "angular-promise-buttons": "^0.1.20", "angular-dragula": "^1.2.7", "ngSweetAlert": "8df6c30b0996f09cb4cf5e90a41115a6c09fa852" }, diff --git a/package.json b/package.json index 92988bd..f5925b3 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,10 @@ "node": ">=4" }, "devDependencies": { - "browser-sync": "^2.18.2", + "browser-sync": "^2.18.8", "del": "^2.2.2", "eslint-config-angular": "^0.5.0", - "eslint-plugin-angular": "^1.4.1", + "eslint-plugin-angular": "^1.6.4", "gulp": "^3.9.1", "gulp-angular-templatecache": "^2.0.0", "gulp-autoprefixer": "^3.1.1", @@ -16,7 +16,7 @@ "gulp-htmlmin": "^3.0.0", "gulp-if": "^2.0.2", "gulp-inject-version": "^1.0.1", - "gulp-load-plugins": "^1.2.4", + "gulp-load-plugins": "^1.5.0", "gulp-manifest": "^0.1.1", "gulp-plumber": "^1.1.0", "gulp-replace": "^0.5.4", @@ -24,8 +24,8 @@ "gulp-rev-replace": "^0.4.3", "gulp-sequence": "^0.4.6", "gulp-size": "^2.1.0", - "gulp-sourcemaps": "^1.9.1", - "gulp-uglify": "^2.0.0", + "gulp-sourcemaps": "^1.11.1", + "gulp-uglify": "^2.1.2", "gulp-useref": "^3.1.0" }, "name": "ariang", diff --git a/src/index.html b/src/index.html index 6a23ebe..ba6ded7 100644 --- a/src/index.html +++ b/src/index.html @@ -277,13 +277,13 @@ - + - + From e6ff345db59cf7ecff8f02e958e3e20ffa7e71f6 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Tue, 28 Mar 2017 08:35:24 +0800 Subject: [PATCH 067/120] after uploading torrent/metalink file, task would not be created directly --- src/langs/zh_CN.txt | 3 + src/scripts/config/defaultLanguage.js | 3 + src/scripts/controllers/new.js | 104 +++++++++++++--------- src/scripts/services/ariaNgFileService.js | 22 +++-- src/views/new.html | 28 +++--- 5 files changed, 100 insertions(+), 60 deletions(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index b4b3b3f..ad79856 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -67,6 +67,9 @@ Remain Time=剩余时间 Download Speed=下载速度 Upload Speed=上传速度 Links=链接 +Torrent File=种子文件 +Metalink File=Metalink 文件 +File Name:=文件名: Options=选项 Overview=总览 Blocks=区块信息 diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 3b5e0d5..a5de56a 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -71,6 +71,9 @@ 'Download Speed': 'Download Speed', 'Upload Speed': 'Upload Speed', 'Links': 'Links', + 'Torrent File': 'Torrent File', + 'Metalink File': 'Metalink File', + 'File Name:': 'File Name:', 'Options': 'Options', 'Overview': 'Overview', 'Blocks': 'Blocks', diff --git a/src/scripts/controllers/new.js b/src/scripts/controllers/new.js index 7584dfb..0ddb556 100644 --- a/src/scripts/controllers/new.js +++ b/src/scripts/controllers/new.js @@ -1,12 +1,51 @@ (function () { 'use strict'; - angular.module('ariaNg').controller('NewTaskController', ['$rootScope', '$scope', '$location', '$timeout', 'aria2SettingService', 'aria2TaskService', 'ariaNgFileService', function ($rootScope, $scope, $location, $timeout, aria2SettingService, aria2TaskService, ariaNgFileService) { + angular.module('ariaNg').controller('NewTaskController', ['$rootScope', '$scope', '$location', '$timeout', 'ariaNgCommonService', 'ariaNgFileService', 'aria2SettingService', 'aria2TaskService', function ($rootScope, $scope, $location, $timeout, ariaNgCommonService, ariaNgFileService, aria2SettingService, aria2TaskService) { var tabOrders = ['links', 'options']; + var downloadByLinks = function (pauseOnAdded, responseCallback) { + var urls = $scope.context.urls.split('\n'); + var options = angular.copy($scope.context.options); + var tasks = []; + + for (var i = 0; i < urls.length; i++) { + if (urls[i] === '' || urls[i].trim() === '') { + continue; + } + + tasks.push({ + urls: [urls[i].trim()], + options: options + }); + } + + return aria2TaskService.newUriTasks(tasks, pauseOnAdded, responseCallback); + }; + + var downloadByTorrent = function (pauseOnAdded, responseCallback) { + var task = { + content: $scope.context.uploadFile.base64Content, + options: angular.copy($scope.context.options) + }; + + return aria2TaskService.newTorrentTask(task, pauseOnAdded, responseCallback); + }; + + var downloadByMetalink = function (pauseOnAdded, responseCallback) { + var task = { + content: $scope.context.uploadFile.base64Content, + options: angular.copy($scope.context.options) + }; + + return aria2TaskService.newMetalinkTask(task, pauseOnAdded, responseCallback); + }; + $scope.context = { currentTab: 'links', + taskType: 'urls', urls: '', + uploadFile: null, availableOptions: (function () { var keys = aria2SettingService.getNewTaskOptionKeys(); @@ -67,56 +106,27 @@ $scope.openTorrent = function () { ariaNgFileService.openFileContent('.torrent', function (result) { - var task = { - content: result.base64Content, - options: angular.copy($scope.context.options) - }; - - $rootScope.loadPromise = aria2TaskService.newTorrentTask(task, true, function (response) { - if (!response.success) { - return; - } - - $location.path('/task/detail/' + response.data); - }); + $scope.context.uploadFile = result; + $scope.context.taskType = 'torrent'; + $scope.changeTab('options'); + }, function (error) { + ariaNgCommonService.showError(error); }); }; $scope.openMetalink = function () { ariaNgFileService.openFileContent('.meta4,.metalink', function (result) { - var task = { - content: result.base64Content, - options: angular.copy($scope.context.options) - }; - - $rootScope.loadPromise = aria2TaskService.newMetalinkTask(task, true, function (response) { - if (!response.success) { - return; - } - - $location.path('/task/detail/' + response.data); - }); + $scope.context.uploadFile = result; + $scope.context.taskType = 'metalink'; + $scope.changeTab('options'); + }, function (error) { + ariaNgCommonService.showError(error); }); }; $scope.startDownload = function (pauseOnAdded) { - var urls = $scope.context.urls.split('\n'); - var options = angular.copy($scope.context.options); - var tasks = []; - - for (var i = 0; i < urls.length; i++) { - if (urls[i] === '' || urls[i].trim() === '') { - continue; - } - - tasks.push({ - urls: [urls[i].trim()], - options: options - }); - } - - $rootScope.loadPromise = aria2TaskService.newUriTasks(tasks, pauseOnAdded, function (response) { - if (!response.hasSuccess) { + var responseCallback = function (response) { + if (!response.hasSuccess && !response.success) { return; } @@ -125,7 +135,15 @@ } else { $location.path('/downloading'); } - }); + }; + + if ($scope.context.taskType === 'urls') { + $rootScope.loadPromise = downloadByLinks(pauseOnAdded, responseCallback); + } else if ($scope.context.taskType === 'torrent') { + $rootScope.loadPromise = downloadByTorrent(pauseOnAdded, responseCallback); + } else if ($scope.context.taskType === 'metalink') { + $rootScope.loadPromise = downloadByMetalink(pauseOnAdded, responseCallback); + } }; $scope.setOption = function (key, value, optionStatus) { diff --git a/src/scripts/services/ariaNgFileService.js b/src/scripts/services/ariaNgFileService.js index 6655f5c..37b9848 100644 --- a/src/scripts/services/ariaNgFileService.js +++ b/src/scripts/services/ariaNgFileService.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('ariaNg').factory('ariaNgFileService', ['$window', 'ariaNgCommonService', function ($window, ariaNgCommonService) { + angular.module('ariaNg').factory('ariaNgFileService', ['$window', function ($window) { var isSupportFileReader = !!$window.FileReader; var getAllowedExtensions = function (fileFilter) { @@ -46,9 +46,12 @@ }; return { - openFileContent: function (fileFilter, callback) { + openFileContent: function (fileFilter, successCallback, errorCallback) { if (!isSupportFileReader) { - ariaNgCommonService.showError('Your browser does not support loading file!'); + if (errorCallback) { + errorCallback('Your browser does not support loading file!'); + } + return; } @@ -63,7 +66,10 @@ var fileName = file.name; if (!checkFileExtension(fileName, allowedExtensions)) { - ariaNgCommonService.showError('The selected file type is invalid!'); + if (errorCallback) { + errorCallback('The selected file type is invalid!'); + } + return; } @@ -75,13 +81,15 @@ base64Content: this.result.replace(/.*?base64,/, '') }; - if (callback) { - callback(result); + if (successCallback) { + successCallback(result); } }; reader.onerror = function () { - ariaNgCommonService.showError('Failed to load file!'); + if (errorCallback) { + errorCallback('Failed to load file!'); + } }; reader.readAsDataURL(file); diff --git a/src/views/new.html b/src/views/new.html index 4a7f3d4..36277cc 100644 --- a/src/views/new.html +++ b/src/views/new.html @@ -3,7 +3,7 @@
 
+ From cb8b164b090b142afd3ea13d4536fbe25ea96520 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Wed, 29 Mar 2017 09:10:12 +0800 Subject: [PATCH 071/120] modify text --- src/langs/zh_CN.txt | 2 +- src/scripts/config/defaultLanguage.js | 2 +- src/views/settings-ariang.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index 897c045..ab45073 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -148,7 +148,7 @@ Waiting Count=正在等待数量 Stopped Count=已停止数量 You have disabled notification in your browser. You should change your browser's settings before you enable this function.=您已经在浏览器中禁用通知功能. 如需使用此功能, 请修改您浏览器的设置. Configuration has been modified, please reload the page for the changes to take effect.=配置已经修改, 请重新加载页面使其生效. -Refresh=立即刷新 +Reload Page=重新加载页面 Show Secret=显示密钥 Hide Secret=隐藏密钥 Aria2 Version=Aria2 版本 diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index e9614a5..28486cb 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -152,7 +152,7 @@ 'Stopped Count': 'Stopped Count', 'You have disabled notification in your browser. You should change your browser\'s settings before you enable this function.': 'You have disabled notification in your browser. You should change your browser\'s settings before you enable this function.', 'Configuration has been modified, please reload the page for the changes to take effect.': 'Configuration has been modified, please reload the page for the changes to take effect.', - 'Refresh': 'Refresh', + 'Reload Page': 'Reload Page', 'Show Secret': 'Show Secret', 'Hide Secret': 'Hide Secret', 'Aria2 Version': 'Aria2 Version', diff --git a/src/views/settings-ariang.html b/src/views/settings-ariang.html index 91a223e..97ad502 100644 --- a/src/views/settings-ariang.html +++ b/src/views/settings-ariang.html @@ -213,7 +213,7 @@ From b54d70d9b9cf22d14d889095b3d897ebf9ea4e37 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Fri, 31 Mar 2017 08:54:33 +0800 Subject: [PATCH 072/120] update LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 6dc41e3..b6396fd 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 MaysWind (i@mayswind.net) +Copyright (c) 2016-2017 MaysWind (i@mayswind.net) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 37b1da6ee089c50568f3806a7f87ff21e5022f5d Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 1 Apr 2017 23:32:25 +0800 Subject: [PATCH 073/120] fix cannot refresh page bug in notification --- src/scripts/controllers/settings-ariang.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/scripts/controllers/settings-ariang.js b/src/scripts/controllers/settings-ariang.js index 956371c..1ad32ed 100644 --- a/src/scripts/controllers/settings-ariang.js +++ b/src/scripts/controllers/settings-ariang.js @@ -14,11 +14,17 @@ return; } + var noticicationScope = $rootScope.$new(); + + noticicationScope.refreshPage = function () { + $window.location.reload(); + }; + lastRefreshPageNotification = ariaNgNotificationService.notifyInPage('', 'Configuration has been modified, please reload the page for the changes to take effect.', { delay: false, type: 'info', templateUrl: 'setting-changed-notification.html', - scope: $scope, + scope: noticicationScope, onClose: function () { lastRefreshPageNotification = null; } @@ -180,10 +186,6 @@ $window.location.reload(); }; - $scope.refreshPage = function () { - $window.location.reload(); - }; - $('[data-toggle="popover"]').popover(); $rootScope.loadPromise = $timeout(function () {}, 100); From ca8a1ee1b97e837a6c1414e1a470918f24161a98 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 8 May 2017 23:45:41 +0800 Subject: [PATCH 074/120] update third party dependency --- bower.json | 6 +++--- src/index.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 66ae15b..794d8f3 100644 --- a/bower.json +++ b/bower.json @@ -23,9 +23,9 @@ "dependencies": { "jquery": "^2.2.4", "bootstrap": "^3.3.7", - "moment": "^2.18.1", - "moment-timezone": "^0.5.11", - "echarts": "^3.5.0", + "moment": "2.18.1", + "moment-timezone": "0.5.13", + "echarts": "^3.5.4", "font-awesome": "font-awsome#^4.7.0", "AdminLTE": "admin-lte#^2.3.11", "sweetalert": "^1.1.3", diff --git a/src/index.html b/src/index.html index ba6ded7..cfe4516 100644 --- a/src/index.html +++ b/src/index.html @@ -281,9 +281,9 @@ - + - + From cde6e5c732526457c488112cbfa23b2e54472d87 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Tue, 9 May 2017 00:03:47 +0800 Subject: [PATCH 075/120] reduce echarts size --- src/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.html b/src/index.html index cfe4516..0d037f5 100644 --- a/src/index.html +++ b/src/index.html @@ -283,8 +283,8 @@ - - + + From d504bad54c6d6a50bf7ca658514e005716fe63c2 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Tue, 9 May 2017 21:56:16 +0800 Subject: [PATCH 076/120] update third party dependency --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 794d8f3..67e4238 100644 --- a/bower.json +++ b/bower.json @@ -45,7 +45,7 @@ "angular-local-storage": "^0.2.7", "angular-notification": "775ee861c1737b284588bcb878ba1f4e43c70c97", "angular-ui-notification": "^0.3.6", - "angular-bittorrent-peerid": "^1.1.1", + "angular-bittorrent-peerid": "^1.2.0", "angular-busy": "^4.1.4", "angular-promise-buttons": "^0.1.20", "angular-dragula": "^1.2.7", From ad64520f2da42bf52b7f13bf546d39deae9b4518 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Tue, 9 May 2017 22:24:13 +0800 Subject: [PATCH 077/120] fix style bug --- src/styles/controls/angular-promise-buttons.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/styles/controls/angular-promise-buttons.css b/src/styles/controls/angular-promise-buttons.css index c58aa87..dd10436 100644 --- a/src/styles/controls/angular-promise-buttons.css +++ b/src/styles/controls/angular-promise-buttons.css @@ -111,3 +111,7 @@ margin-left: 5px; opacity: 1; } + +.btn[promise-btn] { + text-align: left; +} From 7203219c3901075d080003f845ebdbd813b3388b Mon Sep 17 00:00:00 2001 From: MaysWind Date: Wed, 10 May 2017 22:04:54 +0800 Subject: [PATCH 078/120] modify title size --- src/styles/core/core.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/styles/core/core.css b/src/styles/core/core.css index 9291c50..3cb614b 100644 --- a/src/styles/core/core.css +++ b/src/styles/core/core.css @@ -40,6 +40,10 @@ td { float: right; } +.main-header .logo .logo-mini { + font-size: 14px !important; +} + .main-header .logo .logo-lg { cursor: pointer; } From a3e77f665a42ac1ba37066b67775e0c4ee93b105 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 14 May 2017 13:39:22 +0800 Subject: [PATCH 079/120] fix bug --- src/views/new.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/new.html b/src/views/new.html index 36277cc..50320e4 100644 --- a/src/views/new.html +++ b/src/views/new.html @@ -58,7 +58,7 @@

File Name:

- +
From 29ca154c22b761c4fc977e304441a76b2abeb65c Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 14 May 2017 14:16:46 +0800 Subject: [PATCH 080/120] support modifying which page should be navigated to after creating a new task --- src/langs/zh_CN.txt | 3 +++ src/scripts/config/constants.js | 3 ++- src/scripts/config/defaultLanguage.js | 3 +++ src/scripts/controllers/new.js | 20 ++++++++++++++++---- src/scripts/controllers/settings-ariang.js | 4 ++++ src/scripts/services/ariaNgSettingService.js | 6 ++++++ src/views/settings-ariang.html | 12 ++++++++++++ 7 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index ab45073..d6721c9 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -141,6 +141,9 @@ Add New RPC Setting=添加新 RPC 配置 Are you sure you want to remove rpc setting "{{rpcName}}"?=您是否要删除 RPC 设置 "{{rpcName}}"? Global Stat Refresh Interval=全局状态刷新间隔 Download Task Refresh Interval=下载任务刷新间隔 +After Creating A New Task=当创建新任务后 +Navigate to Task List Page=转到任务列表页面 +Navigate to Task Detail Page=转到任务详情页面 Supported Placeholder=支持的占位符 AriaNg Title=AriaNg 标题 Downloading Count=正在下载数量 diff --git a/src/scripts/config/constants.js b/src/scripts/config/constants.js index 5d02e03..cc75b7f 100644 --- a/src/scripts/config/constants.js +++ b/src/scripts/config/constants.js @@ -29,6 +29,7 @@ secret: '', extendRpcServers: [], globalStatRefreshInterval: 1000, - downloadTaskRefreshInterval: 1000 + downloadTaskRefreshInterval: 1000, + afterCreatingNewTask: 'task-list' }); }()); diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 28486cb..518a9bc 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -145,6 +145,9 @@ 'Are you sure you want to remove rpc setting "{{rpcName}}"?': 'Are you sure you want to remove rpc setting "{{rpcName}}"?', 'Global Stat Refresh Interval': 'Global Stat Refresh Interval', 'Download Task Refresh Interval': 'Download Task Refresh Interval', + 'After Creating A New Task': 'After Creating A New Task', + 'Navigate to Task List Page': 'Navigate to Task List Page', + 'Navigate to Task Detail Page': 'Navigate to Task Detail Page', 'Supported Placeholder': 'Supported Placeholder', 'AriaNg Title': 'AriaNg Title', 'Downloading Count': 'Downloading Count', diff --git a/src/scripts/controllers/new.js b/src/scripts/controllers/new.js index 0ddb556..361601d 100644 --- a/src/scripts/controllers/new.js +++ b/src/scripts/controllers/new.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('ariaNg').controller('NewTaskController', ['$rootScope', '$scope', '$location', '$timeout', 'ariaNgCommonService', 'ariaNgFileService', 'aria2SettingService', 'aria2TaskService', function ($rootScope, $scope, $location, $timeout, ariaNgCommonService, ariaNgFileService, aria2SettingService, aria2TaskService) { + angular.module('ariaNg').controller('NewTaskController', ['$rootScope', '$scope', '$location', '$timeout', 'ariaNgCommonService', 'ariaNgSettingService', 'ariaNgFileService', 'aria2SettingService', 'aria2TaskService', function ($rootScope, $scope, $location, $timeout, ariaNgCommonService, ariaNgSettingService, ariaNgFileService, aria2SettingService, aria2TaskService) { var tabOrders = ['links', 'options']; var downloadByLinks = function (pauseOnAdded, responseCallback) { @@ -130,10 +130,22 @@ return; } - if (pauseOnAdded) { - $location.path('/waiting'); + var firstTask = null; + + if (response.results && response.results.length > 0) { + firstTask = response.results[0]; + } else if (response) { + firstTask = response; + } + + if (ariaNgSettingService.getAfterCreatingNewTask() === 'task-detail' && firstTask && firstTask.data) { + $location.path('/task/detail/' + firstTask.data); } else { - $location.path('/downloading'); + if (pauseOnAdded) { + $location.path('/waiting'); + } else { + $location.path('/downloading'); + } } }; diff --git a/src/scripts/controllers/settings-ariang.js b/src/scripts/controllers/settings-ariang.js index 1ad32ed..30bd9d9 100644 --- a/src/scripts/controllers/settings-ariang.js +++ b/src/scripts/controllers/settings-ariang.js @@ -102,6 +102,10 @@ ariaNgSettingService.setLanguage(value); }; + $scope.setAfterCreatingNewTask = function (value) { + ariaNgSettingService.setAfterCreatingNewTask(value); + }; + $scope.setDebugMode = function (value) { ariaNgSettingService.setDebugMode(value); }; diff --git a/src/scripts/services/ariaNgSettingService.js b/src/scripts/services/ariaNgSettingService.js index d239bed..4704496 100644 --- a/src/scripts/services/ariaNgSettingService.js +++ b/src/scripts/services/ariaNgSettingService.js @@ -186,6 +186,12 @@ setTitleRefreshInterval: function (value) { setOption('titleRefreshInterval', Math.max(parseInt(value), 0)); }, + getAfterCreatingNewTask: function () { + return getOption('afterCreatingNewTask'); + }, + setAfterCreatingNewTask: function (value) { + setOption('afterCreatingNewTask', value); + }, getBrowserNotification: function () { return getOption('browserNotification'); }, diff --git a/src/views/settings-ariang.html b/src/views/settings-ariang.html index 97ad502..a0c01bf 100644 --- a/src/views/settings-ariang.html +++ b/src/views/settings-ariang.html @@ -115,6 +115,18 @@ +
+
+ After Creating A New Task +
+
+ +
+
* Changes to the settings take effect after refreshing page. From c92873bf6807f8c36727a93d91911110951105aa Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 14 May 2017 17:48:06 +0800 Subject: [PATCH 081/120] code refactor --- src/styles/core/core.css | 15 ++++++++++++++- src/styles/theme/default.css | 10 ---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/styles/core/core.css b/src/styles/core/core.css index 3cb614b..3af2492 100644 --- a/src/styles/core/core.css +++ b/src/styles/core/core.css @@ -30,10 +30,23 @@ td { z-index: 2000; } +.main-header .navbar .nav > li { + display: inline-block; +} + +.main-header .navbar .nav > li > a { + padding-left: 10px; + padding-right: 10px; +} + .main-header .navbar .nav > li.disabled > a { pointer-events: none !important; } +.main-header .navbar .navbar-nav { + margin-left: 5px; +} + .main-header .navbar .navbar-searchbar { padding-top: 8px; padding-right: 20px; @@ -49,7 +62,7 @@ td { } .content-wrapper, .right-side { - background-color: #fff; + background-color: #fff; } .content-wrapper > .content-body { diff --git a/src/styles/theme/default.css b/src/styles/theme/default.css index 07771b3..2bdaf20 100644 --- a/src/styles/theme/default.css +++ b/src/styles/theme/default.css @@ -12,19 +12,9 @@ border-bottom: 1px solid #ddd; } -.skin-aria-ng .main-header .navbar .navbar-nav { - margin-left: 5px; -} - -.skin-aria-ng .main-header .navbar .nav > li { - display: inline-block; -} - .skin-aria-ng .main-header .navbar .nav > li > a { color: #707070; font-size: 16px; - padding-left: 10px; - padding-right: 10px; } .skin-aria-ng .main-header .navbar .nav > li > a:hover, From 68a598b19e1f6da60c4ea0becbd6fcace2e71f4c Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 14 May 2017 22:45:35 +0800 Subject: [PATCH 082/120] add quick setting in footer toolbar --- src/index.html | 18 +++++- src/langs/zh_CN.txt | 2 + src/scripts/config/aria2Options.js | 4 ++ src/scripts/config/defaultLanguage.js | 2 + src/scripts/controllers/main.js | 9 +++ src/scripts/directives/settingDialog.js | 69 +++++++++++++++++++++ src/scripts/services/aria2SettingService.js | 9 ++- src/styles/core/core.css | 4 ++ src/styles/theme/default.css | 4 +- src/views/setting-dialog.html | 23 +++++++ 10 files changed, 140 insertions(+), 4 deletions(-) create mode 100644 src/scripts/directives/settingDialog.js create mode 100644 src/views/setting-dialog.html diff --git a/src/index.html b/src/index.html index 0d037f5..b297cee 100644 --- a/src/index.html +++ b/src/index.html @@ -244,7 +244,20 @@ + +
@@ -333,6 +348,7 @@ + diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index d6721c9..513898a 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -164,6 +164,8 @@ Are you sure you want to shutdown aria2?=您是否要关闭 aria2? Session has been saved successfully.=会话已经成功保存. Aria2 has been shutdown successfully.=Aria2 已经成功关闭. Toggle Navigation=切换导航 +Quick Setting=快捷设置 +Global Speed Limit=全局速度限制 Loading=正在加载... More Than One Day=超过1天 Unknown=未知 diff --git a/src/scripts/config/aria2Options.js b/src/scripts/config/aria2Options.js index 69b8426..49ea9a0 100644 --- a/src/scripts/config/aria2Options.js +++ b/src/scripts/config/aria2Options.js @@ -861,6 +861,10 @@ 'no-file-allocation-limit', 'parameterized-uri', 'quiet', 'realtime-chunk-checksum', 'remove-control-file', 'save-session', 'save-session-interval', 'socket-recv-buffer-size', 'stop', 'truncate-console-readout' ] + }).constant('aria2QuickSettingsAvailableOptions', { + globalSpeedLimitOptions: [ + 'max-download-limit', 'max-upload-limit' + ] }).constant('aria2TaskAvailableOptions', { // Aria2 Task Option Defination EXAMPLE: // { diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 518a9bc..d218a8c 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -168,6 +168,8 @@ 'Session has been saved successfully.': 'Session has been saved successfully.', 'Aria2 has been shutdown successfully.': 'Aria2 has been shutdown successfully.', 'Toggle Navigation': 'Toggle Navigation', + 'Quick Setting': 'Quick Setting', + 'Global Speed Limit': 'Global Speed Limit', 'Loading': 'Loading...', 'More Than One Day': 'More than 1 day', 'Unknown': 'Unknown', diff --git a/src/scripts/controllers/main.js b/src/scripts/controllers/main.js index 1d668b9..2babb41 100644 --- a/src/scripts/controllers/main.js +++ b/src/scripts/controllers/main.js @@ -36,6 +36,8 @@ data: ariaNgMonitorService.getGlobalStatsData() }; + $scope.quickSettingContext = null; + $scope.rpcSettings = ariaNgSettingService.getAllRpcSettings(); $scope.isTaskSelected = function () { @@ -213,6 +215,13 @@ return orderType.equals(targetType); }; + $scope.showQuickSettingDialog = function (type, title) { + $scope.quickSettingContext = { + type: type, + title: title + }; + }; + $scope.switchRpcSetting = function (setting) { if (setting.isDefault) { return; diff --git a/src/scripts/directives/settingDialog.js b/src/scripts/directives/settingDialog.js new file mode 100644 index 0000000..43e2dd0 --- /dev/null +++ b/src/scripts/directives/settingDialog.js @@ -0,0 +1,69 @@ +(function () { + 'use strict'; + + angular.module('ariaNg').directive('ngSettingDialog', ['ariaNgCommonService', 'aria2SettingService', function (ariaNgCommonService, aria2SettingService) { + return { + restrict: 'E', + templateUrl: 'views/setting-dialog.html', + replace: true, + scope: { + setting: '=' + }, + link: function (scope, element, attrs) { + scope.context = { + isLoading: false, + availableOptions: [], + globalOptions: [] + }; + + scope.setGlobalOption = function (key, value, optionStatus) { + return aria2SettingService.setGlobalOption(key, value, function (response) { + if (response.success && response.data === 'OK') { + optionStatus.setSuccess(); + } else { + optionStatus.setFailed(response.data.message); + } + }, true); + }; + + var loadOptions = function (type) { + var keys = aria2SettingService.getaria2QuickSettingsAvailableOptions(type); + + if (!keys) { + ariaNgCommonService.showError('Type is illegal!'); + return; + } + + scope.context.availableOptions = aria2SettingService.getSpecifiedOptions(keys); + }; + + var loadAria2OptionsValue = function () { + scope.context.isLoading = true; + + return aria2SettingService.getGlobalOption(function (response) { + scope.context.isLoading = false; + + if (response.success) { + scope.context.globalOptions = response.data; + } + }); + }; + + $('#quickSettingModal').on('hidden.bs.modal', function () { + scope.setting = null; + scope.context.availableOptions = []; + scope.context.globalOptions = []; + }); + + scope.$watch('setting', function (setting) { + if (setting) { + loadOptions(setting.type); + loadAria2OptionsValue(); + + $('#quickSettingModal').modal('show'); + } + }, true); + } + }; + }]); +}()); diff --git a/src/scripts/services/aria2SettingService.js b/src/scripts/services/aria2SettingService.js index 6bad2d4..20cefe3 100644 --- a/src/scripts/services/aria2SettingService.js +++ b/src/scripts/services/aria2SettingService.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('ariaNg').factory('aria2SettingService', ['aria2AllOptions', 'aria2GlobalAvailableOptions', 'aria2TaskAvailableOptions', 'aria2RpcService', 'ariaNgLogService', function (aria2AllOptions, aria2GlobalAvailableOptions, aria2TaskAvailableOptions, aria2RpcService, ariaNgLogService) { + angular.module('ariaNg').factory('aria2SettingService', ['aria2AllOptions', 'aria2GlobalAvailableOptions', 'aria2QuickSettingsAvailableOptions', 'aria2TaskAvailableOptions', 'aria2RpcService', 'ariaNgLogService', function (aria2AllOptions, aria2GlobalAvailableOptions, aria2QuickSettingsAvailableOptions, aria2TaskAvailableOptions, aria2RpcService, ariaNgLogService) { var processStatResult = function (stat) { if (!stat) { return stat; @@ -38,6 +38,13 @@ return false; } }, + getaria2QuickSettingsAvailableOptions: function (type) { + if (type === 'globalSpeedLimit') { + return aria2QuickSettingsAvailableOptions.globalSpeedLimitOptions; + } else { + return false; + } + }, getAvailableTaskOptionKeys: function (status, isBittorrent) { var allOptions = aria2TaskAvailableOptions.taskOptions; var availableOptions = []; diff --git a/src/styles/core/core.css b/src/styles/core/core.css index 3af2492..5aa8d7a 100644 --- a/src/styles/core/core.css +++ b/src/styles/core/core.css @@ -69,6 +69,10 @@ td { overflow-y: scroll; } +.main-footer .toolbar { + display: inline-block; +} + .dropdown-menu.right-align { left: inherit; right: 0; diff --git a/src/styles/theme/default.css b/src/styles/theme/default.css index 2bdaf20..1c92afe 100644 --- a/src/styles/theme/default.css +++ b/src/styles/theme/default.css @@ -40,11 +40,11 @@ top: 15px; } -.skin-aria-ng .main-header .navbar .sidebar-toggle, .skin-aria-ng .main-footer .sidebar-toggle { +.skin-aria-ng .main-header .navbar .sidebar-toggle, .skin-aria-ng .main-footer .sidebar-toggle, .skin-aria-ng .main-footer .toolbar > a { color: #707070; } -.skin-aria-ng .main-header .navbar .sidebar-toggle:hover, .skin-aria-ng .main-footer .sidebar-toggle:hover { +.skin-aria-ng .main-header .navbar .sidebar-toggle:hover, .skin-aria-ng .main-footer .sidebar-toggle:hover, .skin-aria-ng .main-footer .toolbar > a:hover, .skin-aria-ng .main-footer .toolbar.open > a { color: #0080ff; } diff --git a/src/views/setting-dialog.html b/src/views/setting-dialog.html new file mode 100644 index 0000000..9b0b315 --- /dev/null +++ b/src/views/setting-dialog.html @@ -0,0 +1,23 @@ + From 18baa839066598c19d72415689301197c28bf946 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 14 May 2017 23:41:29 +0800 Subject: [PATCH 083/120] fix style bug --- src/styles/core/core.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/styles/core/core.css b/src/styles/core/core.css index 5aa8d7a..d7f55dc 100644 --- a/src/styles/core/core.css +++ b/src/styles/core/core.css @@ -100,6 +100,7 @@ td { @media (max-width: 767px) { .navbar-nav .open .dropdown-menu { position: absolute; + border: 1px solid #eee; background-color: #fff; } } From 79c323c50a2d873d00c6717966a295b0245c0d77 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 14 May 2017 23:42:54 +0800 Subject: [PATCH 084/120] code refactor --- src/index.html | 54 +++++++++++++++++++++--------------- src/styles/core/core.css | 26 ++++++++++++++++- src/styles/theme/default.css | 38 ++++++++++++++----------- 3 files changed, 79 insertions(+), 39 deletions(-) diff --git a/src/index.html b/src/index.html index b297cee..33d1d36 100644 --- a/src/index.html +++ b/src/index.html @@ -242,36 +242,46 @@ diff --git a/src/styles/core/core.css b/src/styles/core/core.css index d7f55dc..e3ad338 100644 --- a/src/styles/core/core.css +++ b/src/styles/core/core.css @@ -69,8 +69,27 @@ td { overflow-y: scroll; } -.main-footer .toolbar { +.main-footer > .navbar { + margin-bottom: 0; + min-height: inherit; +} + +.main-footer > .navbar > .navbar-toolbar > .nav { + float: left; + margin: 0; +} + +.main-footer > .navbar > .navbar-toolbar > .nav > li { display: inline-block; + float: left; +} + +.main-footer > .navbar > .navbar-toolbar > .nav > li > a { + padding: 0 10px 0 10px; +} + +.main-footer > .navbar > .navbar-toolbar > .nav > li:first-child > a { + padding-left: 0; } .dropdown-menu.right-align { @@ -103,6 +122,11 @@ td { border: 1px solid #eee; background-color: #fff; } + + .main-footer > .navbar > .navbar-toolbar > .nav > li > a { + padding-left: 8px; + padding-right: 8px; + } } /* toolbar */ diff --git a/src/styles/theme/default.css b/src/styles/theme/default.css index 1c92afe..fd8414c 100644 --- a/src/styles/theme/default.css +++ b/src/styles/theme/default.css @@ -40,14 +40,6 @@ top: 15px; } -.skin-aria-ng .main-header .navbar .sidebar-toggle, .skin-aria-ng .main-footer .sidebar-toggle, .skin-aria-ng .main-footer .toolbar > a { - color: #707070; -} - -.skin-aria-ng .main-header .navbar .sidebar-toggle:hover, .skin-aria-ng .main-footer .sidebar-toggle:hover, .skin-aria-ng .main-footer .toolbar > a:hover, .skin-aria-ng .main-footer .toolbar.open > a { - color: #0080ff; -} - .skin-aria-ng .main-header .navbar .navbar-searchbar .form-control-icon { color: #999999; } @@ -210,16 +202,30 @@ font-size: 12px; } -.skin-aria-ng .main-footer .sidebar-toggle { - float: left; - background-color: transparent; - background-image: none; - padding: 0 15px 0 0; - font-family: fontAwesome; +.skin-aria-ng .main-footer > .navbar { + border: 0; } -.skin-aria-ng .main-footer .sidebar-toggle:before { - content: "\f0c9"; +.skin-aria-ng .main-footer > .navbar > .navbar-toolbar > .nav > li.divider { + padding-top: 16px; + margin-left: 4px; + margin-right: 4px; + border-right: 1px solid #ccc; + position: relative; + top: 0; +} + +.skin-aria-ng .main-footer > .navbar > .navbar-toolbar > .nav > li > a { + color: #707070; + line-height: 17px; +} + +.skin-aria-ng .main-footer > .navbar > .navbar-toolbar > .nav > li > a:hover, +.skin-aria-ng .main-footer > .navbar > .navbar-toolbar > .nav > li > a:active, +.skin-aria-ng .main-footer > .navbar > .navbar-toolbar > .nav > li > a:focus, +.skin-aria-ng .main-footer > .navbar > .navbar-toolbar > .nav > li.open > a { + color: #0080ff; + background: none; } .skin-aria-ng .global-status { From c2e1fb29eb03812427b6ff6f4ae34553c81d1f39 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 14 May 2017 23:47:34 +0800 Subject: [PATCH 085/120] modify text --- src/langs/zh_CN.txt | 2 +- src/scripts/config/defaultLanguage.js | 2 +- src/views/settings-ariang.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index 513898a..5fed0db 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -141,7 +141,7 @@ Add New RPC Setting=添加新 RPC 配置 Are you sure you want to remove rpc setting "{{rpcName}}"?=您是否要删除 RPC 设置 "{{rpcName}}"? Global Stat Refresh Interval=全局状态刷新间隔 Download Task Refresh Interval=下载任务刷新间隔 -After Creating A New Task=当创建新任务后 +Action After Creating New Tasks=创建新任务后执行操作 Navigate to Task List Page=转到任务列表页面 Navigate to Task Detail Page=转到任务详情页面 Supported Placeholder=支持的占位符 diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index d218a8c..51e3396 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -145,7 +145,7 @@ 'Are you sure you want to remove rpc setting "{{rpcName}}"?': 'Are you sure you want to remove rpc setting "{{rpcName}}"?', 'Global Stat Refresh Interval': 'Global Stat Refresh Interval', 'Download Task Refresh Interval': 'Download Task Refresh Interval', - 'After Creating A New Task': 'After Creating A New Task', + 'Action After Creating New Tasks': 'Action After Creating New Tasks', 'Navigate to Task List Page': 'Navigate to Task List Page', 'Navigate to Task Detail Page': 'Navigate to Task Detail Page', 'Supported Placeholder': 'Supported Placeholder', diff --git a/src/views/settings-ariang.html b/src/views/settings-ariang.html index a0c01bf..23f90fc 100644 --- a/src/views/settings-ariang.html +++ b/src/views/settings-ariang.html @@ -117,7 +117,7 @@
- After Creating A New Task + Action After Creating New Tasks
-
From 6c51cf5457a4a05ab0f4faa3e0121797a306d31b Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 18 Jun 2017 15:04:13 +0800 Subject: [PATCH 100/120] support Traditional Chinese --- src/langs/{zh_CN.txt => zh_Hans.txt} | 0 src/langs/zh_Hant.txt | 591 +++++++++++++++++++ src/scripts/config/configuration.js | 28 +- src/scripts/config/languages.js | 10 +- src/scripts/services/ariaNgSettingService.js | 45 ++ 5 files changed, 670 insertions(+), 4 deletions(-) rename src/langs/{zh_CN.txt => zh_Hans.txt} (100%) create mode 100644 src/langs/zh_Hant.txt diff --git a/src/langs/zh_CN.txt b/src/langs/zh_Hans.txt similarity index 100% rename from src/langs/zh_CN.txt rename to src/langs/zh_Hans.txt diff --git a/src/langs/zh_Hant.txt b/src/langs/zh_Hant.txt new file mode 100644 index 0000000..05139de --- /dev/null +++ b/src/langs/zh_Hant.txt @@ -0,0 +1,591 @@ +[default] +Operation Succeeded=操作成功 +Connection Succeeded=連接成功 +Error=錯誤 +OK=確定 +Confirm=確認 +Cancel=取消 +True=是 +False=否 +Connecting=連接中 +Connected=已連接 +Not Connected=未連接 +Global=全局 +New=新建 +Start=開始任務 +Pause=暫停任務 +Restart=重試 +Delete=刪除任務 +Select All=全選 +Select None=不選 +Select Invert=反選 +Display Order=顯示順序 +Help=幫助 +Search=搜索 +Default=默認 +Expand=展開 +Collapse=摺疊 +Remove Task=刪除任務 +Clear Stopped Tasks=清空已結束任務 +Click to view task detail=點擊查看任務詳情 +By File Name=按文件名 +By File Size=按文件大小 +By Progress=按進度 +By Remain Time=按剩餘時間 +By Download Speed=按下載速度 +By Upload Speed=按上傳速度 +Filters=過濾器 +Download=下載 +Upload=上傳 +Downloading=正在下載 +Seeding=正在做種 +Waiting=正在等待 +Paused=已暫停 +Completed=已完成 +Error Occurred=發生錯誤 +Removed=已刪除 +Finished / Stopped=已完成 / 已停止 +Uncompleted=未完成 +Click to pin=點擊固定 +Settings=系統設置 +AriaNg Settings=AriaNg 設置 +Aria2 Settings=Aria2 設置 +Basic Settings=基本設置 +HTTP/FTP/SFTP Settings=HTTP/FTP/SFTP 設置 +HTTP Settings=HTTP 設置 +FTP/SFTP Settings=FTP/SFTP 設置 +BitTorrent Settings=BitTorrent 設置 +Metalink Settings=Metalink 設置 +RPC Settings=RPC 設置 +Advanced Settings=高級設置 +Aria2 Status=Aria2 狀態 +File Name=文件名 +File Size=大小 +Progress=進度 +Share Ratio=分享率 +Remain Time=剩餘時間 +Download Speed=下載速度 +Upload Speed=上傳速度 +Links=鏈接 +Torrent File=種子文件 +Metalink File=Metalink 文件 +File Name:=文件名: +Options=選項 +Overview=總覽 +Blocks=區塊信息 +Files=文件列表 +Peers=連接狀態 +Task Name=任務名稱 +Task Size=任務大小 +Task Status=任務狀態 +Error Description=錯誤描述 +Health Percentage=健康度 +Info Hash=特徵值 +Seeders=種子數 +Connections=連接數 +Seed Creation Time=種子創建時間 +Download Dir=下載路徑 +BT Tracker Servers=BT 伺服器 +(Choose Files)=(選擇文件) +Videos=視頻 +Audios=音頻 +Pictures=圖片 +Documents=文檔 +Applications=應用程序 +Archives=存檔文件 +Address=地址 +Client=客戶端 +Status=狀態 +Speed=速度 +(local)=(本機) +No Data=無數據 +No connected peers=沒有連接到其他節點 +Failed to change some tasks state.=修改一些任務狀態時失敗. +Confirm Restart=確認重試 +Are you sure you want to restart this task? AriaNg will create a same task after clicking OK.=您是否要重試這個任務? 點擊 "確定" 後, AriaNg 將會創建一個相同的任務. +Failed to restart this task.=該任務重試失敗. +Confirm Remove=確認刪除 +Are you sure you want to remove the selected task?=您是否要刪除選中的任務? +Failed to remove some task(s).=刪除一些任務時失敗. +Confirm Clear=確認清除 +Are you sure you want to clear stopped tasks?=您是否要清除已結束的任務? +Download Links:=下載鏈接: +Start Download=立即下載 +Manual Download=手動下載 +Open Torrent File=打開種子文件 +Open Metalink File=打開 Metalink 文件 +Support multiple URLs, one URL per line.=支持多個 URL 地址, 每個地址佔一行. +Your browser does not support loading file!=您的瀏覽器不支持載入文件! +The selected file type is invalid!=選擇的文件類型無效! +Failed to load file!=載入文件失敗! +Download Completed=下載完成 +BT Download Completed=BT 下載完成 +Download Error=下載出錯 +Language=語言 +Debug Mode=調試模式 +Page Title=頁面標題 +Preview=預覽 +Tips: You can use the "noprefix" tag to ignore the prefix, "nosuffix" tag ignore the suffix, and "scale\=n" tag to set the decimal precision.=小提示: 您可以使用 "noprefix" 標籤忽略前綴, "nosuffix" 標籤忽略後綴, 以及 "scale\=n" 標籤設置小數的精度. +Example: ${downspeed:noprefix:nosuffix:scale\=1}=示例: ${downspeed:noprefix:nosuffix:scale\=1} +Page Title Refresh Interval=頁面標題刷新間隔 +Enable Browser Notification=啟用瀏覽器通知 +Aria2 RPC Alias=Aria2 RPC 別名 +Aria2 RPC Address=Aria2 RPC 地址 +Aria2 RPC Protocol=Aria2 RPC 協議 +Aria2 RPC Http Request Method=Aria2 RPC Http 請求方法 +POST method only supports aria2 v1.15.2 and above.=POST 方法僅支持 aria2 v1.15.2 及以上. +Aria2 RPC Secret Token=Aria2 RPC 密鑰 +Activate=激活 +Reset Settings=重置設置 +Confirm Reset=確認重置 +Are you sure you want to reset all settings?=您是否要重置所有設置? +Delete RPC Setting=刪除 RPC 設置 +Add New RPC Setting=添加新 RPC 配置 +Are you sure you want to remove rpc setting "{{rpcName}}"?=您是否要刪除 RPC 設置 "{{rpcName}}"? +Global Stat Refresh Interval=全局狀態刷新間隔 +Download Task Refresh Interval=下載任務刷新間隔 +Action After Creating New Tasks=創建新任務後執行操作 +Navigate to Task List Page=轉到任務列表頁面 +Navigate to Task Detail Page=轉到任務詳情頁面 +Supported Placeholder=支持的佔位符 +AriaNg Title=AriaNg 標題 +Downloading Count=正在下載數量 +Waiting Count=正在等待數量 +Stopped Count=已停止數量 +You have disabled notification in your browser. You should change your browser's settings before you enable this function.=您已經在瀏覽器中禁用通知功能. 如需使用此功能, 請修改您瀏覽器的設置. +Configuration has been modified, please reload the page for the changes to take effect.=配置已經修改, 請重新載入頁面使其生效. +Reload Page=重新載入頁面 +Show Secret=顯示密鑰 +Hide Secret=隱藏密鑰 +Aria2 Version=Aria2 版本 +Enabled Features=已啟用的功能 +Functions=方法 +Save Session=保存會話 +Shutdown Aria2=關閉 Aria2 +Confirm Shutdown=確認關閉 +Are you sure you want to shutdown aria2?=您是否要關閉 aria2? +Session has been saved successfully.=會話已經成功保存. +Aria2 has been shutdown successfully.=Aria2 已經成功關閉. +Toggle Navigation=切換導航 +Quick Setting=快捷設置 +Global Speed Limit=全局速度限制 +Loading=正在載入... +More Than One Day=超過1天 +Unknown=未知 +Bytes=位元組 +Hours=小時 +Minutes=分 +Seconds=秒 +Milliseconds=毫秒 +Http=Http +Https=Https +WebSocket=WebSocket +WebSocket (Security)=WebSocket (安全) +POST=POST +GET=GET +Disabled=禁用 +BitTorrent=BitTorrent +Changes to the settings take effect after refreshing page.=設置將在頁面刷新後生效. +Type is illegal!=類型錯誤! +Parameter is invalid!=請求參數無效! +Option value cannot be empty!=參數內容不能為空! +Input number is invalid!=輸入的數字無效! +Input number is below min value!=輸入的數字小於最小值 {{value}} ! +Input number is above max value!=輸入的數字大於最大值 {{value}} ! +Input value is invalid!=輸入的內容無效! +Protocol is invalid!=協議無效! +RPC host cannot be empty!=RPC 主機不能為空! +RPC secret is not base64 encoded!=RPC 密鑰不是 Base64 編碼後的字元串! +URL is not base64 encoded!=指定 URL 不是 Base64 編碼後的字元串! +Tap to configure and get started with AriaNg.=您還沒有進行過設置, 點擊這裡進行設置. + +[error] +unknown=未知錯誤. +operation.timeout=操作超時. +resource.notfound=無法找到指定資源. +error.resource.notfound.max-file-not-found=無法找到指定資源. 參見 --max-file-not-found option 參數. +error.download.aborted.lowest-speed-limit=由於下載速度過慢, 下載已經終止. 參見 --lowest-speed-limit option 參數. +error.network.problem=網路問題. +resume.notsupported=伺服器不支持斷點續傳. +space.notenough=可用磁碟空間不足. +piece.length.different=分片大小與 .aria2 控制文件中的不同. 參見 --allow-piece-length-change 參數. +download.sametime=aria2 已經下載了另一個相同文件. +download.torrent.sametime=aria2 已經下載了另一個相同哈希的種子文件. +file.exists=文件已經存在. 參見 --allow-overwrite 參數. +file.rename.failed=文件重命名失敗. 參見 --auto-file-renaming 參數. +file.open.failed=文件打開失敗. +file.create.failed=文件創建或刪除已有文件失敗. +io.error=文件系統出錯. +directory.create.failed=無法創建指定目錄. +name.resolution.failed=域名解析失敗. +metalink.file.parse.failed=解析 Metalink 文件失敗. +ftp.command.failed=FTP 命令執行失敗. +http.response.header.bad=HTTP 返回頭無效或無法識別. +redirects.toomany=指定地址重定向過多. +http.authorization.failed=HTTP 認證失敗. +bencoded.file.parse.failed=解析種子文件失敗. +torrent.file.corrupted=指定 ".torrent" 種子文件已經損壞或缺少 aria2 需要的信息. +magnet.uri.bad=指定磁鏈地址無效. +option.bad=設置錯誤. +server.overload=遠程伺服器繁忙, 無法處理當前請求. +rpc.request.parse.failed=處理 RPC 請求失敗. +checksum.failed=文件校驗失敗. + +[format] +longdate=YYYY年MM月DD日 HH:mm:ss +time.millisecond={{value}} 毫秒 +time.milliseconds={{value}} 毫秒 +time.second={{value}} 秒 +time.seconds={{value}} 秒 +time.minute={{value}} 分鐘 +time.minutes={{value}} 分鐘 +time.hour={{value}} 小時 +time.hours={{value}} 小時 +requires.aria2-version=需要 aria2 v{{version}} 或更高版本 +task.pieceinfo=已完成: {{completed}}, 共計: {{total}} 塊 +task.error-occurred=發生錯誤 ({{errorcode}}) +settings.file-count=({{count}} 個文件) +settings.total-count=(共計: {{count}}個) + +[rpc.error] +unauthorized=認證失敗! + +[options] +true=是 +false=否 +default=默認 +none=無 +hide=隱藏 +full=完整 +http=Http +https=Https +ftp=Ftp +mem=僅內存 +plain=明文 +arc4=ARC4 +binary=二進位 +ascii=ASCII +debug=調試 (Debug) +info=普通 (Info) +notice=一般 (Notice) +warn=警告 (Warn) +error=錯誤 (Error) +adaptive=自適應 +feedback=反饋 +geom=幾何 +inorder=順序 +random=隨機 +dir.name=下載路徑 +dir.description= +log.name=日誌文件 +log.description=日誌文件的路徑. 如果設置為 "-", 日誌則寫入到 stdout. 如果設置為空字元串(""), 日誌將不會記錄到磁碟上. +max-concurrent-downloads.name=最大同時下載數 +max-concurrent-downloads.description= +check-integrity.name=檢查完整性 +check-integrity.description=通過對文件的每個分塊或整個文件進行哈希驗證來檢查文件的完整性. 此選項僅對BT、Metalink及設置了 --checksum 選項的 HTTP(S)/FTP 鏈接生效. +continue.name=斷點續傳 +continue.description=繼續下載部分完成的文件. 啟用此選項可以繼續下載從瀏覽器或其他程序按順序下載的文件. 此選項目前只支持 HTTP(S)/FTP 下載的文件. +all-proxy.name=代理伺服器 +all-proxy.description=設置所有協議的代理伺服器地址. 如果覆蓋之前設置的代理伺服器, 使用 "" 即可. 您還可以針對特定的協議覆蓋此選項, 即使用 --http-proxy, --https-proxy 和 --ftp-proxy 選項. 此設置將會影響所有下載. 代理伺服器地址的格式為 [http://][USER:PASSWORD@]HOST[:PORT]. +all-proxy-user.name=代理伺服器用戶名 +all-proxy-user.description= +all-proxy-passwd.name=代理伺服器密碼 +all-proxy-passwd.description= +connect-timeout.name=連接超時時間 +connect-timeout.description=設置建立 HTTP/FTP/代理伺服器 連接的超時時間(秒). 當連接建立後, 此選項不再生效, 請使用 --timeout 選項. +dry-run.name=模擬運行 +dry-run.description=如果設置為"是", aria2 將僅檢查遠程文件是否存在而不會下載文件內容. 此選項僅對 HTTP/FTP 下載生效. 如果設置為 true, BT 下載將會直接取消. +lowest-speed-limit.name=最小速度限制 +lowest-speed-limit.description=當下載速度低於此選項設置的值(B/s) 時將會關閉連接. 0 表示不設置最小速度限制. 您可以增加數值的單位 K 或 M (1K = 1024, 1M = 1024K). 此選項不會影響 BT 下載. +max-connection-per-server.name=單伺服器最大連接數 +max-connection-per-server.description= +max-file-not-found.name=文件未找到重試次數 +max-file-not-found.description=如果 aria2 從遠程 HTTP/FTP 伺服器收到 "文件未找到" 的狀態超過此選項設置的次數後下載將會失敗. 設置為 0 將會禁用此選項. 此選項僅影響 HTTP/FTP 伺服器. 重試時同時會記錄重試次數, 所以也需要設置 --max-tries 這個選項. +max-tries.name=最大嘗試次數 +max-tries.description=設置最大嘗試次數. 0 表示不限制. +min-split-size.name=最小文件分片大小 +min-split-size.description=aria2 不會分割小於 2*SIZE 位元組的文件. 例如, 文件大小為 20MB, 如果 SIZE 為 10M, aria2 會把文件分成 2 段 [0-10MB) 和 [10MB-20MB), 並且使用 2 個源進行下載 (如果 --split >= 2). 如果 SIZE 為 15M, 由於 2*15M > 20MB, 因此 aria2 不會分割文件並使用 1 個源進行下載. 您可以增加數值的單位 K 或 M (1K = 1024, 1M = 1024K). 可以設置的值為: 1M-1024M. +netrc-path.name=.netrc 文件路徑 +netrc-path.description= +no-netrc.name=禁用 netrc +no-netrc.description= +no-proxy.name=不使用代理伺服器列表 +out.name=文件名 +out.description=下載文件的文件名. 其總是相對於 --dir 選項中設置的路徑. 當使用 --force-sequential 參數時此選項無效. +no-proxy.description=設置不使用代理伺服器的主機名, 域名, 包含或不包含子網掩碼的網路地址, 多個使用逗號分隔. +proxy-method.name=代理伺服器請求方法 +proxy-method.description=設置用來請求代理伺服器的方法. 方法可設置為 GET 或 TUNNEL. HTTPS 下載將忽略此選項並總是使用 TUNNEL. +remote-time.name=獲取伺服器文件時間 +remote-time.description=從 HTTP/FTP 服務獲取遠程文件的時間戳, 如果可用將設置到本地文件 +reuse-uri.name=URI 復用 +reuse-uri.description=當所有給定的 URI 地址都已使用, 繼續使用已經使用過的 URI 地址. +retry-wait.name=重試等待時間 +retry-wait.description=設置重試間隔時間(秒). 當此選項的值大於 0 時, aria2 在 HTTP 伺服器返回 503 響應時將會重試. +server-stat-of.name=伺服器狀態保存文件 +server-stat-of.description=指定用來保存伺服器狀態的文件名. 您可以使用 --server-stat-if 參數讀取保存的數據. +server-stat-timeout.name=伺服器狀態超時 +server-stat-timeout.description=指定伺服器狀態的過期時間 (單位為秒). +split.name=單任務連接數 +split.description=下載時使用 N 個連接. 如果提供超過 N 個 URI 地址, 則使用前 N 個地址, 剩餘的地址將作為備用. 如果提供的 URI 地址不足 N 個, 這些地址多次使用以保證同時建立 N 個連接. 同一伺服器的連接數會被 --max-connection-per-server 選項限制. +stream-piece-selector.name=分片選擇演算法 +stream-piece-selector.description=指定 HTTP/FTP 下載使用的分片選擇演算法. 分片表示的是並行下載時固定長度的分隔段. 如果設置為"默認", aria2 將會按減少建立連接數選擇分片. 由於建立連接操作的成本較高, 因此這是合理的默認行為. 如果設置為"順序", aria2 將選擇索引最小的分片. 索引為 0 時表示為文件的第一個分片. 這將有助於視頻的邊下邊播. --enable-http-pipelining 選項有助於減少重連接的開銷. 請注意, aria2 依賴於 --min-split-size 選項, 所以有必要對 --min-split-size 選項設置一個合理的值. 如果設置為"隨機", aria2 將隨機選擇一個分片. 就像"順序"一樣, 依賴於 --min-split-size 選項. 如果設置為"幾何", aria2 會先選擇索引最小的分片, 然後會為之前選擇的分片保留指數增長的空間. 這將減少建立連接的次數, 同時文件開始部分將會先行下載. 這也有助於視頻的邊下邊播. +timeout.name=超時時間 +timeout.description= +uri-selector.name=URI 選擇演算法 +uri-selector.description=指定 URI 選擇的演算法. 可選的值包括 "按順序", "反饋" 和 "自適應". 如果設置為"按順序", URI 將按列表中出現的順序使用. 如果設置為"反饋", aria2 將根據之前的下載速度選擇 URI 列表中下載速度最快的伺服器. 同時也將有效跳過無效鏡像. 之前統計的下載速度將作為伺服器狀態文件的一部分, 參見 --server-stat-of 和 --server-stat-if 選項. 如果設置為"自適應", 將從最好的鏡像和保留的連接里選擇一項. 補充說明, 其返回的鏡像沒有被測試過, 同時如果每個鏡像都已經被測試過時, 返回的鏡像還會被重新測試. 否則, 其將不會選擇其他鏡像. 例如"反饋", 其使用伺服器狀態文件. +check-certificate.name=檢查證書 +check-certificate.description= +http-accept-gzip.name=支持 GZip +http-accept-gzip.description=如果遠程伺服器的響應頭中包含 Content-Encoding: gzip 或 Content-Encoding: deflate , 將發送包含 Accept: deflate, gzip 的請求頭並解壓縮響應. +http-auth-challenge.name=認證質詢 +http-auth-challenge.description=僅當伺服器需要時才發送 HTTP 認證請求頭. 如果設置為"否", 每次都會發送認證請求頭. 例外: 如果用戶名和密碼包含在 URI 中, 將忽略此選項並且每次都會發送認證請求頭. +http-no-cache.name=禁用緩存 +http-no-cache.description=發送的請求頭中將包含 Cache-Control: no-cache 和 Pragma: no-cache header 以避免內容被緩存. 如果設置為"否", 上述請求頭將不會發送, 同時您也可以使用 --header 選項將 Cache-Control 請求頭添加進去. +http-user.name=HTTP 默認用戶名 +http-user.description= +http-passwd.name=HTTP 默認密碼 +http-passwd.description= +http-proxy.name=HTTP 代理伺服器 +http-proxy.description= +http-proxy-user.name=HTTP 代理伺服器用戶名 +http-proxy-user.description= +http-proxy-passwd.name=HTTP 代理伺服器密碼 +http-proxy-passwd.description= +https-proxy.name=HTTPS 代理伺服器 +https-proxy.description= +https-proxy-user.name=HTTPS 代理伺服器用戶名 +https-proxy-user.description= +https-proxy-passwd.name=HTTPS 代理伺服器密碼 +https-proxy-passwd.description= +referer.name=請求來源 +referer.description=設置 HTTP 請求來源 (Referer). 此選項將影響所有 HTTP/HTTPS 下載. 如果設置為 *, 請求來源將設置為下載鏈接. 此選項可以配合 --parameterized-uri 選項使用. +enable-http-keep-alive.name=啟用持久連接 +enable-http-keep-alive.description=啟用 HTTP/1.1 持久連接. +enable-http-pipelining.name=啟用 HTTP 管線化 +enable-http-pipelining.description=啟用 HTTP/1.1 管線化. +header.name=自定義請求頭 +header.description=增加 HTTP 請求頭內容. +save-cookies.name=Cookies 保存路徑 +save-cookies.description=以 Mozilla/Firefox(1.x/2.x)/Netscape 格式將 Cookies 保存到文件中. 如果文件已經存在, 將被覆蓋. 會話過期的 Cookies 也將會保存, 其過期時間將會設置為 0. +use-head.name=啟用 HEAD 方法 +use-head.description=第一次請求 HTTP 伺服器時使用 HEAD 方法. +user-agent.name=自定義 User Agent +user-agent.description= +ftp-user.name=FTP 默認用戶名 +ftp-user.description= +ftp-passwd.name=FTP 默認密碼 +ftp-passwd.description=如果 URI 中包含用戶名單不包含密碼, aria2 首先會從 .netrc 文件中獲取密碼. 如果在 .netrc 文件中找到密碼, 則使用該密碼. 否則, 使用此選項設置的密碼. +ftp-pasv.name=被動模式 +ftp-pasv.description=在 FTP 中使用被動模式. 如果設置為"否", 則使用主動模式. 此選項不適用於 SFTP 傳輸. +ftp-proxy.name=FTP 代理伺服器 +ftp-proxy.description= +ftp-proxy-user.name=FTP 代理伺服器用戶名 +ftp-proxy-user.description= +ftp-proxy-passwd.name=FTP 代理伺服器密碼 +ftp-proxy-passwd.description= +ftp-type.name=傳輸類型 +ftp-type.description= +ftp-reuse-connection.name=連接復用 +ftp-reuse-connection.description= +ssh-host-key-md.name=SSH 公鑰校驗和 +ssh-host-key-md.description=設置 SSH 主機公鑰的校驗和. TYPE 為哈希類型. 支持的哈希類型為 sha-1 和 md5. DIGEST 是十六進位摘要. 例如: sha-1=b030503d4de4539dc7885e6f0f5e256704edf4c3. 此選項可以在使用 SFTP 時用來驗證伺服器的公鑰. 如果此選項不設置, 即保留默認, 不會進行任何驗證。 +bt-detach-seed-only.name=分離僅做種任務 +bt-detach-seed-only.description=統計當前活動下載任務(參見 -j 選項) 時排除僅做種的任務. 這意味著, 如果參數設置為 -j3, 此選項打開並且當前有 3 個正在活動的任務, 並且其中有 1 個進入做種模式, 那麼其會從正在下載的數量中排除(即數量會變為 2), 在隊列中等待的下一個任務將會開始執行. 但要知道, 在 RPC 方法中, 做種的任務仍然被認為是活動的下載任務. +bt-enable-hook-after-hash-check.name=啟用哈希檢查完成事件 +bt-enable-hook-after-hash-check.description=允許 BT 下載哈希檢查(參見 -V 選項) 完成後調用命令. 默認情況下, 當哈希檢查成功後, 通過 --on-bt-download-complete 設置的命令將會被執行. 如果要禁用此行為, 請設置為"否". +bt-enable-lpd.name=啟用本地節點發現 (LPD) +bt-enable-lpd.description= +bt-exclude-tracker.name=BT 排除伺服器地址 +bt-exclude-tracker.description=逗號分隔的 BT 排除伺服器地址. 您可以使用 * 匹配所有地址, 因此將排除所有伺服器地址. 當在 shell 命令行使用 * 時, 需要使用轉義符或引號. +bt-external-ip.name=外部 IP 地址 +bt-external-ip.description=指定用在 BitTorrent 下載和 DHT 中的外部 IP 地址. 它可能被發送到 BitTorrent 伺服器. 對於 DHT, 此選項將會報告本地節點正在下載特定的種子. 這對於在私有網路中使用 DHT 非常關鍵. 雖然這個方法叫外部, 但其可以接受各種類型的 IP 地址. +bt-force-encryption.name=強制加密 +bt-force-encryption.description=BT 消息中的內容需要使用 arc4 加密. 此選項是設置 --bt-require-crypto --bt-min-crypto-level=arc4 這兩個選項的快捷方式. 此選項不會修改上述兩個選項的內容. 如果設置為"是", 將拒絕以前的 BT 握手, 並僅使用模糊握手及加密消息. +bt-hash-check-seed.name=做種前檢查文件哈希 +bt-hash-check-seed.description=如果設置為"是", 當使用 --check-integrity 選項完成哈希檢查及文件完成後才繼續做種. 如果您希望僅當文件損壞或未完成時檢查文件, 請設置為"否". 此選項僅對 BT 下載有效 +bt-max-open-files.name=最多打開文件數 +bt-max-open-files.description=設置 BT/Metalink 下載全局打開的最大文件數. +bt-max-peers.name=最大連接節點數 +bt-max-peers.description=設置每個 BT 下載的最大連接節點數. 0 表示不限制. +bt-metadata-only.name=僅下載種子文件 +bt-metadata-only.description=僅下載種子文件. 種子文件中描述的文件將不會下載. 此選項僅對磁鏈生效. +bt-min-crypto-level.name=最低加密級別 +bt-min-crypto-level.description=設置加密方法的最小級別. 如果節點提供多種加密方法, aria2 將選擇滿足給定級別的最低級別. +bt-prioritize-piece.name=優先下載 +bt-prioritize-piece.description=嘗試先下載每個文件開頭或結尾的分片. 此選項有助於預覽文件. 參數可以包括兩個關鍵詞: head 和 tail. 如果包含兩個關鍵詞, 需要使用逗號分隔. 每個關鍵詞可以包含一個參數, SIZE. 例如, 如果指定 head=SIZE, 每個文件的最前 SIZE 數據將會獲得更高的優先順序. tail=SIZE 表示每個文件的最後 SIZE 數據. SIZE 可以包含 K 或 M (1K = 1024, 1M = 1024K). +bt-remove-unselected-file.name=刪除未選擇的文件 +bt-remove-unselected-file.description=當 BT 任務完成後刪除未選擇的文件. 要選擇需要下載的文件, 請使用 --select-file 選項. 如果沒有選擇, 則所有文件都默認為需要下載. 此選項會從磁碟上直接刪除文件, 請謹慎使用此選項. +bt-require-crypto.name=需要加密 +bt-require-crypto.description=如果設置為"是", aria 將不會接受以前的 BitTorrent 握手協議(\\19BitTorrent 協議)並建立連接. 因此 aria2 總是模糊握手. +bt-request-peer-speed-limit.name=期望下載速度 +bt-request-peer-speed-limit.description=如果一個 BT 下載的整體下載速度低於此選項設置的值, aria2 會臨時提高連接數以提高下載速度. 在某些情況下, 設置期望下載速度可以提高您的下載速度. 您可以增加數值的單位 K 或 M (1K = 1024, 1M = 1024K). +bt-save-metadata.name=保存種子文件 +bt-save-metadata.description=保存種子文件為 ".torrent" 文件. 此選項僅對磁鏈生效. 文件名為十六進位編碼後的哈希值及 ".torrent"後綴. 保存的目錄與下載文件的目錄相同. 如果相同的文件已存在, 種子文件將不會保存. +bt-seed-unverified.name=不檢查已經下載的文件 +bt-seed-unverified.description=不檢查之前下載文件中每個分片的哈希值. +bt-stop-timeout.name=無速度時自動停止時間 +bt-stop-timeout.description=當 BT 任務F下載速度持續為 0, 達到此選項設置的時間後停止下載. 如果設置為 0, 此功能將禁用. +bt-tracker.name=BT 伺服器地址 +bt-tracker.description=逗號分隔的 BT 伺服器地址. 如果伺服器地址在 --bt-exclude-tracker 選項中, 其將不會生效. +bt-tracker-connect-timeout.name=BT 伺服器連接超時時間 +bt-tracker-connect-timeout.description=設置 BT 伺服器的連接超時時間 (秒). 當連接建立後, 此選項不再生效, 請使用 --bt-tracker-timeout 選項. +bt-tracker-interval.name=BT 伺服器連接間隔時間 +bt-tracker-interval.description=設置請求 BT 伺服器的間隔時間 (秒). 此選項將完全覆蓋伺服器返回的最小間隔時間和間隔時間, aria2 僅使用此選項的值.如果設置為 0, aria2 將根據伺服器的響應情況和下載進程決定時間間隔. +bt-tracker-timeout.name=BT 伺服器超時時間 +bt-tracker-timeout.description= +dht-file-path.name=DHT (IPv4) 文件 +dht-file-path.description=修改 IPv4 DHT 路由表文件路徑. +dht-file-path6.name=DHT (IPv6) 文件 +dht-file-path6.description=修改 IPv6 DHT 路由表文件路徑. +dht-listen-port.name=DHT 監聽埠 +dht-listen-port.description=設置 DHT (IPv4, IPv6) 和 UDP 伺服器使用的 UCP 埠. 多個埠可以使用逗號 "," 分隔, 例如: 6881,6885. 您還可以使用短橫線 "-" 表示範圍: 6881-6999, 或可以一起使用: 6881-6889, 6999. +dht-message-timeout.name=DHT 消息超時時間 +dht-message-timeout.description= +enable-dht.name=啟用 DHT (IPv4) +enable-dht.description=啟用 IPv4 DHT 功能. 此選項同時會啟用 UDP 伺服器支持. 如果種子設置為私有, 即使此選項設置為"是", aria2 也不會啟用 DHT. +enable-dht6.name=啟用 DHT (IPv6) +enable-dht6.description=啟用 IPv6 DHT 功能. 如果種子設置為私有, 即使此選項設置為"是", aria2 也不會啟用 DHT. 使用 --dht-listen-port 選項設置監聽的埠. +enable-peer-exchange.name=啟用節點交換 +enable-peer-exchange.description=啟用節點交換擴展. 如果種子設置為私有, 即使此選項設置為"是", aria2 也不會啟用此功能. +follow-torrent.name=下載種子中的文件 +follow-torrent.description=如果設置為"是"或"僅內存", 當後綴為 .torrent 或內容類型為 application/x-bittorrent 的文件下載完成時, aria2 將按種子文件讀取並下載該文件中提到的文件. 如果設置為"僅內存", 該種子文件將不會寫入到磁碟中, 而僅會存儲在內存中. 如果設置為"否", 則 .torrent 文件會下載到磁碟中, 但不會按種子文件讀取並且其中的文件不會進行下載. +listen-port.name=監聽埠 +listen-port.description=設置 BT 下載的 TCP 埠. 多個埠可以使用逗號 "," 分隔, 例如: 6881,6885. 您還可以使用短橫線 "-" 表示範圍: 6881-6999, 或可以一起使用: 6881-6889, 6999. +max-overall-upload-limit.name=全局最大上傳速度 +max-overall-upload-limit.description=設置全局最大上傳速度 (位元組/秒). 0 表示不限制. 您可以增加數值的單位 K 或 M (1K = 1024, 1M = 1024K). +max-upload-limit.name=最大上傳速度 +max-upload-limit.description=設置每個任務的最大上傳速度 (位元組/秒). 0 表示不限制. 您可以增加數值的單位 K 或 M (1K = 1024, 1M = 1024K). +peer-id-prefix.name=節點 ID 前綴 +peer-id-prefix.description=指定節點 ID 的前綴. BT 中節點 ID 長度為 20 位元組. 如果超過 20 位元組, 將僅使用前 20 位元組. 如果少於 20 位元組, 將在其後不足隨機的數據保證為 20 位元組. +seed-ratio.name=最小分享率 +seed-ratio.description=指定分享率. 當分享率達到此選項設置的值時會完成做種. 強烈建議您將此選項設置為大於等於 1.0. 如果您想不限制分享比率, 可以設置為 0.0. 如果同時設置了 --seed-time 選項, 當任意一個條件滿足時將停止做種. +seed-time.name=最小做種時間 +seed-time.description=此選項設置為 0 時, 將在 BT 任務下載完成後不進行做種. +follow-metalink.name=下載 Metalink 中的文件 +follow-metalink.description=如果設置為"是"或"僅內存", 當後綴為 .meta4 或 .metalink 或內容類型為 application/metalink4+xml 或 application/metalink+xml 的文件下載完成時, aria2 將按 Metalink 文件讀取並下載該文件中提到的文件. 如果設置為"僅內存", 該 Metalink 文件將不會寫入到磁碟中, 而僅會存儲在內存中. 如果設置為"否", 則 .metalink 文件會下載到磁碟中, 但不會按 Metalink 文件讀取並且其中的文件不會進行下載. +metalink-base-uri.name=基礎 URI +metalink-base-uri.description=指定基礎 URI 以便解析本地磁碟中存儲的 Metalink 文件里 metalink:url 和 metalink:metaurl 中的相對 URI 地址. 如果 URI 表示的為目錄, 最後需要以 / 結尾. +metalink-language.name=語言 +metalink-language.description= +metalink-location.name=首選伺服器位置 +metalink-location.description=首選伺服器所在的位置. 可以使用逗號分隔的列表, 例如: jp,us. +metalink-os.name=操作系統 +metalink-os.description=下載文件的操作系統. +metalink-version.name=版本號 +metalink-version.description=下載文件的版本號. +metalink-preferred-protocol.name=首選使用協議 +metalink-preferred-protocol.description=指定首選使用的協議. 可以設置為 http, https, ftp 或"無". 設置為"無"時禁用此選項. +metalink-enable-unique-protocol.name=僅使用唯一協議 +metalink-enable-unique-protocol.description=如果一個 Metalink 文件可用多種協議, 並且此選項設置為"是", aria2 將只會使用其中一種. 使用 --metalink-preferred-protocol 參數指定首選的協議. +enable-rpc.name=啟用 JSON-RPC/XML-RPC 伺服器 +enable-rpc.description= +pause-metadata.name=種子文件下載完後暫停 +pause-metadata.description=當種子文件下載完成後暫停後續的下載. 在 aria2 中有 3 種種子文件的下載類型: (1) 下載 .torrent 文件. (2) 通過磁鏈下載的種子文件. (3) 下載 Metalink 文件. 這些種子文件下載完後會根據文件內容繼續進行下載. 此選項會暫停這些後續的下載. 此選項僅當 --enable-rpc 選項啟用時生效. +rpc-allow-origin-all.name=接受所有遠程請求 +rpc-allow-origin-all.description=在 RPC 響應頭增加 Access-Control-Allow-Origin 欄位, 值為 * . +rpc-listen-all.name=在所有網卡上監聽 +rpc-listen-all.description=在所有網路適配器上監聽 JSON-RPC/XML-RPC 的請求, 如果設置為"否", 僅監聽本地網路的請求. +rpc-listen-port.name=監聽埠 +rpc-listen-port.description= +rpc-max-request-size.name=最大請求大小 +rpc-max-request-size.description=設置 JSON-RPC/XML-RPC 最大的請求大小. 如果 aria2 檢測到請求超過設定的位元組數, 會直接取消連接. +rpc-save-upload-metadata.name=保存上傳的種子文件 +rpc-save-upload-metadata.description=在 dir 選項設置的目錄中保存上傳的種子文件或 Metalink 文件. 文件名包括 SHA-1 哈希後的元數據和擴展名兩部分. 對於種子文件, 擴展名為 '.torrent'. 對於 Metalink 為 '.meta4'. 如果此選項設置為"否", 通過 aria2.addTorrent() 或 aria2.addMetalink() 方法添加的下載將無法通過 --save-session 選項保存. +rpc-secure.name=啟用 SSL/TLS +rpc-secure.description=RPC 將通過 SSL/TLS 加密傳輸. RPC 客戶端需要使用 https 協議連接伺服器. 對於 WebSocket 客戶端, 使用 wss 協議. 使用 --rpc-certificate 和 --rpc-private-key 選項設置伺服器的證書和私鑰. +allow-overwrite.name=允許覆蓋 +allow-overwrite.description=如果相應的控制文件不存在時從頭重新下載文件. 參見 --auto-file-renaming 選項. +allow-piece-length-change.name=允許分片大小變化 +allow-piece-length-change.description=如果設置為"否", 當分片長度與控制文件中的不同時, aria2 將會中止下載. 如果設置為"是", 您可以繼續, 但部分下載進度將會丟失. +always-resume.name=始終斷點續傳 +always-resume.description=始終斷點續傳. 如果設置為"是", aria2 始終嘗試斷點續傳, 如果無法恢復, 則中止下載. 如果設置為"否", 對於不支持斷點續傳的 URI 或 aria2 遇到 N 個不支持斷點續傳的 URI (N 為 --max-resume-failure-tries 選項設置的值), aria2 會從頭下載文件. 參見 --max-resume-failure-tries 參數. +async-dns.name=非同步 DNS +async-dns.description= +auto-file-renaming.name=文件自動重命名 +auto-file-renaming.description=重新命名已經存在的文件. 此選項僅對 HTTP(S)/FTP 下載有效. 新的文件名後會在文件名後、擴展名 (如果有) 前追加句點和數字(1..9999). +auto-save-interval.name=自動保存間隔 +auto-save-interval.description=每隔設置的秒數自動保存控制文件(*.aria2). 如果設置為 0, 下載期間控制文件不會自動保存. 不論設置的值為多少, aria2 會在任務結束時保存控制文件. 可以設置的值為 0 到 600. +conditional-get.name=條件下載 +conditional-get.description=僅當本地文件比遠程文件舊時才進行下載. 此功能僅適用於 HTTP(S) 下載. 如果在 Metalink 中文件大小已經被指定則功能無法生效. 同時此功能還將忽略 Content-Disposition 響應頭. 如果存在控制文件, 此選項將被忽略. 此功能通過 If-Modified-Since 請求頭獲取較新的文件. 當獲取到本地文件的修改時間時, 此功能將使用用戶提供的文件名 (參見 --out 選項), 如果沒有指定 --out 選項則使用 URI 中的文件名. 為了覆蓋已經存在的文件, 需要使用 --allow-overwrite 參數. +conf-path.name=配置文件路徑 +conf-path.description= +console-log-level.name=控制台日誌級別 +console-log-level.description= +content-disposition-default-utf8.name=使用 UTF-8 處理 Content-Disposition +content-disposition-default-utf8.description=處理 "Content-Disposition" 頭中的字元串時使用 UTF-8 字符集來代替 ISO-8859-1, 例如, 文件名參數, 但不是擴展版本的文件名. +daemon.name=啟用後台進程 +daemon.description= +deferred-input.name=延遲載入 +deferred-input.description=如果設置為"是", aria2 在啟動時不會讀取 --input-file 選項設置的文件中的所有 URI 地址, 而是會在之後需要時按需讀取. 如果輸入文件中包含大量要下載的 URI, 此選項可以減少內存的使用. 如果設置為"否", aria2 會在啟動時讀取所有的 URI. 當 -save-session 使用時將會禁用 --deferred-input 選項. +disable-ipv6.name=禁用 IPv6 +disable-ipv6.description= +disk-cache.name=磁碟緩存 +disk-cache.description=啟用磁碟緩存. 如果設置為 0, 將禁用磁碟緩存. 此功能將下載的數據緩存在內存中, 最多佔用此選項設置的位元組數. 緩存存儲由 aria2 實例創建並對所有下載共享. 由於數據以較大的單位寫入並按文件的偏移重新排序, 所以磁碟緩存的一個優點是減少磁碟的 I/O. 如果調用哈希檢查時並且數據緩存在內存中時, 將不需要從磁碟中讀取. 大小可以包含 K 或 M (1K = 1024, 1M = 1024K). +download-result.name=下載結果 +download-result.description=此選項將修改下載結果的格式. 如果設置為"默認", 將列印 GID, 狀態, 平均下載速度和路徑/URI. 如果涉及多個文件, 僅列印第一個請求文件的路徑/URI, 其餘的將被忽略. 如果設置為"完整", 將列印 GID, 狀態, 平均下載速度, 下載進度和路徑/URI. 其中, 下載進度和路徑/URI 將會每個文件列印一行. 如果設置為"隱藏", 下載結果將會隱藏. +dscp.name=DSCP +dscp.description=為 QoS 設置 BT 上行 IP 包的 DSCP 值. 此參數僅設置 IP 包中 TOS 欄位的 DSCP 位, 而不是整個欄位. 如果您從 /usr/include/netinet/ip.h 得到的值, 需要除以 4 (否則值將不正確, 例如您的 CS1 類將會轉為 CS4). 如果您從 RFC, 網路供應商的文檔, 維基百科或其他來源採取常用的值, 可以直接使用. +rlimit-nofile.name=最多打開的文件描述符 +rlimit-nofile.description=設置打開的文件描述符的軟限制 (soft limit). 此選項僅當滿足如下條件時開放: a. 系統支持它 (posix). b. 限制沒有超過硬限制 (hard limit). c. 指定的限制比當前的軟限制高. 這相當於設置 ulimit, 除了其不能降低限制. 此選項僅當系統支持 rlimit API 時有效. +enable-color.name=終端輸出使用顏色 +enable-color.description= +enable-mmap.name=啟用 MMap +enable-mmap.description=內存中存放映射文件. 當文件空間沒有預先分配至, 此選項無效. 參見 --file-allocation. +event-poll.name=事件輪詢方法 +event-poll.description=設置事件輪訓的方法. 可選的值包括 epoll, kqueue, port, poll 和 select. 對於 epoll, kqueue, port 和 poll, 只有系統支持時才可用. 最新的 Linux 支持 epoll. 各種 *BSD 系統包括 Mac OS X 支持 kqueue. Open Solaris 支持 port. 默認值根據您使用的操作系統不同而不同. +file-allocation.name=文件分配方法 +file-allocation.description=指定文件分配方法. "無" 不會預先分配文件空間. "prealloc"會在下載開始前預先分配空間. 這將會根據文件的大小需要一定的時間. 如果您使用的是較新的文件系統, 例如 ext4 (帶擴展支持), btrfs, xfs 或 NTFS (僅 MinGW 構建), "falloc" 是最好的選擇. 其幾乎可以瞬間分配大(數 GiB)文件. 不要在舊的文件系統, 例如 ext3 和 FAT32 上使用 falloc, 因為與 prealloc 花費的時間相同, 並且其會阻塞 aria2 知道分配完成. 當您的系統不支持 posix_fallocate(3) 函數時, falloc 可能無法使用. "trunc" 使用 ftruncate(2) 系統調用或平台特定的實現將文件截取到特定的長度. 在多文件的 BitTorrent 下載中, 若某文件與其相鄰的文件共享相同的分片時, 則相鄰的文件也會被分配. +force-save.name=強制保存 +force-save.description=即使任務完成或刪除時使用 --save-session 選項時也保存該任務. 此選項在這種情況下還會保存控制文件. 此選項可以保存被認為已經完成但正在做種的 BT 任務. +save-not-found.name=保存未找到的文件 +save-not-found.description=當使用 --save-session 選項時, 即使當任務中的文件不存在時也保存該下載任務. 此選項同時會將這種情況保存到控制文件中. +hash-check-only.name=僅哈希檢查 +hash-check-only.description=如果設置為"是", 哈希檢查完使用 --check-integrity 選項, 根據是否下載完成決定是否終止下載. +human-readable.name=控制台可讀輸出 +human-readable.description=在控制台輸出可讀格式的大小和速度 (例如, 1.2Ki, 3.4Mi). +keep-unfinished-download-result.name=保留未完成的任務 +keep-unfinished-download-result.description=保留所有未完成的下載結果, 即使超過了 --max-download-result 選項設置的數量. 這將有助於在會話文件中保存所有的未完成的下載 (參考 --save-session 選項). 需要注意的是, 未完成任務的數量沒有上限. 如果不希望這樣, 請關閉此選項. +max-download-result.name=最多下載結果 +max-download-result.description=設置內存中存儲最多的下載結果數量. 下載結果包括已完成/錯誤/已刪除的下載. 下載結果存儲在一個先進先出的隊列中, 因此其可以存儲最多指定的下載結果的數量. 當隊列已滿且有新的下載結果創建時, 最老的下載結果將從隊列的最前部移除, 新的將放在最後. 此選項設置較大的值後如果經過幾千次的下載將導致較高的內存消耗. 設置為 0 表示不存儲下載結果. 注意, 未完成的下載將始終保存在內存中, 不考慮該選項的設置. 參考 --keep-unfinished-download-result 選項. +max-mmap-limit.name=MMap 最大限制 +max-mmap-limit.description=設置啟用 MMap (參見 --enable-mmap 選項) 最大的文件大小. 文件大小由一個下載任務中所有文件大小的和決定. 例如, 如果一個下載包含 5 個文件, 那麼文件大小就是這些文件的總大小. 如果文件大小超過此選項設置的大小時, MMap 將會禁用. +max-resume-failure-tries.name=最大斷點續傳嘗試次數 +max-resume-failure-tries.description=當 --always-resume 選項設置為"否"時, 如果 aria2 檢測到有 N 個 URI 不支持斷點續傳時, 將從頭開始下載文件. 如果 N 設置為 0, 當所有 URI 都不支持斷點續傳時才會從頭下載文件. 參見 --always-resume 選項. +min-tls-version.name=最低 TLS 版本 +min-tls-version.description=指定啟用的最低 SSL/TLS 版本. +log-level.name=日誌級別 +log-level.description= +optimize-concurrent-downloads.name=優化並發下載 +optimize-concurrent-downloads.description=根據可用帶寬優化並發下載的數量. aria2 使用之前統計的下載速度通過規則 N = A + B Log10 (速度單位為 Mbps) 得到並發下載的數量. 其中係數 A 和 B 可以在參數中以冒號分隔自定義. 默認值 (A=5, B=25) 可以在 1Mbps 網路上使用通常 5 個並發下載, 在 100Mbps 網路上為 50 個. 並發下載的數量保持在 --max-concurrent-downloads 參數定義的最大之下. +piece-length.name=文件分片大小 +piece-length.description=設置 HTTP/FTP 下載的分配大小. aria2 根據這個邊界分割文件. 所有的分割都是這個長度的倍數. 此選項不適用於 BitTorrent 下載. 如果 Metalink 文件中包含分片哈希的結果此選項也不適用. +show-console-readout.name=顯示控制台輸出 +show-console-readout.description= +summary-interval.name=下載摘要輸出間隔 +summary-interval.description=設置下載進度摘要的輸出間隔(秒). 設置為 0 禁止輸出. +max-overall-download-limit.name=全局最大下載速度 +max-overall-download-limit.description=設置全局最大下載速度 (位元組/秒). 0 表示不限制. 您可以增加數值的單位 K 或 M (1K = 1024, 1M = 1024K). +max-download-limit.name=最大下載速度 +max-download-limit.description=設置每個任務的最大下載速度 (位元組/秒). 0 表示不限制. 您可以增加數值的單位 K 或 M (1K = 1024, 1M = 1024K). +no-conf.name=禁用配置文件 +no-conf.description= +no-file-allocation-limit.name=文件分配限制 +no-file-allocation-limit.description=不對比此參數設置大小小的分配文件. 您可以增加數值的單位 K 或 M (1K = 1024, 1M = 1024K). +parameterized-uri.name=啟用參數化 URI 支持 +parameterized-uri.description=啟用參數化 URI 支持. 您可以指定部分的集合: http://{sv1,sv2,sv3}/foo.iso. 同時您也可以使用步進計數器指定數字化的序列: http://host/image[000-100:2].img. 步進計數器可以省略. 如果所有 URI 地址不指向同樣的文件, 例如上述第二個示例, 需要使用 -Z 選項. +quiet.name=禁用控制台輸出 +quiet.description= +realtime-chunk-checksum.name=實時數據塊驗證 +realtime-chunk-checksum.description=如果提供了數據塊的校驗和, 將在下載過程中通過校驗和驗證數據塊. +remove-control-file.name=刪除控制文件 +remove-control-file.description=在下載前刪除控制文件. 使用 --allow-overwrite=true 選項時, 總是從頭開始下載文件. 此選項將有助於使用不支持斷點續傳代理伺服器的用戶. +save-session.name=狀態保存文件 +save-session.description=當退出時保存錯誤及未完成的任務到指定的文件中. 您可以在重啟 aria2 時使用 --input-file 選項重新載入. 如果您希望輸出的內容使用 GZip 壓縮, 您可以在文件名後增加 .gz 擴展名. 請注意, 通過 aria2.addTorrent() 和 aria2.addMetalink() RPC 方法添加的下載, 其元數據沒有保存到文件的將不會保存. 通過 aria2.remove() 和 aria2.forceRemove() 刪除的下載將不會保存. +save-session-interval.name=保存狀態間隔 +save-session-interval.description=每隔此選項設置的時間(秒)後會保存錯誤或未完成的任務到 --save-session 選項指定的文件中. 如果設置為 0, 僅當 aria2 退出時才會保存. +socket-recv-buffer-size.name=Socket 接收緩衝區大小 +socket-recv-buffer-size.description=設置 Socket 接收緩衝區最大的位元組數. 指定為 0 時將禁用此選項. 當使用 SO_RCVBUF 選項調用 setsockopt() 時此選項的值將設置到 Socket 的文件描述符中. +stop.name=自動關閉時間 +stop.description=在此選項設置的時間(秒)後關閉應用. 如果設置為 0, 此功能將禁用. +truncate-console-readout.name=縮短控制台輸出內容 +truncate-console-readout.description=縮短控制台輸出的內容在一行中. diff --git a/src/scripts/config/configuration.js b/src/scripts/config/configuration.js index edea970..0771f98 100644 --- a/src/scripts/config/configuration.js +++ b/src/scripts/config/configuration.js @@ -1,15 +1,39 @@ (function () { 'use strict'; - angular.module('ariaNg').config(['$translateProvider', 'localStorageServiceProvider', 'NotificationProvider', 'ariaNgConstants', function ($translateProvider, localStorageServiceProvider, NotificationProvider, ariaNgConstants) { + angular.module('ariaNg').config(['$translateProvider', 'localStorageServiceProvider', 'NotificationProvider', 'ariaNgConstants', 'ariaNgLanguages', function ($translateProvider, localStorageServiceProvider, NotificationProvider, ariaNgConstants, ariaNgLanguages) { localStorageServiceProvider .setPrefix(ariaNgConstants.appPrefix) .setStorageType('localStorage') .setStorageCookie(365, '/'); + var supportedLangs = []; + var languageAliases = {}; + + for (var langName in ariaNgLanguages) { + if (!ariaNgLanguages.hasOwnProperty(langName)) { + continue; + } + + var language = ariaNgLanguages[langName]; + var aliases = language.aliases; + + supportedLangs.push(langName); + + if (!angular.isArray(aliases) || aliases.length < 1) { + continue; + } + + for (var i = 0; i < aliases.length; i++) { + var langAlias = aliases[i]; + languageAliases[langAlias] = langName; + } + } + $translateProvider.useLoader('ariaNgLanguageLoader') .useLoaderCache(true) - .preferredLanguage(ariaNgConstants.defaultLanguage) + .registerAvailableLanguageKeys(supportedLangs, languageAliases) + .determinePreferredLanguage() .fallbackLanguage(ariaNgConstants.defaultLanguage) .useSanitizeValueStrategy('escapeParameters'); diff --git a/src/scripts/config/languages.js b/src/scripts/config/languages.js index c4396da..f4d9f02 100644 --- a/src/scripts/config/languages.js +++ b/src/scripts/config/languages.js @@ -6,9 +6,15 @@ name: 'English', displayName: 'English' }, - 'zh_CN': { + 'zh_Hans': { name: 'Simplified Chinese', - displayName: '简体中文' + displayName: '简体中文', + aliases: ['zh_CHS', 'zh_CN', 'zh_SG'] + }, + 'zh_Hant': { + name: 'Traditional Chinese', + displayName: '繁體中文', + aliases: ['zh_CHT', 'zh_TW', 'zh_HK', 'zh_MO'] } }); }()); diff --git a/src/scripts/services/ariaNgSettingService.js b/src/scripts/services/ariaNgSettingService.js index 53366f1..8e84a0d 100644 --- a/src/scripts/services/ariaNgSettingService.js +++ b/src/scripts/services/ariaNgSettingService.js @@ -18,6 +18,29 @@ } }; + var getLanguageNameFromAlias = function (alias) { + for (var langName in ariaNgLanguages) { + if (!ariaNgLanguages.hasOwnProperty(langName)) { + continue; + } + + var language = ariaNgLanguages[langName]; + var aliases = language.aliases; + + if (!angular.isArray(aliases) || aliases.length < 1) { + continue; + } + + for (var i = 0; i < aliases.length; i++) { + if (aliases[i] === alias) { + return langName; + } + } + } + + return null; + }; + var getDefaultLanguage = function () { var browserLang = $window.navigator.browserLanguage ? $window.navigator.browserLanguage : $window.navigator.language; @@ -27,6 +50,14 @@ browserLang = browserLang.replace(/\-/g, '_'); + if (!ariaNgLanguages[browserLang]) { + var languageName = getLanguageNameFromAlias(browserLang); + + if (languageName) { + browserLang = languageName; + } + } + if (!ariaNgLanguages[browserLang]) { return ariaNgDefaultOptions.language; } @@ -34,6 +65,16 @@ return browserLang; }; + var getLanguageNameFromAliasOrDefaultLanguage = function (lang) { + var languageName = getLanguageNameFromAlias(lang); + + if (languageName) { + return languageName; + } + + return getDefaultLanguage(); + }; + var getDefaultRpcHost = function () { var currentHost = $location.host(); @@ -51,6 +92,10 @@ var getOptions = function () { var options = localStorageService.get(ariaNgConstants.optionStorageKey); + if (options && !ariaNgLanguages[options.language]) { + options.language = getLanguageNameFromAliasOrDefaultLanguage(options.language); + } + if (!options) { options = angular.extend({}, ariaNgDefaultOptions); options.language = getDefaultLanguage(); From fb9d786fe242b6ed75aa50f8a71cf79e5d1f773b Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 18 Jun 2017 17:07:55 +0800 Subject: [PATCH 101/120] update version to 0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 92084fb..4053c21 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ }, "name": "ariang", "description": "AriaNg, a web frontend making aria2 better", - "version": "0.2.0", + "version": "0.3.0", "main": "index.html", "scripts": { "test": "echo \"Error: no test specified\" && exit 0" From c3e7092b1ba534caa36e9c8b9347c9cf841b9e78 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 26 Jun 2017 23:43:16 +0800 Subject: [PATCH 102/120] update slogan --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 885c14b..0e79a5d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Lastest Release](https://img.shields.io/github/release/mayswind/AriaNg.svg?style=flat)](https://github.com/mayswind/AriaNg/releases) ## Introduction -AriaNg is a web frontend making [aria2](https://github.com/aria2/aria2) better. AriaNg is written in pure html & javascript, thus it does not need any compilers or runtime environment. You can just put AriaNg in your web server and open it in your browser. AriaNg uses responsive layout, and supports any desktop or mobile devices. +AriaNg is a web frontend making [aria2](https://github.com/aria2/aria2) easier to use. AriaNg is written in pure html & javascript, thus it does not need any compilers or runtime environment. You can just put AriaNg in your web server and open it in your browser. AriaNg uses responsive layout, and supports any desktop or mobile devices. ## Features 1. Pure Html & Javascript, no runtime required From a37c6623640a3b0c47ba77d5e382acbdac236e27 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 8 Jul 2017 00:06:21 +0800 Subject: [PATCH 103/120] support display bittorrent comment --- src/views/task-detail.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/task-detail.html b/src/views/task-detail.html index 931189f..91c9bde 100644 --- a/src/views/task-detail.html +++ b/src/views/task-detail.html @@ -28,7 +28,8 @@ Task Name
- +
From d7a9b38397dd01f049d2a8516d84b6aa10ebc19b Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 8 Jul 2017 00:32:22 +0800 Subject: [PATCH 104/120] task files supports ordering by index --- src/scripts/filters/fileOrderBy.js | 4 +++- src/scripts/services/aria2TaskService.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/scripts/filters/fileOrderBy.js b/src/scripts/filters/fileOrderBy.js index 7296fe7..56038c4 100644 --- a/src/scripts/filters/fileOrderBy.js +++ b/src/scripts/filters/fileOrderBy.js @@ -13,7 +13,9 @@ return array; } - if (orderType.type === 'name') { + if (orderType.type === 'index') { + return $filter('orderBy')(array, ['index'], orderType.reverse); + } else if (orderType.type === 'name') { return $filter('orderBy')(array, ['fileName'], orderType.reverse); } else if (orderType.type === 'size') { return $filter('orderBy')(array, ['length'], orderType.reverse); diff --git a/src/scripts/services/aria2TaskService.js b/src/scripts/services/aria2TaskService.js index 36513db..bb50f2e 100644 --- a/src/scripts/services/aria2TaskService.js +++ b/src/scripts/services/aria2TaskService.js @@ -159,6 +159,7 @@ for (var i = 0; i < task.files.length; i++) { var file = task.files[i]; + file.index = parseInt(file.index); file.fileName = getFileName(file); file.length = parseInt(file.length); file.selected = (file.selected === true || file.selected === 'true'); @@ -477,7 +478,7 @@ ariaNgLogService.warn('[aria2TaskService.restartTask] task file is null'); } - if (task.files.length != 1) { + if (task.files.length !== 1) { ariaNgLogService.warn('[aria2TaskService.restartTask] task file length is not equal 1'); } From b1b0187245f59cdf2a530e96fd2ab1b5ffc3ebb7 Mon Sep 17 00:00:00 2001 From: mayswind Date: Tue, 1 Aug 2017 22:36:46 +0800 Subject: [PATCH 105/120] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e79a5d..2f575b7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Lastest Release](https://img.shields.io/github/release/mayswind/AriaNg.svg?style=flat)](https://github.com/mayswind/AriaNg/releases) ## Introduction -AriaNg is a web frontend making [aria2](https://github.com/aria2/aria2) easier to use. AriaNg is written in pure html & javascript, thus it does not need any compilers or runtime environment. You can just put AriaNg in your web server and open it in your browser. AriaNg uses responsive layout, and supports any desktop or mobile devices. +AriaNg is a modern web frontend making [aria2](https://github.com/aria2/aria2) easier to use. AriaNg is written in pure html & javascript, thus it does not need any compilers or runtime environment. You can just put AriaNg in your web server and open it in your browser. AriaNg uses responsive layout, and supports any desktop or mobile devices. ## Features 1. Pure Html & Javascript, no runtime required From 7aae26f02b662eef0915a911e52b9d1cb71e6551 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Wed, 16 Aug 2017 21:41:39 +0800 Subject: [PATCH 106/120] modify display style of bittorrent tracker in task detail page --- src/views/task-detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/task-detail.html b/src/views/task-detail.html index 91c9bde..fcc5325 100644 --- a/src/views/task-detail.html +++ b/src/views/task-detail.html @@ -143,7 +143,7 @@ title="{{(context.collapseTrackers ? 'Expand' : 'Collapse') | translate}}">
-
From f03a3fb38d2464b1f59a82526659a17c47b4ec22 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 27 Aug 2017 22:07:02 +0800 Subject: [PATCH 107/120] modify protocol ssh to sftp --- src/views/new.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/new.html b/src/views/new.html index 50320e4..b1627d7 100644 --- a/src/views/new.html +++ b/src/views/new.html @@ -46,7 +46,7 @@ + ng-pattern="/^(\n?(((http|https|ftp|sftp):\/\/.+)|(magnet:\?.+)))*$/i">
From 8c735852c1014eced8a4f15ee83b53ea4eacff6d Mon Sep 17 00:00:00 2001 From: MaysWind Date: Tue, 29 Aug 2017 22:38:11 +0800 Subject: [PATCH 108/120] fix typo --- src/styles/core/extend.css | 4 ++-- src/views/settings-ariang.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/styles/core/extend.css b/src/styles/core/extend.css index 393d35b..f4e9e0c 100644 --- a/src/styles/core/extend.css +++ b/src/styles/core/extend.css @@ -38,11 +38,11 @@ } .input-group.input-group-multiple > .input-group-addon:first-child, -.input-group.input-group-multiple > .input-grougp-addon-container:first-child { +.input-group.input-group-multiple > .input-group-addon-container:first-child { border-left: 1px solid #d2d6de; } -.input-group .input-grougp-addon-container { +.input-group .input-group-addon-container { width: 1%; display: table-cell; } diff --git a/src/views/settings-ariang.html b/src/views/settings-ariang.html index 2445c78..d448178 100644 --- a/src/views/settings-ariang.html +++ b/src/views/settings-ariang.html @@ -157,11 +157,11 @@ : -
+
/ -
+
From 06a4b807b26dc71ef6ff11311cd543b0c8066337 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 2 Sep 2017 18:24:37 +0800 Subject: [PATCH 109/120] support show download url in task detail page --- src/langs/zh_Hans.txt | 1 + src/langs/zh_Hant.txt | 1 + src/scripts/config/defaultLanguage.js | 1 + src/scripts/services/aria2TaskService.js | 18 ++++++++++++++++++ src/views/task-detail.html | 8 ++++++++ 5 files changed, 29 insertions(+) diff --git a/src/langs/zh_Hans.txt b/src/langs/zh_Hans.txt index dc02666..61309df 100644 --- a/src/langs/zh_Hans.txt +++ b/src/langs/zh_Hans.txt @@ -84,6 +84,7 @@ Info Hash=特征值 Seeders=种子数 Connections=连接数 Seed Creation Time=种子创建时间 +Download Url=下载地址 Download Dir=下载路径 BT Tracker Servers=BT 服务器 (Choose Files)=(选择文件) diff --git a/src/langs/zh_Hant.txt b/src/langs/zh_Hant.txt index 05139de..8ec7105 100644 --- a/src/langs/zh_Hant.txt +++ b/src/langs/zh_Hant.txt @@ -84,6 +84,7 @@ Info Hash=特徵值 Seeders=種子數 Connections=連接數 Seed Creation Time=種子創建時間 +Download Url=下載地址 Download Dir=下載路徑 BT Tracker Servers=BT 伺服器 (Choose Files)=(選擇文件) diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 1cdcdfa..fbf23fe 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -88,6 +88,7 @@ 'Seeders': 'Seeders', 'Connections': 'Connections', 'Seed Creation Time': 'Seed Creation Time', + 'Download Url': 'Download Url', 'Download Dir': 'Download Dir', 'BT Tracker Servers': 'BT Tracker Servers', '(Choose Files)': '(Choose Files)', diff --git a/src/scripts/services/aria2TaskService.js b/src/scripts/services/aria2TaskService.js index bb50f2e..03cfb93 100644 --- a/src/scripts/services/aria2TaskService.js +++ b/src/scripts/services/aria2TaskService.js @@ -172,6 +172,24 @@ task.selectedFileCount = selectedFileCount; } + if (task.files && task.files.length === 1 && task.files[0].uris && task.files[0].uris[0]) { + var isSingleUrlTask = true; + var firstUri = task.files[0].uris[0].uri; + + for (var i = 0; i < task.files[0].uris.length; i++) { + var uri = task.files[0].uris[i].uri; + + if (uri !== firstUri) { + isSingleUrlTask = false; + break; + } + } + + if (isSingleUrlTask) { + task.singleUrl = firstUri; + } + } + return task; }; diff --git a/src/views/task-detail.html b/src/views/task-detail.html index fcc5325..5d412a7 100644 --- a/src/views/task-detail.html +++ b/src/views/task-detail.html @@ -125,6 +125,14 @@
+
+
+ Download Url +
+
+ +
+
Download Dir From 213b53f5ef122d7b60db814e782039e436be92d0 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 3 Sep 2017 15:34:25 +0800 Subject: [PATCH 110/120] modify style --- src/index.html | 2 +- src/styles/theme/default.css | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/index.html b/src/index.html index ffb4e02..218574f 100644 --- a/src/index.html +++ b/src/index.html @@ -46,7 +46,7 @@