feat: 支持google证书申请(需要使用代理)

This commit is contained in:
xiaojunnuo
2024-08-25 02:59:49 +08:00
parent 22a336370a
commit a593056e79
4 changed files with 26 additions and 14 deletions
+16 -11
View File
@@ -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;