Ver a proveniência

multiple domains

master
AJ ONeal há 5 anos
ascendente
cometimento
5a229ef27f
  1. 79
      app/index.html
  2. 48
      app/js/greenlock.js

79
app/index.html

@ -151,7 +151,7 @@
<br>
<br>
-->
<button class="button-next" type="submit">Next</button>
<button class="button-next js-account-next" type="submit">Next</button>
<div class="email-usage">
Why do we need your email?
We link your SSL certificates to the email you use so that you'll
@ -177,52 +177,59 @@
<div></div>
</label>
</div>
<div>
<div class="js-acme-verification-http-01">
<h3>Upload this file</h3>
<div class="http-verification-info file-preview">
<div class="paper-fold"></div>
<div>
<div class="file-ver-info-header">FILENAME</div>
<pre class="js-acme-ver-file-location">...loading</pre>
</div>
<hr>
<div>
<div class="file-ver-info-header">CONTENTS</div>
<pre class="js-acme-ver-content">...loading</pre>
<h3>Upload each file</h3>
<div class="js-acme-http">
<div class="http-verification-info file-preview">
<div class="paper-fold"></div>
<div>
<div class="file-ver-info-header">FILENAME</div>
<pre class="js-acme-ver-file-location">...loading</pre>
</div>
<hr>
<div>
<div class="file-ver-info-header">CONTENTS</div>
<pre class="js-acme-ver-content">...loading</pre>
</div>
<div class="download-file">
<svg class="mdicon icon-download" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<use xlink:href="#svg-download"></use>
</svg>
<a class="js-download-verify-link" href="data:text/octet-stream;base64,SGVsbG8gV29ybGQuLi4=" download="hello.txt" target="_blank">
Download
</a>
</div>
<hr>
<div>
<div class="file-ver-info-header">LOCATION</div>
<pre class="js-acme-ver-uri">..loading</pre>
</div>
</div>
<br>
</div>
<div class="download-file">
<svg class="mdicon icon-download" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<use xlink:href="#svg-download"></use>
</svg>
<a class="js-download-verify-link" href="data:text/octet-stream;base64,SGVsbG8gV29ybGQuLi4=" download="hello.txt" target="_blank">
Download
</a>
</div>
<h3>To this location</h3>
<div class="js-acme-ver-uri" class="acme-ver-uri">..loading</div>
</div>
<div class="js-acme-verification-dns-01">
<h3>Set this DNS Record</h3>
<div class="acme-ver-dns-label">Hostname</div>
<div class="js-acme-ver-hostname">loading...</div>
<div class="acme-ver-dns-label">TXT Host</div>
<div class="js-acme-ver-txt-host">loading...</div>
<div class="acme-ver-dns-label">TXT Value</div>
<div class="js-acme-ver-txt-value">loading...</div>
<h3>Set each DNS Record</h3>
<div class="js-acme-dns">
<div class="acme-ver-dns-label">TXT Host</div>
<div class="js-acme-ver-txt-host">loading...</div>
<div class="acme-ver-dns-label">TXT Value</div>
<div class="js-acme-ver-txt-value">loading...</div>
<br>
</div>
</div>
</div>
<div class="js-acme-wildcard-challenges">
<div class="js-acme-wildcard">
<div class="js-acme-verification-wildcard">
<h3>Set this DNS Record</h3>
<div class="acme-ver-dns-label">Hostname</div>
<div class="js-acme-ver-hostname">loading...</div>
<div class="js-acme-verification-wildcard">
<h3>Set each DNS Record (for wildcards)</h3>
<div class="js-acme-wildcard">
<div class="acme-ver-dns-label">TXT Host</div>
<div class="js-acme-ver-txt-host">loading...</div>
<div class="acme-ver-dns-label">TXT Value</div>
<div class="js-acme-ver-txt-value">loading...</div>
<br>
</div>
</div>
</div>
@ -291,7 +298,7 @@
</div>
<div>
<h3>node.js https server example</h3>
<pre><code>'use strict';
<pre><code> 'use strict';
var https = require('https');
var server = https.createServer({

48
app/js/greenlock.js

@ -226,7 +226,7 @@
info.domains = $qs('.js-acme-domains').value.replace(/https?:\/\//g, ' ').replace(/[,+]/g, ' ').trim().split(/\s+/g);
info.identifiers = info.domains.map(function (hostname) {
return { type: 'dns', value: hostname.toLowerCase().trim() };
}).slice(0,1); //Disable multiple values for now. We'll just take the first and work with it.
});
info.identifiers.sort(function (a, b) {
if (a === b) { return 0; }
if (a < b) { return 1; }
@ -255,6 +255,8 @@
info.agree = $qs('.js-acme-account-tos').checked;
//info.greenlockAgree = $qs('.js-gl-tos').checked;
info.domains = info.identifiers.map(function (ident) { return ident.value; });
console.log("domains:");
console.log(info.domains);
// TODO ping with version and account creation
setTimeout(saveContact, 100, email, info.domains);
@ -267,6 +269,8 @@
}
}
$qs('.js-account-next').disabled = true;
return getAccountKeypair(email).then(function (jwk) {
// TODO save account id rather than always retrieving it?
return acme.accounts.create({
@ -313,6 +317,15 @@
, 'wildcard': '.js-acme-verification-wildcard'
};
*/
var $httpList = $qs('.js-acme-http');
var $dnsList = $qs('.js-acme-dns');
var $wildList = $qs('.js-acme-wildcard');
var httpTpl = $httpList.innerHTML;
var dnsTpl = $dnsList.innerHTML;
var wildTpl = $wildList.innerHTML;
$httpList.innerHTML = '';
$dnsList.innerHTML = '';
$wildList.innerHTML = '';
claims.forEach(function (claim) {
console.log("Challenge (claim):");
@ -339,30 +352,33 @@
console.log(data);
console.log('');
var verification;
var verification = document.createElement("div");
if (claim.wildcard) {
obj.wildcard.push(data);
verification = $qs(".js-acme-verification-wildcard");
verification.querySelector(".js-acme-ver-hostname").innerHTML = data.hostname;
verification.innerHTML = wildTpl;
//verification.querySelector(".js-acme-ver-hostname").innerHTML = data.hostname;
verification.querySelector(".js-acme-ver-txt-host").innerHTML = data.dnsHost;
verification.querySelector(".js-acme-ver-txt-value").innerHTML = data.dnsAnswer;
$wildList.appendChild(verification);
} else if(obj[data.type]) {
obj[data.type].push(data);
if ('dns-01' === data.type) {
verification = $qs(".js-acme-verification-dns-01");
verification.querySelector(".js-acme-ver-hostname").innerHTML = data.hostname;
verification.innerHTML = dnsTpl;
//verification.querySelector(".js-acme-ver-hostname").innerHTML = data.hostname;
verification.querySelector(".js-acme-ver-txt-host").innerHTML = data.dnsHost;
verification.querySelector(".js-acme-ver-txt-value").innerHTML = data.dnsAnswer;
$dnsList.appendChild(verification);
} else if ('http-01' === data.type) {
$qs(".js-acme-ver-file-location").innerHTML = data.httpPath.split("/").slice(-1);
$qs(".js-acme-ver-content").innerHTML = data.httpAuth;
$qs(".js-acme-ver-uri").innerHTML = data.httpPath;
$qs(".js-download-verify-link").href =
verification.innerHTML = httpTpl;
verification.querySelector(".js-acme-ver-file-location").innerHTML = data.httpPath.split("/").slice(-1);
verification.querySelector(".js-acme-ver-content").innerHTML = data.httpAuth;
verification.querySelector(".js-acme-ver-uri").innerHTML = data.httpPath;
verification.querySelector(".js-download-verify-link").href =
"data:text/octet-stream;base64," + window.btoa(data.httpAuth);
$qs(".js-download-verify-link").download = data.httpPath.split("/").slice(-1);
verification.querySelector(".js-download-verify-link").download = data.httpPath.split("/").slice(-1);
$httpList.appendChild(verification);
}
}
});
@ -455,9 +471,6 @@
$qs('.js-acme-form-download').hidden = false;
};
// The kickoff
steps[1]();
var params = new URLSearchParams(window.location.search);
var apiType = params.get('acme-api-type') || "staging-v02";
@ -479,7 +492,7 @@
$el.addEventListener('change', updateChallengeType);
});
if(params.has('acme-domains')) {
if (params.has('acme-domains')) {
console.log("acme-domains param: ", params.get('acme-domains'));
$qs('.js-acme-domains').value = params.get('acme-domains');
@ -496,6 +509,9 @@
$qs('body').hidden = false;
// The kickoff
steps[1]();
return testKeypairSupport().then(function (rsaSupport) {
if (rsaSupport) {
return true;

Carregando…
Cancelar
Guardar