Skip to content

Commit ace8a0d

Browse files
AnurilChristoph Schläpferjaapmarcus
authored
Fixed Whitelabel Descriptions and added functionality to reset whitelabelling. (hestiacp#3952)
* Fixed Whitelabel Descriptions and added functionality to reset whitelabelling. * Fixed case where update would remove custom folder due to wrong comparison * Resolve comments * Change: Reset White label to Reset logo --------- Co-authored-by: Christoph Schläpfer <c.schlaepfer@datact.ch> Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
1 parent d30e3ed commit ace8a0d

File tree

3 files changed

+33
-18
lines changed

3 files changed

+33
-18
lines changed

bin/v-update-white-label-logo

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,58 @@
66
#
77
# Replace Hestia logos with User created logo's
88

9-
download=${1-no}
109
#----------------------------------------------------------#
1110
# Variables & Functions #
1211
#----------------------------------------------------------#
1312

1413
# Argument definition
15-
restart=$1
16-
skip=$2
14+
download=${1-no}
15+
reset=${2-no}
1716

1817
# Includes
1918
# shellcheck source=/etc/hestiacp/hestia.conf
2019
source /etc/hestiacp/hestia.conf
2120
# shellcheck source=/usr/local/hestia/func/main.sh
22-
source $HESTIA/func/main.sh
21+
source "$HESTIA/func/main.sh"
2322
# load config file
2423
source_conf "$HESTIA/conf/hestia.conf"
2524

2625
#----------------------------------------------------------#
2726
# Action #
2827
#----------------------------------------------------------#
2928

29+
if [ "$reset" = "yes" ]; then
30+
rm -rf "$HESTIA/web/images/custom/"
31+
fi
32+
3033
if [ -f "$HESTIA/web/images/custom/logo.svg" ]; then
31-
cp -f $HESTIA/web/images/custom/logo.svg $HESTIA/web/images/logo.svg
34+
cp -f "$HESTIA/web/images/custom/logo.svg" "$HESTIA/web/images/logo.svg"
3235
elif [ ! -f "$HESTIA/web/images/custom/logo.svg" ] && [ "$download" = "yes" ]; then
33-
download_file https://raw.githubusercontent.com/hestiacp/hestiacp/release/web/images/logo.svg $HESTIA/web/images/logo.svg
36+
download_file "https://raw.githubusercontent.com/hestiacp/hestiacp/release/web/images/logo.svg" "$HESTIA/web/images/logo.svg"
3437
fi
3538

3639
if [ -f "$HESTIA/web/images/custom/logo.png" ]; then
37-
cp -f $HESTIA/web/images/custom/logo.png $HESTIA/web/images/logo.png
40+
cp -f $"HESTIA/web/images/custom/logo.png" "$HESTIA/web/images/logo.png"
3841
elif [ ! -f "$HESTIA/web/images/custom/logo.png" ] && [ "$download" = "yes" ]; then
39-
download_file https://raw.githubusercontent.com/hestiacp/hestiacp/release/web/images/logo.png $HESTIA/web/images/logo.png
42+
download_file "https://raw.githubusercontent.com/hestiacp/hestiacp/release/web/images/logo.png" "$HESTIA/web/images/logo.png"
4043
fi
4144

4245
if [ -f "$HESTIA/web/images/custom/logo-header.svg" ]; then
43-
cp -f $HESTIA/web/images/custom/logo-header.svg $HESTIA/web/images/logo-header.svg
46+
cp -f "$HESTIA/web/images/custom/logo-header.svg" "$HESTIA/web/images/logo-header.svg"
4447
elif [ ! -f "$HESTIA/web/images/custom/logo-header.svg" ] && [ "$download" = "yes" ]; then
45-
download_file https://raw.githubusercontent.com/hestiacp/hestiacp/release/web/images/logo-header.svg $HESTIA/web/images/logo-header.svg
48+
download_file "https://raw.githubusercontent.com/hestiacp/hestiacp/release/web/images/logo-header.svg" "$HESTIA/web/images/logo-header.svg"
4649
fi
4750

4851
if [ -f "$HESTIA/web/images/custom/favicon.png" ]; then
49-
cp -f $HESTIA/web/images/custom/favicon.png $HESTIA/web/images/favicon.png
52+
cp -f" $HESTIA/web/images/custom/favicon.png" "$HESTIA/web/images/favicon.png"
5053
elif [ ! -f "$HESTIA/web/images/custom/favicon.png" ] && [ "$download" = "yes" ]; then
51-
download_file https://raw.githubusercontent.com/hestiacp/hestiacp/release/web/images/favicon.png $HESTIA/web/images/favicon.png
54+
download_file "https://raw.githubusercontent.com/hestiacp/hestiacp/release/web/images/favicon.png" "$HESTIA/web/images/favicon.png"
5255
fi
5356

5457
if [ -f "$HESTIA/web/images/custom/favicon.ico" ]; then
55-
cp -f $HESTIA/web/images/custom/favicon.ico $HESTIA/web/favicon.ico
58+
cp -f "$HESTIA/web/images/custom/favicon.ico" "$HESTIA/web/favicon.ico"
5659
elif [ ! -f "$HESTIA/web/images/custom/favicon.ico" ] && [ "$download" = "yes" ]; then
57-
download_file https://raw.githubusercontent.com/hestiacp/hestiacp/release/web/favicon.ico $HESTIA/web/favicon.ico
60+
download_file "https://raw.githubusercontent.com/hestiacp/hestiacp/release/web/favicon.ico" "$HESTIA/web/favicon.ico"
5861
fi
5962

6063
#----------------------------------------------------------#

web/edit/server/whitelabel/index.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@
7878
$return_var,
7979
);
8080
}
81+
if (!empty($_POST["v_update_logo"])) {
82+
exec(HESTIA_CMD . "v-update-white-label-logo");
83+
}
84+
if (!empty($_POST["v_reset_logo"])) {
85+
exec(HESTIA_CMD . "v-update-white-label-logo yes yes");
86+
}
8187
}
8288

