Taskd compatibility update, general UI improvements, general bug fixes #1

Open
Ghost wants to merge 8 commits from <deleted>:main into main

@ -11,7 +11,7 @@ m = taskd.docker_map("whoogle", "whoogle", "/usr/libexec/apps/whoogle/whoogle.sh
translate("Whoogle is a free open-source self-hosted metasearch engine that allows you to search and get your Google results without ads, JavaScript trackers, or AMP links. It also ignores cookies, and does not perform any IP address tracking.")
.. translate("Official website:") .. ' <a href=\"https://hub.docker.com/r/benbusby/whoogle-search/\" target=\"_blank\">https://hub.docker.com/r/benbusby/whoogle-search/</a>')
s = m:section(SimpleSection, translate("Service Status"), translate("whoogle status:"))
s = m:section(SimpleSection, translate("Service Status"))
s:append(Template("whoogle/status"))
s = m:section(TypedSection, "whoogle", translate("Setup"), translate("The following parameters will only take effect during installation or upgrade:"))

@ -1,31 +1,20 @@
<%
local util = require "luci.util"
local container_status = util.trim(util.exec("/usr/libexec/apps/whoogle/whoogle.sh status"))
local container_install = (string.len(container_status) > 0)
local container_running = container_status == "running"
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">
<label class="cbi-value-title"><%:Status%></label>
<div class="cbi-value-field">
<% if container_running then %>
<button class="cbi-button cbi-button-success" disabled="true"><%:whoogle is running%></button>
<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"><%:whoogle is not running%></button>
<button class="cbi-button cbi-button-negative" disabled="true"><%= container_status %></button>
<% end %>
</div>
</div>
<%
if container_running then
local port=util.trim(util.exec("/usr/libexec/apps/whoogle/whoogle.sh port"))
if port == "" then
port="5000"
end
-%>
<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 whoogle%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
</div>
</div>
<% end %>

@ -30,9 +30,6 @@ do_install_detail() {
[ -z "$port" ] && port=5000
[ -z "$IMAGE_NAME" ] && IMAGE_NAME=benbusby/whoogle-search
# Create Docker Compose file with custom variables
# Create Docker Compose file with custom variables
rm -R /opt/docker2/compose/whoogle-app
mkdir /opt/docker2/compose/whoogle-app
@ -124,13 +121,28 @@ case ${ACTION} in
do_install_detail
;;
"rm")
docker rm -f whoogle
IMAGE_NAME=$(uci get whoogle.@whoogle[0].image_name 2>/dev/null)
[ -z "$IMAGE_NAME" ] && IMAGE_NAME="benbusby/whoogle-search"
CONTAINER_IDS=$(docker ps -a --filter "ancestor=${IMAGE_NAME}" --format '{{.ID}}')
echo "Stopping and removing containers..."
for ID in $CONTAINER_IDS; do
docker stop "$ID"
docker rm "$ID"
done
docker rmi -f "$IMAGE_NAME"
rm -r /opt/docker2/compose/whoogle-app 2>/dev/null
;;
"start" | "stop" | "restart")
docker ${ACTION} whoogle
docker ${ACTION} whoogle-search
;;
"status")
docker ps --all -f 'name=whoogle' --format '{{.State}}'
CONTAINER_NAME=$(docker ps -a --filter "name=whoogle-search" --format '{{.Names}}')
CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAME}" --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }')
if [ -z "$CONTAINER_NAME" ]; then
echo "Whoogle is not installed"
else
echo "${CONTAINER_STATUS}"
fi
;;
"port")
docker ps --all -f 'name=whoogle' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://'

Loading…
Cancel
Save