1
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
13
|
3 local ipairs = Luan.ipairs or error()
|
|
4 local Html = require "luan:Html.luan"
|
|
5 local html_encode = Html.encode or error()
|
1
|
6 local Io = require "luan:Io.luan"
|
|
7 local Http = require "luan:http/Http.luan"
|
|
8 local Shared = require "site:/lib/Shared.luan"
|
|
9 local head = Shared.head or error()
|
|
10 local header = Shared.header or error()
|
|
11 local footer = Shared.footer or error()
|
13
|
12 local Server = require "site:/lib/Server.luan"
|
1
|
13
|
|
14
|
|
15 return function()
|
13
|
16 local servers = Server.get_user_servers()
|
1
|
17 Io.stdout = Http.response.text_writer()
|
|
18 %>
|
|
19 <!doctype html>
|
|
20 <html>
|
|
21 <head>
|
|
22 <% head() %>
|
|
23 <title>Disearch</title>
|
|
24 </head>
|
|
25 <body>
|
|
26 <% header() %>
|
11
|
27
|
|
28 <h1>Your servers</h1>
|
13
|
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 %>
|
11
|
41 <p><a href="choose_server.html">add server</a></p>
|
|
42
|
1
|
43 <% footer() %>
|
|
44 </body>
|
|
45 </html>
|
|
46 <%
|
|
47 end
|