mirror of https://github.com/certd/certd
feat: 支持google证书申请(需要使用代理)
parent
22a336370a
commit
a593056e79
|
@ -18,6 +18,21 @@ class AcmeApi {
|
||||||
this.accountUrl = accountUrl;
|
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
|
* Get account URL
|
||||||
*
|
*
|
||||||
|
@ -104,17 +119,7 @@ class AcmeApi {
|
||||||
|
|
||||||
/* Set account URL */
|
/* Set account URL */
|
||||||
if (resp.headers.location) {
|
if (resp.headers.location) {
|
||||||
this.accountUrl = resp.headers.location;
|
this.accountUrl = this.getLocationFromHeader(resp);
|
||||||
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;
|
||||||
|
|
|
@ -300,7 +300,8 @@ class AcmeClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add URL to response */
|
/* Add URL to response */
|
||||||
resp.data.url = resp.headers.location;
|
resp.data.url = this.api.getLocationFromHeader(resp);
|
||||||
|
|
||||||
return resp.data;
|
return resp.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ export class Executor {
|
||||||
contextFactory: ContextFactory;
|
contextFactory: ContextFactory;
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
pipelineContext!: IContext;
|
pipelineContext!: IContext;
|
||||||
|
currentStatusMap!: RunnableCollection;
|
||||||
lastStatusMap!: RunnableCollection;
|
lastStatusMap!: RunnableCollection;
|
||||||
lastRuntime!: RunHistory;
|
lastRuntime!: RunHistory;
|
||||||
options: ExecutorOptions;
|
options: ExecutorOptions;
|
||||||
|
@ -52,6 +53,7 @@ export class Executor {
|
||||||
const lastRuntime = await this.pipelineContext.getObj(`lastRuntime`);
|
const lastRuntime = await this.pipelineContext.getObj(`lastRuntime`);
|
||||||
this.lastRuntime = lastRuntime;
|
this.lastRuntime = lastRuntime;
|
||||||
this.lastStatusMap = new RunnableCollection(lastRuntime?.pipeline);
|
this.lastStatusMap = new RunnableCollection(lastRuntime?.pipeline);
|
||||||
|
this.currentStatusMap = new RunnableCollection(this.pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
async cancel() {
|
async cancel() {
|
||||||
|
@ -206,7 +208,7 @@ export class Executor {
|
||||||
|
|
||||||
private async runStep(step: Step) {
|
private async runStep(step: Step) {
|
||||||
const currentLogger = this.runtime._loggers[step.id];
|
const currentLogger = this.runtime._loggers[step.id];
|
||||||
|
this.currentStatusMap.add(step);
|
||||||
const lastStatus = this.lastStatusMap.get(step.id);
|
const lastStatus = this.lastStatusMap.get(step.id);
|
||||||
//执行任务
|
//执行任务
|
||||||
const plugin: RegistryItem<AbstractTaskPlugin> = pluginRegistry.get(step.type);
|
const plugin: RegistryItem<AbstractTaskPlugin> = pluginRegistry.get(step.type);
|
||||||
|
@ -224,7 +226,7 @@ export class Executor {
|
||||||
const arr = contextKey.split(".");
|
const arr = contextKey.split(".");
|
||||||
const id = arr[1];
|
const id = arr[1];
|
||||||
const outputKey = arr[2];
|
const outputKey = arr[2];
|
||||||
step.input[key] = this.lastStatusMap.get(id)?.status?.output[outputKey];
|
step.input[key] = this.currentStatusMap.get(id)?.status?.output[outputKey] ?? this.lastStatusMap.get(id)?.status?.output[outputKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -165,4 +165,8 @@ export class RunnableCollection {
|
||||||
item.status = undefined;
|
item.status = undefined;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add(runnable: Runnable) {
|
||||||
|
this.collection[runnable.id] = runnable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue