mirror of
https://github.com/certd/certd.git
synced 2026-04-26 22:07:29 +08:00
feat: 支持google证书申请(需要使用代理)
This commit is contained in:
@@ -18,6 +18,21 @@ class AcmeApi {
|
||||
this.accountUrl = accountUrl;
|
||||
}
|
||||
|
||||
getLocationFromHeader(resp) {
|
||||
let locationUrl = resp.headers.location;
|
||||
const mapping = this.http.urlMapping;
|
||||
if (mapping.mappings) {
|
||||
// eslint-disable-next-line guard-for-in,no-restricted-syntax
|
||||
for (const key in mapping.mappings) {
|
||||
const url = mapping.mappings[key];
|
||||
if (locationUrl.indexOf(url) > -1) {
|
||||
locationUrl = locationUrl.replace(url, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return locationUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get account URL
|
||||
*
|
||||
@@ -104,17 +119,7 @@ class AcmeApi {
|
||||
|
||||
/* Set account URL */
|
||||
if (resp.headers.location) {
|
||||
this.accountUrl = resp.headers.location;
|
||||
const mapping = this.http.urlMapping;
|
||||
if (mapping.mappings) {
|
||||
// eslint-disable-next-line guard-for-in,no-restricted-syntax
|
||||
for (const key in mapping.mappings) {
|
||||
const url = mapping.mappings[key];
|
||||
if (this.accountUrl.indexOf(url) > -1) {
|
||||
this.accountUrl = this.accountUrl.replace(url, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.accountUrl = this.getLocationFromHeader(resp);
|
||||
}
|
||||
|
||||
return resp;
|
||||
|
||||
Reference in New Issue
Block a user