annotate src/add_server.html.luan @ 11:62dd23f0b549

start add server
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 29 Oct 2023 22:39:31 -0600
parents src/index.html.luan@43814e9f5802
children 3e2cb946d511
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
11
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
3 local Html = require "luan:Html.luan"
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
4 local html_encode = Html.encode or error()
1
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local Io = require "luan:Io.luan"
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local Http = require "luan:http/Http.luan"
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 local Shared = require "site:/lib/Shared.luan"
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 local head = Shared.head or error()
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 local header = Shared.header or error()
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 local footer = Shared.footer or error()
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 return function()
11
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
14 local parameters = Http.request.parameters
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
15 local id = parameters.id or error()
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
16 local name = parameters.name or error()
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
17 local icon = parameters.icon
1
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 Io.stdout = Http.response.text_writer()
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 %>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 <!doctype html>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 <html>
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 <% head() %>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 <title>Disearch</title>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 </head>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 <body>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 <% header() %>
11
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
28
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
29 <h1>Add server</h1>
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
30
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
31 <p><%=html_encode(name)%></p>
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
32 <% if icon ~= nil then %>
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
33 <p><img src="https://cdn.discordapp.com/icons/<%=id%>/<%=icon%>.png"></p>
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
34 <% end %>
62dd23f0b549 start add server
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
35
1
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 <% footer() %>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 </body>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 </html>
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 <%
d19b150ecb83 add Shared
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 end