comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:8f4df159f06b
1 local Luan = require "luan:Luan.luan"
2 local error = Luan.error
3 local ipairs = Luan.ipairs or error()
4 local Io = require "luan:Io.luan"
5 local Http = require "luan:http/Http.luan"
6 local Db = require "site:/lib/Db.luan"
7
8
9 return function()
10 local docs = Db.search("type:unsubscribe",1,1000000)
11 Io.stdout = Http.response.text_writer()
12 %>
13 <!doctype html>
14 <html lang="en">
15 <head>
16 <meta name="viewport" content="width=device-width, initial-scale=1">
17 <style>
18 @import "tools.css";
19
20 body {
21 margin-top: 0;
22 margin-bottom: 0;
23 }
24 </style>
25 </head>
26 <body>
27 <%
28 for _, doc in ipairs(docs) do
29 local email = doc.unsubscribe_email or error()
30 %>
31 <p>
32 <a href="/subscribe.html?email=<%= email %>">X</a>
33 <%= email %>
34 </p>
35 <%
36 end
37 %>
38 </body>
39 </html>
40 <%
41 end