heimdall: fix open button

This commit is contained in:
Liangbin Lian 2024-01-05 15:57:31 +08:00
parent 35a6d9c97a
commit faf9ea6fff
3 changed files with 19 additions and 4 deletions

View File

@ -2,7 +2,7 @@
include $(TOPDIR)/rules.mk
PKG_VERSION:=1.1.1-20231208
PKG_VERSION:=1.1.2-20240105
PKG_RELEASE:=
LUCI_TITLE:=LuCI support for heimdall

View File

@ -17,15 +17,26 @@ local container_running = container_status == "running"
<%
if container_running then
local port=util.trim(util.exec("/usr/libexec/istorec/heimdall.sh port"))
local https_port=util.trim(util.exec("/usr/libexec/istorec/heimdall.sh https_port"))
if port == "" then
port="8088"
end
if https_port == "" then
https_port="8089"
end
-%>
<div class="cbi-value cbi-value-last">
<div class="cbi-value">
<label class="cbi-value-title">&nbsp;</label>
<div class="cbi-value-field">
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open Heimdall%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
</div>
</div>
<div class="cbi-value cbi-value-last">
<label class="cbi-value-title">&nbsp;</label>
<div class="cbi-value-field">
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open Heimdall%> (HTTPS)" onclick="window.open('https://'+location.hostname+':<%=https_port%>/', '_blank')">
</div>
</div>
<% end %>

View File

@ -55,7 +55,8 @@ usage() {
echo " upgrade Upgrade the heimdall"
echo " rm/start/stop/restart Remove/Start/Stop/Restart the heimdall"
echo " status Heimdall status"
echo " port Heimdall port"
echo " port Heimdall http port"
echo " https_port Heimdall https port"
}
case ${ACTION} in
@ -75,7 +76,10 @@ case ${ACTION} in
docker ps --all -f 'name=heimdall' --format '{{.State}}'
;;
"port")
docker ps --all -f 'name=heimdall' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://'
docker ps --all -f 'name=heimdall' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*->80/tcp' | sed 's/0.0.0.0:\([0-9]*\)->.*/\1/'
;;
"https_port")
docker ps --all -f 'name=heimdall' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*->443/tcp' | sed 's/0.0.0.0:\([0-9]*\)->.*/\1/'
;;
*)
usage