Skip to content

Commit 83efefc

Browse files
committed
Fix favicon for the radarr and readarr
1 parent bec880e commit 83efefc

File tree

6 files changed

+75
-39
lines changed
  • docker-mods
    • radarr/root/etc
    • readarr/root/etc
    • sonarr/root/etc

6 files changed

+75
-39
lines changed

docker-mods/radarr/root/etc/cont-init.d/98-themepark

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if [ "${TP_HOTIO}" = true ]; then
2020
echo 'Changing to Hotio file path!'
2121
APP_FILEPATH='/app/bin/UI/index.html'
2222
LOGIN_FILEPATH='/app/bin/UI/login.html'
23+
APP_ICON_FILEPATH='/app/bin/UI/Content/Images/Icons'
2324
fi
2425

2526
# Set default
@@ -49,6 +50,18 @@ if [[ -z ${TP_THEME} ]]; then
4950
TP_THEME='organizr'
5051
fi
5152

53+
# Function to download files for a given addon
54+
download_favicon_files() {
55+
local addon=$1
56+
local urls=$(curl -s "${TP_SCHEME}://${TP_DOMAIN}/themes.json" | jq -r ".addons.sonarr[\"$addon\"].files[]?")
57+
for url in $urls; do
58+
# Remove the query parameters from the URL
59+
clean_url="${url%%\?*}"
60+
wget -O "${APP_ICON_FILEPATH}/$(basename "${clean_url}")" "${clean_url}"
61+
printf 'Downloaded favicon: %s\n' "${clean_url}"
62+
done
63+
}
64+
5265
# Adding stylesheets
5366
if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
5467
echo '---------------------------'
@@ -63,16 +76,11 @@ if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
6376
if [[ -n ${TP_ADDON} ]]; then
6477
for addon in $(echo "$TP_ADDON" | tr "|" " "); do
6578
sheets="${sheets} <link rel='stylesheet' href='${url_base}/css/addons/radarr/${addon}/${addon}.css'>"
66-
67-
#if TP_ADDON is one that changes the logo, add the corresponding favicon
68-
#find favicon folder name based on addon name
69-
favicon_dir="${url_base}/css/addons/radarr/favicon/$(echo "${addon}" | sed 's/-logo//g; s/-text//g')"
70-
#if favicon folder exists, copy content to the app favicon folder
71-
if [ -d "$favicon_dir" ]; then
72-
cp "${favicon_dir}/." "${APP_ICON_FILEPATH}"
73-
echo "Added favicon."
79+
# If the addon variable has "favicon" in it, download all the favicon files from the themes.json file.
80+
if [[ ${addon} == *"favicon"* ]]; then
81+
echo 'Downloading favicon files...'
82+
download_favicon_files "$addon"
7483
fi
75-
7684
printf 'Added custom addon: %s\n\n' "${addon}"
7785
done
7886
fi

docker-mods/radarr/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if [ "${TP_HOTIO}" = true ]; then
2020
echo 'Changing to Hotio file path!'
2121
APP_FILEPATH='/app/bin/UI/index.html'
2222
LOGIN_FILEPATH='/app/bin/UI/login.html'
23+
APP_ICON_FILEPATH='/app/bin/UI/Content/Images/Icons'
2324
fi
2425

2526
# Set default
@@ -49,6 +50,18 @@ if [[ -z ${TP_THEME} ]]; then
4950
TP_THEME='organizr'
5051
fi
5152

