~ev/tildeprotocol

c98c69e482ae74a1b953f2762c7d6371873c0ee4 — Ev Bogue 2 years ago 18f8228 master
add a composer to screen
2 files changed, 16 insertions(+), 3 deletions(-)

M app.js
M util.js
M app.js => app.js +16 -1
@@ 27,7 27,7 @@ function route (keys) {
      }
    }, ['Delete Key']))

    var textarea = h('textarea', {placeholder: 'Import your existing ed25519 keypair (right now this only supports ~protocol keys'})
    var textarea = h('textarea', {placeholder: 'Import your existing ed25519 keypair (right now this only supports ~protocol keys)'})

    keyDiv.appendChild(textarea)



@@ 40,6 40,21 @@ function route (keys) {
    }, ['Import Key']))
    scroller.appendChild(keyDiv)
  }

  else {
    var textarea = h('textarea', {placeholder: 'Write something'})

    var composer = h('div', {classList: 'message'}, [
      textarea,
      h('button', {onclick: function () {
        publish(textarea.value, null, 'nickname', keys).then(tilde => {
          scroller.appendChild(render(tilde, keys))
        })                
      }}, ['Post'])
    ])

    scroller.appendChild(composer)
  }
}

window.onhashchange = function () {

M util.js => util.js +0 -2
@@ 6,8 6,6 @@ if ((typeof process !== 'undefined') && (process.release.name === 'node')) {
  var homedir = require('os').homedir()
}



async function hash (msg) {
  var hash = nacl.hash(nacl.util.decodeUTF8(msg))
  var hex = Buffer.from(hash).toString('hex')