diff --git a/rln-js/index.html b/rln-js/index.html index c4518fa..57ad322 100644 --- a/rln-js/index.html +++ b/rln-js/index.html @@ -53,7 +53,6 @@
-
@@ -115,7 +114,6 @@ const dialButton = document.getElementById('dial') const nicknameInput = document.getElementById('nick-input') - const setNickButton = document.getElementById('set-nick') const textInput = document.getElementById('textInput'); const sendButton = document.getElementById('sendButton'); @@ -123,7 +121,7 @@ const messagesDiv = document.getElementById('messages') - let membershipId, membershipKey, encoder, node, nodeConnected, nick, rlnInstance; + let membershipId, membershipKey, encoder, node, nodeConnected, rlnInstance; let retrievedRLNEvents = false; const rlnInstancePromise = create(); @@ -172,12 +170,10 @@ && identityKeyInput.value && commitmentKeyInput.value); - const readyToSend = (membershipKey && membershipId && nodeConnected && nick) + const readyToSend = (membershipKey && membershipId && nodeConnected && nicknameInput.value) textInput.disabled = !readyToSend; sendButton.disabled = !readyToSend; - setNickButton.disabled = !nicknameInput.value; - dialButton.disabled = !(node && node.isStarted() && retrievedRLNEvents) retrieveRLNDetailsButton.disabled = !rlnInstance && !retrievedRLNEvents; @@ -311,10 +307,6 @@ // Waku nicknameInput.onchange = updateFields - setNickButton.onclick = () => { - nick = nicknameInput.value; - updateFields() - } let messages = []; @@ -397,12 +389,13 @@ await node.filter.subscribe([decoder], callback) statusDiv.innerHTML = '

Waku node subscribed.

'; nodeConnected = true; + updateFields() } sendButton.onclick = async () => { const text = utils.utf8ToBytes(textInput.value); const timestamp = new Date(); - const msg = ProtoChatMessage.create({text, nick, timestamp: timestamp.valueOf()}); + const msg = ProtoChatMessage.create({text, nick: nicknameInput.value, timestamp: timestamp.valueOf()}); const payload = ProtoChatMessage.encode(msg).finish(); console.log("Sending message with proof...") sendingStatusSpan.innerText = 'sending...'