Skip to content

Commit 36ac88f

Browse files
authored
Merge pull request #97 from ImageWare/debus/cert_one_liner
Add example curl commands for getting cert and private key
2 parents 2ad4566 + d08c740 commit 36ac88f

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

ui/templates/view_certificate.html

+29-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44

55
<h2 class="tls-title">{{.Cert.CommonName}}</h2>
6-
76
<div class="tls-page">
87
<div class="row">
98
<div class="col-12 order-md-1">
@@ -101,7 +100,24 @@ <h6>
101100

102101
</div>
103102
</div>
104-
103+
<div class="row border-top">
104+
<div class="col-12 pt-2">
105+
<h6 class="float-left" >
106+
<label class="text-muted font-weight-normal">Get private key shell script:</label><p></p>
107+
<code><pre><samp id="curl-command-elem"></samp></pre></code>
108+
<a class="clip-copy" id="curl-command-elem-clicky" data-copy-source="#curl-command-elem" href="#" class="float-right text-decoration-none">Copy command</a>
109+
</h6>
110+
</div>
111+
</div>
112+
<div class="row border-top">
113+
<div class="col-12 pt-2">
114+
<h6 class="float-left" >
115+
<label class="text-muted font-weight-normal">Get cert shell script:</label><p></p>
116+
<code><pre><samp id="cert-curl-command-elem"></samp></pre></code>
117+
<a class="clip-copy" data-copy-source="#cert-curl-command-elem" href="#" class="float-right text-decoration-none">Copy command</a>
118+
</h6>
119+
</div>
120+
</div>
105121
</div>
106122
</div>
107123
<script>
@@ -119,6 +135,17 @@ <h6>
119135
console.log("There was an error trying to copy to the users clipboard.");
120136
});
121137
});
138+
//Store the id in a variable because when we use {{.Cert.ID}} in the string directly it gets surrounded by double quotes for some reason
139+
var id = "{{.Cert.ID}}";
140+
141+
$("#curl-command-elem").html(`curl ${window.location.origin}/api/certificate/${id}/privkey -H"Authorization: Secret {{ .Cert.Secret }}"`);
142+
$("#cert-curl-command-elem").html(`curl ${window.location.origin}/api/certificate/${id}/cert`);
143+
144+
145+
$(".clip-copy").click(function(e){
146+
navigator.clipboard.writeText($(e.target.attributes.getNamedItem("data-copy-source").value).html());
147+
})
148+
122149
}
123150

124151
</script>

0 commit comments

Comments
 (0)