diff unsubscribe/src/private/tools/unsubscribed.html.luan @ 0:8f4df159f06b

start public repo
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 11 Jul 2025 20:57:49 -0600
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unsubscribe/src/private/tools/unsubscribed.html.luan	Fri Jul 11 20:57:49 2025 -0600
@@ -0,0 +1,41 @@
+local Luan = require "luan:Luan.luan"
+local error = Luan.error
+local ipairs = Luan.ipairs or error()
+local Io = require "luan:Io.luan"
+local Http = require "luan:http/Http.luan"
+local Db = require "site:/lib/Db.luan"
+
+
+return function()
+	local docs = Db.search("type:unsubscribe",1,1000000)
+	Io.stdout = Http.response.text_writer()
+%>
+<!doctype html>
+<html lang="en">
+	<head>
+		<meta name="viewport" content="width=device-width, initial-scale=1">
+		<style>
+			@import "tools.css";
+
+			body {
+				margin-top: 0;
+				margin-bottom: 0;
+			}
+		</style>
+	</head>
+	<body>
+<%
+	for _, doc in ipairs(docs) do
+		local email = doc.unsubscribe_email or error()
+%>
+		<p>
+			<a href="/subscribe.html?email=<%= email %>">X</a>
+			<%= email %>
+		</p>
+<%
+	end
+%>
+	</body>
+</html>
+<%
+end