display support for signatures
authorMichael Wallner <mike@php.net>
Wed, 6 Apr 2016 11:55:31 +0000 (13:55 +0200)
committerMichael Wallner <mike@php.net>
Wed, 6 Apr 2016 11:55:31 +0000 (13:55 +0200)
public/html.php
public/index.php

index 21c20fe2980c764d78db7fb7baa69972d7af2f50..8ab447036e0f8b7c0b768ca67fe8f5e44b630ba3 100644 (file)
@@ -16,8 +16,8 @@ ob_start($res);
                <meta name="viewport" content="width=device-width, initial-scale=1">
                <style>
                        body {
-                               padding-bottom: 4em;
-                               padding-top: 10em;
+                               padding-bottom: 2em;
+                               padding-top: 7em;
                        }
                        .header {
                                top: 0;
@@ -27,12 +27,13 @@ ob_start($res);
                                bottom: 0;
                                width: 100%;
                                text-align: center;
+                               font-size: .9em;
                        }
                        .header, .footer {
                                position: fixed;
-                               box-shadow: 0px 0px 1em .4em #89a;
+                               box-shadow: 0px 0px .8em .4em #89a;
                                background: #62B3E7;
-                               padding: 1em 0;
+                               padding: .5em 0;
                        }
                        .header h1 {
                                font-weight: bold;
@@ -45,7 +46,7 @@ ob_start($res);
                        }
                        .header h1 big {
                                /* normalize browser difference */
-                               font-size: 1.8em;
+                               font-size: 1.3em;
                        }
                        .header h1 big, .footer, .footer a {
                                color: #fdfdfd;
@@ -53,11 +54,32 @@ ob_start($res);
                        }
                        .header h1 small {
                                color: #666;
+                               font-size: 1.3rem;
                                text-shadow: white 0 0 .2em;
                        }
                        li {
                                list-style-type: circle;
                        }
+                       pre.publickey {
+                               font-size: .8rem;
+                               line-height: 1rem;
+                               word-wrap: none;
+                       }
+                       code {
+                               background: #EEE;
+                               padding: .1rem;
+                               border-radius: 4px;
+                       }
+                       pre.code {
+                               background: #333;
+                               color: #62B3E7;
+                               padding: 1em;
+                               border-radius: 4px;
+                               margin-right: 2em;
+                       }
+                       pre.code code {
+                               background: transparent;
+                       }
                </style>
        </head>
        <body>
@@ -95,9 +117,12 @@ ob_start($res);
 
                                                <?php foreach (array_map("array_values", $phars) as $ext => list($phar, $date, $size, $pharext)) : ?>
                                                <td class="text-left">
-                                                       <a href="<?= htmlspecialchars($phar) ?>"
-                                                          >ext.phar<?= htmlspecialchars($ext) ?></a><br>
-                                                       <small>&#10507; <?= human_size($size) ?></small>
+                                                       &#10507;&nbsp;<a href="<?= htmlspecialchars($phar) ?>"
+                                                          download>ext.phar<?= htmlspecialchars($ext) ?></a>&nbsp;<small>(<?= human_size($size) ?>)</small><br>
+
+                                                       <?php foreach (SIGS as $typ => $sig) : ?>
+                                                               <small>#&nbsp;<a href="<?= sigof($phar, $sig) ?>" download><?= "$typ.$sig" ?></a></small>
+                                                       <?php endforeach; ?>
                                                </td>
                                                <?php endforeach; ?>
                                                <?php for($i = 0; $i < 3-count($phars); ++$i) : ?>
@@ -136,9 +161,65 @@ ob_start($res);
                        </ul>
                        <?php endif; ?>
                </div>
