-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added custom headers support for Aria2 RPC HTTP(s) requests #638
Conversation
@@ -66,6 +66,18 @@ | |||
requestContext.url = getUrlWithQueryString(requestContext.url, context.requestBody); | |||
} | |||
|
|||
var options = ariaNgStorageService.get(ariaNgConstants.optionStorageKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not import ariaNgStorageService
into this service, because ariaNgSettingService
is the unique interface for other service/controller getting/setting option value. You should put a method like getCurrentRpcHttpRequestHeaders
into ariaNgSettingService
, this method should return a array containing all request headers. I think you can refer to getCurrentRpcUrl
or getCurrentRpcDisplayName
method.
By the way, I think you should also put a default option value (maybe a empty string ""
) into scripts/config/constants.js
@@ -66,6 +66,18 @@ | |||
requestContext.url = getUrlWithQueryString(requestContext.url, context.requestBody); | |||
} | |||
|
|||
var options = ariaNgStorageService.get(ariaNgConstants.optionStorageKey); | |||
if (options.httpHeader) { | |||
var lines = options.httpHeader.split("\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use single quotes
another commit has been committed, so this pr would be closed |
Could you please provide the commit number you mentioned? |
|
This PR will add a "Aria2 RPC Http Request Header" option in AriaNg settings, which allows users to customize the headers of each RPC HTTP request.
Some users use the Cloudflare Access service to block others from illegally accessing their NAS at home, thereby improving the security of the home network. That service usually requires users to log in with OAuth for authentication. For automation or CI programs, users can also add specific headers(
CF-Access-Client-Id
andCF-Access-Client-Secret
) to the http request to pass the verification of Cloudflare.So this PR will benefit users similar to the above scenarios.