53+
# Function to download files for a given addon
54+
download_favicon_files() {
55+
local addon=$1
56+
local urls=$(curl -s "${TP_SCHEME}://${TP_DOMAIN}/themes.json" | jq -r ".addons.sonarr[\"$addon\"].files[]?")
57+
for url in $urls; do
58+
# Remove the query parameters from the URL
59+
clean_url="${url%%\?*}"
60+
wget -O "${APP_ICON_FILEPATH}/$(basename "${clean_url}")" "${clean_url}"
61+
printf 'Downloaded favicon: %s\n' "${clean_url}"
62+
done
63+
}
64+
5265
# Adding stylesheets
5366
if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
5467
echo '---------------------------'
@@ -63,16 +76,11 @@ if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
6376
if [[ -n ${TP_ADDON} ]]; then
6477
for addon in $(echo "$TP_ADDON" | tr "|" " "); do
6578
sheets="${sheets} <link rel='stylesheet' href='${url_base}/css/addons/radarr/${addon}/${addon}.css'>"
66-
67-
#if TP_ADDON is one that changes the logo, add the corresponding favicon
68-
#find favicon folder name based on addon name
69-
favicon_dir="${url_base}/css/addons/radarr/favicon/$(echo "${addon}" | sed 's/-logo//g; s/-text//g')"
70-
#if favicon folder exists, copy content to the app favicon folder
71-
if [ -d "$favicon_dir" ]; then
72-
cp "${favicon_dir}/." "${APP_ICON_FILEPATH}"
73-
echo "Added favicon."
79+
# If the addon variable has "favicon" in it, download all the favicon files from the themes.json file.
80+
if [[ ${addon} == *"favicon"* ]]; then
81+
echo 'Downloading favicon files...'
82+
download_favicon_files "$addon"
7483
fi
75-
7684
printf 'Added custom addon: %s\n\n' "${addon}"
7785
done
7886
fi

docker-mods/readarr/root/etc/cont-init.d/98-themepark

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if [ "${TP_HOTIO}" = true ]; then
2020
echo 'Changing to Hotio file path!'
2121
APP_FILEPATH='/app/bin/UI/index.html'
2222
LOGIN_FILEPATH='/app/bin/UI/login.html'
23+
APP_ICON_FILEPATH='/app/bin/UI/Content/Images/Icons'
2324
fi
2425

2526
# Set default
@@ -49,6 +50,18 @@ if [[ -z ${TP_THEME} ]]; then
4950
TP_THEME='organizr'
5051
fi
5152

53+
# Function to download files for a given addon
54+
download_favicon_files() {
55+
local addon=$1
56+
local urls=$(curl -s "${TP_SCHEME}://${TP_DOMAIN}/themes.json" | jq -r ".addons.sonarr[\"$addon\"].files[]?")
57+
for url in $urls; do
58+
# Remove the query parameters from the URL
59+
clean_url="${url%%\?*}"
60+
wget -O "${APP_ICON_FILEPATH}/$(basename "${clean_url}")" "${clean_url}"
61+
printf 'Downloaded favicon: %s\n' "${clean_url}"
62+
done
63+
}
64+
5265
# Adding stylesheets
5366
if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
5467
echo '---------------------------'
@@ -63,16 +76,11 @@ if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
6376
if [[ -n ${TP_ADDON} ]]; then
6477
for addon in $(echo "$TP_ADDON" | tr "|" " "); do
6578
sheets="${sheets} <link rel='stylesheet' href='${url_base}/css/addons/readarr/${addon}/${addon}.css'>"
66-
67-
#if TP_ADDON is one that changes the logo, add the corresponding favicon
68-
#find favicon folder name based on addon name
69-
favicon_dir="${url_base}/css/addons/readarr/favicon/$(echo "${addon}" | sed 's/-logo//g; s/-text//g')"
70-
#if favicon folder exists, copy content to the app favicon folder
71-
if [ -d "$favicon_dir" ]; then
72-
cp "${favicon_dir}/." "${APP_ICON_FILEPATH}"
73-
echo "Added favicon."
79+
# If the addon variable has "favicon" in it, download all the favicon files from the themes.json file.
80+
if [[ ${addon} == *"favicon"* ]]; then
81+
echo 'Downloading favicon files...'
82+
download_favicon_files "$addon"
7483
fi
75-
7684
printf 'Added custom addon: %s\n\n' "${addon}"
7785
done
7886
fi

docker-mods/readarr/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if [ "${TP_HOTIO}" = true ]; then
2020
echo 'Changing to Hotio file path!'
2121
APP_FILEPATH='/app/bin/UI/index.html'
2222
LOGIN_FILEPATH='/app/bin/UI/login.html'
23+
APP_ICON_FILEPATH='/app/bin/UI/Content/Images/Icons'
2324
fi
2425

