annotate src/private/tools/configure_mail.html.luan @ 18:64eee582fec1

add move logs while restart
author Vadim Filimonov <fffilimonov@yandex.ru>
date Wed, 19 Jun 2024 11:45:10 +0300
parents a6be8817c05b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local stringify = Luan.stringify or error()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local parse = Luan.parse or error()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local Io = require "luan:Io.luan"
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local Http = require "luan:http/Http.luan"
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 local Shared = require "site:/lib/Shared.luan"
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 local head = Shared.head or error()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 local header = Shared.private_header or error()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 local config = Shared.config or error()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 local get_raw_config = Shared.get_raw_config or error()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 local save_raw_config = Shared.save_raw_config or error()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 local function posted()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 local mail_info = Http.request.parameters.mail_info or error()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 mail_info = parse(mail_info)
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 local raw_config = get_raw_config()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 raw_config.mail_info = mail_info
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 save_raw_config(raw_config)
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 %>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 <!doctype html>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 <html>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 <head>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 <% head() %>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 <title>Mercurial Configure Email</title>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 </head>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 <body>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 <% header() %>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 <div content>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 <h1>Configure Email</h1>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 <p>Updated</p>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 </div>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 </body>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 </html>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 <%
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 end
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 return function()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 local mail_info = stringify(config.mail_info or {
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 host = "smtpcorp.com"
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 username = "xxx"
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43 password = "xxx"
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 port = 2525
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 })
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
46 Io.stdout = Http.response.text_writer()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
47 if Http.request.method == "POST" then
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
48 posted()
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
49 return
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
50 end
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
51 %>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
52 <!doctype html>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
53 <html>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
54 <head>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
55 <% head() %>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
56 <title>Mercurial Configure Email</title>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
57 </head>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
58 <body>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
59 <% header() %>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
60 <div content>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
61 <h1>Configure Email</h1>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
62 <form method=post>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
63 <p>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
64 <textarea name=mail_info rows=6 cols=40><%=mail_info%></textarea>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
65 </p>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
66 <p>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
67 <input type=submit value="Update">
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
68 </p>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
69 </form>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
70 </div>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
71 </body>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
72 </html>
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
73 <%
a6be8817c05b move mail_info to config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
74 end