1
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local Time = require "luan:Time.luan"
|
4
|
4 local Http = require "luan:http/Http.luan"
|
1
|
5
|
|
6
|
|
7 local Shared = {}
|
|
8
|
|
9 local started = Time.now()
|
|
10
|
4
|
11 local function get_user()
|
|
12 return Http.request.cookies.user
|
|
13 end
|
|
14 Shared.get_user = get_user
|
|
15
|
1
|
16 function Shared.head()
|
|
17 %>
|
|
18 <meta name="viewport" content="width=device-width, initial-scale=1">
|
|
19 <style>
|
|
20 @import "/site.css?s=<%=started%>";
|
|
21 </style>
|
4
|
22 <script src="/site.js?s=<%=started%>"></script>
|
1
|
23 <%
|
|
24 end
|
|
25
|
|
26 function Shared.header()
|
|
27 %>
|
|
28 <div header>
|
2
|
29 <h1><a href="/">Disearch</a></h1>
|
4
|
30 <% if get_user() == nil then %>
|
5
|
31 <a href="login1.red">login</a>
|
4
|
32 <% else %>
|
|
33 <a href="javascript:logout()">logout</a>
|
|
34 <% end %>
|
1
|
35 </div>
|
|
36 <hr>
|
|
37 <%
|
|
38 end
|
|
39
|
|
40 function Shared.footer()
|
|
41 %>
|
|
42 <hr>
|
|
43 <div footer>
|
|
44 something or other in the footer
|
|
45 </div>
|
|
46 <%
|
|
47 end
|
|
48
|
6
|
49 function Shared.discord_redirect_uri()
|
|
50 local request = Http.request
|
|
51 return request.scheme.."://"..request.headers["Host"].."/login2.red"
|
|
52 end
|
|
53
|
1
|
54 return Shared
|