Mercurial Hosting > disearch
comparison src/servers.html.luan @ 13:af2b95854072
add server records
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 30 Oct 2023 21:32:42 -0600 |
parents | 62dd23f0b549 |
children | 80105b716a62 |
comparison
equal
deleted
inserted
replaced
12:3e2cb946d511 | 13:af2b95854072 |
---|---|
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 Html = require "luan:Html.luan" | |
5 local html_encode = Html.encode or error() | |
3 local Io = require "luan:Io.luan" | 6 local Io = require "luan:Io.luan" |
4 local Http = require "luan:http/Http.luan" | 7 local Http = require "luan:http/Http.luan" |
5 local Shared = require "site:/lib/Shared.luan" | 8 local Shared = require "site:/lib/Shared.luan" |
6 local head = Shared.head or error() | 9 local head = Shared.head or error() |
7 local header = Shared.header or error() | 10 local header = Shared.header or error() |
8 local footer = Shared.footer or error() | 11 local footer = Shared.footer or error() |
12 local Server = require "site:/lib/Server.luan" | |
9 | 13 |
10 | 14 |
11 return function() | 15 return function() |
16 local servers = Server.get_user_servers() | |
12 Io.stdout = Http.response.text_writer() | 17 Io.stdout = Http.response.text_writer() |
13 %> | 18 %> |
14 <!doctype html> | 19 <!doctype html> |
15 <html> | 20 <html> |
16 <head> | 21 <head> |
19 </head> | 24 </head> |
20 <body> | 25 <body> |
21 <% header() %> | 26 <% header() %> |
22 | 27 |
23 <h1>Your servers</h1> | 28 <h1>Your servers</h1> |
24 | 29 <% |
30 for _, server in ipairs(servers) do | |
31 %> | |
32 <p> | |
33 <%=html_encode(server.name)%> | |
34 <% server.write_img_html() %> | |
35 <a href="<%=server.invite_url()%>">invite</a> | |
36 <a href="javascript:ajax('/delete_server.js?server=<%=server.id%>')">delete</a> | |
37 </p> | |
38 <% | |
39 end | |
40 %> | |
25 <p><a href="choose_server.html">add server</a></p> | 41 <p><a href="choose_server.html">add server</a></p> |
26 | 42 |
27 <% footer() %> | 43 <% footer() %> |
28 </body> | 44 </body> |
29 </html> | 45 </html> |