Move favicon mods out of folder and rename folder.
Add favicon files to the themes.json file
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 622 B After Width: | Height: | Size: 622 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 726 B After Width: | Height: | Size: 726 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
@ -49,6 +49,16 @@ if [[ -z ${TP_THEME} ]]; then
|
|||||||
TP_THEME='organizr'
|
TP_THEME='organizr'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Function to download files for a given addon
|
||||||
|
download_favicon_files() {
|
||||||
|
local addon=$1
|
||||||
|
local urls=$(echo "${TP_SCHEME}://${TP_DOMAIN}/themes.json" | jq -r ".addons.sonarr[\"$addon\"].files[]")
|
||||||
|
for url in $urls; do
|
||||||
|
wget -P "${APP_ICON_FILEPATH}" "$url"
|
||||||
|
printf 'Downloaded favicon: %s\n' "$url"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Adding stylesheets
|
# Adding stylesheets
|
||||||
if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
|
if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
|
||||||
echo '---------------------------'
|
echo '---------------------------'
|
||||||
@ -63,16 +73,11 @@ if ! grep -q "${TP_DOMAIN}/css/base" "${APP_FILEPATH}"; then
|
|||||||
if [[ -n ${TP_ADDON} ]]; then
|
if [[ -n ${TP_ADDON} ]]; then
|
||||||
for addon in $(echo "$TP_ADDON" | tr "|" " "); do
|
for addon in $(echo "$TP_ADDON" | tr "|" " "); do
|
||||||
sheets="${sheets} <link rel='stylesheet' href='${url_base}/css/addons/sonarr/${addon}/${addon}.css'>"
|
sheets="${sheets} <link rel='stylesheet' href='${url_base}/css/addons/sonarr/${addon}/${addon}.css'>"
|
||||||
|
# If the addon variable has "favicon" in it, download all the favicon files from the themes.json file.
|
||||||
#if TP_ADDON is one that changes the logo, add the corresponding favicon
|
if [[ ${addon} == *"favicon"* ]]; then
|
||||||
#find favicon folder name based on addon name
|
echo 'Downloading favicon files...'
|
||||||
favicon_dir="${url_base}/css/addons/sonarr/favicon/$(echo "${addon}" | sed 's/-logo//g; s/-text//g')"
|
download_favicon_files "$addon"
|
||||||
#if favicon folder exists, copy content to the app favicon folder
|
|
||||||
if [ -d "$favicon_dir" ]; then
|
|
||||||
cp "${favicon_dir}/." "${APP_ICON_FILEPATH}"
|
|
||||||
echo "Added favicon."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf 'Added custom addon: %s\n\n' "${addon}"
|
printf 'Added custom addon: %s\n\n' "${addon}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
22
themes.py
@ -51,6 +51,11 @@ def create_addons_json() -> str:
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
if len([f for f in files if not f.endswith('.css')]) >= 1:
|
||||||
|
ADDONS["addons"][app][addon].update({
|
||||||
|
"files": [f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{file}?sha={get_md5_hash(join(getcwd(),'css','addons',app,addon,file))}" for file in files]
|
||||||
|
}
|
||||||
|
)
|
||||||
ADDONS["addons"][app].update({
|
ADDONS["addons"][app].update({
|
||||||
addon: f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{file}?sha={get_md5_hash(join(getcwd(),'css','addons',app,addon,file))}" for file in files if file.split(".")[1] == "css"
|
addon: f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{file}?sha={get_md5_hash(join(getcwd(),'css','addons',app,addon,file))}" for file in files if file.split(".")[1] == "css"
|
||||||
}
|
}
|
||||||
@ -63,8 +68,9 @@ def create_addons_json() -> str:
|
|||||||
f"{addon_root}/{app}/{addon}/{dir}") if isfile(join(f"{addon_root}/{app}/{addon}/{dir}", file))]
|
f"{addon_root}/{app}/{addon}/{dir}") if isfile(join(f"{addon_root}/{app}/{addon}/{dir}", file))]
|
||||||
ADDONS["addons"][app][addon].update({
|
ADDONS["addons"][app][addon].update({
|
||||||
dir: {
|
dir: {
|
||||||
"css": [f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{dir}/{extra_file}?sha={get_md5_hash(join(getcwd(),'css','addons',app,addon,dir,extra_file))}" for extra_file in extra_dir_files if extra_file.split(".")[1] == "css"]
|
"css": [f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{dir}/{extra_file}?sha={get_md5_hash(join(getcwd(),'css','addons',app,addon,dir,extra_file))}" for extra_file in extra_dir_files if extra_file.split(".")[1] == "css"],
|
||||||
}
|
"files": [f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{dir}/{extra_file}?sha={get_md5_hash(join(getcwd(),'css','addons',app,addon,dir,extra_file))}" for extra_file in extra_dir_files if extra_file.split(".")[1] != "css"]
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return dumps(ADDONS, sort_keys=True)
|
return dumps(ADDONS, sort_keys=True)
|
||||||
@ -153,7 +159,6 @@ def create_theme_options() -> None:
|
|||||||
for theme in community_themes:
|
for theme in community_themes:
|
||||||
create_css(theme,theme_type="community")
|
create_css(theme,theme_type="community")
|
||||||
|
|
||||||
env_domain = env.get('TP_DOMAIN')
|
|
||||||
scheme = env.get('TP_SCHEME','https') if env.get('TP_SCHEME') else 'https'
|
scheme = env.get('TP_SCHEME','https') if env.get('TP_SCHEME') else 'https'
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@ -161,14 +166,15 @@ if __name__ == "__main__":
|
|||||||
themes = [name for name in listdir('./css/theme-options') if isfile(join('./css/theme-options', name))]
|
themes = [name for name in listdir('./css/theme-options') if isfile(join('./css/theme-options', name))]
|
||||||
docker_mods = [name for name in listdir('./docker-mods')] if isdir('./docker-mods') else []
|
docker_mods = [name for name in listdir('./docker-mods')] if isdir('./docker-mods') else []
|
||||||
community_themes = [name for name in listdir('./css/community-theme-options') if isfile(join('./css/community-theme-options', name))]
|
community_themes = [name for name in listdir('./css/community-theme-options') if isfile(join('./css/community-theme-options', name))]
|
||||||
develop = True if isdir(".git") and subprocess.check_output(["git", "symbolic-ref", "--short", "HEAD"]).decode('ascii').strip() == "develop" else False
|
branch: str | None = subprocess.check_output(["git", "symbolic-ref", "--short", "HEAD"]).decode('ascii').strip() if isdir(".git") else None
|
||||||
if env_domain:
|
|
||||||
DOMAIN = env_domain
|
if env.get('TP_DOMAIN'):
|
||||||
|
DOMAIN = env.get('TP_DOMAIN')
|
||||||
else:
|
else:
|
||||||
with open("CNAME", "rt", closefd=True) as cname:
|
with open("CNAME", "rt", closefd=True) as cname:
|
||||||
CNAME = cname.readline()
|
CNAME = cname.readline()
|
||||||
DOMAIN = CNAME if not develop else f"develop.{CNAME}"
|
DOMAIN = f"{branch}.{CNAME}" if branch else CNAME
|
||||||
apps = loads(create_json(app_folders=app_folders, themes=themes, community_themes=community_themes, docker_mods=docker_mods))
|
apps = loads(create_json(app_folders=app_folders, themes=themes, community_themes=community_themes, docker_mods=docker_mods))
|
||||||
with open("themes.json", "w") as outfile:
|
with open("themes.json", "w") as outfile:
|
||||||
dump(apps, outfile, indent=2, sort_keys=True)
|
dump(apps, outfile, indent=2, sort_keys=True)
|
||||||
create_theme_options()
|
#create_theme_options()
|