Lil refactor

pull/1/head
riley 11 months ago
parent 41b6f083d8
commit eb0145ddd5

@ -2,22 +2,19 @@
local util = require "luci.util"
local container_status = util.trim(util.exec("/usr/libexec/apps/whoogle/whoogle.sh status"))
local container_running = string.match(string.lower(container_status), "^up%W")
local port = util.trim(util.exec("/usr/libexec/apps/whoogle/whoogle.sh port"))
if port == "" then
port="1880"
end
-%>
<div class="cbi-value">
<div class="cbi-value-field">
<% if container_running then %>
<button class="cbi-button cbi-button-success" disabled="true"><%= container_status %></button>
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open Whoogle%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
<% else %>
<button class="cbi-button cbi-button-negative" disabled="true"><%= container_status %></button>
<% end %>
<% if container_running then %>
<%
local port=util.trim(util.exec("/usr/libexec/apps/whoogle/whoogle.sh port"))
if port == "" then
port="1880"
end
-%>
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open Whoogle%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
<% end %>
</div>
</div>

Loading…
Cancel
Save