[object Object]

← back to Doing Viewer

doing-viewer: add Basic Auth (admin/DW2024!) gate

4e2d1e34a2ec85647431a902e899a3020248a5af · 2026-08-20 12:15:38 -0700 · Steve

Files touched

Diff

commit 4e2d1e34a2ec85647431a902e899a3020248a5af
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu Aug 20 12:15:38 2026 -0700

    doing-viewer: add Basic Auth (admin/DW2024!) gate
---
 .deploy.conf |   2 ++
 board.png    | Bin 0 -> 558098 bytes
 server.js    |  16 ++++++++++++++++
 3 files changed, 18 insertions(+)

diff --git a/.deploy.conf b/.deploy.conf
new file mode 100644
index 0000000..f52ce87
--- /dev/null
+++ b/.deploy.conf
@@ -0,0 +1,2 @@
+PROJECT_NAME=doing-viewer
+HEALTH_URL=http://127.0.0.1:9790/api/doing
diff --git a/board.png b/board.png
new file mode 100644
index 0000000..24ac3bb
Binary files /dev/null and b/board.png differ
diff --git a/server.js b/server.js
index 45e1b1f..4dcfc9c 100644
--- a/server.js
+++ b/server.js
@@ -118,7 +118,23 @@ tick();
 
 // ── http ─────────────────────────────────────────────────────────────────────
 const INDEX = fs.readFileSync(path.join(__dirname, 'public', 'index.html'), 'utf8');
+
+// ── Basic Auth (house standard admin / DW2024!, env-overridable) ─────────────
+const AUTH_USER = process.env.BASIC_USER || 'admin';
+const AUTH_PASS = process.env.BASIC_PASS || 'DW2024!';
+function authed(req) {
+  const h = req.headers['authorization'] || '';
+  if (!h.startsWith('Basic ')) return false;
+  const [u, p] = Buffer.from(h.slice(6), 'base64').toString().split(':');
+  return u === AUTH_USER && p === AUTH_PASS;
+}
+
 http.createServer((req, res) => {
+  if (!authed(req)) {
+    res.writeHead(401, { 'WWW-Authenticate': 'Basic realm="doing-viewer"' });
+    res.end('auth required');
+    return;
+  }
   if (req.url === '/api/doing') {
     const list = doingList();
     const pending = list.filter(i => !i.eli12).length;

← b2a0530 doing-viewer: live 3-column board (doing / what it's doing /  ·  back to Doing Viewer  ·  doing-viewer: Kamatera mirror (snapshot publish + mirror ser 72f6ce7 →