diff --git a/src/langs/zh_CN.json b/src/langs/zh_CN.json index 6013eef..820ce56 100644 --- a/src/langs/zh_CN.json +++ b/src/langs/zh_CN.json @@ -151,7 +151,7 @@ }, "rpc": { "error": { - "Unauthorized": "认证失败!" + "unauthorized": "认证失败!" } }, "options": { diff --git a/src/scripts/config/aria2RpcConstants.js b/src/scripts/config/aria2RpcConstants.js index ad1e901..a5dac95 100644 --- a/src/scripts/config/aria2RpcConstants.js +++ b/src/scripts/config/aria2RpcConstants.js @@ -8,7 +8,8 @@ rpcTokenPrefix: 'token:' }).constant('aria2RpcErrors', { Unauthorized: { - message: 'Unauthorized' + message: 'Unauthorized', + tipTextKey: 'rpc.error.unauthorized' } }); })(); diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index a115e00..ca5622b 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -155,7 +155,7 @@ }, 'rpc': { 'error': { - 'Unauthorized': 'Authorization Failed!' + 'unauthorized': 'Authorization Failed!' } }, 'options': { diff --git a/src/scripts/services/aria2RpcService.js b/src/scripts/services/aria2RpcService.js index a835e0a..72c6f5d 100644 --- a/src/scripts/services/aria2RpcService.js +++ b/src/scripts/services/aria2RpcService.js @@ -71,8 +71,8 @@ return false; } - if (error.message == aria2RpcErrors.Unauthorized.message) { - ariaNgCommonService.showError('rpc.error.' + error.message); + if (aria2RpcErrors[error.message] && aria2RpcErrors[error.message].tipTextKey) { + ariaNgCommonService.showError(aria2RpcErrors[error.message].tipTextKey); return true; } else { ariaNgCommonService.showError(error.message);