annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
13
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
3 local ipairs = Luan.ipairs or error()
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
4 local Html = require "luan:Html.luan"
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
5 local html_encode = Html.encode or error()
1
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local Io = require "luan:Io.luan"
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 local Http = require "luan:http/Http.luan"
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 local Shared = require "site:/lib/Shared.luan"
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 local head = Shared.head or error()
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 local header = Shared.header or error()
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 local footer = Shared.footer or error()
13
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
12 local Server = require "site:/lib/Server.luan"
1
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 return function()
13
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
16 local servers = Server.get_user_servers()
1
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 Io.stdout = Http.response.text_writer()
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 %>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 <!doctype html>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 <html>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 <head>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 <% head() %>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 <title>Disearch</title>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 </head>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 <body>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 <% header() %>
11
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
27
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
28 <h1>Your servers</h1>
13
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
29 <%
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
30 for _, server in ipairs(servers) do
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
31 %>
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
32 <p>
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
33 <%=html_encode(server.name)%>
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
34 <% server.write_img_html() %>
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
35 <a href="<%=server.invite_url()%>">invite</a>
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
36 <a href="javascript:ajax('/delete_server.js?server=<%=server.id%>')">delete</a>
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
37 </p>
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
38 <%
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
39 end
af2b95854072 add server records
Franklin Schmidt <fschmidt@gmail.com>
parents: 11
diff changeset
40 %>
11
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
41 <p><a href="choose_server.html">add server</a></p>
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
42
1
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43 <% footer() %>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 </body>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 </html>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
46 <%
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
47 end