aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js58
1 files changed, 25 insertions, 33 deletions
diff --git a/app.js b/app.js
index f9c9c6b..a5838fd 100644
--- a/app.js
+++ b/app.js
@@ -8,20 +8,38 @@ function route (keys) {
var screen = document.getElementById('screen')
screen.appendChild(scroller)
- var identify = h('div', {id: 'identify'})
- var mess = h('div', {classList: 'message'})
+ if (src === 'key') {
+ keyPage(keys)
+ } else if (src === 'pubs') {
+ pubs()
+ } else if (src[0] === '@') {
+ profilePage(src, keys)
+ } else if (src[0] === '%') {
+ threadPage(src, keys)
+ } else {
+ publicPage(keys)
+ }
+}
+keys().then(key => {
function nameCheck (id) {
+
console.log('Checking for name of ' + id)
+ var scroller = h('div', {id: 'scroller'})
+ var screen = document.getElementById('screen')
+ screen.appendChild(scroller)
- scroller.appendChild(identify)
+ var identify = h('div', {id: 'identify'})
+ var mess = h('div', {classList: 'message'})
+
+ scroller.appendChild(identify)
setTimeout(function () {
identify.appendChild(mess)
- mess.appendChild(h('span', {innerHTML: marked("Hey [" + keys.publicKey.substring(0, 10) + "...](/#"+ keys.publicKey +")! Welcome to Bogbook. If you have any questions be sure to reach out to [@ev](/#@Q++V5BbvWIg8B+TqtC9ZKFhetruuw+nOgxEqfjlOZI0=).")}))
+ mess.appendChild(h('span', {innerHTML: marked("Hey [" + key.publicKey.substring(0, 10) + "...](/#"+ key.publicKey +")! Welcome to Bogbook. If you have any questions be sure to reach out to [@ev](/#@Q++V5BbvWIg8B+TqtC9ZKFhetruuw+nOgxEqfjlOZI0=).")}))
mess.appendChild(h('span', {innerHTML: marked("Your current public key doesn't have a name yet. Either import your existing id on the [key](/#key) page, or identify yourself using the box below. Identifying is optional, but you'll see this welcome message as long as you don't give yourself a name.")}))
@@ -37,7 +55,7 @@ function route (keys) {
name: input.value
}
- publish(content, keys)
+ publish(content, key)
setTimeout(function () {
location.reload()
}, 1000)
@@ -45,13 +63,12 @@ function route (keys) {
}, ['Identify'])
]))
-
mess.appendChild(h('span', {innerHTML: marked("Next, make sure to save your public/private keypair on the [key](/#key) page, so that you can continue to use the same identity. No one but you can access your private key, so only you can restore your ability to publish to this identity. If you lose your key, you lose your ability to publish to this identity forever.")}))
mess.appendChild(h('span', {innerHTML: marked("Finally, be sure to check out the code on [SourceHut](http://git.sr.ht/~ev/bogbook)")}))
}, 2000)
- bog(keys.publicKey).then(log => {
+ bog(key.publicKey).then(log => {
if (log) {
log.forEach(function (msg) {
open(msg).then(post => {
@@ -66,35 +83,10 @@ function route (keys) {
})
}
})
-
- /*bog(id).then(feed => {
- if (feed) {
- for (var i = 0; i < feed.length; i++) {
- console.log(feed[i])
- if (feed[i].named == id) {
- console.log('You named yourself already')
- }
- }
- }
- })*/
}
- nameCheck(keys.publicKey)
+ nameCheck(key.publicKey)
- if (src === 'key') {
- keyPage(keys)
- } else if (src === 'pubs') {
- pubs()
- } else if (src[0] === '@') {
- profilePage(src, keys)
- } else if (src[0] === '%') {
- threadPage(src, keys)
- } else {
- publicPage(keys)
- }
-}
-
-keys().then(key => {
var navbar = h('div', {classList: 'navbar'}, [
h('div', {classList: 'internal'}, [
h('li', [h('a', {href: '#'}, ['Home'])]),