@@ -22,6 +22,35 @@ source $HESTIA/func/main.sh
2222# load config file
2323source_conf " $HESTIA /conf/hestia.conf"
2424
25+ # Define array for available themes
26+ available_themes=()
27+
28+ # Function to process CSS theme files
29+ get_themes () {
30+ # Retrieve list of system themes
31+ if [ -d " $HESTIA_THEMES " ]; then
32+ for file in " $HESTIA_THEMES " /* .min.css; do
33+ filename=$( basename " $file " .min.css)
34+ available_themes+=(" ${filename% .* } " )
35+ done
36+ fi
37+
38+ # Check for existence of custom themes folder and iterate through items
39+ if [ -d " $HESTIA_THEMES_CUSTOM " ] && [ " $( ls -A " $HESTIA_THEMES_CUSTOM " ) " ]; then
40+ for file in " $HESTIA_THEMES_CUSTOM " /* .css; do
41+ filename=$( basename " $file " .css)
42+ available_themes+=(" ${filename% .* } " )
43+ done
44+ fi
45+
46+ # Sort theme list alphabetically
47+ IFS=$' \n ' available_themes=($( sort <<< " ${available_themes[*]}" ) )
48+ unset IFS
49+
50+ # Get count of themes (for proper JSON formatting)
51+ theme_count=" ${# available_themes[@]} "
52+ }
53+
2554# JSON list function
2655json_list () {
2756 i=1
@@ -65,21 +94,7 @@ csv_list() {
6594# Action #
6695# ----------------------------------------------------------#
6796
68- # Parse system provided themes
69- provided_themes=$( ls -v $HESTIA /web/css/themes | grep ' \.min.css' | sed ' s/\.min.css$//' )
70-
71- # Parse custom themes
72- if [ -d " $HESTIA /web/css/themes/custom" ]; then
73- custom_themes=$( ls -v $HESTIA /web/css/themes/custom/ | grep ' \.css' | sed ' s/\.css$//' )
74- fi
75-
76- # Create array with all available themes
77- for theme in $provided_themes $custom_themes ; do
78- available_themes+=(" $theme " )
79- done
80-
81- # Get count of themes (for proper JSON formatting)
82- theme_count=" ${# available_themes[@]} "
97+ get_themes
8398
8499# Listing data
85100case $format in
0 commit comments