Mercurial Hosting > chat
view src/lib/Shared.luan @ 1:b116b6ef07bf
add config
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 23 Oct 2024 21:18:04 -0600 |
parents | fddd11ae516c |
children | ee1f91e67509 |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local parse = Luan.parse or error() local Io = require "luan:Io.luan" local uri = Io.uri or error() local Shared = {} function Shared.head() %> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> @import "/site.css"; </style> <% end local function header(crumbs) %> <div header> <a href="/">Reactionary Chat</a> <% for _, crumb in ipairs(crumbs or {}) do %> / <%=crumb%> <% end %> </div> <% end Shared.header = header function Shared.private_header() header{ [[<a href="/private/">private</a>]] [[<a href="/private/tools/">tools</a>]] } end local config_file = uri("site:/private/local/config.luano") Shared.config_file = config_file do if config_file.exists() then Shared.config = parse( config_file.read_text() ) else Shared.config = { mail_server = { host = "smtpcorp.com" port = 465 username = "xxx" password = "xxx" } } end end return Shared