Skip to content

Commit

Permalink
Fix epoch in send message (#25)
Browse files Browse the repository at this point in the history
fix: set epoch in send_message API even if not specified

Signed-off-by: Gerard Hickey <[email protected]>
  • Loading branch information
hickey authored Dec 9, 2023
1 parent e384052 commit 1357fca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions meshchat
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function send_message()
local message = query.message:gsub("\n", "\\n"):gsub('"', '\\"'):gsub("\t", " ")

local epoch = os.time()
if tonumber(query.epoch) > epoch then
if query.epoch and tonumber(query.epoch) > epoch then
epoch = query.epoch
end

Expand Down Expand Up @@ -467,7 +467,7 @@ end
function messages_version_ui()
print("Content-type: application/json\r")
print("\r")

print(string.format([[{"messages_version":%s}]], get_messages_db_version()))

get_lock()
Expand Down Expand Up @@ -511,7 +511,7 @@ end
function hosts()
print("Content-type: application/json\r")
print("\r")

local node = node_name()
local hosts = {}
for line in io.lines("/var/dhcp.leases")
Expand Down Expand Up @@ -562,7 +562,7 @@ end
function hosts_raw()
print("Content-type: application/json\r")
print("\r")

local hosts = {}
for line in io.lines("/var/dhcp.leases")
do
Expand Down

0 comments on commit 1357fca

Please sign in to comment.