mirror of https://github.com/certd/certd
fix: 修复使用代理的情况下申请证书失败的bug
parent
ab7a1673ff
commit
95122e2860
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const util = require('./util');
|
const util = require('./util');
|
||||||
|
const { log } = require('./logger');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AcmeApi
|
* AcmeApi
|
||||||
|
@ -104,6 +105,16 @@ class AcmeApi {
|
||||||
/* Set account URL */
|
/* Set account URL */
|
||||||
if (resp.headers.location) {
|
if (resp.headers.location) {
|
||||||
this.accountUrl = 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
|
|
|
@ -43,7 +43,11 @@ export class AcmeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAccountConfig(email: string): Promise<any> {
|
async getAccountConfig(email: string): Promise<any> {
|
||||||
return (await this.userContext.getObj(this.buildAccountKey(email))) || {};
|
const conf = (await this.userContext.getObj(this.buildAccountKey(email))) || {};
|
||||||
|
if (conf.accountUrl?.indexOf("letsencrypt.proxy.handsfree.work")) {
|
||||||
|
conf.accountUrl = conf.accountUrl.replace("letsencrypt.proxy.handsfree.work", "acme-v02.api.letsencrypt.org");
|
||||||
|
}
|
||||||
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildAccountKey(email: string) {
|
buildAccountKey(email: string) {
|
||||||
|
|
Loading…
Reference in New Issue