view src/index.html.luan @ 19:b386303be994

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 02 Nov 2023 21:00:37 -0600
parents 74277b56ac3c
children
line wrap: on
line source

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>
<html>
	<head>
<%		head() %>
		<title>Disearch</title>
	</head>
	<body>
<%		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>
<%
end