comparison 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
comparison
equal deleted inserted replaced
16:552d6f944acb 17:74277b56ac3c
1 local Luan = require "luan:Luan.luan" 1 local Luan = require "luan:Luan.luan"
2 local error = Luan.error 2 local error = Luan.error
3 local ipairs = Luan.ipairs or error()
4 local Time = require "luan:Time.luan"
5 local time_now = Time.now or error()
6 local Html = require "luan:Html.luan"
7 local html_encode = Html.encode or error()
3 local Io = require "luan:Io.luan" 8 local Io = require "luan:Io.luan"
4 local Http = require "luan:http/Http.luan" 9 local Http = require "luan:http/Http.luan"
5 local Shared = require "site:/lib/Shared.luan" 10 local Shared = require "site:/lib/Shared.luan"
6 local head = Shared.head or error() 11 local head = Shared.head or error()
7 local header = Shared.header or error() 12 local header = Shared.header or error()
8 local footer = Shared.footer or error() 13 local footer = Shared.footer or error()
14 local ago = Shared.ago or error()
15 local Server = require "site:/lib/Server.luan"
16 local search_servers = Server.search or error()
9 17
10 18
11 return function() 19 return function()
20 local servers = search_servers("type:server","server_bumped desc")
12 Io.stdout = Http.response.text_writer() 21 Io.stdout = Http.response.text_writer()
13 %> 22 %>
14 <!doctype html> 23 <!doctype html>
15 <html> 24 <html>
16 <head> 25 <head>
17 <% head() %> 26 <% head() %>
18 <title>Disearch</title> 27 <title>Disearch</title>
19 </head> 28 </head>
20 <body> 29 <body>
21 <% header() %> 30 <% header()
22 <p>under construction</p> 31 local now = time_now()
23 <% footer() %> 32 for _, server in ipairs(servers) do
33 %>
34 <p>
35 <%=html_encode(server.name)%>
36 <% server.write_img_html() %>
37 <a href="<%=server.invite_url()%>">invite</a>
38 bumped <% ago( now - server.bumped ) %>
39 </p>
40 <%
41 end
42 footer() %>
24 </body> 43 </body>
25 </html> 44 </html>
26 <% 45 <%
27 end 46 end