mirror of
https://github.com/YunoHost-Apps/mautrix_signal_ynh.git
synced 2024-09-03 19:46:07 +02:00
Add config panel, WIP
This commit is contained in:
parent
0ae994fd3b
commit
a49ddbe487
2 changed files with 81 additions and 0 deletions
16
config_panel.toml
Normal file
16
config_panel.toml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
version = "1.0"
|
||||||
|
|
||||||
|
[main]
|
||||||
|
name = "Mautrix Signal configuration"
|
||||||
|
|
||||||
|
[main.encryption]
|
||||||
|
name = "Manage encryption"
|
||||||
|
|
||||||
|
[main.encryption.allowed]
|
||||||
|
ask = "Do you want to allow the use of encrypted room with Mautrix Signal Bridge? "
|
||||||
|
type = "bololean"
|
||||||
|
optional = false
|
||||||
|
default = "0"
|
||||||
|
help = "Allow encryption, work in group chat rooms with e2ee enabled"
|
||||||
|
|
||||||
|
# TODO: Add toggle for enabling and enforcing encyption
|
65
scripts/config
Normal file
65
scripts/config
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
encryption_allowed=$(ynh_app_setting_get --app=$app --key=encryption_allowed)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
get__encryption_allowed() {
|
||||||
|
# Maintenance mode status
|
||||||
|
if [ $encryption_allowed -eq "1" ]
|
||||||
|
then
|
||||||
|
echo "1"
|
||||||
|
else
|
||||||
|
echo "0"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
set__encryption_allowed() {
|
||||||
|
if [ "$encryption_allowed" -eq "1" ]; then
|
||||||
|
# If encryption_allowed was set to 1, enable maintenance mode
|
||||||
|
(cd "$final_path" && ynh_exec_as "$app" \
|
||||||
|
echo "Site under maintenance." > .maintenance)
|
||||||
|
ynh_print_info "Maintenance mode disabled"
|
||||||
|
elif [ "$encryption_allowed" -eq "0" ]; then
|
||||||
|
# If encryption_allowed was set to 0, disable maintenance mode
|
||||||
|
ynh_secure_remove --file=$final_path/.maintenance
|
||||||
|
ynh_print_info "Maintenance mode enabled"
|
||||||
|
fi
|
||||||
|
ynh_app_setting_set --app=$app --key=encryption_allowed --value="$encryption_allowed"
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_app_config_apply() {
|
||||||
|
_ynh_app_config_apply
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ynh_app_config_ run $1
|
Loading…
Reference in a new issue