mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 23:09:29 -07:00
Improve WKD URL generator
This commit is contained in:
parent
4018ec1c7b
commit
47b0383341
4 changed files with 29 additions and 8 deletions
|
@ -1004,14 +1004,30 @@ if (elUtilWKD) {
|
|||
|
||||
const elInput = document.body.querySelector("#input");
|
||||
const elOutput = document.body.querySelector("#output");
|
||||
const elOutputDirect = document.body.querySelector("#output_url_direct");
|
||||
const elOutputAdvanced = document.body.querySelector("#output_url_advanced");
|
||||
let match;
|
||||
|
||||
elInput.addEventListener("input", async function(evt) {
|
||||
if (evt.target.value) {
|
||||
elOutput.value = await computeWKDLocalPart(evt.target.value);
|
||||
if (/(.*)@(.{1,}\..{1,})/.test(evt.target.value)) {
|
||||
match = evt.target.value.match(/(.*)@(.*)/);
|
||||
elOutput.innerText = await computeWKDLocalPart(match[1]);
|
||||
elOutputDirect.innerText = `https://${match[2]}/.well-known/openpgpkey/hu/${elOutput.innerText}?l=${match[1]}`;
|
||||
elOutputAdvanced.innerText = `https://openpgpkey.${match[2]}/.well-known/openpgpkey/${match[2]}/hu/${elOutput.innerText}?l=${match[1]}`;
|
||||
} else {
|
||||
elOutput.innerText = await computeWKDLocalPart(evt.target.value);
|
||||
elOutputDirect.innerText = "Waiting for input";
|
||||
elOutputAdvanced.innerText = "Waiting for input";
|
||||
}
|
||||
} else {
|
||||
elOutput.value = "";
|
||||
elOutput.innerText = "Waiting for input";
|
||||
elOutputDirect.innerText = "Waiting for input";
|
||||
elOutputAdvanced.innerText = "Waiting for input";
|
||||
}
|
||||
});
|
||||
|
||||
elInput.dispatchEvent(new Event("input"));
|
||||
}
|
||||
|
||||
if (elUtilQRFP) {
|
||||
|
|
|
@ -84,7 +84,7 @@ footer a {
|
|||
background: linear-gradient(0deg, #4da4d2 0%, #82c5ea 100%);
|
||||
}
|
||||
.full-width {
|
||||
width: 100%;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
<h2>Utilities</h2>
|
||||
<p>
|
||||
<a href="/util/profile-url">Profile URL generator</a><br>
|
||||
<a href="/util/wkd">Web Key Directory</a><br>
|
||||
<a href="/util/qr">Fingerprint QR</a>
|
||||
<a href="/util/wkd">Web Key Directory URL generator</a><br>
|
||||
<a href="/util/qr">Fingerprint QR generator</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
<?php $this->layout('template.base', ['title' => $title]) ?>
|
||||
|
||||
<div class="content">
|
||||
<h1>WKD Local Part</h1>
|
||||
<h1>Web Key Directory generator</h1>
|
||||
<form id="form-util-wkd" method="post">
|
||||
<p>This tool computes the part of the URL that corresponds to the username when <a href="https://keyoxide.org/guides/web-key-directory">uploading keys using web key directory</a>.</p>
|
||||
<h3>Input</h3>
|
||||
<input type="text" name="input" id="input" placeholder="Username">
|
||||
<input type="text" name="input" id="input" placeholder="WKD username or identifier">
|
||||
<h3>Output</h3>
|
||||
<input type="text" name="output" id="output" placeholder="Waiting for input..." readonly>
|
||||
<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>
|
||||
|
|
Loading…
Reference in a new issue