Merge remote-tracking branch 'origin/acme_sync' into v2

# Conflicts:
#	packages/core/acme-client/package.json
#	packages/core/acme-client/src/auto.js
#	packages/core/acme-client/src/axios.js
#	packages/core/acme-client/src/http.js
This commit is contained in:
xiaojunnuo
2024-07-01 23:09:57 +08:00
39 changed files with 262 additions and 503 deletions
+3 -9
View File
@@ -14,10 +14,9 @@ const defaultOpts = {
skipChallengeVerification: false,
challengePriority: ['http-01', 'dns-01'],
challengeCreateFn: async () => { throw new Error('Missing challengeCreateFn()'); },
challengeRemoveFn: async () => { throw new Error('Missing challengeRemoveFn()'); }
challengeRemoveFn: async () => { throw new Error('Missing challengeRemoveFn()'); },
};
/**
* ACME client auto mode
*
@@ -26,8 +25,8 @@ const defaultOpts = {
* @returns {Promise<buffer>} Certificate
*/
module.exports = async function(client, userOpts) {
const opts = Object.assign({}, defaultOpts, userOpts);
module.exports = async (client, userOpts) => {
const opts = { ...defaultOpts, ...userOpts };
const accountPayload = { termsOfServiceAgreed: opts.termsOfServiceAgreed };
if (!Buffer.isBuffer(opts.csr)) {
@@ -38,7 +37,6 @@ module.exports = async function(client, userOpts) {
accountPayload.contact = [`mailto:${opts.email}`];
}
/**
* Register account
*/
@@ -54,7 +52,6 @@ module.exports = async function(client, userOpts) {
await client.createAccount(accountPayload);
}
/**
* Parse domains from CSR
*/
@@ -65,7 +62,6 @@ module.exports = async function(client, userOpts) {
log(`[auto] Resolved ${uniqueDomains.length} unique domains from parsing the Certificate Signing Request`);
/**
* Place order
*/
@@ -77,7 +73,6 @@ module.exports = async function(client, userOpts) {
log(`[auto] Placed certificate order successfully, received ${authorizations.length} identity authorizations`);
/**
* Resolve and satisfy challenges
*/
@@ -196,7 +191,6 @@ module.exports = async function(client, userOpts) {
return Promise.all(results);
}
try {
log('开始challenge');
await runPromisePa(challengePromises);