1
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
11
|
3 local Html = require "luan:Html.luan"
|
|
4 local html_encode = Html.encode or error()
|
1
|
5 local Io = require "luan:Io.luan"
|
|
6 local Http = require "luan:http/Http.luan"
|
|
7 local Shared = require "site:/lib/Shared.luan"
|
|
8 local head = Shared.head or error()
|
|
9 local header = Shared.header or error()
|
|
10 local footer = Shared.footer or error()
|
|
11
|
|
12
|
|
13 return function()
|
11
|
14 local parameters = Http.request.parameters
|
|
15 local id = parameters.id or error()
|
|
16 local name = parameters.name or error()
|
12
|
17 name = html_encode(name)
|
|
18 local icon = parameters.icon or error()
|
1
|
19 Io.stdout = Http.response.text_writer()
|
|
20 %>
|
|
21 <!doctype html>
|
|
22 <html>
|
|
23 <head>
|
|
24 <% head() %>
|
|
25 <title>Disearch</title>
|
12
|
26 <style>
|
|
27 input[type="url"] {
|
|
28 width: 100%;
|
|
29 }
|
|
30 </style>
|
1
|
31 </head>
|
|
32 <body>
|
|
33 <% header() %>
|
11
|
34
|
|
35 <h1>Add server</h1>
|
|
36
|
12
|
37 <form page onsubmit="ajaxForm('/add_server.js',this); return false">
|
|
38 <input type=hidden name=id value="<%=id%>">
|
|
39 <input type=hidden name=name value="<%=name%>">
|
|
40 <input type=hidden name=icon value="<%=icon%>">
|
|
41 <p><%=name%></p>
|
|
42 <p><img icon src="https://cdn.discordapp.com/icons/<%=id%>/<%=icon%>.png"></p>
|
|
43 <p>
|
|
44 Invite URL:<br>
|
|
45 <input type=url required name=invite>
|
|
46 <span error=invite></span>
|
|
47 </p>
|
|
48 <p><input type=submit></p>
|
|
49 </form>
|
11
|
50
|
1
|
51 <% footer() %>
|
|
52 </body>
|
|
53 </html>
|
|
54 <%
|
|
55 end
|