Comparison

plugins/mod_admin_shell.lua @ 13037:635ed9a362ee

mod_admin_shell: Dynamically size JIDs and hosts Reasoning: a hostname is one part, a JID is 3 parts.
author Kim Alvefur <zash@zash.se>
date Fri, 07 Apr 2023 12:58:02 +0200
parent 13036:1612c7f7dd55
child 13041:61b00bd20074
comparison
equal deleted inserted replaced
13036:1612c7f7dd55 13037:635ed9a362ee
769 769
770 available_columns = { 770 available_columns = {
771 jid = { 771 jid = {
772 title = "JID"; 772 title = "JID";
773 description = "Full JID of user session"; 773 description = "Full JID of user session";
774 width = 32; 774 width = "3p";
775 key = "full_jid"; 775 key = "full_jid";
776 mapper = function(full_jid, session) return full_jid or get_jid(session) end; 776 mapper = function(full_jid, session) return full_jid or get_jid(session) end;
777 }; 777 };
778 host = { 778 host = {
779 title = "Host"; 779 title = "Host";
780 description = "Local hostname"; 780 description = "Local hostname";
781 key = "host"; 781 key = "host";
782 width = 22; 782 width = "1p";
783 mapper = function(host, session) 783 mapper = function(host, session)
784 return host or get_s2s_hosts(session) or "?"; 784 return host or get_s2s_hosts(session) or "?";
785 end; 785 end;
786 }; 786 };
787 remote = { 787 remote = {
788 title = "Remote"; 788 title = "Remote";
789 description = "Remote hostname"; 789 description = "Remote hostname";
790 width = 22; 790 width = "1p";
791 mapper = function(_, session) 791 mapper = function(_, session)
792 return select(2, get_s2s_hosts(session)); 792 return select(2, get_s2s_hosts(session));
793 end; 793 end;
794 }; 794 };
795 port = { 795 port = {
910 end; 910 end;
911 }; 911 };
912 sni = { 912 sni = {
913 title = "SNI"; 913 title = "SNI";
914 description = "Hostname requested in TLS"; 914 description = "Hostname requested in TLS";
915 width = 22; -- same as host, remote etc 915 width = "1p"; -- same as host, remote etc
916 mapper = function(_, session) 916 mapper = function(_, session)
917 if not session.conn then return end 917 if not session.conn then return end
918 local sock = session.conn:socket(); 918 local sock = session.conn:socket();
919 return sock and sock.getsniname and sock:getsniname() or ""; 919 return sock and sock.getsniname and sock:getsniname() or "";
920 end; 920 end;