Skip to content

Commit 7612de4

Browse files
author
Kristan Kenney
committed
Merge branch 'main' into feature/statistics-page
2 parents b3e8fb8 + 3937afa commit 7612de4

25 files changed

+101
-334
lines changed

bin/v-add-sys-theme

Lines changed: 0 additions & 98 deletions
This file was deleted.

bin/v-change-sys-api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ if [ "$status" = "enable" ]; then
4444
else
4545
if [ $API = "yes" ]; then
4646
$HESTIA/bin/v-change-sys-config-value "API" "no"
47+
$HESTIA/bin/v-change-sys-config-value "API_ALLOWED_IP" ""
4748
sed -i 's|//die("Error: Disabled");|die("Error: Disabled");|g' $HESTIA/web/api/index.php
4849
fi
4950
fi

bin/v-change-sys-theme

Lines changed: 0 additions & 63 deletions
This file was deleted.

bin/v-delete-sys-theme

Lines changed: 0 additions & 64 deletions
This file was deleted.

bin/v-list-sys-themes

Lines changed: 21 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,63 +22,40 @@ source $HESTIA/conf/hestia.conf
2222

2323
# JSON list function
2424
json_list() {
25-
object1=$(echo "$themes" |wc -w)
26-
object2=$(echo "$themes_custom" |wc -w)
2725
i=1
2826
echo '['
29-
for theme in $themes; do
30-
if [ "$i" -lt "$object1" ]; then
27+
for theme in "${available_themes[@]}"; do
28+
if [ "$i" -lt "$theme_count" ]; then
3129
echo -e "\t\"$theme\","
3230
else
33-
if [ $object2 -gt 0 ]; then
34-
echo -e "\t\"$theme\","
35-
else
36-
echo -e "\t\"$theme\""
37-
fi
31+
echo -e "\t\"$theme\""
3832
fi
3933
(( ++i))
4034
done
41-
for custom_theme in $themes_custom; do
42-
if [ "$i" -lt "$object2" ]; then
43-
echo -e "\t\"$custom_theme\","
44-
else
45-
echo -e "\t\"$custom_theme\""
46-
fi
47-
(( ++i))
48-
done
49-
echo "]"
35+
echo ']'
5036
}
5137

5238
# SHELL list function
5339
shell_list() {
5440
echo "THEME"
55-
echo "------"
56-
for theme in $themes; do
57-
echo "$theme"
58-
done
59-
for custom_theme in $themes_custom; do
60-
echo "$custom_theme"
41+
echo "-----"
42+
for theme in "${available_themes[@]}"; do
43+
echo $theme
6144
done
6245
}
6346

6447
# PLAIN list function
6548
plain_list() {
66-
for theme in $themes; do
67-
echo "$theme"
68-
done
69-
for custom_theme in $themes_custom; do
70-
echo "$custom_theme"
49+
for theme in "${available_themes[@]}"; do
50+
echo $theme
7151
done
7252
}
7353

7454
# CSV list function
7555
csv_list() {
7656
echo "THEME"
77-
for theme in $themes; do
78-
echo "$theme"
79-
done
80-
for custom_theme in $themes_custom; do
81-
echo "$custom_theme"
57+
for theme in "${available_themes[@]}"; do
58+
echo $theme
8259
done
8360
}
8461

@@ -87,16 +64,19 @@ csv_list() {
8764
# Action #
8865
#----------------------------------------------------------#
8966

90-
# Parsing templates
67+
# Parse system provided themes
68+
provided_themes=$(ls -v $HESTIA/web/css/themes | grep '\.min.css' | sed 's/\.min.css$//')
9169

92-
# System provided themes
93-
themes=$(ls -v $HESTIA_THEMES/)
94-
themes=$(echo "$themes" | grep '\.css' | sed 's/\.css$//')
70+
# Parse custom themes
71+
custom_themes=$(ls -v $HESTIA/web/css/themes/custom/ | grep '\.css' | sed 's/\.css$//')
9572

96-
# Custom themes
97-
themes_custom=$(ls -v $HESTIA_THEMES_CUSTOM/)
98-
themes_custom=$(echo "$themes_custom" | grep '\.css' | sed 's/\.css$//')
73+
# Create array with all available themes
74+
for theme in $provided_themes $custom_themes; do
75+
available_themes=(${available_themes[@]} $theme)
76+
done
9977

78+
# Get count of themes (for proper JSON formatting)
79+
theme_count="${#available_themes[@]}"
10080

10181
# Listing data
10282
case $format in

func/main.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ DNSTPL=$HESTIA/data/templates/dns
1616
RRD=$HESTIA/web/rrd
1717
SENDMAIL="$HESTIA/web/inc/mail-wrapper.php"
1818
HESTIA_GIT_REPO="https://raw.githubusercontent.com/hestiacp/hestiacp"
19-
HESTIA_THEMES="$HESTIA_INSTALL_DIR/themes"
20-
HESTIA_THEMES_CUSTOM="$HESTIA/data/templates/themes"
19+
HESTIA_THEMES="$HESTIA/web/css/themes"
20+
HESTIA_THEMES_CUSTOM="$HESTIA/web/css/themes/custom"
2121
SCRIPT="$(basename $0)"
2222

2323
# Return codes

func/upgrade.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ upgrade_health_check() {
6969
# Theme
7070
if [ -z "$THEME" ]; then
7171
echo "[ ! ] Adding missing variable to hestia.conf: THEME ('default')"
72-
$BIN/v-change-sys-theme 'default'
72+
$BIN/v-change-sys-config-value 'THEME' 'default'
7373
fi
7474

7575
# Default language
@@ -151,8 +151,8 @@ upgrade_health_check() {
151151
fi
152152
# API Allowed IP
153153
if [ -z "$API_ALLOWED_IP" ]; then
154-
echo "[ ! ] Adding missing variable to hestia.conf: API_ALLOWED_IP ('')"
155-
$BIN/v-change-sys-config-value "API_ALLOWED_IP" "127.0.0.1"
154+
echo "[ ! ] Adding missing variable to hestia.conf: API_ALLOWED_IP ('allow-all')"
155+
$BIN/v-change-sys-config-value "API_ALLOWED_IP" "allow-all"
156156
fi
157157

158158
echo "[ * ] Health check complete. Starting upgrade from $VERSION to $new_version..."
@@ -678,6 +678,7 @@ disable_api(){
678678
if [ "$API" = "no" ]; then
679679
echo "[ ! ] Disable Api..."
680680
sed -i 's|//die("Error: Disabled");|die("Error: Disabled");|g' $HESTIA/web/api/index.php
681+
$HESTIA/bin/v-change-sys-config-value "API_ALLOWED_IP" ""
681682
fi
682683
}
683684
upgrade_rebuild_web_templates() {
@@ -750,14 +751,6 @@ upgrade_rebuild_users() {
750751
}
751752

752753
upgrade_restart_services() {
753-
# Refresh user interface theme
754-
if [ "$THEME" ]; then
755-
if [ "$THEME" != "default" ]; then
756-
echo "[ * ] Applying user interface updates..."
757-
$BIN/v-change-sys-theme $THEME
758-
fi
759-
fi
760-
761754
if [ "$UPGRADE_RESTART_SERVICES" = "true" ]; then
762755
echo "[ * ] Restarting services..."
763756
export restart="yes"

install/deb/themes/default.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)