comparison src/lib/Shared.luan @ 12:3e2cb946d511

form handling
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 30 Oct 2023 14:59:45 -0600
parents 62dd23f0b549
children af2b95854072
comparison
equal deleted inserted replaced
11:62dd23f0b549 12:3e2cb946d511
1 local Luan = require "luan:Luan.luan" 1 local Luan = require "luan:Luan.luan"
2 local error = Luan.error 2 local error = Luan.error
3 local Time = require "luan:Time.luan" 3 local Time = require "luan:Time.luan"
4 local Parsers = require "luan:Parsers.luan"
5 local json_string = Parsers.json_string or error()
4 local Http = require "luan:http/Http.luan" 6 local Http = require "luan:http/Http.luan"
5 7
6 8
7 local Shared = {} 9 local Shared = {}
8 10
56 function Shared.discord_redirect_uri() 58 function Shared.discord_redirect_uri()
57 local request = Http.request 59 local request = Http.request
58 return request.scheme.."://"..request.headers["Host"].."/login2.html" 60 return request.scheme.."://"..request.headers["Host"].."/login2.html"
59 end 61 end
60 62
63 function Shared.js_error(field,message)
64 %>
65 showError( context.form, '<%=field%>', <%=json_string(message)%> );
66 <%
67 end
68
61 return Shared 69 return Shared