summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-03-01 16:09:56 -0300
committerEuAndreh <eu@euandre.org>2024-03-01 16:11:17 -0300
commit013f9222f3134460a43fd79446b59237916cf0c3 (patch)
tree8d83c437c215f4b8260f513820830ebfcd326ee3
parentsrc/web.mjs: Try out new hero API (diff)
downloadpapod-013f9222f3134460a43fd79446b59237916cf0c3.tar.gz
papod-013f9222f3134460a43fd79446b59237916cf0c3.tar.xz
Setup user-level lighttpd reverse proxy for development and testing
Add static files as in production, too.
-rw-r--r--Makefile6
-rw-r--r--src/static/client.js0
-rw-r--r--src/static/favicon.svg62
-rw-r--r--src/static/index.html27
-rw-r--r--src/static/styles.css0
-rw-r--r--tests/lighttpd.conf32
6 files changed, 126 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index e0789d3..fce3ce3 100644
--- a/Makefile
+++ b/Makefile
@@ -57,6 +57,7 @@ derived-assets = \
side-assets = \
tests/hero-0.sock \
tests/hero-1.sock \
+ lighttpd.sock \
ircd.sock \
web.sock \
@@ -142,9 +143,12 @@ run-web: all
rm -f web.sock
./src/bin.mjs web web.sock
+run-proxy: all
+ lighttpd -Df tests/lighttpd.conf
+
## Run the web and IRC server locally.
run: all
- $(MAKE) run-ircd & $(MAKE) run-web & wait
+ $(MAKE) run-ircd & $(MAKE) run-web & $(MAKE) run-proxy & wait
## Show this help.
diff --git a/src/static/client.js b/src/static/client.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/static/client.js
diff --git a/src/static/favicon.svg b/src/static/favicon.svg
new file mode 100644
index 0000000..ce566b2
--- /dev/null
+++ b/src/static/favicon.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
+ <path d="M 0 8 L 1 8 L 1 9 L 0 9 L 0 8 Z" />
+ <path d="M 0 13 L 1 13 L 1 14 L 0 14 L 0 13 Z" />
+ <path d="M 1 8 L 2 8 L 2 9 L 1 9 L 1 8 Z" />
+ <path d="M 1 13 L 2 13 L 2 14 L 1 14 L 1 13 Z" />
+ <path d="M 2 8 L 3 8 L 3 9 L 2 9 L 2 8 Z" />
+ <path d="M 2 13 L 3 13 L 3 14 L 2 14 L 2 13 Z" />
+ <path d="M 3 8 L 4 8 L 4 9 L 3 9 L 3 8 Z" />
+ <path d="M 3 13 L 4 13 L 4 14 L 3 14 L 3 13 Z" />
+ <path d="M 4 7 L 5 7 L 5 8 L 4 8 L 4 7 Z" />
+ <path d="M 4 8 L 5 8 L 5 9 L 4 9 L 4 8 Z" />
+ <path d="M 4 13 L 5 13 L 5 14 L 4 14 L 4 13 Z" />
+ <path d="M 5 6 L 6 6 L 6 7 L 5 7 L 5 6 Z" />
+ <path d="M 5 7 L 6 7 L 6 8 L 5 8 L 5 7 Z" />
+ <path d="M 5 13 L 6 13 L 6 14 L 5 14 L 5 13 Z" />
+ <path d="M 6 5 L 7 5 L 7 6 L 6 6 L 6 5 Z" />
+ <path d="M 6 6 L 7 6 L 7 7 L 6 7 L 6 6 Z" />
+ <path d="M 6 14 L 7 14 L 7 15 L 6 15 L 6 14 Z" />
+ <path d="M 7 1 L 8 1 L 8 2 L 7 2 L 7 1 Z" />
+ <path d="M 7 14 L 8 14 L 8 15 L 7 15 L 7 14 Z" />
+ <path d="M 7 15 L 8 15 L 8 16 L 7 16 L 7 15 Z" />
+ <path d="M 7 2 L 8 2 L 8 3 L 7 3 L 7 2 Z" />
+ <path d="M 7 3 L 8 3 L 8 4 L 7 4 L 7 3 Z" />
+ <path d="M 7 4 L 8 4 L 8 5 L 7 5 L 7 4 Z" />
+ <path d="M 7 5 L 8 5 L 8 6 L 7 6 L 7 5 Z" />
+ <path d="M 8 1 L 9 1 L 9 2 L 8 2 L 8 1 Z" />
+ <path d="M 8 15 L 9 15 L 9 16 L 8 16 L 8 15 Z" />
+ <path d="M 9 1 L 10 1 L 10 2 L 9 2 L 9 1 Z" />
+ <path d="M 9 2 L 10 2 L 10 3 L 9 3 L 9 2 Z" />
+ <path d="M 9 6 L 10 6 L 10 7 L 9 7 L 9 6 Z" />
+ <path d="M 9 15 L 10 15 L 10 16 L 9 16 L 9 15 Z" />
+ <path d="M 10 2 L 11 2 L 11 3 L 10 3 L 10 2 Z" />
+ <path d="M 10 3 L 11 3 L 11 4 L 10 4 L 10 3 Z" />
+ <path d="M 10 4 L 11 4 L 11 5 L 10 5 L 10 4 Z" />
+ <path d="M 10 5 L 11 5 L 11 6 L 10 6 L 10 5 Z" />
+ <path d="M 10 6 L 11 6 L 11 7 L 10 7 L 10 6 Z" />
+ <path d="M 11 6 L 12 6 L 12 7 L 11 7 L 11 6 Z" />
+ <path d="M 11 8 L 12 8 L 12 9 L 11 9 L 11 8 Z" />
+ <path d="M 10 15 L 11 15 L 11 16 L 10 16 L 10 15 Z" />
+ <path d="M 11 10 L 12 10 L 12 11 L 11 11 L 11 10 Z" />
+ <path d="M 11 12 L 12 12 L 12 13 L 11 13 L 11 12 Z" />
+ <path d="M 11 14 L 12 14 L 12 15 L 11 15 L 11 14 Z" />
+ <path d="M 11 15 L 12 15 L 12 16 L 11 16 L 11 15 Z" />
+ <path d="M 12 6 L 13 6 L 13 7 L 12 7 L 12 6 Z" />
+ <path d="M 12 8 L 13 8 L 13 9 L 12 9 L 12 8 Z" />
+ <path d="M 12 10 L 13 10 L 13 11 L 12 11 L 12 10 Z" />
+ <path d="M 12 12 L 13 12 L 13 13 L 12 13 L 12 12 Z" />
+ <path d="M 12 14 L 13 14 L 13 15 L 12 15 L 12 14 Z" />
+ <path d="M 13 6 L 14 6 L 14 7 L 13 7 L 13 6 Z" />
+ <path d="M 13 8 L 14 8 L 14 9 L 13 9 L 13 8 Z" />
+ <path d="M 13 10 L 14 10 L 14 11 L 13 11 L 13 10 Z" />
+ <path d="M 13 12 L 14 12 L 14 13 L 13 13 L 13 12 Z" />
+ <path d="M 13 13 L 14 13 L 14 14 L 13 14 L 13 13 Z" />
+ <path d="M 13 14 L 14 14 L 14 15 L 13 15 L 13 14 Z" />
+ <path d="M 14 7 L 15 7 L 15 8 L 14 8 L 14 7 Z" />
+ <path d="M 14 8 L 15 8 L 15 9 L 14 9 L 14 8 Z" />
+ <path d="M 14 9 L 15 9 L 15 10 L 14 10 L 14 9 Z" />
+ <path d="M 14 10 L 15 10 L 15 11 L 14 11 L 14 10 Z" />
+ <path d="M 14 11 L 15 11 L 15 12 L 14 12 L 14 11 Z" />
+ <path d="M 14 12 L 15 12 L 15 13 L 14 13 L 14 12 Z" />
+</svg>
diff --git a/src/static/index.html b/src/static/index.html
new file mode 100644
index 0000000..b4c5118
--- /dev/null
+++ b/src/static/index.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Papo</title>
+ <link rel="stylesheet" type="text/css" href="styles.css" />
+ <link rel="icon" type="image/svg+xml" href="favicon.svg" />
+ <script type="module" src="client.js"></script>
+ </head>
+ <body>
+<!--
+// FIXME:
+// - i18n
+// - head metadata
+// - inline the favicon
+// - dark mode
+// - noscript
+-->
+ <h1>Chat</h1>
+ <div>
+ <input id="message" placeholder="Message" />
+ <button id="send" disabled="true">Send</button>
+ </div>
+ <div id="messages"></div>
+ </body>
+</html>
diff --git a/src/static/styles.css b/src/static/styles.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/static/styles.css
diff --git a/tests/lighttpd.conf b/tests/lighttpd.conf
new file mode 100644
index 0000000..5438366
--- /dev/null
+++ b/tests/lighttpd.conf
@@ -0,0 +1,32 @@
+server.modules += (
+ "mod_proxy",
+ "mod_accesslog",
+)
+
+server.bind = var.CWD + "/lighttpd.sock"
+server.document-root = var.CWD + "/src/static/"
+
+server.errorlog = "/dev/stderr"
+server.breakagelog = "/dev/stderr"
+accesslog.filename = "/dev/stderr"
+
+accesslog.format = ""
+accesslog.format += "{ "
+accesslog.format += "\"tool\": " + "\"lighttpd\", "
+accesslog.format += "\"http-host\": " + "\"%V\", "
+accesslog.format += "\"remote-addr\": " + "\"%h\", "
+accesslog.format += "\"remote-user\": " + "\"%u\", "
+accesslog.format += "\"request-method\": " + "\"%m\", "
+accesslog.format += "\"request\": " + "\"%r\", "
+accesslog.format += "\"status\": " + "%s, "
+accesslog.format += "\"body-bytes-sent\": " + "\"%b\", "
+accesslog.format += "\"duration-usec\": " + "%D, "
+accesslog.format += "\"http-referrer\": " + "\"%{Referer}i\", "
+accesslog.format += "\"http-user-agent\": " + "\"%{User-Agent}i\" "
+accesslog.format += "}"
+
+index-file.names = ( "index.html" )
+
+$HTTP["url"] =~ "^/api/" {
+ proxy.server = ( "" => (( "host" => var.CWD + "/web.sock" )))
+}