Mercurial Hosting > chat
comparison src/index.html.luan @ 46:42b741a1d5c6
add username
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 28 Feb 2025 19:25:12 -0700 |
parents | 436216d17a1b |
children | 7628fd0e3560 |
comparison
equal
deleted
inserted
replaced
45:e138343b2c76 | 46:42b741a1d5c6 |
---|---|
5 local range = Luan.range or error() | 5 local range = Luan.range or error() |
6 local Table = require "luan:Table.luan" | 6 local Table = require "luan:Table.luan" |
7 local concat = Table.concat or error() | 7 local concat = Table.concat or error() |
8 local is_empty = Table.is_empty or error() | 8 local is_empty = Table.is_empty or error() |
9 local size = Table.size or error() | 9 local size = Table.size or error() |
10 local Parsers = require "luan:Parsers.luan" | |
11 local json_string = Parsers.json_string or error() | |
10 local Io = require "luan:Io.luan" | 12 local Io = require "luan:Io.luan" |
11 local Http = require "luan:http/Http.luan" | 13 local Http = require "luan:http/Http.luan" |
12 local Shared = require "site:/lib/Shared.luan" | 14 local Shared = require "site:/lib/Shared.luan" |
13 local head = Shared.head or error() | 15 local head = Shared.head or error() |
14 local header = Shared.header or error() | 16 local header = Shared.header or error() |
61 end | 63 end |
62 return chat | 64 return chat |
63 end | 65 end |
64 | 66 |
65 return function() | 67 return function() |
66 local with = Http.request.parameters.with | 68 local with_email = Http.request.parameters.with |
67 with = to_set(with) | 69 local with = to_set(with_email) |
68 local user = current_user() | 70 local user = current_user() |
69 if user == nil then | 71 if user == nil then |
70 local url = "/login.html" | 72 local url = "/login.html" |
71 if not is_empty(with) then | 73 if not is_empty(with) then |
72 local t = {} | 74 local t = {} |
146 | 148 |
147 <% | 149 <% |
148 if selected ~= nil then | 150 if selected ~= nil then |
149 %> | 151 %> |
150 let div = document.querySelector('div[chat="<%=selected.id%>"]'); | 152 let div = document.querySelector('div[chat="<%=selected.id%>"]'); |
151 selectChat(div); | 153 selectChat(div,<%=json_string(with_email)%>); |
152 <% | 154 <% |
153 end | 155 end |
154 %> | 156 %> |
155 setUserEventSource(<%=user_id%>); | 157 setUserEventSource(<%=user_id%>); |
156 lastUpdate = <%=user.last_update()%>; | 158 lastUpdate = <%=user.last_update()%>; |