Diff

mod_client_management/mod_client_management.lua @ 5663:f6e8165a2ec2 draft

Merge upstream
author Trần H. Trung <xmpp:trần.h.trung@trung.fun>
date Tue, 29 Aug 2023 22:46:27 +0700
parent 5650:1571c280aaef
child 5668:f16edebb1305
line wrap: on
line diff
--- a/mod_client_management/mod_client_management.lua	Tue Aug 01 01:27:45 2023 +0700
+++ b/mod_client_management/mod_client_management.lua	Tue Aug 29 22:46:27 2023 +0700
@@ -437,6 +437,10 @@
 			return true, "No clients associated with this account";
 		end
 
+		local function date_or_time(last_seen)
+			return last_seen and os.date(os.difftime(os.time(), last_seen) >= 86400 and "%Y-%m-%d" or "%H:%M:%S", last_seen);
+		end
+
 		local colspec = {
 			{ title = "ID"; key = "id"; width = "1p" };
 			{
@@ -446,13 +450,18 @@
 				mapper = user_agent_tostring;
 			};
 			{
+				title = "First seen";
+				key = "first_seen";
+				width = math.max(#os.date("%Y-%m-%d"), #os.date("%H:%M:%S"));
+				align = "right";
+				mapper = date_or_time;
+			};
+			{
 				title = "Last seen";
 				key = "last_seen";
 				width = math.max(#os.date("%Y-%m-%d"), #os.date("%H:%M:%S"));
 				align = "right";
-				mapper = function(last_seen)
-					return last_seen and os.date(os.difftime(os.time(), last_seen) >= 86400 and "%Y-%m-%d" or "%H:%M:%S", last_seen);
-				end;
+				mapper = date_or_time;
 			};
 			{
 				title = "Authentication";