Skip to content

Commit 4df60ba

Browse files
jaapmarcusAlecRustmyrevery
authored
Refactor translations (hestiacp#3441)
* Refactor translation - Refactor translations - Add support for Whitelabeling (Logo's will come in other PR) - Add support for changing email templates - Removed copy javascript email credentials to hidden input. * Remove multiple php errors Fix: php error Undefined variable $error Remove: Undefined variable $v_record_id Remove: Undefined variable $status Also removed unused from form: murmur hasn't been used for a long time... * Fix error message v-change-web-docroot * Fix label DNS records * Improve "Refactor translations" (hestiacp#3512) * Use sprintf instead gettext twice Allows translators to format Every 2 days. For month tab replace: "Date" with "Day" * Another fixes to "Refactor translations (hestiacp#3441)" (hestiacp#3523) * Another fixes to "Refactor translations" * Final adjustments * Fix syntax error * Convert {text} to <b>text</b> Also remove hardcode color from template in add access key --------- Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com> Co-authored-by: Alec Rust <me@alecrust.com> Co-authored-by: myrevery <16082142+myrevery@users.noreply.github.com>
1 parent 07e8f9e commit 4df60ba

File tree

145 files changed

+3760
-3333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+3760
-3333
lines changed

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
# Web templates (for now)
2424
web/templates/
2525

26+
# Email templates
27+
/install/common/templates/email/
28+
2629
# Vendor/packages
2730
.pnp.*
2831
.yarn/*

bin/v-change-user-language

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@ source $HESTIA/func/main.sh
2323
source_conf "$HESTIA/conf/hestia.conf"
2424

2525
is_language_valid() {
26-
if ! [[ "$1" =~ ^[[:alnum:]_-]+$ ]]; then
27-
echo "Error: language $1 is not valid"
28-
log_event "$E_INVALID" "$ARGUMENTS"
29-
exit $E_INVALID
30-
fi
31-
if [ ! -d "$HESTIA/web/locale/$1" ]; then
32-
echo "Error: language $1 doesn't exist"
33-
log_event "$E_NOTEXIST" "$ARGUMENTS"
34-
exit $E_NOTEXIST
26+
# English is always allowed
27+
if [ "$1" != "en" ]; then
28+
if ! [[ "$1" =~ ^[[:alnum:]_-]+$ ]]; then
29+
echo "Error: language $1 is not valid"
30+
log_event "$E_INVALID" "$ARGUMENTS"
31+
exit $E_INVALID
32+
fi
33+
if [ ! -d "$HESTIA/web/locale/$1" ]; then
34+
echo "Error: language $1 doesn't exist"
35+
log_event "$E_NOTEXIST" "$ARGUMENTS"
36+
exit $E_NOTEXIST
37+
fi
3538
fi
3639
}
3740

bin/v-change-web-domain-docroot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ else
8989
# Checking destination path
9090
real_target_directory="$(readlink -e "${target_domain_directory}/public_html/$target_directory/")"
9191
if [ ! -e "$real_target_directory" ]; then
92-
check_result "$E_NOTEXIST" "Directory $target_directory does not exist under $HOMEDIR/$user/$target_domain/public_html/."
92+
check_result "$E_NOTEXIST" "Directory $target_directory does not exist under $HOMEDIR/$user/web/$target_domain/public_html/."
9393
elif [ -z "$(echo $real_target_directory | egrep "^$target_domain_directory\b")" ]; then
9494
check_result "$E_FORBIDEN" "Target dir outside of target domain dir"
9595
else

bin/v-list-sys-config

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@ json_list() {
103103
"SERVER_SMTP_USER": "'$SERVER_SMTP_USER'",
104104
"SERVER_SMTP_PASSWD": "'$SERVER_SMTP_PASSWD'",
105105
"SERVER_SMTP_ADDR": "'$SERVER_SMTP_ADDR'",
106-
"DISABLE_IP_CHECK": "'$DISABLE_IP_CHECK'"
106+
"DISABLE_IP_CHECK": "'$DISABLE_IP_CHECK'",
107+
"FROM_NAME": "'$FROM_NAME'",
108+
"FROM_EMAIL": "'$FROM_EMAIL'",
109+
"APP_NAME": "'$APP_NAME'",
110+
"TITLE": "'$TITLE'",
111+
"SUBJECT_EMAIL": "'$SUBJECT_EMAIL'",
112+
"HIDE_DOCS": "'$HIDE_DOCS'"
107113
}
108114
}'
109115
}

bin/v-list-sys-hestia-updates

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ if [ -n "$hesta_v" ] && [ "$hestia_v" \> "$VERSION" ]; then
107107
fi
108108

109109
data="NAME='hestia' VERSION='$VERSION' ARCH='$ARCH'"
110-
data="$data UPDATED='$UPDATED' DESCR='core package' TIME='$TIME' DATE='$DATE'"
110+
data="$data UPDATED='$UPDATED' DESCR='Hestia core package' TIME='$TIME' DATE='$DATE'"
111111

112112
# Checking installed hestia-php version
113113
if [ -f '/etc/redhat-release' ]; then
@@ -122,7 +122,7 @@ if [ -n "$php_v" ] && [ "$php_v" \> "$VERSION" ]; then
122122
fi
123123

124124
data="$data\nNAME='hestia-php' VERSION='$VERSION'"
125-
data="$data ARCH='$ARCH' UPDATED='$UPDATED' DESCR='php interpreter'"
125+
data="$data ARCH='$ARCH' UPDATED='$UPDATED' DESCR='Hestia internal php interpreter'"
126126
data="$data TIME='$TIME' DATE='$DATE'"
127127

128128
# Checking installed hestia-nginx version
@@ -138,7 +138,7 @@ if [ -n "$nginx_v" ] && [ "$nginx_v" \> "$VERSION" ]; then
138138
fi
139139

140140
data="$data\nNAME='hestia-nginx' VERSION='$VERSION'"
141-
data="$data ARCH='$ARCH' UPDATED='$UPDATED' DESCR='internal web server'"
141+
data="$data ARCH='$ARCH' UPDATED='$UPDATED' DESCR='Hestia internal web server'"
142142
data="$data TIME='$TIME' DATE='$DATE'"
143143

144144
# Listing data

bin/v-list-sys-languages

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ json_list() {
2727
objects=$(echo "$languages" | wc -l)
2828
i=1
2929
echo '['
30+
echo -e "\t\"en\","
3031
for lang in $languages; do
3132
if [ "$i" -lt "$objects" ]; then
3233
echo -e "\t\"$lang\","
@@ -42,13 +43,15 @@ json_list() {
4243
shell_list() {
4344
echo "LANGUAGE"
4445
echo "--------"
46+
echo "en"
4547
for lang in $languages; do
4648
echo "$lang"
4749
done
4850
}
4951

5052
# PLAIN list function
5153
plain_list() {
54+
echo "en"
5255
for lang in $languages; do
5356
echo "$lang"
5457
done
@@ -57,6 +60,7 @@ plain_list() {
5760
# CSV list function
5861
csv_list() {
5962
echo "LANGUAGE"
63+
echo "en"
6064
for lang in $languages; do
6165
echo "$lang"
6266
done

bin/v-list-sys-services

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ fi
200200
# Checking MAIL IMAP
201201
if [ -n "$IMAP_SYSTEM" ] && [ "$IMAP_SYSTEM" != 'remote' ]; then
202202
get_srv_state "$IMAP_SYSTEM"
203-
data="$data\nNAME='$IMAP_SYSTEM' SYSTEM='pop/imap server' STATE='$state'"
203+
data="$data\nNAME='$IMAP_SYSTEM' SYSTEM='imap / pop server' STATE='$state'"
204204
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
205205
fi
206206

@@ -217,15 +217,15 @@ if [ -n "$ANTIVIRUS_SYSTEM" ] && [ "$ANTIVIRUS_SYSTEM" != 'remote' ]; then
217217
fi
218218
get_srv_state "$ANTIVIRUS_SYSTEM" "$proc_name"
219219
fi
220-
data="$data\nNAME='$ANTIVIRUS_SYSTEM' SYSTEM='email antivirus'"
220+
data="$data\nNAME='$ANTIVIRUS_SYSTEM' SYSTEM='email anti-virus'"
221221
data="$data STATE='$state' CPU='$cpu' MEM='$mem' RTIME='$rtime'"
222222
proc_name=''
223223
fi
224224

225225
# Checking MAIL ANTISPAM
226226
if [ -n "$ANTISPAM_SYSTEM" ] && [ "$ANTISPAM_SYSTEM" != 'remote' ]; then
227227
get_srv_state "$ANTISPAM_SYSTEM" "spamd"
228-
data="$data\nNAME='$ANTISPAM_SYSTEM' SYSTEM='email antispam'"
228+
data="$data\nNAME='$ANTISPAM_SYSTEM' SYSTEM='email spam filter'"
229229
data="$data STATE='$state' CPU='$cpu' MEM='$mem' RTIME='$rtime'"
230230
fi
231231

@@ -295,7 +295,7 @@ fi
295295
# Checking SSH daemon
296296
if [ -e "/etc/ssh/sshd_config" ]; then
297297
get_srv_state ssh
298-
data="$data\nNAME='ssh' SYSTEM='SSH Access' STATE='$state'"
298+
data="$data\nNAME='ssh' SYSTEM='ssh server' STATE='$state'"
299299
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
300300
fi
301301

@@ -320,7 +320,7 @@ if [ -n "$FIREWALL_EXTENSION" ]; then
320320
else
321321
get_srv_state "$FIREWALL_EXTENSION" fail2ban-server script
322322
fi
323-
data="$data\nNAME='$FIREWALL_EXTENSION' SYSTEM='brute-force monitor'"
323+
data="$data\nNAME='$FIREWALL_EXTENSION' SYSTEM='brute-force protection'"
324324
data="$data STATE='$state' CPU='$cpu' MEM='$mem' RTIME='$rtime'"
325325
fi
326326

docs/docs/server-administration/backup-restore.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Currently supported backup protocols are:
6969
Login via SSH and run the following command as root:
7070

7171
```bash
72-
v-add-backup-host 'ftp' 'remote.ftp-host.ltd' 'backup-user' 'p4ssw0rd' '/path-backups/' 'port'
72+
v-add-backup-host 'ftp' 'remote.ftp-host.tld' 'backup-user' 'p4ssw0rd' '/path-backups/' 'port'
7373
```
7474

7575
### How to setup an SFTP backup server
@@ -81,13 +81,13 @@ Please note passwords are stored as **plain text** on the server. They are only
8181
Login via SSH and run the following command as root:
8282

8383
```bash
84-
v-add-backup-host 'sftp' 'remote.ftp-host.ltd' 'backup-user' 'p4ssw0rd' '/path-backups/' 'port'
84+
v-add-backup-host 'sftp' 'remote.ftp-host.tld' 'backup-user' 'p4ssw0rd' '/path-backups/' 'port'
8585
```
8686

8787
If using public and private keys (recommended):
8888

8989
```bash
90-
v-add-backup-host 'sftp' 'remote.ftp-host.ltd' 'backup-user' '/root/id_rsa' '/path-backups/' 'port'
90+
v-add-backup-host 'sftp' 'remote.ftp-host.tld' 'backup-user' '/root/id_rsa' '/path-backups/' 'port'
9191
```
9292

9393
## How to setup Rclone

func/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ source_conf() {
15801580
format_no_quotes() {
15811581
exclude="['|\"]"
15821582
if [[ "$1" =~ $exclude ]]; then
1583-
check_result "$E_INVALID" "Invalid $2 contains qoutes (\" or ') :: $1"
1583+
check_result "$E_INVALID" "Invalid $2 contains qoutes (\" or ' or | ) :: $1"
15841584
fi
15851585
is_no_new_line_format "$1"
15861586
}

func/syshealth.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,34 @@ function syshealth_repair_system_config() {
483483
echo "[ ! ] Adding missing variable to hestia.conf: DISABLE_IP_CHECK ('no')"
484484
$BIN/v-change-sys-config-value "DISABLE_IP_CHECK" "no"
485485
fi
486+
if [[ -z $(check_key_exists 'APP_NAME') ]]; then
487+
echo "[ ! ] Adding missing variable to hestia.conf: APP_NAME ('Hestia Control Panel')"
488+
$BIN/v-change-sys-config-value "APP_NAME" "Hestia Control Panel"
489+
fi
490+
if [[ -z $(check_key_exists 'FROM_NAME') ]]; then
491+
# Default is always APP_NAME
492+
echo "[ ! ] Adding missing variable to hestia.conf: FROM_NAME ('')"
493+
$BIN/v-change-sys-config-value "FROM_NAME" ""
494+
fi
495+
if [[ -z $(check_key_exists 'FROM_EMAIL') ]]; then
496+
# Default is always noreply@hostname.com
497+
echo "[ ! ] Adding missing variable to hestia.conf: FROM_EMAIL ('')"
498+
$BIN/v-change-sys-config-value "FROM_EMAIL" ""
499+
fi
500+
if [[ -z $(check_key_exists 'SUBJECT_EMAIL') ]]; then
501+
echo "[ ! ] Adding missing variable to hestia.conf: SUBJECT_EMAIL ('{{subject}}')"
502+
$BIN/v-change-sys-config-value "SUBJECT_EMAIL" "{{subject}}"
503+
fi
504+
505+
if [[ -z $(check_key_exists 'TITLE') ]]; then
506+
echo "[ ! ] Adding missing variable to hestia.conf: TITLE ('{{page}} - {{hostname}} - {{appname}}')"
507+
$BIN/v-change-sys-config-value "TITLE" "{{page}} - {{hostname}} - {{appname}}"
508+
fi
509+
510+
if [[ -z $(check_key_exists 'HIDE_DOCS') ]]; then
511+
echo "[ ! ] Adding missing variable to hestia.conf: HIDE_DOCS ('no')"
512+
$BIN/v-change-sys-config-value "HIDE_DOCS" "no"
513+
fi
486514

487515
touch $HESTIA/conf/hestia.conf.new
488516
while IFS='= ' read -r lhs rhs; do

0 commit comments

Comments
 (0)