Create simple demo ui

This commit is contained in:
Tankred Hase 2016-06-10 21:39:58 +02:00
parent fdae73bf38
commit c6230b95a4
4 changed files with 68 additions and 8 deletions

View File

@ -31,6 +31,10 @@ module.exports = {
name: process.env.SENDER_NAME,
email: process.env.SENDER_EMAIL
}
},
ui: {
title: process.env.UI_TITLE || 'OpenPGP Public Key Server'
}
};

View File

@ -46,6 +46,7 @@ class HKP {
}
let origin = util.origin(ctx);
yield this._publicKey.put({ publicKeyArmored, origin });
ctx.body = 'Upload successful. Check your inbox to verify your email address.';
ctx.status = 201;
}

View File

@ -1,32 +1,85 @@
'use strict';
const util = require('../service/util');
const config = require('config');
module.exports = function () {
let hkpLink = util.hkpUrl(this);
let removeLink = util.url(util.origin(this), '/api/v1/removeKey?email=user@example.com');
this.body =
`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>OpenPGP key server</title>
<title>${config.ui.title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
</head>
<body>
<h1>Welcome to the OpenPGP key server</h1>
<p>This server verifies email address as well as private key ownership by sending an encrypted verification email.</p>
<h1>${config.ui.title}</h1>
<h2>Try it out</h2>
<ol>
<li>Configure this key server in your HKP compatible OpenPGP client using this url: <a href="${hkpLink}" target="_blank">${hkpLink}</a></li>
<li>Now just upload a public key like you always do.</li>
<li>Upload your public OpenPGP key using the form below.</li>
<li>Check your inbox and click on the verification link inside the encrypted message.</li>
<li>You can delete all your data from the server at any time using this link: <a href="${removeLink}" target="_blank">${removeLink}</a></li>
<li>You can delete all your data from the server at any time using the form below.</li>
<li>Configure this key server in your HKP compatible OpenPGP client using this url: <a href="${hkpLink}" target="_blank">${hkpLink}</a></li>
</ol>
<h2>Documentation and code</h2>
<p>Please refer to <a href="https://github.com/mailvelope/keyserver" target="_blank">the documentation</a> to learn more about the api.</p>
<p>Please refer to <a href="https://github.com/mailvelope/keyserver" target="_blank">the documentation</a> to learn more about the REST api.</p>
<p>License AGPL v3.0</p>
<hr>
<h2>
<a id="extract" name="extract">Find OpenPGP Key</a>
</h2>
<form action="/pks/lookup" method="get">
<p>
Get:
<input type="radio" name="op" value="get" checked="checked">
Index:
<input type="radio" name="op" value="index">
</p>
<p>
Search:
<input name="search" size="40" spellcheck="false" placeholder="Email address, long key ID or fingerprint">
</p>
<p>
<input type="reset" value="Reset">
<input type="submit" value="Search">
</p>
</form>
<hr>
<h2>
<a id="upload" name="submit">Upload a new OpenPGP Key</a>
</h2>
<form action="/pks/add" method="post">
<p>Paste ASCII-armored OpenPGP key block here:</p>
<p>
<textarea name="keytext" rows="20" cols="66"></textarea>
</p>
<p>
<input type="reset" value="Reset">
<input type="submit" value="Upload">
</p>
</form>
<hr>
<h2>
<a id="delete" name="extract">Delete your OpenPGP Key</a>
</h2>
<form action="/api/v1/removeKey" method="get">
<p>
Remove:
<input name="email" type="email" spellcheck="false" size="40" placeholder="Email address">
</p>
<p>
<input type="reset" value="Reset">
<input type="submit" value="Remove">
</p>
</form>
</body>
</html>
`;

View File

@ -46,6 +46,7 @@ class REST {
}
let origin = util.origin(ctx);
yield this._publicKey.put({ publicKeyArmored, primaryEmail, origin });
ctx.body = 'Upload successful. Check your inbox to verify your email address.';
ctx.status = 201;
}
@ -106,6 +107,7 @@ class REST {
ctx.throw(400, 'Invalid request!');
}
yield this._publicKey.requestRemove(q);
ctx.body = 'Check your inbox to verify the removal of your key.';
ctx.status = 202;
}