Skip to content

Commit aaec5d9

Browse files
White label for file manager (hestiacp#4681)
* White label for file manager * Add the $HESTIA variable to the path * Add app name after update filemanager * Update format --------- Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
1 parent 23b6e89 commit aaec5d9

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

bin/v-add-sys-filemanager

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ fi
102102
# Add configuration file
103103
cp -f $HESTIA_INSTALL_DIR/filemanager/filegator/configuration.php $HESTIA/web/fm/configuration.php
104104

105+
# Path to the file manager configuration file where the change will be made.
106+
config_file="$HESTIA/web/fm/configuration.php"
107+
app_name="File Manager - $APP_NAME"
108+
109+
# Sed replaces only the value after "File Manager -"
110+
sed -i "s|\(\$dist_config\[\"frontend_config\"\]\[\"app_name\"\] = \"File Manager - \).*\";|\1${APP_NAME}\";|" "$config_file"
111+
105112
echo "$fm_v" > "${FM_INSTALL_DIR}/version"
106113
# Set permissions
107114
chown root: -R "${FM_INSTALL_DIR}"

bin/v-change-sys-config-value

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ mv $HESTIA/conf/hestia.conf $HESTIA/conf/hestia.conf.bak
4545
mv /tmp/updconf $HESTIA/conf/hestia.conf
4646
rm -f $HESTIA/conf/hestia.conf.bak
4747

48+
# Check if the variable "$key" has the value "APP_NAME"
49+
if [ "$key" == "APP_NAME" ]; then
50+
# Path to the file manager configuration file where the change will be made.
51+
config_file="$HESTIA/web/fm/configuration.php"
52+
new_app_name="File Manager - $value"
53+
54+
# Verify if configuration.php exists and is writable
55+
if [ -f "$config_file" ] && [ -w "$config_file" ]; then
56+
# Sed replaces only the value after "File Manager -"
57+
sed -i "s|\(\$dist_config\[\"frontend_config\"\]\[\"app_name\"\] = \"File Manager - \).*\";|\1${value}\";|" "$config_file"
58+
fi
59+
fi
60+
4861
#----------------------------------------------------------#
4962
# Hestia #
5063
#----------------------------------------------------------#

func/upgrade.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,14 @@ upgrade_filemanager() {
687687
echo "[ ! ] Updating File Manager configuration..."
688688
# Update configuration.php
689689
cp -f $HESTIA_INSTALL_DIR/filemanager/filegator/configuration.php $HESTIA/web/fm/configuration.php
690+
691+
# Path to the file manager configuration file where the change will be made.
692+
config_file="$HESTIA/web/fm/configuration.php"
693+
app_name="File Manager - $APP_NAME"
694+
695+
# Sed replaces only the value after "File Manager -"
696+
sed -i "s|\(\$dist_config\[\"frontend_config\"\]\[\"app_name\"\] = \"File Manager - \).*\";|\1${APP_NAME}\";|" "$config_file"
697+
690698
# Set environment variable for interface
691699
$BIN/v-change-sys-config-value 'FILE_MANAGER' 'true'
692700
fi

0 commit comments

Comments
 (0)