瀏覽代碼

First 2 steps down.

master
John Shaver 6 年前
提交者 AJ ONeal
父節點
當前提交
1dc1cae50a
  1. 55
      app/index.html
  2. 31
      app/js/app.js
  3. 64
      app/styles/main.css

55
app/index.html

@ -41,10 +41,14 @@
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</g>
<g id="svg-download">
<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</g>
</defs>
</svg>
<div class="column-container wide">
<div class="column-row">
<div class="header-row column-row">
<div id="js-progress-bar" class="progress-bar">
<div class="progress-bar-step">
<div class="circle">
@ -160,26 +164,33 @@
</div>
<div class="js-acme-challenges">
<h2>Verify Domains &amp; Sub-Domains</h2>
<h3>Upload this file</h3>
<table class="js-acme-table-http-01">
<thead>
<tr>
<th>Hostname</th>
<th>File Location</th>
<th>File Contents</th>
</tr>
</thead>
<tbody>
<tr>
<td>example.com</td>
<td>.well-known/acme-challenge/xxx</td>
<td>sec.ret</td>
</tr>
</tbody>
</table>
<table class="js-acme-table-dns-01">
<div class="js-acme-verification-http-01">
<div class="http-verification-info">
<div class="file-ver-corner-fold"></div>
<div>
<div class="file-ver-info-header">FILENAME</div>
<div id="js-acme-ver-file-location">...loading</div>
</div>
<hr>
<div>
<div class="file-ver-info-header">CONTENTS</div>
<div id="js-acme-ver-content">...loading</div>
</div>
</div>
<div class="download-ver-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 id="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 id="js-acme-ver-uri" class="acme-ver-uri">..loading</div>
</div>
<table class="js-acme-verification-dns-01">
<thead>
<tr>
<th>Hostname</th>
@ -200,7 +211,7 @@
<div class="js-acme-wildcard">
<h2>Verify Wildcard Domains</h2>
<table class="js-acme-table-wildcard">
<table class="js-acme-verification-wildcard">
<thead>
<tr>
<th>Hostname</th>
@ -218,7 +229,7 @@
</table>
</div>
<button type="submit">Next</button>
<button class="button-next" type="submit">Next</button>
</form>
<!-- Step 4 Process Challanges -->

31
app/js/app.js

