Fix join path
This commit is contained in:
parent
fca036f7e3
commit
a5e3f99ecf
3 changed files with 4 additions and 7 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const http = require('http')
|
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const {
|
const {
|
||||||
promisify
|
promisify
|
||||||
|
|
@ -105,16 +104,12 @@ class Client {
|
||||||
challenge
|
challenge
|
||||||
} = await this.authz(authzUrls[0])
|
} = await this.authz(authzUrls[0])
|
||||||
|
|
||||||
console.log('step 1');
|
|
||||||
await this.completeChallenge(challenge)
|
await this.completeChallenge(challenge)
|
||||||
console.log('step 2');
|
|
||||||
await this.pollAuthz(authzUrls[0])
|
await this.pollAuthz(authzUrls[0])
|
||||||
console.log('step 3');
|
|
||||||
const {
|
const {
|
||||||
certificate,
|
certificate,
|
||||||
privateKeyData
|
privateKeyData
|
||||||
} = await this.finalizeOrder(finalizeUrl, domain, email)
|
} = await this.finalizeOrder(finalizeUrl, domain, email)
|
||||||
console.log('step 4');
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
certificate,
|
certificate,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ const {
|
||||||
const {
|
const {
|
||||||
findTxtRecord
|
findTxtRecord
|
||||||
} = require('./util');
|
} = require('./util');
|
||||||
|
const combineURLs = require('axios/lib/helpers/combineURLs');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object<string, {expire: number, expand: boolean, url: string}>}
|
* @type {Object<string, {expire: number, expand: boolean, url: string}>}
|
||||||
|
|
@ -36,6 +37,7 @@ const listener = async function (/** @type {import('http').IncomingMessage} */ r
|
||||||
if (req.url.startsWith(acme_prefix)) {
|
if (req.url.startsWith(acme_prefix)) {
|
||||||
if (client.challengeCallbacks) {
|
if (client.challengeCallbacks) {
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
|
// This is important :)
|
||||||
'content-type': 'application/octet-stream'
|
'content-type': 'application/octet-stream'
|
||||||
});
|
});
|
||||||
res.write(client.challengeCallbacks());
|
res.write(client.challengeCallbacks());
|
||||||
|
|
@ -51,7 +53,7 @@ const listener = async function (/** @type {import('http').IncomingMessage} */ r
|
||||||
resolveCache[req.headers.host] = cache;
|
resolveCache[req.headers.host] = cache;
|
||||||
}
|
}
|
||||||
res.writeHead(301, {
|
res.writeHead(301, {
|
||||||
'Location': cache.expand ? path.join(cache.url, req.url) : cache.url,
|
'Location': cache.expand ? combineURLs(cache.url, req.url) : cache.url,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const {
|
||||||
const { default: AwaitLock } = require('await-lock');
|
const { default: AwaitLock } = require('await-lock');
|
||||||
const record_email_prefix = 'forward-domain-cert-maintainer=';
|
const record_email_prefix = 'forward-domain-cert-maintainer=';
|
||||||
const client = new certnode.Client();
|
const client = new certnode.Client();
|
||||||
const certsDir = path.join(__dirname, '.certs');
|
const certsDir = path.join(__dirname, '../.certs');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object<string, {cert: any, key: any, expire: number}>}
|
* @type {Object<string, {cert: any, key: any, expire: number}>}
|
||||||
|
|
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue