diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index a0aa52a..5e46e9a 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -7,6 +7,9 @@ Confirm=确认 Cancel=取消 True=是 False=否 +Connecting=连接中 +Connected=已连接 +Not Connected=未连接 Global=全局 RPC=RPC New=新建 @@ -116,6 +119,7 @@ Aria2 RPC Host=Aria2 RPC 主机 Aria2 RPC Port=Aria2 RPC 端口 Aria2 RPC Protocol=Aria2 RPC 协议 Aria2 RPC Secret Token=Aria2 RPC 密钥 +Aria2 RPC Address=Aria2 RPC 地址 Global Stat Refresh Interval=全局状态刷新间隔 Download Task Refresh Interval=下载任务刷新间隔 Supported Placeholder: AriaNg Title ${title}, Downloading Count ${downloading}, Waiting Count ${waiting}, Stopped Count ${stopped}, Download Speed ${downspeed}, Upload Speed ${upspeed}.=支持的占位符: AriaNg 标题 ${title}, 正在下载数量 ${downloading}, 正在等待数量 ${waiting}, 已停止数量 ${stopped}, 下载速度 ${downspeed}, 上传速度: ${upspeed}. diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index a6837e0..63e4738 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -11,6 +11,9 @@ 'Cancel': 'Cancel', 'True': 'True', 'False': 'False', + 'Connecting': 'Connecting', + 'Connected': 'Connected', + 'Not Connected': 'Not Connected', 'Global': 'Global', 'RPC': 'RPC', 'New': 'New', @@ -120,6 +123,7 @@ 'Aria2 RPC Port': 'Aria2 RPC Port', 'Aria2 RPC Protocol': 'Aria2 RPC Protocol', 'Aria2 RPC Secret Token': 'Aria2 RPC Secret Token', + 'Aria2 RPC Address': 'Aria2 RPC Address', 'Global Stat Refresh Interval': 'Global Stat Refresh Interval', 'Download Task Refresh Interval': 'Download Task Refresh Interval', 'Supported Placeholder: AriaNg Title ${title}, Downloading Count ${downloading}, Waiting Count ${waiting}, Stopped Count ${stopped}, Download Speed ${downspeed}, Upload Speed ${upspeed}.': 'Supported Placeholder: AriaNg Title ${title}, Downloading Count ${downloading}, Waiting Count ${waiting}, Stopped Count ${stopped}, Download Speed ${downspeed}, Upload Speed ${upspeed}.', diff --git a/src/scripts/controllers/status.js b/src/scripts/controllers/status.js index ca6d7cf..6b6dcd9 100644 --- a/src/scripts/controllers/status.js +++ b/src/scripts/controllers/status.js @@ -1,9 +1,11 @@ (function () { 'use strict'; - angular.module('ariaNg').controller('Aria2StatusController', ['$rootScope', '$scope', 'ariaNgCommonService', 'aria2SettingService', function ($rootScope, $scope, ariaNgCommonService, aria2SettingService) { + angular.module('ariaNg').controller('Aria2StatusController', ['$rootScope', '$scope', 'ariaNgCommonService', 'ariaNgSettingService', 'aria2SettingService', function ($rootScope, $scope, ariaNgCommonService, ariaNgSettingService, aria2SettingService) { $scope.context = { - aria2Status: null + host: ariaNgSettingService.getJsonRpcUrl(), + status: 'Connecting', + serverStatus: null }; $scope.saveSession = function () { @@ -27,7 +29,10 @@ $rootScope.loadPromise = (function () { return aria2SettingService.getAria2Status(function (response) { if (response.success) { - $scope.context.aria2Status = response.data; + $scope.context.status = 'Connected'; + $scope.context.serverStatus = response.data; + } else { + $scope.context.status = 'Not Connected'; } }); })(); diff --git a/src/scripts/services/aria2HttpRpcService.js b/src/scripts/services/aria2HttpRpcService.js index 3283ab1..a5763b7 100644 --- a/src/scripts/services/aria2HttpRpcService.js +++ b/src/scripts/services/aria2HttpRpcService.js @@ -16,7 +16,7 @@ data: context.requestBody }; - return $http(requestContext).success(function (data, header, config, status) { + return $http(requestContext).success(function (data) { if (!data) { return; } @@ -24,9 +24,16 @@ if (context.successCallback) { context.successCallback(data.id, data.result); } - }).error(function (data, header, config, status) { + }).error(function (data) { if (!data) { - return; + data = { + id: '-1', + error: { + // code: '-1', + // message: 'Unknown Error', + innerError: true + } + }; } if (context.errorCallback) { diff --git a/src/views/status.html b/src/views/status.html index 24dcc4c..853f289 100644 --- a/src/views/status.html +++ b/src/views/status.html @@ -2,21 +2,38 @@