2526
# Set default
@@ -49,6 +50,18 @@ if [[ -z ${TP_THEME} ]]; then
4950
TP_THEME='organizr'
5051
fi
5152

53+
# Function to download files for a given addon
54+
download_favicon_files() {
55+
local addon=$1
56+
local urls=$(curl -s "${TP_SCHEME}://${TP_DOMAIN}/themes.json" | jq -r ".addons.sonarr[\"$addon\"].files[]?")
57+
for url in $urls; do
58+
# Remove the query parameters from the URL
59+
clean_url="${url%%\?*}"
60+
wget -O "${APP_ICON_FILEPATH}/$(basename "${clean_url}")" "${clean_url}"
61+
printf 'Downloaded favicon: %s\n' "${clean_url}"
62+
done
63+
}
64+
5265
# Adding stylesheets
5366
if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
5467
echo '---------------------------'
@@ -63,16 +76,11 @@ if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
6376
if [[ -n ${TP_ADDON} ]]; then
6477
for addon in $(echo "$TP_ADDON" | tr "|" " "); do
6578
sheets="${sheets} <link rel='stylesheet' href='${url_base}/css/addons/readarr/${addon}/${addon}.css'>"
66-
67-
#if TP_ADDON is one that changes the logo, add the corresponding favicon
68-
#find favicon folder name based on addon name
69-
favicon_dir="${url_base}/css/addons/readarr/favicon/$(echo "${addon}" | sed 's/-logo//g; s/-text//g')"
70-
#if favicon folder exists, copy content to the app favicon folder
71-
if [ -d "$favicon_dir" ]; then
72-
cp "${favicon_dir}/." "${APP_ICON_FILEPATH}"
73-
echo "Added favicon."
79+
# If the addon variable has "favicon" in it, download all the favicon files from the themes.json file.
80+
if [[ ${addon} == *"favicon"* ]]; then
81+
echo 'Downloading favicon files...'
82+
download_favicon_files "$addon"
7483
fi
75-
7684
printf 'Added custom addon: %s\n\n' "${addon}"
7785
done
7886
fi

docker-mods/sonarr/root/etc/cont-init.d/98-themepark

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if [ "${TP_HOTIO}" = true ]; then
2020
echo 'Changing to Hotio file path!'
2121
APP_FILEPATH='/app/bin/UI/index.html'
2222
LOGIN_FILEPATH='/app/bin/UI/login.html'
23+
APP_ICON_FILEPATH='/app/bin/UI/Content/Images/Icons'
2324
fi
2425

2526
# Set default
@@ -52,10 +53,12 @@ fi
5253
# Function to download files for a given addon
5354
download_favicon_files() {
5455
local addon=$1
55-
local urls=$(echo "${TP_SCHEME}://${TP_DOMAIN}/themes.json" | jq -r ".addons.sonarr[\"$addon\"].files[]")
56+
local urls=$(curl -s "${TP_SCHEME}://${TP_DOMAIN}/themes.json" | jq -r ".addons.sonarr[\"$addon\"].files[]?")
5657
for url in $urls; do
57-
wget -P "${APP_ICON_FILEPATH}" "$url"
58-
printf 'Downloaded favicon: %s\n' "$url"
58+
# Remove the query parameters from the URL
59+
clean_url="${url%%\?*}"
60+
wget -O "${APP_ICON_FILEPATH}/$(basename "${clean_url}")" "${clean_url}"
61+
printf 'Downloaded favicon: %s\n' "${clean_url}"
5962
done
6063
}
6164

docker-mods/sonarr/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if [ "${TP_HOTIO}" = true ]; then
2020
echo 'Changing to Hotio file path!'
2121
APP_FILEPATH='/app/bin/UI/index.html'
2222
LOGIN_FILEPATH='/app/bin/UI/login.html'
23+
APP_ICON_FILEPATH='/app/bin/UI/Content/Images/Icons'
2324
fi
2425

2526
# Set default

0 commit comments

Comments
 (0)