Mercurial Hosting > chat
comparison src/private/tools/save_config.txt.luan @ 1:b116b6ef07bf
add config
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Wed, 23 Oct 2024 21:18:04 -0600 |
| parents | |
| children | e229f4aacde0 |
comparison
equal
deleted
inserted
replaced
| 0:fddd11ae516c | 1:b116b6ef07bf |
|---|---|
| 1 local Luan = require "luan:Luan.luan" | |
| 2 local error = Luan.error | |
| 3 local parse = Luan.parse or error() | |
| 4 local stringify = Luan.stringify or error() | |
| 5 local Io = require "luan:Io.luan" | |
| 6 local uri = Io.uri or error() | |
| 7 local Http = require "luan:http/Http.luan" | |
| 8 local Shared = require "site:/lib/Shared.luan" | |
| 9 local config_file = Shared.config_file or error() | |
| 10 | |
| 11 | |
| 12 return function() | |
| 13 local config = Http.request.parameters.config or error() | |
| 14 config = parse(config) | |
| 15 uri("site:/private/local/").mkdir() | |
| 16 config_file.write_text(stringify(config).."\n") | |
| 17 Http.reset_luan() | |
| 18 Io.stdout = Http.response.text_writer() | |
| 19 %>saved<% | |
| 20 end |
