Fixed status.htm polling

pull/1/head
riley 1 year ago
parent dfeef784bd
commit a65748bfe7

@ -1,30 +1,30 @@
<% <%
local util = require "luci.util" local util = require "luci.util"
local container_status = util.trim(util.exec("/usr/libexec/apps/btcpayserver/btcpayserver.sh status")) local container_status = util.trim(util.exec("/usr/libexec/apps/btcpayserver/btcpayserver.sh status"))
local container_install = (string.len(container_status) > 0) local container_running = string.find(string.lower(container_status), "up") and string.find(string.lower(container_status), "(healthy)")
local container_running = container_status == "running"
-%> -%>
<div class="cbi-value"> <div class="cbi-value">
<label class="cbi-value-title"><%:Status%></label> <label class="cbi-value-title">Status</label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<% if container_running then %> <% if container_running then %>
<button class="cbi-button cbi-button-success" disabled="true"><%:btcpayserver is running%></button> <button class="cbi-button cbi-button-success" disabled="true"><%= container_status %></button>
<% else %> <% else %>
<button class="cbi-button cbi-button-negative" disabled="true"><%:btcpayserver is not running%></button> <button class="cbi-button cbi-button-negative" disabled="true"><%= container_status %></button>
<% end %> <% end %>
</div> </div>
</div> </div>
<% <%
if container_running then if container_running then
local port=util.trim(util.exec("/usr/libexec/apps/btcpayserver/btcpayserver.sh port")) local port = util.trim(util.exec("/usr/libexec/apps/btcpayserver/btcpayserver.sh port"))
if port == "" then if port == "" then
port="3000" port = "3000"
end end
-%> -%>
<div class="cbi-value cbi-value-last"> <div class="cbi-value cbi-value-last">
<label class="cbi-value-title">&nbsp;</label> <label class="cbi-value-title">&nbsp;</label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open btcpayserver%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')"> <input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open btcpayserver%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
</div> </div>
</div> </div>

Loading…
Cancel
Save