@ -62,14 +62,14 @@
$qsa('.js-acme-challenge-type'), function ($el) { return $el.checked; }
)[0];
console.log('ch type radio:', input.value);
$qs('.js-acme-table-wildcard').hidden = true;
$qs('.js-acme-table-http-01').hidden = true;
$qs('.js-acme-table-dns-01').hidden = true;
$qs('.js-acme-verification-wildcard').hidden = true;
$qs('.js-acme-verification-http-01').hidden = true;
$qs('.js-acme-verification-dns-01').hidden = true;
if (info.challenges.wildcard) {
$qs('.js-acme-table-wildcard').hidden = false;
$qs('.js-acme-verification-wildcard').hidden = false;
}
if (info.challenges[input.value]) {
$qs('.js-acme-table-' + input.value).hidden = false;
$qs('.js-acme-verification-' + input.value).hidden = false;
}
}
$qsa('.js-acme-challenge-type').forEach(function ($el) {
@ -107,7 +107,7 @@
steps[1].submit = function () {
info.identifiers = $qs('.js-acme-domains').value.split(/\s*,\s*/g).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; }
@ -216,19 +216,22 @@
console.log('claims:');
console.log(claims);
var obj = { 'dns-01': [], 'http-01': [], 'wildcard': [] };
info.challenges = obj;
var map = {
'http-01': '.js-acme-table-http-01'
, 'dns-01': '.js-acme-table-dns-01'
, 'wildcard': '.js-acme-table-wildcard'
'http-01': '.js-acme-verification-http-01'
, 'dns-01': '.js-acme-verification-dns-01'
, 'wildcard': '.js-acme-verification-wildcard'
}
/*
var tpls = {};
info.challenges = obj;
Object.keys(map).forEach(function (k) {
var sel = map[k] + ' tbody';
console.log(sel);
tpls[k] = $qs(sel).innerHTML;
$qs(map[k] + ' tbody').innerHTML = '';
});
*/
// TODO make Promise-friendly
return Promise.all(claims.map(function (claim) {
@ -265,6 +268,7 @@
if (claim.wildcard) {
obj.wildcard.push(data);
$qs(map.wildcard).innerHTML += '<tr><td>' + data.hostname + '</td><td>' + data.dnsHost + '</td><td>' + data.dnsAnswer + '</td></tr>';
} else if(obj[data.type]) {
@ -272,7 +276,12 @@
if ('dns-01' === data.type) {
$qs(map[data.type]).innerHTML += '<tr><td>' + data.hostname + '</td><td>' + data.dnsHost + '</td><td>' + data.dnsAnswer + '</td></tr>';
} else if ('http-01' === data.type) {
$qs(map[data.type]).innerHTML += '<tr><td>' + data.hostname + '</td><td>' + data.httpPath + '</td><td>' + data.httpAuth + '</td></tr>';
$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 =
"data:text/octet-stream;base64," + window.btoa(data.httpAuth);
$qs("#js-download-verify-link").download = data.httpPath.split("/").slice(-1);
}
}

64
app/styles/main.css

@ -11,6 +11,7 @@
.progress-bar {
height: 0;
border: solid 1px #5bc17f;
background-color: #5bc17f;
display: flex;
justify-content: space-between;
align-items: center;
@ -31,7 +32,7 @@
margin-top: 4.277777778em;
}
.column-row {
.header-row {
text-align: center;
}
@ -97,12 +98,13 @@ input[type=email], input[type=text] {
font-size: 1em;
padding: 0.444444444em 0.888889em;
width: 100%;
border: solid 1px #d9d9d9;
border-radius: 2px;
}
.checkbox-array {
display: flex;
flex-direction: column;
align-items: start;
padding: 1em 0;
}
@ -135,7 +137,6 @@ input[type=email], input[type=text] {
.checkbox-array label {
display: flex;
align-items: center;
height: 1.333333333em;
font-size: 0.833333333em;
margin: 0.4em 0;
@ -147,7 +148,6 @@ a {
.email-usage {
color: #666666;
text-align: start;
font-size: 0.833333333em;
margin: 2em 0;
}
@ -170,6 +170,7 @@ a {
.tabbed-selector {
display: flex;
font-weight: bold;
text-align: center;
}
.tabbed-selector input[type=radio] {
@ -178,4 +179,59 @@ a {
table.js-acme-table-http-01, table.js-acme-table-dns-01 {
margin-left: -14em;
}
.download-ver-file svg {
fill: #5bc17f;
width: 1.333333333em;
}
.download-ver-file a {
color: #5bc17f;
}
.download-ver-file {
}
.mdicon {
position: relative;
top: 0.4em;
}
.http-verification-info {
background: #f7f7f7;
position: relative;
font-size: 0.833333333em;
padding: 1.6em 6.933333333em 1.6em 1.6em;
word-break: break-all;
text-align: start;
}
.file-ver-corner-fold {
position: absolute;
width: 2em;
height: 2em;
border-left: solid #d9d9d9 1px;
border-bottom: solid #d9d9d9 1px;
right: 0;
top: 0;
background: linear-gradient(45deg, #f7f7f7 0%,#f7f7f7 50%,#ffffff 50%,#ffffff 100%);
}
.file-ver-info-header {
color: #808080;
}
.http-verification-info hr {
border: none;
border-bottom: solid 1px #d9d9d9;
}
.acme-ver-uri {
word-break: break-all;
margin: auto;
}
h1 {
text-align: center;
}
載入中…
取消
儲存