Skip to content

Commit 705a4ae

Browse files
jaapmarcusAlecRust
andauthored
Feature/2493 change logo support (hestiacp#3572)
* Update whitelabel.php * Add support for custom logo's * Update web/templates/pages/edit_whitelabel.php Co-authored-by: Alec Rust <me@alecrust.com> --------- Co-authored-by: Alec Rust <me@alecrust.com>
1 parent 164619b commit 705a4ae

File tree

5 files changed

+103
-0
lines changed

5 files changed

+103
-0
lines changed

bin/v-update-white-label-logo

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
# info: update white label logo's
3+
# options: [DOWNLOAD]
4+
#
5+
# example: v-update-white-label-logo
6+
#
7+
# Replace Hestia logos with User created logo's
8+
9+
download=${1-no}
10+
#----------------------------------------------------------#
11+
# Variables & Functions #
12+
#----------------------------------------------------------#
13+
14+
# Argument definition
15+
restart=$1
16+
skip=$2
17+
18+
# Includes
19+
# shellcheck source=/etc/hestiacp/hestia.conf
20+
source /etc/hestiacp/hestia.conf
21+
# shellcheck source=/usr/local/hestia/func/main.sh
22+
source $HESTIA/func/main.sh
23+
# load config file
24+
source_conf "$HESTIA/conf/hestia.conf"
25+
26+
#----------------------------------------------------------#
27+
# Action #
28+
#----------------------------------------------------------#
29+
30+
if [ -f "$HESTIA/web/images/custom/logo.svg" ]; then
31+
cp -f $HESTIA/web/images/custom/logo.svg $HESTIA/web/images/logo.svg
32+
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
34+
fi
35+
36+
if [ -f "$HESTIA/web/images/custom/logo.png" ]; then
37+
cp -f $HESTIA/web/images/custom/logo.png $HESTIA/web/images/logo.png
38+
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
40+
fi
41+
42+
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
44+
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
46+
fi
47+
48+
if [ -f "$HESTIA/web/images/custom/favicon.png" ]; then
49+
cp -f $HESTIA/web/images/custom/favicon.png $HESTIA/web/images/favicon.png
50+
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
52+
fi
53+
54+
if [ -f "$HESTIA/web/images/custom/favicon.ico" ]; then
55+
cp -f $HESTIA/web/images/custom/favicon.ico $HESTIA/web/favicon.ico
56+
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
58+
fi
59+
60+
#----------------------------------------------------------#
61+
# Hestia #
62+
#----------------------------------------------------------#
63+
64+
exit

func/upgrade.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,10 @@ upgrade_rebuild_users() {
780780
fi
781781
}
782782

783+
update_whitelabel_logo() {
784+
$BIN/v-update-white-label-logo
785+
}
786+
783787
upgrade_replace_default_config() {
784788
syshealth_update_web_config_format
785789
syshealth_update_mail_config_format

src/deb/hestia/postinst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ upgrade_phppgadmin | tee -a $LOG
9898
# Upgrade blackblaze-cli-took if applicable
9999
upgrade_b2_tool | tee -a $LOG
100100

101+
# update whitelabel logo's
102+
update_whitelabel_logo | tee -a $LOG
103+
101104
# Set new version number in hestia.conf
102105
upgrade_set_version $new_version
103106
upgrade_set_branch $new_version

src/rpm/hestia/hestia.spec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ if [ -e "/usr/local/hestia/data/users/admin" ]; then
119119
# Upgrade blackblaze-cli-took if applicable
120120
upgrade_b2_tool | tee -a $LOG
121121

122+
# update whitelabel logo's
123+
update_whitelabel_logo | tee -a $LOG
124+
122125
# Set new version number in hestia.conf
123126
upgrade_set_version
124127

web/templates/pages/edit_whitelabel.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,35 @@ class="form-control"
113113
</div>
114114
</div>
115115
</details>
116+
<!-- Basic options section -->
117+
<details class="collapse u-mb10">
118+
<summary class="collapse-header">
119+
<i class="fas fa-gear u-mr15"></i>
120+
<?= _("Custom Logo") ?>
121+
</summary>
122+
<div class="collapse-content">
123+
<div class="u-mb10">
124+
<label for="v_custom_logo" class="form-label">
125+
<?= _("Custom logo") ?>
126+
</label>
127+
</div>
128+
<div class="u-mb10">
129+
<p><?=sprintf(_("Upload the files to %s"), '/usr/local/hestia/web/images/custom/');?></p>
130+
<ul>
131+
<li>logo.svg <small>(100px x 120px)</small></li>
132+
<li>logo.png <small>(100px x 120px)</small></li>
133+
<li>logo-header.png <small>(54x x 29px)</small></li>
134+
<li>favicon.png <small>(64px x 64px)</small></li>
135+
<li>favicon.ico<<small>(16px x 16px)</small></li>
136+
</ul>
137+
</div>
138+
<div class="u-mb10">
139+
<input type="checkbox" id="v_update_logo" name="v_update_logo">
140+
<label for="v_update_logo" class="form-label">
141+
<?= _("Update logo") ?>
142+
</label>
143+
</div>
144+
</details>
116145
</div>
117146
</form>
118147
</div>

0 commit comments

Comments
 (0)