mirror of
https://github.com/YunoHost-Apps/fluffychat_ynh.git
synced 2024-09-03 18:36:04 +02:00
add default_matrix_server setting
This commit is contained in:
parent
c9c767cd7c
commit
ec10a22c68
4 changed files with 48 additions and 0 deletions
26
config_panel.toml
Normal file
26
config_panel.toml
Normal file
|
@ -0,0 +1,26 @@
|
|||
version = "1.0"
|
||||
|
||||
[main]
|
||||
|
||||
services = [ "__APP__" ]
|
||||
|
||||
name.en = "Config panel"
|
||||
name.fr = "Panneau de configuration"
|
||||
|
||||
help = "Here you can easily configure some things about your Fluffychat instance."
|
||||
|
||||
####################
|
||||
#### FLUFFYCHAT CONFIG
|
||||
####################
|
||||
|
||||
[main.fluffychat]
|
||||
name = "Fluffychat config"
|
||||
|
||||
[main.fluffychat.default_matrix_server]
|
||||
ask.en = "Default Matrix server?"
|
||||
ask.fr = "Serveur Matrix par défaut ?"
|
||||
help.en = "This option changes the default Matrix server on the Fluffychat login page."
|
||||
help.fr = "Cette option modifie le serveur Matrix renseigné par défaut sur la page de connexion de Fluffychat."
|
||||
type = "string"
|
||||
pattern.regexp = '^([-?a-zA-Z0-9]\.?){1,256}[a-zA-Z0-9]{1,6}$'
|
||||
pattern.error = "Must be a domain name or a sub-domain. Must not start with 'http://' or 'https://'."
|
|
@ -45,6 +45,12 @@ ram.runtime = "50M"
|
|||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.default_matrix_server]
|
||||
ask.en = "Default Matrix server"
|
||||
help.en = "Serveur Matrix par défaut"
|
||||
type = "url"
|
||||
default = "matrix.org"
|
||||
|
||||
[resources]
|
||||
[resources.sources]
|
||||
[resources.sources.main]
|
||||
|
|
|
@ -9,6 +9,16 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# INITIALIZE AND STORE SETTINGS
|
||||
#=================================================
|
||||
|
||||
# remove the 'https://' part
|
||||
default_matrix_server=${default_matrix_server#*://}
|
||||
# remove any trailing slash
|
||||
default_matrix_server=${default_matrix_server%/}
|
||||
ynh_app_setting_set --app="$app" --key=default_matrix_server --value="$default_matrix_server"
|
||||
|
||||
#=================================================
|
||||
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
||||
#=================================================
|
||||
|
@ -23,6 +33,9 @@ ynh_setup_source --dest_dir="$install_dir"
|
|||
path_without_trailing_slash=${path%/}
|
||||
ynh_replace_string --match_string="<base href=".*">" --replace_string="<base href=\"$path_without_trailing_slash/\">" --target_file="$install_dir/index.html"
|
||||
|
||||
# patching main.dart.js to replace the default matrix server
|
||||
ynh_replace_string --match_string="$.cmx=\"matrix.org\"" --replace_string="$.cmx=\"$default_matrix_server\"" --target_file="$install_dir/main.dart.js"
|
||||
|
||||
chown -R "www-data:www-data" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -27,6 +27,9 @@ then
|
|||
# remove potential trailing slash to avoid double slashes
|
||||
path_without_trailing_slash=${path%/}
|
||||
ynh_replace_string --match_string="<base href=".*">" --replace_string="<base href=\"$path_without_trailing_slash/\">" --target_file="$install_dir/index.html"
|
||||
|
||||
# patching main.dart.js to replace the default matrix server
|
||||
ynh_replace_string --match_string="$.cmx=\".*\"" --replace_string="$.cmx=\"$default_matrix_server\"" --target_file="$install_dir/main.dart.js"
|
||||
fi
|
||||
|
||||
chown -R "www-data:www-data" "$install_dir"
|
||||
|
|
Loading…
Reference in a new issue