tangled
alpha
login
or
join now
evbogue.com
/
wiredove
1
fork
atom
a demonstration replicated social networking web app built with anproto
wiredove.net/
social
ed25519
protocols
1
fork
atom
overview
issues
pulls
pipelines
Merge branch 'master' of github.com:evbogue/wiredove
Ev Bogue
10 months ago
6de2ca28
264415fb
+57
-4
5 changed files
expand all
collapse all
unified
split
composer.js
connect.js
import.js
navbar.js
route.js
+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
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
50
-
const button = h('button', {style: 'margin-left: auto; margin-right: 0px; display: block;', onclick: async () => {
51
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
69
-
}}, ['Send'])
70
70
+
}}, ['Publish'])
71
71
+
72
72
+
const previewButton = h('button', {style: 'margin-left: auto; margin-right: 0px;', onclick: async () => {
73
73
+
textareaDiv.style = 'display: none;'
74
74
+
previewDiv.style = 'display: block;'
75
75
+
content.innerHTML = await markdown(textarea.value)
76
76
+
}}, ['Preview'])
70
77
71
78
const textareaDiv = h('div', [
72
79
textarea,
73
73
-
button
80
80
+
previewButton
81
81
+
])
82
82
+
83
83
+
const content = h('div')
84
84
+
85
85
+
const previewDiv = h('div', {style: 'display: none;'}, [
86
86
+
content,
87
87
+
h('button', {style: 'margin-left: auto; margin-right: 0px;', onclick: () => {
88
88
+
textareaDiv.style = 'display: block;'
89
89
+
previewDiv.style = 'display: none;'
90
90
+
}}, ['Cancel']),
91
91
+
publishButton
74
92
])
75
93
76
94
const composerDiv = h('div', [
···
79
97
await nameSpan(),
80
98
replyDiv,
81
99
textareaDiv,
100
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
45
-
console.log('NEEDS' + m.data)
45
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
1
+
import { h } from 'h'
2
2
+
import { bogbot } from 'bogbot'
3
3
+
4
4
+
export const importBlob = async () => {
5
5
+
const textarea = h('textarea', {placeholder: 'Import a bog5 message or blob'})
6
6
+
7
7
+
const button = h('button', {
8
8
+
onclick: async () => {
9
9
+
if (textarea.value) {
10
10
+
try {
11
11
+
const blob = await bogbot.make(textarea.value)
12
12
+
const msg = await bogbot.open(textarea.value)
13
13
+
window.location.hash = await bogbot.hash(textarea.value)
14
14
+
if (msg) {
15
15
+
await bogbot.add(textarea.value)
16
16
+
}
17
17
+
} catch (err) {
18
18
+
}
19
19
+
}
20
20
+
}
21
21
+
}, ['Import'])
22
22
+
23
23
+
return h('div', {classList: 'message'}, [
24
24
+
textarea,
25
25
+
button
26
26
+
])
27
27
+
}
+2
navbar.js
···
26
26
' ',
27
27
await composeButton(),
28
28
' ',
29
29
+
h('a', {href: '#import', classList: 'material-symbols-outlined'}, ['Post_Add']),
30
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
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
58
+
}
59
59
+
60
60
+
else if (src === 'import') {
61
61
+
scroller.appendChild(await importBlob())
57
62
}
58
63
59
64
else if (src.length < 44) {