+               <div class="container">
+                       <h3>Public Keys</h3>
+                       <div class="column-8">
+                               <h4>RSA <small><a href="replicator.pub" download>replicator.pub</a></small></h4>
+                               <p>Verify with:</p>
+                                       <pre class="code"><code># openssl dgst \
+       -verify replicator.pub \
+       -signature <?= isset($phar) ? htmlspecialchars(basename($phar)).".sig" : "apfd-1.0.1.ext.phar.sig" ?> \
+                  <?= isset($phar) ? htmlspecialchars(basename($phar)): "apfd-1.0.1.ext.phar" ?></code></pre>
+                               <pre class="publickey">
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnzsDXNox5V0V9GLcnXEu
+kxnhFs9+/AMm//1qJAoNwP6sgmYShuyI3NDZzCmT7tOIcpqW0I4P8D1Psrftyqbt
+spedAvyOLCLZXaOuE130aMlvfqEiO+s8ZVZL8aHLE/orLbpOexEs33a1j6shl5C6
+MoojzK3uYccL4XJfj0t2nrC+XMfWE9oQGvyLZv3tNCzH4Oy7knWVVy10EKbKgPft
+izCFR+0mPYw35RN3gAGrug+khnVRMRNpS7B0uZ6E29Bgsrud9l91mVbrL+DaoaSa
+IFGeYuFGe2ZpHUfxf16S0w7ybPrrJJsD6cYOtwXjRZo+4ux6PdKZ+m3hnKWoj9IF
+OwIDAQAB
+-----END PUBLIC KEY-----</pre>
+                       </div>
+                       <div class="column-8">
+                               <h4>OpenPGP <small><a href="4093AEF6.pub" download>4093AEF6.pub</a></small></h4>
+                               <p>Verify with:</p>
+                                       <pre class="code"><code># gpg --import 4093AEF6.pub
+
+# gpg --verify <?= isset($phar) ? htmlspecialchars(basename($phar)).".asc" : "apfd-1.0.1.ext.phar.asc" ?> \
+               <?= isset($phar) ? htmlspecialchars(basename($phar)): "apfd-1.0.1.ext.phar" ?></code></pre>
+                               </p>
+                               <pre class="publickey">
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mQENBFcBXgsBCACfOwNc2jHlXRX0YtydcS6TGeEWz378Ayb//WokCg3A/qyCZhKG
+7Ijc0NnMKZPu04hympbQjg/wPU+yt+3Kpu2yl50C/I4sItldo64TXfRoyW9+oSI7
+6zxlVkvxocsT+istuk57ESzfdrWPqyGXkLoyiiPMre5hxwvhcl+PS3aesL5cx9YT
+2hAa/Itm/e00LMfg7LuSdZVXLXQQpsqA9+2LMIVH7SY9jDflE3eAAau6D6SGdVEx
+E2lLsHS5noTb0GCyu532X3WZVusv4NqhpJogUZ5i4UZ7ZmkdR/F/XpLTDvJs+usk
+mwPpxg63BeNFmj7i7Ho90pn6beGcpaiP0gU7ABEBAAG0K1BIQVJleHQgUmVwbGlj
+YXRvciA8cmVwbGljYXRvckBwaGFyZXh0Lm9yZz6JATcEEwEKACEFAlcBXgsCGwMF
+CwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQZJhrlUCTrvbYGAgAi120YHruidld
+uPTUS05/ZLoSn3orKkmkskOsjBrUqJvQHx1s8mqJpNJdbIrgPIxQPHauiE6Fj72q
+uv6TsVRxM+7VjiCHTbHmDheP5Zcyac7Nd/e62DsCYP7LAAx7MHbQvki6XQg4EsQZ
+cXMKRYuuizJxNGVUeZpusY5WXmc5PRIigsI4eh/2l96IK/eqTDSZiDUwv9ze+HMf
+JxOunBZVebYUQ3RYEWx1NseInxbiAnEdGM7phZH43jkohxPLROr3nWBmrJbBqULn
+m6M5fRucJoldU8VIzMdy0xxu+3PuX8aug96njK448r53wjb7yRf6WLonwjlFqTWq
+0tZzZR3Nd4kBHAQTAQoABgUCVwFehAAKCRBIDj4UsKTHx8iNB/0dl+8T8zp0Pksc
+jGo8WBA8sfdnMqaE/NkUCbMhT5wkAk+4JRlv/DUfokB6cF87yQCC/IjVAapPT2xS
+h31QubsjfnfrqSiF4ls8JCTLp/xkafx+tFsJKJOEgCsoeFCOeZBfvhhLPwLyhHLZ
+ZIsHmYX8YEeku+gsbQIVnWC06WJbJ5HuKByr8VEpgGBig4eRRMcDTJShgDQhn476
+VLKah3xplnU6bgOzsLn1Ssv095DOouh7tZabkS4jtvDAQK/1g2VQ/d0sOrbKAugQ
+IHEcyAQedGERU0JqXrXW9WdOqs1AZTl/YGWe94kZqJ1XSWibTSq1TUNCtTcrW558
+yImBVgJx
+=nFzc
+-----END PGP PUBLIC KEY BLOCK-----</pre>
+                       </div>
+                       <div style="clear:both"></div>
+               </div>
                <div class="footer">
                        <footer>
-                               &copy; 2015 m6w6, Michael Wallner &mdash; Powered by <a href="//github.com/m6w6/pharext">pharext
+                               &copy; 2015 <a href="https://m6w6.name">m6w6</a>, Michael Wallner &mdash; Powered by <a href="//github.com/m6w6/pharext">pharext
                                        <?php
                                        require_once "../vendor/autoload.php";
                                        printf("v%s\n", pharext\Metadata::version());
@@ -150,4 +231,4 @@ ob_start($res);
 </html>
 <?php
 $res->send();
-?>
\ No newline at end of file
+?>
index 08e85131e8897d99ef7e431cb475b6072a7860f7..c1679805116d98cbe270fd0deac31b8c5a02df2d 100644 (file)
@@ -5,6 +5,7 @@ use http\Env\Response;
 use http\Header;
 
 const UNITS = ["Bytes", "KB", "MB"];
+const SIGS = ["rsa" => "sig", "gpg" => "asc"];
 
 function human_size($s) {
        $l = floor(log10($s));
@@ -28,6 +29,10 @@ function human_date($t) {
        return gmdate("Y-m-d", $t);
 }
 
+function sigof($phar, $typ) {
+       return str_replace("phars/", "sigs/", $phar) . ".$typ";
+}
+
 function package_versions($package) {
        $versions = [];
        foreach (glob("phars/$package/*.ext.phar*") as $phar) {
@@ -40,10 +45,15 @@ function package_versions($package) {
                        $release = substr($name, strlen($package)+1);
                }
 
+               foreach (SIGS as $sigtyp => $sigext) {
+                       if (file_exists($sigdat = sigof($phar, $sigext))) {
+                               $sigs[$sigtyp] = $sigdat;
+                       }
+               }
                $size = filesize($phar);
                $date = isset($meta["date"]) ? strtotime($meta["date"]) : filemtime($phar);
                $pharext = isset($meta["version"]) ? $meta["version"] : "2.0.1";
-               $versions[$release][$enc] = compact("phar", "date", "size", "pharext");
+               $versions[$release][$enc] = compact("phar", "date", "size", "pharext", "sigs");
                uksort($versions[$release], function($a, $b) {
                        $al = strlen($a);
                        $bl = strlen($b);
@@ -73,4 +83,4 @@ if (!defined("INCLUDED")) {
                $neg = "html";
        }
        include_once "$neg.php";
-}
\ No newline at end of file
+}