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

remove archive because that is not well thought out

+12 -66
+1 -5
navbar.js
··· 32 32 }) 33 33 34 34 export const navbar = async () => { 35 - const span = h('span', {style: 'margin-left: 5px; margin-right: 25px; float: right;'}) 35 + const span = h('span', {style: 'margin-left: 5px; float: right;'}) 36 36 37 37 const div = h('div', 38 38 {id: 'navbar'}, ··· 40 40 h('a', {href: '#', classList: 'material-symbols-outlined'}, [h('img', {src: './dovepurple_sm.png', classList: 'avatar_small'})]), 41 41 ' ', 42 42 await composeButton(), 43 - ' ', 44 - //h('a', {href: '#import', classList: 'material-symbols-outlined'}, ['Post_Add']), 45 - //' ', 46 - h('a', {href: '#archive', classList: 'material-symbols-outlined'}, ['Archive']), 47 43 ' ', 48 44 span, 49 45 ' ',
+3 -27
render.js
··· 32 32 33 33 let show = true 34 34 35 - const archiver = h('span') 36 - 37 - const unread = h('a', { 38 - onclick: async () => { 39 - await apds.put('archived' + hash, hash) 40 - meta.remove() 41 - }, 42 - classList: 'material-symbols-outlined' 43 - }, ['Check']) 44 - 45 - const read = h('a', { 46 - onclick: async () => { 47 - await apds.rm('archived' + hash) 48 - meta.remove() 49 - }, 50 - classList: 'material-symbols-outlined' 51 - }, ['Close']) 52 - 53 - if (await apds.get('archived' + hash)) { 54 - archiver.appendChild(read) 55 - } else { archiver.appendChild(unread)} 56 - 57 35 const rawDiv = h('div') 58 36 59 37 let rawshow = true ··· 74 52 const right = h('span', {style: 'float: right;'}, [ 75 53 h('span', {classList: 'pubkey'}, [author.substring(0, 6)]), 76 54 ' ', 77 - archiver, 55 + await render.qr(hash, blob), 78 56 ' ', 79 57 permalink, 80 58 ' ', 81 59 raw, 82 60 ' ', 83 61 ts, 84 - ' ', 85 - await render.qr(hash, blob), 86 62 ]) 87 63 88 64 const contentHash = opened.substring(13) ··· 261 237 const scroller = document.getElementById('scroller') 262 238 const div = await render.hash(hash) 263 239 if (div) { 264 - //scroller.appendChild(div) 265 - scroller.insertBefore(div, scroller.firstChild) 240 + scroller.appendChild(div) 241 + //scroller.insertBefore(div, scroller.firstChild) 266 242 await render.blob(blob) 267 243 } 268 244 }
+6 -33
route.js
··· 17 17 18 18 if (src === '') { 19 19 const log = await apds.query() 20 - const newlog = [] 21 - if (log) { 22 - for (const msg of log) { 23 - if (!await apds.get('archived' + msg.hash)) { 24 - newlog.push(msg) 25 - } 26 - } 27 - adder(newlog, src, scroller) 20 + if (log && log[0]) { 21 + log.sort((a,b) => a.ts - b.ts) 22 + adder(log, src, scroller) 28 23 } 29 24 } 30 25 31 - else if (src === 'archive') { 32 - const log = await apds.query() 33 - if (log) { 34 - const newlog = [] 35 - for (const msg of log) { 36 - if (await apds.get('archived' + msg.hash)) { 37 - newlog.push(msg) 38 - } 39 - } 40 - adder(newlog, src, scroller) 41 - } 42 - //if (log) { 43 - // log.forEach(async (msg) => { 44 - // const div = await render.hash(msg.hash) 45 - // await scroller.insertBefore(div, scroller.firstChild) 46 - // const sig = await apds.get(msg.hash) 47 - // if (sig) { await render.blob(sig)} 48 - // } 49 - // }) 50 - //} 51 - } 52 - 53 26 else if (src === 'settings') { 54 27 if (await apds.pubkey()) { 55 28 scroller.appendChild(await settings()) ··· 75 48 query.push(...q) 76 49 } 77 50 } 78 - await query.sort((a, b) => a.ts - b.ts) 79 - //console.log(query) 80 51 adder(query, src, scroller) 81 52 } catch (err) {console.log(err)} 82 53 } ··· 85 56 try { 86 57 const log = await apds.query(src) 87 58 if (log && log[0]) { 59 + log.sort((a,b) => a.ts - b.ts) 88 60 adder(log, src, scroller) 89 61 } else { 90 62 console.log('we do not have it') ··· 96 68 try { 97 69 const log = await apds.query(src) 98 70 if (log && log[0] && log != '') { 71 + log.sort((a,b) => a.ts - b.ts) 99 72 adder(log, src, scroller) 100 73 } 101 74 } catch (err) {} ··· 104 77 const hash = await apds.hash(src) 105 78 const opened = await apds.open(src) 106 79 if (opened) { 107 - await makeRoom(src.substring(0, 44)) 80 + //await makeRoom(src.substring(0, 44)) 108 81 await apds.add(src) 109 82 } 110 83 const check = await document.getElementById(hash)
+2 -1
style.css
··· 110 110 padding-top: .5em; 111 111 padding-left: 1em; 112 112 padding-bottom: .5em; 113 + padding-right: 5em; 113 114 position: fixed; 114 - width: 100%; 115 + width: 98.5%; 115 116 z-index: 1; 116 117 top: 0; 117 118 left: 0;