Skip to content

Commit

Permalink
update signer.html
Browse files Browse the repository at this point in the history
  • Loading branch information
jejer committed Aug 5, 2023
1 parent 6c7b922 commit 51f2750
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions hiforums/signer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HiForum Signer</title>
<title>Hiforum Signer</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
</head>

<body>
<section class="section">
<div class="container">
<h1 class="title">
HiForum Signer
Hiforum Signer
</h1>
</div>
</section>
Expand Down Expand Up @@ -88,6 +88,8 @@ <h1 class="title">
const resultOutput = document.getElementById('result');
const copyBtn = document.getElementById('copy');

keyInput.value = localStorage.getItem("key");

disableDateSwitch.addEventListener('change', () => {
if (disableDateSwitch.checked) {
dateInput.disabled = true;
Expand All @@ -99,6 +101,7 @@ <h1 class="title">
signBtn.addEventListener('click', () => {
const email = emailInput.value;
const date = dateInput.value;
// const result = `Email: ${email}, Date: ${date}`;
var input = email;
if (!dateInput.disabled) {
input = `${email};${date}`;
Expand All @@ -111,11 +114,14 @@ <h1 class="title">
const bytes = new Uint8Array(hex_string.match(/[\da-f]{2}/gi).map(h => parseInt(h, 16)));
const signature = btoa(String.fromCharCode.apply(null, bytes));
console.log(signature);
if ((signature?.trim()?.length || 0) > 0) {
localStorage.setItem("key", keyInput.value);
}
signatureOutput.value = signature;

var result = signature;
if (!dateInput.disabled) {
result = `${btoa(date)}.${signature}`;
result = `${date};${signature}`;
}
resultOutput.value = result;
});
Expand Down

0 comments on commit 51f2750

Please sign in to comment.