Migrate util pages to pug and add routes

This commit is contained in:
Yarmo Mackenbach 2020-08-08 09:20:33 +02:00
parent 1ab13275b6
commit 26c6b5fbfa
10 changed files with 113 additions and 209 deletions

View file

@ -17,6 +17,7 @@ app.use('/', require('./routes/main'));
app.use('/encrypt', require('./routes/encrypt'));
app.use('/verify', require('./routes/verify'));
app.use('/proofs', require('./routes/proofs'));
app.use('/util', require('./routes/util'));
app.use('/', require('./routes/profile'));
app.listen(port, () => {

View file

@ -1,39 +1,31 @@
var router = require('express').Router();
router.get('/', function(req, res) {
res.render('encrypt', { mode: "auto" })
router.get('/profile-url', function(req, res) {
res.render('util/profile-url')
});
router.get('/profile-url/:input', function(req, res) {
res.render('util/profile-url', { input: req.params.input })
});
router.get('/qr', function(req, res) {
res.render('util/qr')
});
router.get('/qr/:input', function(req, res) {
res.render('util/qr', { input: req.params.input })
});
router.get('/qrfp', function(req, res) {
res.render('util/qrfp')
});
router.get('/qrfp/:input', function(req, res) {
res.render('util/qrfp', { input: req.params.input })
});
router.get('/wkd', function(req, res) {
res.render('encrypt', { mode: "wkd" })
res.render('util/wkd')
});
router.get('/wkd/:input', function(req, res) {
res.render('encrypt', { mode: "wkd", input: req.params.input })
});
router.get('/hkp', function(req, res) {
res.render('encrypt', { mode: "hkp" })
});
router.get('/hkp/:input', function(req, res) {
res.render('encrypt', { mode: "hkp", input: req.params.input })
});
router.get('/plaintext', function(req, res) {
res.render('encrypt', { mode: "plaintext" })
});
router.get('/keybase', function(req, res) {
res.render('encrypt', { mode: "keybase" })
});
router.get('/keybase/:username', function(req, res) {
res.render('encrypt', { mode: "keybase", username: req.params.username })
});
router.get('/keybase/:username/:fingerprint', function(req, res) {
res.render('encrypt', { mode: "keybase", username: req.params.username, fingerprint: req.params.fingerprint })
});
router.get('/:input', function(req, res) {
res.render('encrypt', { mode: "auto", input: req.params.input })
res.render('util/wkd', { input: req.params.input })
});
module.exports = router;

View file

@ -1,52 +0,0 @@
<?php
// Copyright (C) 2020 Yarmo Mackenbach
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details.
//
// You should have received a copy of the GNU Affero General Public License along
// with this program. If not, see <https://www.gnu.org/licenses/>.
//
// Also add information on how to contact you by electronic and paper mail.
//
// If your software can interact with users remotely through a computer network,
// you should also make sure that it provides a way for users to get its source.
// For example, if your program is a web application, its interface could display
// a "Source" link that leads users to an archive of the code. There are many
// ways you could offer source, and different solutions will be better for different
// programs; see section 13 for the specific requirements.
//
// You should also get your employer (if you work as a programmer) or school,
// if any, to sign a "copyright disclaimer" for the program, if necessary. For
// more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.
?>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="content">
<h1>Profile URL</h1>
<form id="form-util-profile-url" method="post">
<p>This tool generates an URL for your Keyoxide profile page.</p>
<h3>Public key</h3>
<label for="source">Source: </label>
<select class="source" name="source" id="source">
<option value="wkd">Web Key Directory</option>
<option value="hkp">keys.openpgp.org</option>
<option value="keybase">Keybase</option>
</select>
<br>
<input type="text" name="input" id="input" placeholder="Input" value="">
<h3>Profile URL</h3>
<code id="output">Waiting for input...</code>
<h3>Help</h3>
<p>When using the <strong>Web Key Directory</strong> source, the <strong>Input</strong> looks like <strong>username@domain.org</strong>.</p>
<p>When using the <strong>keys.openpgp.org</strong> source, the <strong>Input</strong> is either the <strong>fingerprint</strong> of your public key, or the main identity's <strong>email address</strong>.</p>
<p>When using the <strong>Keybase</strong> source, the <strong>Input</strong> is the URL obtained by going to your Keybase profile page, clicking on the <strong>key id</strong> of your keypair and copying the URL of the <strong>this key</strong> link.</p>
</form>
</div>

View file

@ -0,0 +1,46 @@
extends ../template.base.pug
block content
.content
h1 Profile URL
form#form-util-profile-url(method='post')
p This tool generates an URL for your Keyoxide profile page.
h3 Public key
label(for='source') Source:
select#source.source(name='source')
option(value='wkd') Web Key Directory
option(value='hkp') keys.openpgp.org
option(value='keybase') Keybase
br
input#input(type='text' name='input' placeholder='Input' value='')
h3 Profile URL
code#output Waiting for input...
h3 Help
p
| When using the
strong Web Key Directory
| source, the
strong Input
| looks like
strong username@domain.org
| .
p
| When using the
strong keys.openpgp.org
| source, the
strong Input
| is either the
strong fingerprint
| of your public key, or the main identity&apos;s
strong email address
| .
p
| When using the
strong Keybase
| source, the
strong Input
| is the URL obtained by going to your Keybase profile page, clicking on the
strong key id
| of your keypair and copying the URL of the
strong this key
| link.

View file

@ -1,41 +0,0 @@
<?php
// Copyright (C) 2020 Yarmo Mackenbach
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details.
//
// You should have received a copy of the GNU Affero General Public License along
// with this program. If not, see <https://www.gnu.org/licenses/>.
//
// Also add information on how to contact you by electronic and paper mail.
//
// If your software can interact with users remotely through a computer network,
// you should also make sure that it provides a way for users to get its source.
// For example, if your program is a web application, its interface could display
// a "Source" link that leads users to an archive of the code. There are many
// ways you could offer source, and different solutions will be better for different
// programs; see section 13 for the specific requirements.
//
// You should also get your employer (if you work as a programmer) or school,
// if any, to sign a "copyright disclaimer" for the program, if necessary. For
// more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.
?>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="content">
<h1>QR Code</h1>
<form id="form-util-qr" method="post">
<!-- <input type="txt" name="input" id="input" class="full-width" readonly value="<?=$this->escape($input)?>"> -->
<!-- <textarea name="input" id="input" class="full-width" readonly><?=$this->escape($input)?></textarea> -->
<code id="input" class="full-width"><?=$this->escape($input)?></code>
</form>
<div id="qrcode"></div>
<a id="qrcode--altLink" href="#">Press this link to directly open the URI</a>
</div>

9
views/util/qr.pug Normal file
View file

@ -0,0 +1,9 @@
extends ../template.base.pug
block content
.content
h1 QR Code
form#form-util-qr(method='post')
code#input.full-width !{input}
#qrcode
a#qrcode--altLink(href='#') Press this link to directly open the URI

View file

@ -1,40 +0,0 @@
<?php
// Copyright (C) 2020 Yarmo Mackenbach
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details.
//
// You should have received a copy of the GNU Affero General Public License along
// with this program. If not, see <https://www.gnu.org/licenses/>.
//
// Also add information on how to contact you by electronic and paper mail.
//
// If your software can interact with users remotely through a computer network,
// you should also make sure that it provides a way for users to get its source.
// For example, if your program is a web application, its interface could display
// a "Source" link that leads users to an archive of the code. There are many
// ways you could offer source, and different solutions will be better for different
// programs; see section 13 for the specific requirements.
//
// You should also get your employer (if you work as a programmer) or school,
// if any, to sign a "copyright disclaimer" for the program, if necessary. For
// more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.
?>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="content">
<h1>QR Code</h1>
<form id="form-util-qrfp" 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)?>">
</form>
<div id="qrcode"></div>
</div>

15
views/util/qrfp.pug Normal file
View file

@ -0,0 +1,15 @@
extends ../template.base.pug
block content
.content
h1 QR Code
form#form-util-qrfp(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
| ). This QR code can be scanned by apps like
a(href='https://www.openkeychain.org/') OpenKeyChain
| .
h3 Fingerprint
input#input(type='text' name='input' placeholder='Fingerprint' value=input)
#qrcode

View file

@ -1,47 +0,0 @@
<?php
// Copyright (C) 2020 Yarmo Mackenbach
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details.
//
// You should have received a copy of the GNU Affero General Public License along
// with this program. If not, see <https://www.gnu.org/licenses/>.
//
// Also add information on how to contact you by electronic and paper mail.
//
// If your software can interact with users remotely through a computer network,
// you should also make sure that it provides a way for users to get its source.
// For example, if your program is a web application, its interface could display
// a "Source" link that leads users to an archive of the code. There are many
// ways you could offer source, and different solutions will be better for different
// programs; see section 13 for the specific requirements.
//
// You should also get your employer (if you work as a programmer) or school,
// if any, to sign a "copyright disclaimer" for the program, if necessary. For
// more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.
?>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="content">
<h1>Web Key Directory generator</h1>
<form id="form-util-wkd" method="post">
<p>This tool computes the part of the WKD URL that corresponds to the username when <a href="https://keyoxide.org/guides/web-key-directory">uploading keys using web key directory</a>.</p>
<p>If you enter the entire WKD identifier (username@domain.org), this tool will also generate the complete URLs.</p>
<h3>Input</h3>
<input type="text" name="input" id="input" placeholder="WKD username or identifier">
<h3>Output</h3>
<h4>Local part</h4>
<code class="full-width"id="output">Waiting for input...</code>
<h4>Direct URL</h4>
<code class="full-width"id="output_url_direct">Waiting for input...</code>
<h4>Advanced URL</h4>
<code class="full-width"id="output_url_advanced">Waiting for input...</code>
</form>
</div>

21
views/util/wkd.pug Normal file
View file

@ -0,0 +1,21 @@
extends ../template.base.pug
block content
.content
h1 Web Key Directory generator
form#form-util-wkd(method='post')
p
| This tool computes the part of the WKD URL that corresponds to the username when
a(href='https://keyoxide.org/guides/web-key-directory') uploading keys using web key directory
| .
p
| If you enter the entire WKD identifier (username@domain.org), this tool will also generate the complete URLs.
h3 Input
input#input(type='text' name='input' placeholder='WKD username or identifier' value=input)
h3 Output
h4 Local part
code#output.full-width Waiting for input...
h4 Direct URL
code#output_url_direct.full-width Waiting for input...
h4 Advanced URL
code#output_url_advanced.full-width Waiting for input...