diff unsubscribe/src/lib/Shared.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/lib/Shared.luan	Fri Jul 11 20:57:49 2025 -0600
@@ -0,0 +1,50 @@
+local Luan = require "luan:Luan.luan"
+local error = Luan.error
+local String = require "luan:String.luan"
+local regex = String.regex or error()
+
+
+local Shared = {}
+
+function Shared.head()
+%>
+		<meta name="viewport" content="width=device-width, initial-scale=1">
+		<style>
+			@import "/site.css";
+		</style>
+<%
+end
+
+function Shared.header()
+%>
+		<div header>
+			<a header href="https://linkmy.style/">
+				<img logo=big src="https://linkmy.style/images/logo.png">
+				<img logo=small src="https://linkmy.style/images/small_logo.png">
+			</a>
+		</div>
+<%
+end
+
+function Shared.footer()
+%>
+		<div footer>
+			<span>
+				<a href="https://linkmy.style/help.html">Help</a>
+				<br>support@linkmy.style
+			</span>
+			<span>
+				<a href="https://apps.apple.com/us/app/linkmystyle/id6475133762"><img ios src="https://linkmy.style/images/ios.svg"></a>
+				<a href="https://www.instagram.com/linkmy.style/"><img src="https://linkmy.style/images/icons/instagram.svg"></a>
+			</span>
+		</div>
+<%
+end
+
+local email_regex = regex[[^[-+~.\w]+@[-.\w]+$]]
+
+function Shared.validate_email(email)
+	email_regex.matches(email) or error("bad email: "..email)
+end
+
+return Shared