feat: join via nip-07

This commit is contained in:
thesimplekid 2023-03-01 00:16:50 -05:00 committed by Greg Heartsfield
parent 9a141dc950
commit 05b08c7916

View File

@ -304,11 +304,12 @@ async fn handle_web_request(
<div style="width:75%;"> <div style="width:75%;">
<h1>Enter your pubkey</h1> <h1>Enter your pubkey</h1>
<form action="/invoice" onsubmit="return checkForm(this);"> <form action="/invoice" onsubmit="return checkForm(this);">
<input type="text" name="pubkey"><br><br> <input type="text" name="pubkey" id="pubkey-input"><br><br>
<input type="checkbox" id="terms" required> <input type="checkbox" id="terms" required>
<label for="terms">I agree to the <a href="/terms">terms and conditions</a></label><br><br> <label for="terms">I agree to the <a href="/terms">terms and conditions</a></label><br><br>
<button type="submit">Submit</button> <button type="submit">Submit</button>
</form> </form>
<button id="get-public-key-btn">Get Public Key</button>
</div> </div>
<script> <script>
function checkForm(form) { function checkForm(form) {
@ -318,6 +319,17 @@ async fn handle_web_request(
} }
return true; return true;
} }
const pubkeyInput = document.getElementById('pubkey-input');
const getPublicKeyBtn = document.getElementById('get-public-key-btn');
getPublicKeyBtn.addEventListener('click', async function() {
try {
const publicKey = await window.nostr.getPublicKey();
pubkeyInput.value = publicKey;
} catch (error) {
console.error(error);
}
});
</script> </script>
</body> </body>
</html> </html>