From 394498b14d8271f38df2e0417c8221f028f0a408 Mon Sep 17 00:00:00 2001 From: sbwml Date: Fri, 2 Sep 2022 13:30:19 +0800 Subject: [PATCH] ttyd ssl --- luasrc/model/cbi/dockerman/container.lua | 9 +++++++++ luasrc/view/dockerman/container_console.htm | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/luasrc/model/cbi/dockerman/container.lua b/luasrc/model/cbi/dockerman/container.lua index 5e3771a..8ec5293 100644 --- a/luasrc/model/cbi/dockerman/container.lua +++ b/luasrc/model/cbi/dockerman/container.lua @@ -705,6 +705,15 @@ elseif action == "console" then if not cmd_docker or not cmd_ttyd or cmd_docker:match("^%s+$") or cmd_ttyd:match("^%s+$")then return end + local uci = (require "luci.model.uci").cursor() + + local ttyd_ssl = uci:get("ttyd", "@ttyd[0]", "ssl") + local ttyd_ssl_key = uci:get("ttyd", "@ttyd[0]", "ssl_key") + local ttyd_ssl_cert = uci:get("ttyd", "@ttyd[0]", "ssl_cert") + + if ttyd_ssl == "1" and ttyd_ssl_cert and ttyd_ssl_key then + cmd_ttyd = string.format('%s -S -C %s -K %s', cmd_ttyd, ttyd_ssl_cert, ttyd_ssl_key) + end local pid = luci.util.trim(luci.util.exec("netstat -lnpt | grep :7682 | grep ttyd | tr -s ' ' | cut -d ' ' -f7 | cut -d'/' -f1")) if pid and pid ~= "" then diff --git a/luasrc/view/dockerman/container_console.htm b/luasrc/view/dockerman/container_console.htm index 7f626b3..1a4dc2a 100644 --- a/luasrc/view/dockerman/container_console.htm +++ b/luasrc/view/dockerman/container_console.htm @@ -2,5 +2,5 @@