Mercurial Hosting > hghosting
comparison src/private/tools/configure_mail.html.luan @ 6:a6be8817c05b
move mail_info to config
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 02 Jun 2022 19:18:12 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
5:a09d8bcdc0f9 | 6:a6be8817c05b |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local stringify = Luan.stringify or error() | |
4 local parse = Luan.parse or error() | |
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.private_header or error() | |
10 local config = Shared.config or error() | |
11 local get_raw_config = Shared.get_raw_config or error() | |
12 local save_raw_config = Shared.save_raw_config or error() | |
13 | |
14 | |
15 local function posted() | |
16 local mail_info = Http.request.parameters.mail_info or error() | |
17 mail_info = parse(mail_info) | |
18 local raw_config = get_raw_config() | |
19 raw_config.mail_info = mail_info | |
20 save_raw_config(raw_config) | |
21 %> | |
22 <!doctype html> | |
23 <html> | |
24 <head> | |
25 <% head() %> | |
26 <title>Mercurial Configure Email</title> | |
27 </head> | |
28 <body> | |
29 <% header() %> | |
30 <div content> | |
31 <h1>Configure Email</h1> | |
32 <p>Updated</p> | |
33 </div> | |
34 </body> | |
35 </html> | |
36 <% | |
37 end | |
38 | |
39 return function() | |
40 local mail_info = stringify(config.mail_info or { | |
41 host = "smtpcorp.com" | |
42 username = "xxx" | |
43 password = "xxx" | |
44 port = 2525 | |
45 }) | |
46 Io.stdout = Http.response.text_writer() | |
47 if Http.request.method == "POST" then | |
48 posted() | |
49 return | |
50 end | |
51 %> | |
52 <!doctype html> | |
53 <html> | |
54 <head> | |
55 <% head() %> | |
56 <title>Mercurial Configure Email</title> | |
57 </head> | |
58 <body> | |
59 <% header() %> | |
60 <div content> | |
61 <h1>Configure Email</h1> | |
62 <form method=post> | |
63 <p> | |
64 <textarea name=mail_info rows=6 cols=40><%=mail_info%></textarea> | |
65 </p> | |
66 <p> | |
67 <input type=submit value="Update"> | |
68 </p> | |
69 </form> | |
70 </div> | |
71 </body> | |
72 </html> | |
73 <% | |
74 end |