Lil refactor

pull/2/head
riley 1 year ago
parent 41cdbe55b1
commit 0e3c757ed1

@ -3,17 +3,15 @@ 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_running = string.match(string.lower(container_status), "^up%W") local container_running = string.match(string.lower(container_status), "^up%W")
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
port = "3000"
end
-%> -%>
<div class="cbi-value"> <div class="cbi-value">
<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"><%= container_status %></button> <button class="cbi-button cbi-button-success" disabled="true"><%= container_status %></button>
<%
if port == "" then
port = "3000"
end
-%>
<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')">
<% else %> <% else %>
<button class="cbi-button cbi-button-negative" disabled="true"><%= container_status %></button> <button class="cbi-button cbi-button-negative" disabled="true"><%= container_status %></button>

Loading…
Cancel
Save