annotate src/private/tools/config.html.luan @ 23:e5c77f8d506d default tip

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 15 Sep 2024 10:45:43 -0600
parents 43814e9f5802
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local stringify = Luan.stringify or error()
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local Io = require "luan:Io.luan"
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local Http = require "luan:http/Http.luan"
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local Config = require "site:/lib/Config.luan"
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 return function()
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 local config = Config.get_for_config()
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 config = stringify(config)
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 Io.stdout = Http.response.text_writer()
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 %>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 <!doctype html>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 <html>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 <head>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 <meta name="viewport" content="width=device-width, initial-scale=1">
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 <style>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 @import "/tools/tools.css";
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 textarea {
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 width: 100%;
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 height: 200px;
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 }
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 </style>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 </head>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 <body>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 <h1>Config</h1>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 <form method=post action="config_save.txt">
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 <p><textarea name=config><%=config%></textarea></p>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 <p><input type=submit></p>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 </form>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 </body>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 </html>
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 <%
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 end