diff --git a/README.md b/README.md index 2850245..6e9a476 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -16,10 +16,11 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -FluffyChat is an open source, nonprofit and cute [[matrix](https://matrix.org)] client written in [Flutter](https://flutter.dev). The goal of the app is to create an easy to use instant messenger which is open source and accessible for everyone. +FluffyChat is an open source, nonprofit and cute [[matrix](https://matrix.org)] client written in [Flutter](https://flutter.dev). +The goal of the app is to create an easy to use instant messenger which is open source and accessible for everyone. -**Shipped version:** 1.17.3~ynh1 +**Shipped version:** 1.18.0~ynh1 **Demo:** https://fluffychat.im/web @@ -47,4 +48,4 @@ or sudo yunohost app upgrade fluffychat -u https://github.com/YunoHost-Apps/fluffychat_ynh/tree/testing --debug ``` -**More info regarding app packaging:** +**More info regarding app packaging:** \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index f50ca8c..50fe452 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,5 +1,5 @@ @@ -16,9 +16,11 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -[FluffyChat](https://fluffychat.im) est un client [[matrix](https://matrix.org)] open-source, à but non lucratif et mignon écrit en [Flutter](https://flutter.dev). Le but de cette app est de créer un client de messagerie instantannée facile d'utilisation, open-source et accessible pour tout le monde. +FluffyChat est un client [[matrix](https://matrix.org)] open-source, à but non lucratif et mignon écrit en [Flutter](https://flutter.dev). +Le but de cette app est de créer un client de messagerie instantannée facile d'utilisation, open-source et accessible pour tout le monde. -**Version incluse :** 1.17.3~ynh1 + +**Version incluse :** 1.18.0~ynh1 **Démo :** https://fluffychat.im/web diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..be15513 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,25 @@ +version = "1.0" + +[main] + +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" + help = "The changes may not appear if you do not clear your browser's cache." + + [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}){1}$' + pattern.error = "Must be a domain name or a sub-domain. Must not start with 'http://' or 'https://'." diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index e894e3f..466edee 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1 +1,2 @@ -FluffyChat is an open source, nonprofit and cute [[matrix](https://matrix.org)] client written in [Flutter](https://flutter.dev). The goal of the app is to create an easy to use instant messenger which is open source and accessible for everyone. +FluffyChat is an open source, nonprofit and cute [[matrix](https://matrix.org)] client written in [Flutter](https://flutter.dev). +The goal of the app is to create an easy to use instant messenger which is open source and accessible for everyone. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index e54a37d..49e7d83 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1 +1,2 @@ -[FluffyChat](https://fluffychat.im) est un client [[matrix](https://matrix.org)] open-source, à but non lucratif et mignon écrit en [Flutter](https://flutter.dev). Le but de cette app est de créer un client de messagerie instantannée facile d'utilisation, open-source et accessible pour tout le monde. \ No newline at end of file +FluffyChat est un client [[matrix](https://matrix.org)] open-source, à but non lucratif et mignon écrit en [Flutter](https://flutter.dev). +Le but de cette app est de créer un client de messagerie instantannée facile d'utilisation, open-source et accessible pour tout le monde. diff --git a/doc/PRE_UPGRADE.d/1.18.0~ynh1 b/doc/PRE_UPGRADE.d/1.18.0~ynh1 new file mode 100644 index 0000000..dec075f --- /dev/null +++ b/doc/PRE_UPGRADE.d/1.18.0~ynh1 @@ -0,0 +1,2 @@ +Starting with this update, you can configure Fluffychat using the config panel integrated in Yunohost, you will find it in the web admin interface of your Yunohost by following these steps: +`Applications > Fluffychat > Config Panel` diff --git a/manifest.toml b/manifest.toml index 802a2de..2f4b62e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Fluffychat" description.en = "Matrix messenger client" description.fr = "Client de messagerie Matrix" -version = "1.17.3~ynh1" +version = "1.18.0~ynh1" maintainers = [ "OniriCorpe" ] @@ -45,14 +45,17 @@ ram.runtime = "50M" type = "group" default = "visitors" + [install.default_matrix_server] + ask.en = "Default Matrix server" + help.en = "Must be a domain name or a sub-domain. Must not contain a path." + type = "url" + default = "matrix.org" + [resources] - [resources.sources] - [resources.sources.main] - - url = "https://github.com/krille-chan/fluffychat/releases/download/v1.17.3/fluffychat-web.tar.gz" - sha256 = "cd88c8d6aaf1c90ddba1b69696eda8212d7d529d2c1f5f6943a589621ae38ca9" + url = "https://github.com/krille-chan/fluffychat/releases/download/v1.18.0/fluffychat-web.tar.gz" + sha256 = "0b9fbc74e1098c3df966dd1b689ec16bef5aa3e83cecb7d3f408a5fab6128cf7" in_subdir = 2 autoupdate.asset = "fluffychat-web.tar.gz" diff --git a/scripts/config b/scripts/config new file mode 100644 index 0000000..9501279 --- /dev/null +++ b/scripts/config @@ -0,0 +1,43 @@ +#!/bin/bash + +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source /usr/share/yunohost/helpers + +ynh_abort_if_errors + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +install_dir=$(ynh_app_setting_get --app="$app" --key=install_dir) + +#================================================= +# SPECIFIC GETTERS +#================================================= + +get__default_matrix_server() { + + default_matrix_server=$(ynh_app_setting_get --app="$app" --key=default_matrix_server) + + echo "$default_matrix_server" +} + +#================================================= +# SPECIFIC SETTERS +#================================================= + +set__default_matrix_server() { + + # 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" + + ynh_app_setting_set --app="$app" --key=default_matrix_server --value="$default_matrix_server" +} + +#================================================= +# GENERIC FINALIZATION +#================================================= +ynh_app_config_run "$1" diff --git a/scripts/install b/scripts/install index c969593..f5e8814 100755 --- a/scripts/install +++ b/scripts/install @@ -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="" --replace_string="" --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" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d0606b0..a4be173 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,6 +11,12 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) +# if we update from a version prior to the config panel, create new setting +if [ -z "${default_matrix_server:-}" ]; then + default_matrix_server="matrix.org" + ynh_app_setting_set --app="$app" --key=default_matrix_server --value="$default_matrix_server" +fi + #================================================= # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) #================================================= @@ -27,6 +33,9 @@ then # remove potential trailing slash to avoid double slashes path_without_trailing_slash=${path%/} ynh_replace_string --match_string="" --replace_string="" --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"