diff options
-rw-r--r-- | bog.js | 7 | ||||
-rw-r--r-- | css/style.css | 6 | ||||
-rw-r--r-- | gossip.js | 24 |
3 files changed, 18 insertions, 19 deletions
@@ -12,7 +12,6 @@ if ((typeof process !== 'undefined') && (process.release.name === 'node')) { // EX: open(msg).then(content => { console.log(content) }) async function open (msg) { - var pubkey = nacl.util.decodeBase64(msg.author.substring(1)) var sig = nacl.util.decodeBase64(msg.signature) var opened = await JSON.parse(nacl.util.encodeUTF8(nacl.sign.open(sig, pubkey))) @@ -139,7 +138,7 @@ function getName (id, keys) { localforage.getItem('name:' + id).then(cache => { if (cache) { - console.log(cache) + //console.log(cache) return name.textContent = '@' + cache } else { bog().then(log => { @@ -182,7 +181,7 @@ function regenerate (home) { if (key[0] == '@') { newlog = newlog.concat(value) } - console.log(newlog) + //console.log(newlog) }).then(function () { newlog.forEach(function (msg) { var pubkey = nacl.util.decodeBase64(msg.author.substring(1)) @@ -192,7 +191,7 @@ function regenerate (home) { openedlog.push(opened) }) - console.log(openedlog) + //console.log(openedlog) openedlog.sort((a, b) => a.timestamp - b.timestamp) diff --git a/css/style.css b/css/style.css index 96a50e7..bdd1c6b 100644 --- a/css/style.css +++ b/css/style.css @@ -45,7 +45,7 @@ hr { } #scroller { - max-width: 50em; + max-width: 680px; margin-right: auto; margin-left: auto; } @@ -172,8 +172,8 @@ textarea { position: fixed; z-index: 1000; margin: 0; - padding-top: .3em; - padding-bottom: .3em; + padding-top: .33em; + padding-bottom: .27em; left: 0; right: 0; top: 0; } @@ -25,7 +25,7 @@ function sync (subs, keys) { setTimeout(function () { wsServers.forEach(function (server, index) { setTimeout(function () { - console.log('SYNCING WITH: ' + server + ' to fetch ' + sub) + //console.log('SYNCING WITH: ' + server + ' to fetch ' + sub) var split = server.split('~') var serverurl = split[0] var serverpub = split[1] @@ -50,7 +50,7 @@ function sync (subs, keys) { unbox(req.box, req.requester, keys).then(unboxed => { var unboxedreq = JSON.parse(nacl.util.encodeUTF8(unboxed)) if (unboxedreq.content) { - console.log(unboxedreq) + unboxedreq.signature = unboxedreq.content renderAd(unboxedreq) } if (unboxedreq.seq === 0) { @@ -60,13 +60,13 @@ function sync (subs, keys) { requester: keys.publicKey, box: boxed } - console.log('Sending entire log of ' + msg.author + ' to ' + serverpub) + //console.log('Sending entire log of ' + msg.author + ' to ' + serverpub) ws.send(JSON.stringify(obj)) }) } if (unboxedreq.seq > msg.seq) { - console.log('server feed is longer, requesting diff from server') + //console.log('server feed is longer, requesting diff from server') var reqdiff = JSON.stringify({author: unboxedreq.author, seq: msg.seq}) box(reqdiff, serverpub, keys).then(boxed => { var obj = { @@ -78,7 +78,7 @@ function sync (subs, keys) { } if (unboxedreq.seq < msg.seq) { - console.log('server feed is shorter, sending diff to server') + //console.log('server feed is shorter, sending diff to server') var diff = JSON.stringify(srclog.slice(0, msg.seq - unboxedreq.seq)) box(diff, serverpub, keys).then(boxed => { var obj = { @@ -90,14 +90,14 @@ function sync (subs, keys) { } if (Array.isArray(unboxedreq)) { - console.log('received diff from server') + //console.log('received diff from server') open(unboxedreq[0]).then(msg => { localforage.getItem(msg.author).then(feed => { open(feed[0]).then(lastmsg => { if (unboxedreq.length + lastmsg.seq === msg.seq) { var newlog = unboxedreq.concat(feed) localforage.setItem(msg.author, newlog).then(success => { - console.log('combined existing feed of ' + msg.author + ' with diff and saved to client') + //console.log('combined existing feed of ' + msg.author + ' with diff and saved to client') }) localforage.getItem('log').then(log => { if (!log) { @@ -112,7 +112,7 @@ function sync (subs, keys) { log.sort((a, b) => a.timestamp - b.timestamp) var reversed = log.reverse() localforage.setItem('log', reversed).then(success => { - console.log('saved log with ' + opened.author + ' prepended to localForage') + //console.log('saved log with ' + opened.author + ' prepended to localForage') }) } }) @@ -129,7 +129,7 @@ function sync (subs, keys) { } }) } else { - console.log('NO LOG IN CLIENT') + //console.log('NO LOG IN CLIENT') ws.onopen = function () { var reqwhole = JSON.stringify({author: sub, seq: 0}) box(reqwhole, serverpub, keys).then(boxed => { @@ -142,7 +142,7 @@ function sync (subs, keys) { } ws.onmessage = function (message) { var req = JSON.parse(message.data) - console.log('received message from ' + req.requester) + //console.log('received message from ' + req.requester) unbox(req.box, req.requester, keys).then(unboxed => { var unboxedreq = JSON.parse(nacl.util.encodeUTF8(unboxed)) if (Array.isArray(unboxedreq)) { @@ -150,7 +150,7 @@ function sync (subs, keys) { localforage.getItem(msg.author).then(feed => { if (!feed) { localforage.setItem(msg.author, unboxedreq).then(success => { - console.log('saved log of ' + msg.author + ' to localforage') + //console.log('saved log of ' + msg.author + ' to localforage') }) localforage.getItem('log').then(log => { if (!log) { @@ -165,7 +165,7 @@ function sync (subs, keys) { log.sort((a, b) => a.timestamp - b.timestamp) var reversed = log.reverse() localforage.setItem('log', reversed).then(success => { - console.log('saved log with ' + opened.author + ' prepended to localForage') + //console.log('saved log with ' + opened.author + ' prepended to localForage') }) } }) |