8389
// Check system configuration

web/templates/pages/edit_whitelabel.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class="form-control"
113113
</div>
114114
</div>
115115
</details>
116-
<!-- Basic options section -->
116+
<!-- Custom Logo options section -->
117117
<details class="collapse u-mb10">
118118
<summary class="collapse-header">
119119
<i class="fas fa-gear u-mr15"></i>
@@ -130,17 +130,23 @@ class="form-control"
130130
<ul>
131131
<li>logo.svg <small>(100px x 120px)</small></li>
132132
<li>logo.png <small>(100px x 120px)</small></li>
133-
<li>logo-header.png <small>(54x x 29px)</small></li>
133+
<li>logo-header.svg <small>(54x x 29px)</small></li>
134134
<li>favicon.png <small>(64px x 64px)</small></li>
135-
<li>favicon.ico<<small>(16px x 16px)</small></li>
135+
<li>favicon.ico<small>(16px x 16px)</small></li>
136136
</ul>
137137
</div>
138138
<div class="u-mb10">
139-
<input type="checkbox" id="v_update_logo" name="v_update_logo">
139+
<input type="checkbox" id="v_update_logo" name="v_update_logo" value="yes">
140140
<label for="v_update_logo" class="form-label">
141141
<?= _("Update logo") ?>
142142
</label>
143143
</div>
144+
<div class="u-mb10">
145+
<input type="checkbox" id="v_reset_logo" name="v_reset_logo" value="yes">
146+
<label for="v_reset_logo" class="form-label">
147+
<?= _("Reset Logo") ?>
148+
</label>
149+
</div>
144150
</details>
145151
</div>
146152
</form>

0 commit comments

Comments
 (0)