use username IP for path links

This commit is contained in:
Johann Dreo 2022-12-07 08:19:41 +01:00
commit 34d451b8cd

View file

@ -786,8 +786,17 @@ __dotmatrix_activate_hostname() {
if _lp_hostname; then
case "$lp_connection" in
ssh)
local client_ip client_port server_ip server_port hostname=
IFS=" " read -r client_ip client_port server_ip server_port <<<"$SSH_CONNECTION"
local username=${USER:-${USERNAME:-${LOGNAME-}}}
if _lp_create_link "ssh://${username}@${server_ip}:${server_port}" "$lp_hostname"; then
hostname="$link"
else
hostname="$lp_hostname"
fi
# If we want a different color for each host
(( LP_ENABLE_SSH_COLORS )) && LP_COLOR_SSH="$LP_COLOR_HOST_HASH"
hostname="${LP_COLOR_SSH}${lp_hostname}"
hostname="${LP_COLOR_SSH}${hostname}"
;;
tel)
hostname="${lp_hostname}"