3
3
4
4
5
5
< h2 class ="tls-title "> {{.Cert.CommonName}}</ h2 >
6
-
7
6
< div class ="tls-page ">
8
7
< div class ="row ">
9
8
< div class ="col-12 order-md-1 ">
@@ -101,7 +100,24 @@ <h6>
101
100
102
101
</ div >
103
102
</ 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 >
105
121
</ div >
106
122
</ div >
107
123
< script >
@@ -119,6 +135,17 @@ <h6>
119
135
console . log ( "There was an error trying to copy to the users clipboard." ) ;
120
136
} ) ;
121
137
} ) ;
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
+
122
149
}
123
150
124
151
</ script >
0 commit comments