From 2b32a2a4eede38c3dc9615a24f4354e45fbdb588 Mon Sep 17 00:00:00 2001 From: GilbN <24592972+GilbN@users.noreply.github.com> Date: Mon, 29 May 2023 14:18:30 +0200 Subject: [PATCH 1/4] 1.13.8 (#496) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bad interpreter error associated with the NPM release of 2.9.21 (#486) * Fix Pi-Hole network details table colors (#489) * Grafana 9.5.1 element support (#492) Adding support for only a few elements in latest version of Grafana * Added uptime kuma card css (#494) * Use hashlib instead of git shas * Fix Latest manifest if logic --------- Co-authored-by: goodbyepavlyi 3 Co-authored-by: Samuel Bartík <63553146+sambartik@users.noreply.github.com> Co-authored-by: rg9400 <39887349+rg9400@users.noreply.github.com> Co-authored-by: Henry Whitaker <36062479+henrywhitaker3@users.noreply.github.com> --- .github/workflows/docker-build.yml | 2 +- themes.py | 59 +++++++++++++++++------------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 25c94a93..a8c8624e 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -136,7 +136,7 @@ jobs: docker manifest create ${IMAGE}:${TAG} ${AMD64} ${ARM64} ${ARMV7} docker manifest push ${IMAGE}:${TAG} - name: Latest manifest - if: ${{ github.event.release.target_commitish == 'master' }} || ${{ github.event.inputs.branch == 'master' }} + if: github.event.release.target_commitish == 'master' || github.event.inputs.branch == 'master' env: DOCKER_CLI_EXPERIMENTAL: enabled run: | diff --git a/themes.py b/themes.py index 6f95ce79..637afdcb 100644 --- a/themes.py +++ b/themes.py @@ -1,13 +1,14 @@ #! /usr/bin/env python3 -from os import defpath, listdir, environ as env, chdir +from os import defpath, listdir, environ as env, chdir, getcwd from os.path import isdir, isfile, join, dirname, abspath from json import dump, dumps, loads, load import subprocess +from hashlib import md5 chdir(dirname(abspath(__file__))) # Set working dir -def get_shas(output): +def get_shas(output) -> dict[str, str]: """Returns a dict of CSS files and SHAs""" output_lines = output.splitlines() if output else [] sha_dict = {} @@ -19,9 +20,17 @@ def get_shas(output): return(sha_dict) -def create_addons_json(): - addon_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/addons/*.css"]) if isdir(".git") else [] - SHAS = get_shas(addon_shas) +def get_md5_hash(file_path) -> str: + """Returns the MD5 hash of a file""" + md5_hash = md5() + with open(file_path, "rb") as f: + for byte_block in iter(lambda: f.read(4096), b""): + md5_hash.update(byte_block) + return md5_hash.hexdigest() + +def create_addons_json() -> str: + #addon_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/addons/*.css"]) if isdir(".git") else [] + #SHAS = get_shas(addon_shas) ADDONS = {"addons": {}} addon_root = './css/addons' addon_folders = [name for name in listdir( @@ -38,12 +47,12 @@ def create_addons_json(): f"{addon_root}/{app}/{addon}") if isfile(join(f"{addon_root}/{app}/{addon}", file))] if len([f for f in files if f.endswith('.css')]) > 1: ADDONS["addons"][app][addon].update({ - "css": [f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{file}?sha={SHAS.get(file)}" for file in files if file.split(".")[1] == "css"] + "css": [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"] } ) else: ADDONS["addons"][app].update({ - addon: f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{file}?sha={SHAS.get(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" } ) extra_dirs = [dir for dir in listdir( @@ -54,7 +63,7 @@ def create_addons_json(): f"{addon_root}/{app}/{addon}/{dir}") if isfile(join(f"{addon_root}/{app}/{addon}/{dir}", file))] ADDONS["addons"][app][addon].update({ dir: { - "css": [f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{dir}/{extra_file}?sha={SHAS.get(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"] } } ) @@ -64,18 +73,18 @@ def create_addons_json(): def create_json(app_folders: list = None, themes: list = None, community_themes: list = None ,docker_mods: list = None, no_sub_folders=False) -> str: if no_sub_folders: THEMES_DICT = {} - theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/theme-options/*.css"]) if isdir(".git") else [] - community_theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/community-theme-options/*.css"]) if isdir(".git") else [] - THEME_SHAS = get_shas(theme_shas) - COMMUNITY_THEME_SHAS = get_shas(community_theme_shas) + #theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/theme-options/*.css"]) if isdir(".git") else [] + #community_theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/community-theme-options/*.css"]) if isdir(".git") else [] + #THEME_SHAS = get_shas(theme_shas) + #COMMUNITY_THEME_SHAS = get_shas(community_theme_shas) THEMES = { theme.split(".")[0].capitalize(): { - "url": f"{scheme}://{DOMAIN}/css/theme-options/{theme}?sha={THEME_SHAS.get(theme)}" + "url": f"{scheme}://{DOMAIN}/css/theme-options/{theme}?sha={get_md5_hash(join(getcwd(),'css','theme-options', theme))}" }for theme in themes if themes } COMMUNITY_THEMES = { theme.split(".")[0].capitalize(): { - "url": f"{scheme}://{DOMAIN}/css/community-theme-options/{theme}?sha={COMMUNITY_THEME_SHAS.get(theme)}" + "url": f"{scheme}://{DOMAIN}/css/community-theme-options/{theme}?sha={get_md5_hash(join(getcwd(),'css','community-theme-options', theme))}" }for theme in community_themes if community_themes } THEMES_DICT.update(dict(sorted({ @@ -93,12 +102,12 @@ def create_json(app_folders: list = None, themes: list = None, community_themes: else: ADDONS = loads(create_addons_json()) APPS = {} - app_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/base/*base.css"]) if isdir(".git") else [] - SHAS = get_shas(app_shas) + #app_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/base/*base.css"]) if isdir(".git") else [] + #SHAS = get_shas(app_shas) APPS.update(dict(sorted({ "applications": { app: { - "base_css": f"{scheme}://{DOMAIN}/css/base/{app}/{app}-base.css?sha={SHAS.get(f'{app}-base.css')}", + "base_css": f"{scheme}://{DOMAIN}/css/base/{app}/{app}-base.css?sha={get_md5_hash(join('css','base', app, f'{app}-base.css'))}", "addons": ADDONS["addons"][app] if app in ADDONS["addons"] else {} } for app in app_folders if not isfile(f'./css/base/{app}/.deprecated') } @@ -106,7 +115,7 @@ def create_json(app_folders: list = None, themes: list = None, community_themes: APPS.update(dict(sorted({ "deprecated": { app: { - "base_css": f"{scheme}://{DOMAIN}/css/base/{app}/{app}-base.css?sha={SHAS.get(f'{app}-base.css')}", + "base_css": f"{scheme}://{DOMAIN}/css/base/{app}/{app}-base.css?sha={get_md5_hash(join('css','base', app, f'{app}-base.css'))}", "addons": ADDONS["addons"][app] if app in ADDONS["addons"] else {} } for app in app_folders if isfile(f'./css/base/{app}/.deprecated') } @@ -122,16 +131,16 @@ def create_json(app_folders: list = None, themes: list = None, community_themes: return dumps(APPS) def create_theme_options() -> None: - app_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/base/*base.css"]) if isdir(".git") else [] - theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/theme-options/*.css"]) if isdir(".git") else [] - community_theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/community-theme-options/*.css"]) if isdir(".git") else [] - THEME_SHAS = get_shas(theme_shas) - COMMUNITY_THEME_SHAS = get_shas(community_theme_shas) - APP_SHAS = get_shas(app_shas) + #app_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/base/*base.css"]) if isdir(".git") else [] + #theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/theme-options/*.css"]) if isdir(".git") else [] + #community_theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/community-theme-options/*.css"]) if isdir(".git") else [] + #THEME_SHAS = get_shas(theme_shas) + #COMMUNITY_THEME_SHAS = get_shas(community_theme_shas) + #APP_SHAS = get_shas(app_shas) def create_css(theme, theme_type="standard"): folder = "./css/base" with open(f"{folder}/{app}/{theme.lower()}.css", "w") as create_app: - content = f'@import url("/css/base/{app}/{app}-base.css?sha={APP_SHAS.get(f"{app}-base.css")}");\n@import url("/css/{"theme-options" if theme_type=="standard" else "community-theme-options"}/{theme.lower()}.css?sha={THEME_SHAS.get(f"{theme.lower()}.css") if theme_type=="standard" else COMMUNITY_THEME_SHAS.get(f"{theme.lower()}.css")}");' + content = f'@import url("/css/base/{app}/{app}-base.css?sha={get_md5_hash(join(getcwd(),"css","base",app,f"{app}-base.css"))}");\n@import url("/css/{"theme-options" if theme_type=="standard" else "community-theme-options"}/{theme.lower()}.css?sha={get_md5_hash(join(getcwd(),"css","theme-options",f"{theme.lower()}.css")) if theme_type=="standard" else get_md5_hash(join(getcwd(),"css","community-theme-options",f"{theme.lower()}.css"))}");' create_app.write(content) with open("themes.json") as themes: data = load(themes) From ad5a877b75b48513e46fc9e6c672d5b1f2ce1b02 Mon Sep 17 00:00:00 2001 From: GilbN <24592972+GilbN@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:33:26 +0200 Subject: [PATCH 2/4] Set line feed in fetch script --- fetch.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fetch.sh b/fetch.sh index e3f3fd37..6e868277 100644 --- a/fetch.sh +++ b/fetch.sh @@ -1,17 +1,23 @@ #!/usr/bin/env bash -# Downloads all docker mod scripts +# Downloads all docker mod scripts MODS=$(curl https://theme-park.dev/themes.json | jq -r '.["docker-mods"]') if [[ "$0" == "bash" ]]; then DIR="/tmp/theme-park-mods" else - DIR="$0" + DIR="$0" fi mkdir -p "$DIR" printf "\nSaving mods into $DIR\n\n" jq -r 'to_entries | map(.key + "|" + (.value | tostring)) | .[]' <<< "$MODS" | \ while IFS='|' read key value; do - curl "$value" --create-dirs --output "$DIR/98-themepark-$key" --silent + download_file="$DIR/98-themepark-$key" + curl "$value" --create-dirs --output "$download_file" --silent echo "Fetched $key script" + + # Convert line endings from CRLF to LF manually + if [[ "$(tail -c2 "$download_file")" == $'\r\n' ]]; then + perl -pi -e 's/\r\n/\n/' "$download_file" + fi done -chmod -R +x $DIR \ No newline at end of file +chmod -R +x "$DIR" \ No newline at end of file From 89a556cd004cc4e9dccccbbad5afa08a2a153b87 Mon Sep 17 00:00:00 2001 From: GilbN <24592972+GilbN@users.noreply.github.com> Date: Sat, 20 Jan 2024 12:15:57 +0100 Subject: [PATCH 3/4] 1.15.1 (#534) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * qbittorrent: 💄Fixes for #526 * Unraid: Fix login script github.io URL Unraid: Fix the navbar scroll overflow. * Move from subversion to git for pulling the qbittorrent webui (#530) * Move from subversion to git for pulling the qbittorrent webui * slight verbage changes --------- Co-authored-by: Blake <7227893+nintendo424@users.noreply.github.com> --- css/addons/unraid/login-page/custom_login.sh | 2 +- css/base/qbittorrent/qbittorrent-base.css | 6 +++++ css/base/unraid/unraid-base.css | 1 + docker-mods/qbittorrent/Dockerfile | 2 +- .../root/etc/cont-init.d/98-themepark | 22 +++++++++---------- .../init-mod-themepark-add-package/run | 4 ++-- .../s6-overlay/s6-rc.d/init-mod-themepark/run | 14 ++++++------ 7 files changed, 29 insertions(+), 22 deletions(-) diff --git a/css/addons/unraid/login-page/custom_login.sh b/css/addons/unraid/login-page/custom_login.sh index 558521b1..c8eda6c3 100644 --- a/css/addons/unraid/login-page/custom_login.sh +++ b/css/addons/unraid/login-page/custom_login.sh @@ -55,7 +55,7 @@ fi case ${DOMAIN} in *"github.io"*) echo "Switching to github.io URL style" - DOMAIN="${DOMAIN}\/theme.park" + DOMAIN="${DOMAIN}/theme.park" ;; esac diff --git a/css/base/qbittorrent/qbittorrent-base.css b/css/base/qbittorrent/qbittorrent-base.css index 820b8982..77a45b3a 100644 --- a/css/base/qbittorrent/qbittorrent-base.css +++ b/css/base/qbittorrent/qbittorrent-base.css @@ -489,6 +489,7 @@ hr { .toolbarTabs { background: var(--transparency-dark-25) !important; + margin: 0px 5px 0 0 !important; } .progressbar_dark { @@ -662,4 +663,9 @@ select:focus { .select-watched-folder-editable { background-color: var(--transparency-dark-05); border: solid var(--transparency-light-10) 1px; +} + +#torrentsFilterToolbar { + float: right; + margin-right: .5rem; } \ No newline at end of file diff --git a/css/base/unraid/unraid-base.css b/css/base/unraid/unraid-base.css index 066607f4..86244a76 100644 --- a/css/base/unraid/unraid-base.css +++ b/css/base/unraid/unraid-base.css @@ -102,6 +102,7 @@ pre { .nav-tile { background-color: var(--transparency-dark-50); + overflow-x: auto; } div.title { diff --git a/docker-mods/qbittorrent/Dockerfile b/docker-mods/qbittorrent/Dockerfile index 4c3ca04c..d12803c2 100644 --- a/docker-mods/qbittorrent/Dockerfile +++ b/docker-mods/qbittorrent/Dockerfile @@ -1,7 +1,7 @@ FROM scratch - LABEL maintainer="GilbN" LABEL app="Qbittorrent" + #copy local files. COPY root/ / \ No newline at end of file diff --git a/docker-mods/qbittorrent/root/etc/cont-init.d/98-themepark b/docker-mods/qbittorrent/root/etc/cont-init.d/98-themepark index b02e895e..783c94fb 100755 --- a/docker-mods/qbittorrent/root/etc/cont-init.d/98-themepark +++ b/docker-mods/qbittorrent/root/etc/cont-init.d/98-themepark @@ -23,17 +23,17 @@ if [ "${TP_DISABLE_THEME}" = true ]; then exit 0 fi -if ! [[ -x "$(command -v svn)" ]]; then +if ! [[ -x "$(command -v git)" ]]; then echo '--------------------------' -echo '| Installing svn package |' +echo '| Installing git package |' echo '--------------------------' if [ -x "$(command -v apk)" ]; then apk update && \ - apk add --no-cache subversion + apk add --no-cache git apk add --no-cache perl elif [ -x "$(command -v apt-get)" ]; then apt-get update && \ - apt-get install -y subversion + apt-get install -y git apt-get install -y perl fi fi @@ -80,15 +80,15 @@ if [[ ! -d /themepark ]]; then echo '---------------------------------------' echo '| Downloading WebUI files from github |' echo '---------------------------------------' - printf '\nDownloading qBittorrent webui to "/themepark"..please wait\n' - svn export --quiet https://github.com/qbittorrent/qBittorrent/trunk/src/webui/www /themepark + printf '\nDownloading qBittorrent to /temp\n' + git clone --depth 1 https://github.com/qbittorrent/qBittorrent /temp printf '\nDownload finished\n\n' - printf '\nDownloading qBittorrent webui icons to "/themepark/xxx"..please wait\n' - svn export --force --quiet https://github.com/qbittorrent/qBittorrent/trunk/src/icons /temp - cp -a /temp/. /themepark/public/icons - cp -a /temp/. /themepark/private/icons + cp -a /temp/src/webui/www /themepark + cp -a /temp/src/icons/. /themepark/public/icons + cp -a /temp/src/icons/. /themepark/private/icons + printf '\nCopy finished\n\n' rm -rf /temp - printf '\nDownload finished\n\n' + printf '\nCleanup finished\n\n' fi sed_file(){ diff --git a/docker-mods/qbittorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark-add-package/run b/docker-mods/qbittorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark-add-package/run index 441dcab9..605a4f23 100755 --- a/docker-mods/qbittorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark-add-package/run +++ b/docker-mods/qbittorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark-add-package/run @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash -if ! [[ -x "$(command -v svn)" ]]; then - echo "subversion" >> /mod-repo-packages-to-install.list +if ! [[ -x "$(command -v git)" ]]; then + echo "git" >> /mod-repo-packages-to-install.list echo "perl" >> /mod-repo-packages-to-install.list fi diff --git a/docker-mods/qbittorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run b/docker-mods/qbittorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run index 6935bc69..634b19ab 100755 --- a/docker-mods/qbittorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run +++ b/docker-mods/qbittorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run @@ -65,15 +65,15 @@ if [[ ! -d /themepark ]]; then echo '---------------------------------------' echo '| Downloading WebUI files from github |' echo '---------------------------------------' - printf '\nDownloading qBittorrent webui to "/themepark"..please wait\n' - svn export --quiet https://github.com/qbittorrent/qBittorrent/trunk/src/webui/www /themepark + printf '\nDownloading qBittorrent to /temp\n' + git clone --depth 1 https://github.com/qbittorrent/qBittorrent /temp printf '\nDownload finished\n\n' - printf '\nDownloading qBittorrent webui icons to "/themepark/xxx"..please wait\n' - svn export --force --quiet https://github.com/qbittorrent/qBittorrent/trunk/src/icons /temp - cp -a /temp/. /themepark/public/icons - cp -a /temp/. /themepark/private/icons + cp -a /temp/src/webui/www /themepark + cp -a /temp/src/icons/. /themepark/public/icons + cp -a /temp/src/icons/. /themepark/private/icons + printf '\nCopy finished\n\n' rm -rf /temp - printf '\nDownload finished\n\n' + printf '\nCleanup finished\n\n' fi sed_file(){ From 325dbddd7543ad3324b8dcd46e2e29e54abd08e3 Mon Sep 17 00:00:00 2001 From: cjLGH Date: Fri, 26 Jan 2024 08:34:27 -0600 Subject: [PATCH 4/4] Update run for vuetorrent curl redirect Missed when reviewing https://github.com/themepark-dev/theme.park/pull/535 --- .../root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-mods/vuetorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run b/docker-mods/vuetorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run index 84cc2afd..4d1a687c 100755 --- a/docker-mods/vuetorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run +++ b/docker-mods/vuetorrent/root/etc/s6-overlay/s6-rc.d/init-mod-themepark/run @@ -55,7 +55,7 @@ if [[ -z ${TP_THEME} ]]; then fi RELEASE_FILEPATH='/vuetorrent/release.json' NEEDS_UPDATE=false -CURRENT_RELEASE=$(curl -s https://api.github.com/repos/WDaan/VueTorrent/releases/latest | jq -r ".assets[]") +CURRENT_RELEASE=$(curl -Ls https://api.github.com/repos/WDaan/VueTorrent/releases/latest | jq -r ".assets[]") # =============================================== check_updates() { @@ -131,4 +131,4 @@ if ! grep -q "${TP_DOMAIN}/css/base" "${INDEX_FILEPATH}"; then sed -i "s/<\/body>/<\/body> /g" "${INDEX_FILEPATH}" sed -i "s/<\/body>/<\/body> /g" "${INDEX_FILEPATH}" printf 'Stylesheet set to %s on public index.html\n' "${TP_THEME}" -fi \ No newline at end of file +fi