upd: add download tag and target tag to HTML links
authorINOPIAE <m.maengel@inopiae.de>
Fri, 10 Apr 2020 02:38:54 +0000 (04:38 +0200)
committerINOPIAE <m.maengel@inopiae.de>
Fri, 10 Apr 2020 09:49:57 +0000 (11:49 +0200)
fixes issue #183

Change-Id: I6ed8bddb48cee65e5af01f7c868ba317a76674b3

src/club/wpia/gigi/output/template/SprintfCommand.java
src/club/wpia/gigi/pages/RootCertPage.java
src/club/wpia/gigi/pages/RootCertPage.templ
src/club/wpia/gigi/pages/account/certs/CertificateDisplay.templ

index d313df8..7a525ab 100644 (file)
@@ -116,7 +116,7 @@ public final class SprintfCommand implements Translatable {
                     throw new Error("Need an absolute link for the link service.");
                 }
                 String link = "//" + host + replacement.substring(2);
-                out.print("<a href='" + HTMLEncoder.encodeHTML(link) + "'>");
+                out.print("<a href='" + HTMLEncoder.encodeHTML(link) + "' target='_blank' rel='noreferrer'>");
             } else if (replacement.startsWith("$")) {
                 Template.outputVar(out, l, externalVariables, replacement.substring(2), false);
             } else {
index 55e4500..ffde096 100644 (file)
@@ -62,7 +62,7 @@ public class RootCertPage extends Page {
 
         @Override
         public void output(PrintWriter out, Language l, Map<String, Object> vars) {
-            out.println("<a href='" + HTMLEncoder.encodeHTML(target.getLink()) + "'>");
+            out.println("<a href='" + HTMLEncoder.encodeHTML(target.getLink()) + "' download='" + HTMLEncoder.encodeHTML(target.getKeyname()) + "'>");
             out.println(HTMLEncoder.encodeHTML(target.getKeyname()));
             out.println("</a>");
             out.println(HTMLEncoder.encodeHTML(target.getCertificate().getSubjectX500Principal().toString()));
index 8c2711a..0bda407 100644 (file)
@@ -1,12 +1,12 @@
 <p><?=_The Root certificate is available for download here. Choose your preferred format:?><br/>
-<a href="?pem">PEM</a> <a href="?cer">DER</a></p>
+<a href="?pem" download>PEM</a> <a href="?cer" download>DER</a></p>
 <p><?=_Root certificate fingerprints:?><br/>
 <?=_Fingerprint SHA-1?>:
 <?=$fingerprintSHA1?><br/>
 <?=_Fingerprint SHA-256?>:
 <?=$fingerprintSHA256?><br/></p>
 <p><?=_A p7b file with all intermediate certificates is available for download here:?><br/>
-<a href="?bundle"><?=$bundle?></a></p>
+<a href="?bundle" download><?=$bundle?></a></p>
 <p><?=_Find information how to add the root and intermediate certificates to the truststore of your browser or operating system in our !(/kb/truststores)FAQ!'</a>'.?></p>
 <p>
 <?=_A full list of all DER-encoded intermediate certificates is provided below:?>
index a688cfe..e761a5b 100644 (file)
   <tr>
     <td valign="top"><?=_Certificate and Chain?>*:</td>
     <td>
-        <?=_PEM encoded Certificate?> (<a href='<?=$serial?>.crt'>CRT</a>/<a href='<?=$serial?>.pem'>PEM</a>)
+        <?=_PEM encoded Certificate?> (<a href='<?=$serial?>.crt' download>CRT</a>/<a href='<?=$serial?>.pem' download>PEM</a>)
         <? foreach($trustchain) { ?>
             <?=_issued by?> <a href='<?=$link?>'><?=$name?></a>
         <? } ?><br/>
-        <?=_PEM encoded Certificate Chain?> (<a href='<?=$serial?>.crt?chain'>CRT</a>/<a href='<?=$serial?>.pem?chain'>PEM</a>)<br/>
-        <?=_PEM encoded Certificate Chain (Excluding Anchor)?> (<a href='<?=$serial?>.crt?chain&noAnchor'>CRT</a>/<a href='<?=$serial?>.pem?chain&noAnchor'>PEM</a>)<br/>
-        <?=_PEM encoded Certificate Chain (Excluding Leaf)?> (<a href='<?=$serial?>.crt?chain&noLeaf'>CRT</a>/<a href='<?=$serial?>.pem?chain&noLeaf'>PEM</a>)<br/>
-        <?=_DER encoded Certificate?> (<a href='<?=$serial?>.cer'>CER</a>)<br/>
+        <?=_PEM encoded Certificate Chain?> (<a href='<?=$serial?>.crt?chain'  download>CRT</a>/<a href='<?=$serial?>.pem?chain' download>PEM</a>)<br/>
+        <?=_PEM encoded Certificate Chain (Excluding Anchor)?> (<a href='<?=$serial?>.crt?chain&noAnchor' download>CRT</a>/<a href='<?=$serial?>.pem?chain&noAnchor' download>PEM</a>)<br/>
+        <?=_PEM encoded Certificate Chain (Excluding Leaf)?> (<a href='<?=$serial?>.crt?chain&noLeaf' download>CRT</a>/<a href='<?=$serial?>.pem?chain&noLeaf' download>PEM</a>)<br/>
+        <?=_DER encoded Certificate?> (<a href='<?=$serial?>.cer' download>CER</a>)<br/>
         <a href='<?=$serial?>.cer?install&chain'><?=_Install into browser.?></a><br/>
         <a href='<?=$serial?>.cer?install'><?=_Install into browser (Chrome)?></a>. <?=_Please ensure that the intermediate certificates listed above are installed prior to installing the certificate.?><br/><br/>
         * <?=_For information on how to install the root certificates into the truststore of your browser take a look at the !(/kb/rootcert)root certificate page in the FAQ!'</a>'!?>.</br>