Rename qr to qrfp

This commit is contained in:
Yarmo Mackenbach 2020-07-22 14:54:56 +02:00
parent d070ed0864
commit c25e7e6ef1
3 changed files with 21 additions and 4 deletions

View file

@ -273,7 +273,7 @@ async function displayProfile(opts) {
if (opts.mode == "hkp") { if (opts.mode == "hkp") {
feedback += `<div class="profileDataItem">`; feedback += `<div class="profileDataItem">`;
feedback += `<div class="profileDataItem__label">qrcode</div>`; feedback += `<div class="profileDataItem__label">qrcode</div>`;
feedback += `<div class="profileDataItem__value"><a href="/util/qr/${keyData.fingerprint}">fingerprint</a></div>`; feedback += `<div class="profileDataItem__value"><a href="/util/qrfp/${keyData.fingerprint}">fingerprint</a></div>`;
feedback += `</div>`; feedback += `</div>`;
} }

View file

@ -14,7 +14,8 @@ $templates = new League\Plates\Engine('views');
$router->map('GET', '/', function() {}, 'index'); $router->map('GET', '/', function() {}, 'index');
$router->map('GET', '/guides', function() {}, 'guides'); $router->map('GET', '/guides', function() {}, 'guides');
$router->map('GET', '/guides/[:id]', function() {}, 'guideId'); $router->map('GET', '/guides/[:id]', function() {}, 'guideId');
$router->map('GET', '/util/qr/[:fp]', function() {}, 'util_qr'); $router->map('GET', '/util/qrfp/[:fp]', function() {}, 'util_qrfp');
$router->map('GET', '/util/qr/[:txt]', function() {}, 'util_qr');
$router->map('GET', '/util/[:id]', function() {}, 'util'); $router->map('GET', '/util/[:id]', function() {}, 'util');
$router->map('GET', '/faq', function() {}, 'faq'); $router->map('GET', '/faq', function() {}, 'faq');
$router->map('GET', '/verify', function() {}, 'verify'); $router->map('GET', '/verify', function() {}, 'verify');
@ -136,9 +137,14 @@ if(is_array($match) && is_callable($match['target'])) {
echo $templates->render("util/$id"); echo $templates->render("util/$id");
break; break;
case 'util_qr': case 'util_qrfp':
$fp = htmlspecialchars($match['params']['fp']); $fp = htmlspecialchars($match['params']['fp']);
echo $templates->render("util/qr", ['input' => $fp]); echo $templates->render("util/qrfp", ['input' => $fp]);
break;
case 'util_qr':
$uri = htmlspecialchars($match['params']['fp']);
echo $templates->render("util/qr", ['input' => $uri]);
break; break;
case 'faq': case 'faq':

11
views/util/qrfp.php Normal file
View file

@ -0,0 +1,11 @@
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="content">
<h1>QR Code</h1>
<form id="form-util-qr" method="post">
<p>This tool generates a QR code containing the fingerprint of your public key (<a href="https://github.com/open-keychain/open-keychain/wiki/QR-Codes">format</a>). This QR code can be scanned by apps like <a href="https://www.openkeychain.org/">OpenKeyChain</a>.</p>
<h3>Fingerprint</h3>
<input type="text" name="input" id="input" placeholder="Fingerprint" value="<?=$this->escape($input)?>">
<div id="qrcode"></div>
</form>
</div>