From 552e70e3b003c10f4a54bb8d226313a17f6dc7f9 Mon Sep 17 00:00:00 2001 From: Doug Hoyte Date: Sun, 10 Sep 2023 18:47:08 -0400 Subject: [PATCH] wip --- src/apps/web/WebReader.cpp | 4 ++++ src/apps/web/static/oddbean.css | 25 +++++++++++++++++++++++++ src/apps/web/static/oddbean.js | 5 +++++ src/apps/web/tmpls/about.tmpl | 25 +++++++++++++++++++++++++ src/apps/web/tmpls/login.tmpl | 7 +++++++ src/apps/web/tmpls/main.tmpl | 5 +++++ 6 files changed, 71 insertions(+) create mode 100644 src/apps/web/tmpls/about.tmpl create mode 100644 src/apps/web/tmpls/login.tmpl diff --git a/src/apps/web/WebReader.cpp b/src/apps/web/WebReader.cpp index 8e0f578..b4b4a1c 100644 --- a/src/apps/web/WebReader.cpp +++ b/src/apps/web/WebReader.cpp @@ -293,6 +293,10 @@ HTTPResponse WebServer::generateReadResponse(lmdb::txn &txn, Decompressor &decom } else if (u.path[0] == "favicon.ico") { rawBody = std::string(oddbeanStatic__favicon_ico()); contentType = "image/x-icon"; + } else if (u.path[0] == "login") { + body = tmpl::login(0); + } else if (u.path[0] == "about") { + body = tmpl::about(0); } diff --git a/src/apps/web/static/oddbean.css b/src/apps/web/static/oddbean.css index 5f2c84f..5ff3219 100644 --- a/src/apps/web/static/oddbean.css +++ b/src/apps/web/static/oddbean.css @@ -79,12 +79,20 @@ h2 { .new-post { margin-left: 20px; } + + .about { + margin-left: 20px; + } } .login { margin-right: 5px; } + .no-js { + color: red; + } + a:link, a:visited { color: black; } @@ -299,3 +307,20 @@ table.vert { margin-bottom: 2px; } } + + + + +.info-page { + padding-left: 10px; + padding-right: 10px; + + p { + margin-top: 15px; + margin-bottom: 15px; + } + + b { + font-weight: bold; + } +} diff --git a/src/apps/web/static/oddbean.js b/src/apps/web/static/oddbean.js index bd90bf1..d78cd1d 100644 --- a/src/apps/web/static/oddbean.js +++ b/src/apps/web/static/oddbean.js @@ -24,6 +24,11 @@ document.addEventListener('alpine:init', () => { }, async login() { + if (!window.nostr) { + window.location = "/login"; + return; + } + let pubkey = await nostr.getPublicKey(); let response = await fetch(`/u/${pubkey}/metadata.json`); diff --git a/src/apps/web/tmpls/about.tmpl b/src/apps/web/tmpls/about.tmpl new file mode 100644 index 0000000..068671d --- /dev/null +++ b/src/apps/web/tmpls/about.tmpl @@ -0,0 +1,25 @@ +
+

+ Hi, thanks for stopping by! Oddbean is a discussion site built on the nostr protocol. You may notice that our design is heavily inspired by Hacker News and Reddit. This is on purpose. We want Oddbean to be a comfortable and familiar experience, with fast loading pages and minimal distractions. +

+ +

+ Why nostr? Nostr is a protocol for building decentralised systems. Is it perfect? No, but it is the closest thing we have to an honest-to-goodness decentralised social media protocol. Oddbean is just one of many interfaces to the same network. Even though most of the posts don't originate here, Oddbean users can still interact with anyone else on the network, thanks to the interoperability of nostr. If you get tired of Oddbean, you can easily move to another client. +

+ +

+ No crap. We just want to build a great distraction-free discussion site. No cookie pop-ups. In fact, no cookies, period. No elements bouncing around as the page loads. No "sign-up to our newsletter" modals that appear half way down. Javascript is optional (only needed for posting). +

+ +

+ No images. The written word is one of the greatest achievements of civilisation. They say "a picture is worth a thousand words", but consider this: If you give me a picture, I can describe it in great detail using a thousand words. But if I give you a thousand words, can you draw a picture that conveys all this information? +

+ +

+ How do I login? You don't. If you want to post or vote, I recommend using a browser extension such as nos2x (chrome, firefox), or one of several others. +

+ +

+ Is there an algorithm? Yes, computers don't work without algorithms. The goal of Oddbean is to make the algorithms used for ranking and filtering posts and comments transparent. When communities are ready, you'll be able to click on "algo" at the top of a community page and see exactly how it works. If you don't like it, you can fork it to your own community. The homepage is just another community, except one that I control. Don't like it? Don't use it. +

+
diff --git a/src/apps/web/tmpls/login.tmpl b/src/apps/web/tmpls/login.tmpl new file mode 100644 index 0000000..0473158 --- /dev/null +++ b/src/apps/web/tmpls/login.tmpl @@ -0,0 +1,7 @@ +
+

Hi, welcome!

+ +

Oddbean does not use usernames or passwords. If you want to post on Oddbean, you'll need to generate a nostr private key. But don't worry, this is easy and free. Best of all, if you get tired of Oddbean you can easily bring your key over to one of the many other nostr clients.

+ +

You should always keep your private key secret. That's why you'll never be asked to enter it into the Oddbean site. Instead, we recommend using a browser extension such as nos2x (chrome, firefox), or one of several others.

+
diff --git a/src/apps/web/tmpls/main.tmpl b/src/apps/web/tmpls/main.tmpl index 28014fc..c5e7079 100644 --- a/src/apps/web/tmpls/main.tmpl +++ b/src/apps/web/tmpls/main.tmpl @@ -23,6 +23,8 @@ (algo) ?(ctx.communitySpec) new post + + about @@ -31,6 +33,9 @@ | logout +