Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

JerryLocke
Copy link

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 and CF-Access-Client-Secret) to the http request to pass the verification of Cloudflare.

So this PR will benefit users similar to the above scenarios.

@mayswind mayswind self-requested a review January 6, 2022 02:56
@@ -66,6 +66,18 @@
requestContext.url = getUrlWithQueryString(requestContext.url, context.requestBody);
}

var options = ariaNgStorageService.get(ariaNgConstants.optionStorageKey);
Copy link
Owner

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");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use single quotes

@mayswind
Copy link
Owner

another commit has been committed, so this pr would be closed

@mayswind mayswind closed this Nov 14, 2022
@limuyuan
Copy link

another commit has been committed, so this pr would be closed

Could you please provide the commit number you mentioned?
I'm also doing the same thing (Using Cloudflare Access to access my home NAS), and I really wanted to know the steps.

@mayswind
Copy link
Owner

another commit has been committed, so this pr would be closed

Could you please provide the commit number you mentioned? I'm also doing the same thing (Using Cloudflare Access to access my home NAS), and I really wanted to know the steps.

7aa3816

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants