a demonstration replicated social networking web app built with anproto wiredove.net/
social ed25519 protocols

Merge branch 'master' of github.com:evbogue/wiredove

Ev Bogue 6de2ca28 264415fb

+57 -4
+22 -3
composer.js
··· 5 5 import { avatarSpan, nameSpan } from './profile.js' 6 6 import { ntfy } from './ntfy.js' 7 7 import { send } from './connect.js' 8 + import { markdown } from './markdown.js' 8 9 9 10 export const composer = async (sig) => { 10 11 const obj = {} ··· 47 48 48 49 const pubkey = await bogbot.pubkey() 49 50 50 - const button = h('button', {style: 'margin-left: auto; margin-right: 0px; display: block;', onclick: async () => { 51 + const publishButton = h('button', {style: 'margin-left: auto; margin-right: 0px;', onclick: async () => { 51 52 const published = await bogbot.compose(textarea.value, replyObj) 52 53 textarea.value = '' 53 54 const scroller = document.getElementById('scroller') ··· 66 67 div.id = hash 67 68 await render.blob(signed) 68 69 composerDiv.remove() 69 - }}, ['Send']) 70 + }}, ['Publish']) 71 + 72 + const previewButton = h('button', {style: 'margin-left: auto; margin-right: 0px;', onclick: async () => { 73 + textareaDiv.style = 'display: none;' 74 + previewDiv.style = 'display: block;' 75 + content.innerHTML = await markdown(textarea.value) 76 + }}, ['Preview']) 70 77 71 78 const textareaDiv = h('div', [ 72 79 textarea, 73 - button 80 + previewButton 81 + ]) 82 + 83 + const content = h('div') 84 + 85 + const previewDiv = h('div', {style: 'display: none;'}, [ 86 + content, 87 + h('button', {style: 'margin-left: auto; margin-right: 0px;', onclick: () => { 88 + textareaDiv.style = 'display: block;' 89 + previewDiv.style = 'display: none;' 90 + }}, ['Cancel']), 91 + publishButton 74 92 ]) 75 93 76 94 const composerDiv = h('div', [ ··· 79 97 await nameSpan(), 80 98 replyDiv, 81 99 textareaDiv, 100 + previewDiv 82 101 ]) 83 102 84 103 const div = h('div', {classList: 'message'}, [
+1 -1
connect.js
··· 42 42 43 43 ws.onmessage = async (m) => { 44 44 if (m.data.length === 44) { 45 - console.log('NEEDS' + m.data) 45 + //console.log('NEEDS' + m.data) 46 46 const blob = await bogbot.get(m.data) 47 47 if (blob) { 48 48 ws.send(blob)
+27
import.js
··· 1 + import { h } from 'h' 2 + import { bogbot } from 'bogbot' 3 + 4 + export const importBlob = async () => { 5 + const textarea = h('textarea', {placeholder: 'Import a bog5 message or blob'}) 6 + 7 + const button = h('button', { 8 + onclick: async () => { 9 + if (textarea.value) { 10 + try { 11 + const blob = await bogbot.make(textarea.value) 12 + const msg = await bogbot.open(textarea.value) 13 + window.location.hash = await bogbot.hash(textarea.value) 14 + if (msg) { 15 + await bogbot.add(textarea.value) 16 + } 17 + } catch (err) { 18 + } 19 + } 20 + } 21 + }, ['Import']) 22 + 23 + return h('div', {classList: 'message'}, [ 24 + textarea, 25 + button 26 + ]) 27 + }
+2
navbar.js
··· 26 26 ' ', 27 27 await composeButton(), 28 28 ' ', 29 + h('a', {href: '#import', classList: 'material-symbols-outlined'}, ['Post_Add']), 30 + ' ', 29 31 h('a', {href: '#archive', classList: 'material-symbols-outlined'}, ['Archive']), 30 32 ' ', 31 33 h('a', {href: '#settings', classList: 'material-symbols-outlined', style: 'float: right; margin-right: 25px;'}, ['Settings']),
+5
route.js
··· 6 6 import { makeRoom, gossip } from './gossip.js' 7 7 import { settings, importKey } from './settings.js' 8 8 import { adder } from './adder.js' 9 + import { importBlob } from './import.js' 9 10 10 11 export const route = async () => { 11 12 const src = window.location.hash.substring(1) ··· 54 55 } else { 55 56 scroller.appendChild(await importKey()) 56 57 } 58 + } 59 + 60 + else if (src === 'import') { 61 + scroller.appendChild(await importBlob()) 57 62 } 58 63 59 64 else if (src.length < 44) {