diff src/index.html.luan @ 17:74277b56ac3c

home page
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 01 Nov 2023 21:11:25 -0600
parents 62dd23f0b549
children
line wrap: on
line diff
--- a/src/index.html.luan	Wed Nov 01 17:34:15 2023 -0600
+++ b/src/index.html.luan	Wed Nov 01 21:11:25 2023 -0600
@@ -1,14 +1,23 @@
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
+local ipairs = Luan.ipairs or error()
+local Time = require "luan:Time.luan"
+local time_now = Time.now or error()
+local Html = require "luan:Html.luan"
+local html_encode = Html.encode or error()
 local Io = require "luan:Io.luan"
 local Http = require "luan:http/Http.luan"
 local Shared = require "site:/lib/Shared.luan"
 local head = Shared.head or error()
 local header = Shared.header or error()
 local footer = Shared.footer or error()
+local ago = Shared.ago or error()
+local Server = require "site:/lib/Server.luan"
+local search_servers = Server.search or error()
 
 
 return function()
+	local servers = search_servers("type:server","server_bumped desc")
 	Io.stdout = Http.response.text_writer()
 %>
 <!doctype html>
@@ -18,9 +27,19 @@
 		<title>Disearch</title>
 	</head>
 	<body>
-<%		header() %>
-		<p>under construction</p>
-<%		footer() %>
+<%		header()
+	local now = time_now()
+	for _, server in ipairs(servers) do
+%>
+		<p>
+			<%=html_encode(server.name)%>
+			<% server.write_img_html() %>
+			<a href="<%=server.invite_url()%>">invite</a>
+			bumped <% ago( now - server.bumped ) %>
+		</p>
+<%
+	end
+		footer() %>
 	</body>
 </html>
 <%