From 41b543e1dac809cd4175231f8b6895b66656977f Mon Sep 17 00:00:00 2001 From: rodinux Date: Fri, 16 Aug 2024 15:28:50 +0200 Subject: [PATCH 01/39] add config_panel.toml file --- config_panel.toml | 303 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 config_panel.toml diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..feb37ec --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,303 @@ +#:schema https://github.com/YunoHost/apps/raw/master/schemas/config_panel.v1.schema.json + +## Config panel are available from webadmin > Apps > YOUR_APP > Config Panel Button +## Those panels let user configure some params on their apps using a friendly interface, +## and remove the need to manually edit files from the command line. + +## From a packager perspective, this .toml is coupled to the scripts/config script, +## which may be used to define custom getters/setters. However, most use cases +## should be covered automagically by the core, thus it may not be necessary +## to define a scripts/config at all! + +## ----------------------------------------------------------------------------- +## IMPORTANT: In accordance with YunoHost's spirit, please keep things simple and +## do not overwhelm the admin with tons of misunderstandable or advanced settings. +## ----------------------------------------------------------------------------- + +## The top level describe the entire config panels screen. + +## The version is a required property. +## Here a small reminder to associate config panel version with YunoHost version +## | Config | YNH | Config panel small change log | +## | ------ | --- | ------------------------------------------------------- | +## | 0.1 | 3.x | 0.1 config script not compatible with YNH >= 4.3 | +## | 1.0 | 4.3.x | The new config panel system with 'bind' property | +version = "1.0" + +## (optional) i18n property let you internationalize questions, however this feature +## is only available in core configuration panel (like yunohost domain config). +## So in app config panel this key is ignored for now, but you can internationalize +## by using a lang dictionary (see property name bellow) +# i18n = "prefix_translation_key" + +################################################################################ +#### ABOUT PANELS +################################################################################ + +## The next level describes web admin panels +## You have to choose an ID for each panel, in this example the ID is "main" +## Keep in mind this ID will be used in CLI to refer to your question, so choose +## something short and meaningfull. +## In the webadmin, each panel corresponds to a distinct tab / form +[main] + +## Define the label for your panel +## Internationalization works similarly to the 'description' and 'ask' questions in the manifest +# name.en = "Main configuration" +# name.fr = "Configuration principale" + +## (optional) If you need to trigger a service reload-or-restart after the user +## change a question in this panel, you can add your service in the list. +services = ["__APP__"] +# or services = ["nginx", "__APP__"] to also reload-or-restart nginx + +## (optional) This help properties is a short help displayed on the same line +## than the panel title but not displayed in the tab. +# help = "" + + ############################################################################ + #### ABOUT SECTIONS + ############################################################################ + + ## A panel is composed of one or several sections. + ## + ## Sections are meant to group questions together when they correspond to + ## a same subtopic. This impacts the rendering in terms of CLI prompts + ## and HTML forms + ## + ## You should choose an ID for your section, and prefix it with the panel ID + ## (Be sure to not make a typo in the panel ID, which would implicitly create + ## an other entire panel) + ## + ## We use the context of pepettes_ynh as an example, + ## which is a simple donation form app written in python, + ## and for which the admin will want to edit the configuration + [main.customization] + + ## (optional) Defining a proper title for sections is not mandatory + ## and depends on the exact rendering you're aiming for the CLI / webadmin + name = "" + + ## (optional) This help properties is a short help displayed on the same line + ## than the section title, meant to provide additional details + # help = "" + + ## (optional) As for panel, you can specify to trigger a service + ## reload-or-restart after the user change a question in this section. + ## This property is added to the panel property, it doesn't deactivate it. + ## So no need to replicate, the service list from panel services property. + # services = [] + + ## (optional) By default all questions are optionals, but you can specify a + ## default behaviour for question in the section + optional = false + + ## (optional) It's also possible with the 'visible' property to only + ## display the section depending on the user's answers to previous questions. + ## + ## Be careful that the 'visible' property should only refer to **previous** questions + ## Hence, it should not make sense to have a "visible" property on the very first section. + ## + ## Also, keep in mind that this feature only works in the webadmin and not in CLI + ## (therefore a user could be prompted in CLI for a question that may not be relevant) + # visible = true + + ######################################################################## + #### ABOUT QUESTIONS + ######################################################################## + + ## A section is compound of one or several questions. + + ## --------------------------------------------------------------------- + ## IMPORTANT: as for panel and section you have to choose an ID, but this + ## one should be unique in all this document, even if the question is in + ## an other panel. + ## --------------------------------------------------------------------- + + ## You can use same questions types and properties than in manifest.yml + ## install part. However, in YNH 4.3, a lot of change has been made to + ## extend availables questions types list. + ## See: TODO DOC LINK + + [main.customization.project_name] + + ## (required) The ask property is equivalent to the ask property in + ## the manifest. However, in config panels, questions are displayed on the + ## left side and therefore have less space to be rendered. Therefore, + ## it is better to use a short question, and use the "help" property to + ## provide additional details if necessary. + ask.en = "Name of the project" + + ## (required) The type property indicates how the question should be + ## displayed, validated and managed. Some types have specific properties. + ## + ## Types available: string, boolean, number, range, text, password, path + ## email, url, date, time, color, select, domain, user, tags, file. + ## + ## For a complete list with specific properties, see: TODO DOC LINK + type = "string" + + ######################################################################## + #### ABOUT THE BIND PROPERTY + ######################################################################## + + ## (recommended) 'bind' property is a powerful feature that let you + ## configure how and where the data will be read, validated and written. + + ## By default, 'bind property is in "settings" mode, it means it will + ## **only** read and write the value in application settings file. + ## bind = "settings" + + ## However, settings usually correspond to key/values in actual app configurations + ## Hence, a more useful mode is to have bind = ":FILENAME". In that case, YunoHost + ## will automagically find a line with "KEY=VALUE" in FILENAME + ## (with the adequate separator between KEY and VALUE) + ## + ## YunoHost will then use this value for the read/get operation. + ## During write/set operations, YunoHost will overwrite the value + ## in **both** FILENAME and in the app's settings.yml + + ## Configuration file format supported: yaml, toml, json, ini, env, php, + ## python. The feature probably works with others formats, but should be tested carefully. + + ## Note that this feature only works with relatively simple cases + ## such as `KEY: VALUE`, but won't properly work with + ## complex data structures like multilin array/lists or dictionnaries. + ## It also doesn't work with XML format, custom config function call, php define(), ... + + ## More info on TODO + # bind = ":/var/www/__APP__/settings.py" + + + ## By default, bind = ":FILENAME" will use the question ID as KEY + ## ... but the question ID may sometime not be the exact KEY name in the configuration file. + ## + ## In particular, in pepettes, the python variable is 'name' and not 'project_name' + ## (c.f. https://github.com/YunoHost-Apps/pepettes_ynh/blob/5cc2d3ffd6529cc7356ff93af92dbb6785c3ab9a/conf/settings.py##L11 ) + ## + ## In that case, the key name can be specified before the column ':' + + bind = "name:/var/www/__APP__/settings.py" + + ## --------------------------------------------------------------------- + ## IMPORTANT: other 'bind' mode exists: + ## + ## bind = "FILENAME" (with no column character before FILENAME) + ## may be used to bind to the **entire file content** (instead of a single KEY/VALUE) + ## This could be used to expose an entire configuration file, or binary files such as images + ## For example: + ## bind = "/var/www/__APP__/img/logo.png" + ## + ## bind = "null" can be used to disable reading / writing in settings. + ## This creates sort of a "virtual" or "ephemeral" question which is not related to any actual setting + ## In this mode, you are expected to define custom getter/setters/validators in scripts/config: + ## + ## getter: get__QUESTIONID() + ## setter: set__QUESTIONID() + ## validator: validate__QUESTIONID() + ## + ## You can also specify a common getter / setter / validator, with the + ## function 'bind' mode, for example here it will try to run + ## get__array_settings() first. + # bind = "array_settings()" + ## --------------------------------------------------------------------- + + ## --------------------------------------------------------------------- + ## IMPORTANT: with the exception of bind=null questions, + ## question IDs should almost **always** correspond to an app setting + ## initialized / reused during install/upgrade. + ## Not doing so may result in inconsistencies between the config panel mechanism + ## and the use of ynh_add_config + ## --------------------------------------------------------------------- + + ######################################################################## + #### OTHER GENERIC PROPERTY FOR QUESTIONS + ######################################################################## + + ## (optional) An help text for the question + help = "Fill the name of the project which will received donation" + + ## (optional) An example display as placeholder in web form + # example = "YunoHost" + + ## (optional) set to true in order to redact the value in operation logs + # redact = false + + ## (optional) for boolean questions you can specify replacement values + ## bound to true and false, in case property is bound to config file + # useful if bound property in config file expects something else than integer 1 + yes = "Enable" + # useful if bound property in config file expects something else than integer 0 + no = "Disable" + + ## (optional) A validation pattern + ## --------------------------------------------------------------------- + ## IMPORTANT: your pattern should be between simple quote, not double. + ## --------------------------------------------------------------------- + pattern.regexp = '^\w{3,30}$' + pattern.error = "The name should be at least 3 chars and less than 30 chars. Alphanumeric chars are accepted" + + ## Note: visible and optional properties are also available for questions + + + [main.customization.contact_url] + ask = "Contact url" + type = "url" + example = "mailto: contact@example.org" + help = "mailto: accepted" + pattern.regexp = '^mailto:[^@]+@[^@]+|https://$' + pattern.error = "Should be https or mailto:" + bind = ":/var/www/__APP__/settings.py" + + [main.customization.logo] + ask = "Logo" + type = "file" + accept = ".png" + help = "Fill with an already resized logo" + bind = "__INSTALL_DIR__/img/logo.png" + + [main.customization.favicon] + ask = "Favicon" + type = "file" + accept = ".png" + help = "Fill with an already sized favicon" + bind = "__INSTALL_DIR__/img/favicon.png" + + + [main.stripe] + name = "Stripe general info" + optional = false + + # The next alert is overwrited with a getter from the config script + [main.stripe.amount] + ask = "Donation in the month : XX € + type = "alert" + style = "success" + + [main.stripe.publishable_key] + ask = "Publishable key" + type = "string" + redact = true + help = "Indicate here the stripe publishable key" + bind = ":/var/www/__APP__/settings.py" + + [main.stripe.secret_key] + ask = "Secret key" + type = "string" + redact = true + help = "Indicate here the stripe secret key" + bind = ":/var/www/__APP__/settings.py" + + [main.stripe.prices] + ask = "Prices ID" + type = "tags" + help = """\ + Indicates here the prices ID of donation products you created in stripe interfaces. \ + Go on [Stripe products](https://dashboard.stripe.com/products) to create those donation products. \ + Fill it tag with 'FREQUENCY/CURRENCY/PRICE_ID' \ + FREQUENCY: 'one_time' or 'recuring' \ + CURRENCY: 'EUR' or 'USD' \ + PRICE_ID: ID from stripe interfaces starting with 'price_' \ + """ + pattern.regexp = '^(one_time|recuring)/(EUR|USD)/price_.*$' + pattern.error = "Please respect the format describe in help text for each price ID" \ No newline at end of file From cd9a763b3761fc67b1a7868de8f697ed1eb16daa Mon Sep 17 00:00:00 2001 From: rodinux Date: Fri, 16 Aug 2024 18:42:03 +0200 Subject: [PATCH 02/39] add install and upgrade --- conf/config.local.php | 14 +- conf/config.local.user.php | 2 +- config_panel.toml | 318 +++++-------------------------------- scripts/install | 8 + scripts/upgrade | 24 +++ 5 files changed, 78 insertions(+), 288 deletions(-) diff --git a/conf/config.local.php b/conf/config.local.php index 44f9db0..dc66944 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -508,7 +508,7 @@ const USE_CRON = true; * Défaut : null */ -//const SMTP_HOST = '__DOMAIN__'; +const SMTP_HOST = '__SMTP_HOST__'; /** * Port du serveur SMTP @@ -519,7 +519,7 @@ const USE_CRON = true; * Défaut : 587 */ -//const SMTP_PORT = 25; +const SMTP_PORT = __SMTP_PORT__; /** * Login utilisateur pour le server SMTP @@ -529,7 +529,7 @@ const USE_CRON = true; * Défaut : null */ -//const SMTP_USER = '__APP__'; +const SMTP_USER = '__SMTP_USER__'; /** * Mot de passe pour le serveur SMTP @@ -539,7 +539,7 @@ const USE_CRON = true; * Défaut : null */ -//const SMTP_PASSWORD = '__MAIL_PWD__'; +const SMTP_PASSWORD = '__SMTP_PASSWORD__'; /** * Sécurité du serveur SMTP @@ -552,7 +552,7 @@ const USE_CRON = true; * Défaut : STARTTLS */ -//const SMTP_SECURITY = 'STARTTLS'; +const SMTP_SECURITY = '__SMTP_SECURITY__'; /** * Nom du serveur utilisé dans le HELO SMTP @@ -584,7 +584,7 @@ const USE_CRON = true; * Défaut : null */ -//const MAIL_RETURN_PATH = '__APP__@__DOMAIN__'; +const MAIL_RETURN_PATH = '__MAIL_RETURN_PATH__'; /** @@ -602,7 +602,7 @@ const USE_CRON = true; * Défaut : null */ -//const MAIL_SENDER = '__APP__@__DOMAIN__'; +const MAIL_SENDER = '__MAIL_SENDER__'; /** * Mot de passe pour l'accès à l'API permettant de gérer les mails d'erreur diff --git a/conf/config.local.user.php b/conf/config.local.user.php index 890c7aa..468d554 100644 --- a/conf/config.local.user.php +++ b/conf/config.local.user.php @@ -75,7 +75,7 @@ const SMTP_SECURITY = 'STARTTLS'; * @var null|string */ -const SMTP_HELO_HOSTNAME = '__DOMAIN__'; +// const SMTP_HELO_HOSTNAME = '__DOMAIN__'; /** * Adresse e-mail destinée à recevoir les erreurs de mail diff --git a/config_panel.toml b/config_panel.toml index feb37ec..3bab3d6 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -1,303 +1,61 @@ -#:schema https://github.com/YunoHost/apps/raw/master/schemas/config_panel.v1.schema.json - -## Config panel are available from webadmin > Apps > YOUR_APP > Config Panel Button -## Those panels let user configure some params on their apps using a friendly interface, -## and remove the need to manually edit files from the command line. - -## From a packager perspective, this .toml is coupled to the scripts/config script, -## which may be used to define custom getters/setters. However, most use cases -## should be covered automagically by the core, thus it may not be necessary -## to define a scripts/config at all! - -## ----------------------------------------------------------------------------- -## IMPORTANT: In accordance with YunoHost's spirit, please keep things simple and -## do not overwhelm the admin with tons of misunderstandable or advanced settings. -## ----------------------------------------------------------------------------- - -## The top level describe the entire config panels screen. - -## The version is a required property. -## Here a small reminder to associate config panel version with YunoHost version -## | Config | YNH | Config panel small change log | -## | ------ | --- | ------------------------------------------------------- | -## | 0.1 | 3.x | 0.1 config script not compatible with YNH >= 4.3 | -## | 1.0 | 4.3.x | The new config panel system with 'bind' property | version = "1.0" -## (optional) i18n property let you internationalize questions, however this feature -## is only available in core configuration panel (like yunohost domain config). -## So in app config panel this key is ignored for now, but you can internationalize -## by using a lang dictionary (see property name bellow) -# i18n = "prefix_translation_key" - ################################################################################ #### ABOUT PANELS ################################################################################ -## The next level describes web admin panels -## You have to choose an ID for each panel, in this example the ID is "main" -## Keep in mind this ID will be used in CLI to refer to your question, so choose -## something short and meaningfull. -## In the webadmin, each panel corresponds to a distinct tab / form [main] -## Define the label for your panel -## Internationalization works similarly to the 'description' and 'ask' questions in the manifest -# name.en = "Main configuration" -# name.fr = "Configuration principale" +name.fr = "Configuration SMTP" -## (optional) If you need to trigger a service reload-or-restart after the user -## change a question in this panel, you can add your service in the list. -services = ["__APP__"] -# or services = ["nginx", "__APP__"] to also reload-or-restart nginx - -## (optional) This help properties is a short help displayed on the same line -## than the panel title but not displayed in the tab. -# help = "" - ############################################################################ #### ABOUT SECTIONS ############################################################################ - ## A panel is composed of one or several sections. - ## - ## Sections are meant to group questions together when they correspond to - ## a same subtopic. This impacts the rendering in terms of CLI prompts - ## and HTML forms - ## - ## You should choose an ID for your section, and prefix it with the panel ID - ## (Be sure to not make a typo in the panel ID, which would implicitly create - ## an other entire panel) - ## - ## We use the context of pepettes_ynh as an example, - ## which is a simple donation form app written in python, - ## and for which the admin will want to edit the configuration - [main.customization] + [main.smtp] - ## (optional) Defining a proper title for sections is not mandatory - ## and depends on the exact rendering you're aiming for the CLI / webadmin name = "" ## (optional) This help properties is a short help displayed on the same line - ## than the section title, meant to provide additional details - # help = "" - - ## (optional) As for panel, you can specify to trigger a service - ## reload-or-restart after the user change a question in this section. - ## This property is added to the panel property, it doesn't deactivate it. - ## So no need to replicate, the service list from panel services property. - # services = [] - - ## (optional) By default all questions are optionals, but you can specify a - ## default behaviour for question in the section - optional = false - - ## (optional) It's also possible with the 'visible' property to only - ## display the section depending on the user's answers to previous questions. - ## - ## Be careful that the 'visible' property should only refer to **previous** questions - ## Hence, it should not make sense to have a "visible" property on the very first section. - ## - ## Also, keep in mind that this feature only works in the webadmin and not in CLI - ## (therefore a user could be prompted in CLI for a question that may not be relevant) - # visible = true - ######################################################################## - #### ABOUT QUESTIONS - ######################################################################## - - ## A section is compound of one or several questions. - - ## --------------------------------------------------------------------- - ## IMPORTANT: as for panel and section you have to choose an ID, but this - ## one should be unique in all this document, even if the question is in - ## an other panel. - ## --------------------------------------------------------------------- - - ## You can use same questions types and properties than in manifest.yml - ## install part. However, in YNH 4.3, a lot of change has been made to - ## extend availables questions types list. - ## See: TODO DOC LINK - - [main.customization.project_name] - - ## (required) The ask property is equivalent to the ask property in - ## the manifest. However, in config panels, questions are displayed on the - ## left side and therefore have less space to be rendered. Therefore, - ## it is better to use a short question, and use the "help" property to - ## provide additional details if necessary. - ask.en = "Name of the project" - - ## (required) The type property indicates how the question should be - ## displayed, validated and managed. Some types have specific properties. - ## - ## Types available: string, boolean, number, range, text, password, path - ## email, url, date, time, color, select, domain, user, tags, file. - ## - ## For a complete list with specific properties, see: TODO DOC LINK - type = "string" - - ######################################################################## - #### ABOUT THE BIND PROPERTY - ######################################################################## - - ## (recommended) 'bind' property is a powerful feature that let you - ## configure how and where the data will be read, validated and written. - - ## By default, 'bind property is in "settings" mode, it means it will - ## **only** read and write the value in application settings file. - ## bind = "settings" - - ## However, settings usually correspond to key/values in actual app configurations - ## Hence, a more useful mode is to have bind = ":FILENAME". In that case, YunoHost - ## will automagically find a line with "KEY=VALUE" in FILENAME - ## (with the adequate separator between KEY and VALUE) - ## - ## YunoHost will then use this value for the read/get operation. - ## During write/set operations, YunoHost will overwrite the value - ## in **both** FILENAME and in the app's settings.yml - - ## Configuration file format supported: yaml, toml, json, ini, env, php, - ## python. The feature probably works with others formats, but should be tested carefully. - - ## Note that this feature only works with relatively simple cases - ## such as `KEY: VALUE`, but won't properly work with - ## complex data structures like multilin array/lists or dictionnaries. - ## It also doesn't work with XML format, custom config function call, php define(), ... - - ## More info on TODO - # bind = ":/var/www/__APP__/settings.py" - - - ## By default, bind = ":FILENAME" will use the question ID as KEY - ## ... but the question ID may sometime not be the exact KEY name in the configuration file. - ## - ## In particular, in pepettes, the python variable is 'name' and not 'project_name' - ## (c.f. https://github.com/YunoHost-Apps/pepettes_ynh/blob/5cc2d3ffd6529cc7356ff93af92dbb6785c3ab9a/conf/settings.py##L11 ) - ## - ## In that case, the key name can be specified before the column ':' - - bind = "name:/var/www/__APP__/settings.py" - - ## --------------------------------------------------------------------- - ## IMPORTANT: other 'bind' mode exists: - ## - ## bind = "FILENAME" (with no column character before FILENAME) - ## may be used to bind to the **entire file content** (instead of a single KEY/VALUE) - ## This could be used to expose an entire configuration file, or binary files such as images - ## For example: - ## bind = "/var/www/__APP__/img/logo.png" - ## - ## bind = "null" can be used to disable reading / writing in settings. - ## This creates sort of a "virtual" or "ephemeral" question which is not related to any actual setting - ## In this mode, you are expected to define custom getter/setters/validators in scripts/config: - ## - ## getter: get__QUESTIONID() - ## setter: set__QUESTIONID() - ## validator: validate__QUESTIONID() - ## - ## You can also specify a common getter / setter / validator, with the - ## function 'bind' mode, for example here it will try to run - ## get__array_settings() first. - # bind = "array_settings()" - ## --------------------------------------------------------------------- - - ## --------------------------------------------------------------------- - ## IMPORTANT: with the exception of bind=null questions, - ## question IDs should almost **always** correspond to an app setting - ## initialized / reused during install/upgrade. - ## Not doing so may result in inconsistencies between the config panel mechanism - ## and the use of ynh_add_config - ## --------------------------------------------------------------------- - - ######################################################################## - #### OTHER GENERIC PROPERTY FOR QUESTIONS - ######################################################################## - - ## (optional) An help text for the question - help = "Fill the name of the project which will received donation" - - ## (optional) An example display as placeholder in web form - # example = "YunoHost" - - ## (optional) set to true in order to redact the value in operation logs - # redact = false - - ## (optional) for boolean questions you can specify replacement values - ## bound to true and false, in case property is bound to config file - # useful if bound property in config file expects something else than integer 1 - yes = "Enable" - # useful if bound property in config file expects something else than integer 0 - no = "Disable" - - ## (optional) A validation pattern - ## --------------------------------------------------------------------- - ## IMPORTANT: your pattern should be between simple quote, not double. - ## --------------------------------------------------------------------- - pattern.regexp = '^\w{3,30}$' - pattern.error = "The name should be at least 3 chars and less than 30 chars. Alphanumeric chars are accepted" - - ## Note: visible and optional properties are also available for questions - - - [main.customization.contact_url] - ask = "Contact url" - type = "url" - example = "mailto: contact@example.org" - help = "mailto: accepted" - pattern.regexp = '^mailto:[^@]+@[^@]+|https://$' - pattern.error = "Should be https or mailto:" - bind = ":/var/www/__APP__/settings.py" - - [main.customization.logo] - ask = "Logo" - type = "file" - accept = ".png" - help = "Fill with an already resized logo" - bind = "__INSTALL_DIR__/img/logo.png" - - [main.customization.favicon] - ask = "Favicon" - type = "file" - accept = ".png" - help = "Fill with an already sized favicon" - bind = "__INSTALL_DIR__/img/favicon.png" - - - [main.stripe] - name = "Stripe general info" optional = false - # The next alert is overwrited with a getter from the config script - [main.stripe.amount] - ask = "Donation in the month : XX € - type = "alert" - style = "success" - - [main.stripe.publishable_key] - ask = "Publishable key" + [main.smtp.smtp_host] + ask = "Host" type = "string" - redact = true - help = "Indicate here the stripe publishable key" - bind = ":/var/www/__APP__/settings.py" + bind = "SMTP_HOST:__INSTALL_DIR__/config.local.php" - [main.stripe.secret_key] - ask = "Secret key" + [main.smtp.smtp_port] + ask = "Port" + min = 25 + type = "number" + bind = "SMTP_PORT:__INSTALL_DIR__/config.local.php" + + [main.smtp.smtp_user] + ask = "User" type = "string" - redact = true - help = "Indicate here the stripe secret key" - bind = ":/var/www/__APP__/settings.py" - - [main.stripe.prices] - ask = "Prices ID" - type = "tags" - help = """\ - Indicates here the prices ID of donation products you created in stripe interfaces. \ - Go on [Stripe products](https://dashboard.stripe.com/products) to create those donation products. \ - Fill it tag with 'FREQUENCY/CURRENCY/PRICE_ID' \ - FREQUENCY: 'one_time' or 'recuring' \ - CURRENCY: 'EUR' or 'USD' \ - PRICE_ID: ID from stripe interfaces starting with 'price_' \ - """ - pattern.regexp = '^(one_time|recuring)/(EUR|USD)/price_.*$' - pattern.error = "Please respect the format describe in help text for each price ID" \ No newline at end of file + bind = "SMTP_USER:__INSTALL_DIR__/config.local.php" + + [main.smtp.smtp_password] + ask = "Password" + type = "password" + bind = "SMTP_PASSWORD:__INSTALL_DIR__/config.local.php" + + [main.smtp.smtp_security] + ask = "Security" + type = "string" + choices.NONE = "NONE, pas de chiffrement" + choices.SSL = "SSL, connexion SSL native" + choices.TLS = "TLS, connexion TLS native (le plus sécurisé)" + choices.STARTTLS = SARTTLS, utilisation de STARTTLS (moyennement sécurisé)" + bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php" + + [main.smtp.mail_return_path] + ask = "Adresse e-mail destinée à recevoir les erreurs de mail, si renseigné, cette adresse sera utilisée également comme "MAIL FROM" lors de la session avec le serveur SMTP." + type = "string" + bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php" + + [main.smtp.mail_sender] + ask = "Adresse e-mail expéditrice des messages" + type = "string" + bind = "MAIL_SENDER:__INSTALL_DIR__/config.local.php" diff --git a/scripts/install b/scripts/install index 6820f82..e2ed0da 100644 --- a/scripts/install +++ b/scripts/install @@ -12,6 +12,14 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key +ynh_app_setting_set --app=$app --key=smtp_host --value=$domain +ynh_app_setting_set --app=$app --key=smtp_port --value=25 +ynh_app_setting_set --app=$app --key=smtp_user --value=$app +ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd +ynh_app_setting_set --app=$app --key=smtp_secutrity --value=STARTTLS +ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain +ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 7535325..c253736 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,6 +29,28 @@ if [ -z "${secret_key:-}" ]; then ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key fi +if [ -z "${smtp_host:-}" ]; then + user_conf = "$data_dir/data/config.local.user.php" + if [ -f $user_conf ]; then + smtp_host=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_HOST) + else + smtp_host=$domain + smtp_port=25 + smtp_user=$app + smtp_password=$mail_pwd + smtp_secutrity=STARTTLS + mail_return_path=$app@$domain + mail_sender=$app@$domain + fi + ynh_app_setting_set --app=$app --key=smtp_host --value=$smtp_host + ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port + ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user + ynh_app_setting_set --app=$app --key=smtp_password --value=$smtp_password + ynh_app_setting_set --app=$app --key=smtp_secutrity --value=$smtp_secutrity + ynh_app_setting_set --app=$app --key=mail_return_path --value=$mail_return_path + ynh_app_setting_set --app=$app --key=mail_sender --value=$mail_sender +fi + #================================================= # KEEP CONFIGS IF NEEDED #================================================= @@ -133,6 +155,8 @@ if [ ! -f "$data_dir/data/config.local.user.php" ]; then chown $app:$app "$data_dir/data/config.local.user.php" fi + + if [ ! -d "$data_dir/data/local_addresses" ]; then ynh_script_progression --message="Adding a configuration directory..." --weight=5 mkdir "$data_dir/data/local_addresses" From f75c7571ffdd51637548f95f7e8c818b4b3f19dc Mon Sep 17 00:00:00 2001 From: rodinux Date: Fri, 16 Aug 2024 19:08:20 +0200 Subject: [PATCH 03/39] syntax upgrade --- scripts/upgrade | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index c253736..7bfa620 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,7 +30,7 @@ if [ -z "${secret_key:-}" ]; then fi if [ -z "${smtp_host:-}" ]; then - user_conf = "$data_dir/data/config.local.user.php" + user_conf="$data_dir/data/config.local.user.php" if [ -f $user_conf ]; then smtp_host=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_HOST) else @@ -155,8 +155,6 @@ if [ ! -f "$data_dir/data/config.local.user.php" ]; then chown $app:$app "$data_dir/data/config.local.user.php" fi - - if [ ! -d "$data_dir/data/local_addresses" ]; then ynh_script_progression --message="Adding a configuration directory..." --weight=5 mkdir "$data_dir/data/local_addresses" @@ -167,7 +165,6 @@ else chown $app:www-data "$data_dir/data/local_addresses" fi - if [ -f "$install_dir/data/association.sqlite" ]; then ynh_script_progression --message="Moving db files..." --weight=5 mv $install_dir/data/association.* $data_dir/data/ From c08149a12ec3eedb56f45af45df171b91e9b2e2e Mon Sep 17 00:00:00 2001 From: rodinux Date: Fri, 16 Aug 2024 19:10:51 +0200 Subject: [PATCH 04/39] syntax error --- scripts/install | 2 +- scripts/upgrade | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index e2ed0da..2dd438d 100644 --- a/scripts/install +++ b/scripts/install @@ -16,7 +16,7 @@ ynh_app_setting_set --app=$app --key=smtp_host --value=$domain ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd -ynh_app_setting_set --app=$app --key=smtp_secutrity --value=STARTTLS +ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain diff --git a/scripts/upgrade b/scripts/upgrade index 7bfa620..c6db790 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,7 +38,7 @@ if [ -z "${smtp_host:-}" ]; then smtp_port=25 smtp_user=$app smtp_password=$mail_pwd - smtp_secutrity=STARTTLS + smtp_security=STARTTLS mail_return_path=$app@$domain mail_sender=$app@$domain fi @@ -46,7 +46,7 @@ if [ -z "${smtp_host:-}" ]; then ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user ynh_app_setting_set --app=$app --key=smtp_password --value=$smtp_password - ynh_app_setting_set --app=$app --key=smtp_secutrity --value=$smtp_secutrity + ynh_app_setting_set --app=$app --key=smtp_security --value=$smtp_security ynh_app_setting_set --app=$app --key=mail_return_path --value=$mail_return_path ynh_app_setting_set --app=$app --key=mail_sender --value=$mail_sender fi From 6d244a9aa0905ebf5c6bf41eef0fa8920727ec45 Mon Sep 17 00:00:00 2001 From: rodinux Date: Fri, 16 Aug 2024 19:32:36 +0200 Subject: [PATCH 05/39] correct values cleaning config.local.user --- conf/config.local.user.php | 102 ------------------------------------- scripts/upgrade | 8 +++ 2 files changed, 8 insertions(+), 102 deletions(-) diff --git a/conf/config.local.user.php b/conf/config.local.user.php index 468d554..877d546 100644 --- a/conf/config.local.user.php +++ b/conf/config.local.user.php @@ -11,106 +11,4 @@ // Nécessaire pour situer les constantes dans le bon namespace namespace Paheko; -/** - * Hôte du serveur SMTP, mettre à false (défaut) pour utiliser la fonction - * mail() de PHP - * - * Défaut : null - */ - -const SMTP_HOST = '__DOMAIN__'; - -/** - * Port du serveur SMTP - * - * 25 = port standard pour connexion non chiffrée (465 pour Gmail) - * 587 = port standard pour connexion SSL - * - * Défaut : 587 - */ - -const SMTP_PORT = 25; - -/** - * Login utilisateur pour le server SMTP - * - * mettre à null pour utiliser un serveur local ou anonyme - * - * Défaut : null - */ - -const SMTP_USER = '__APP__'; - -/** - * Mot de passe pour le serveur SMTP - * - * mettre à null pour utiliser un serveur local ou anonyme - * - * Défaut : null - */ - -const SMTP_PASSWORD = '__MAIL_PWD__'; - -/** - * Sécurité du serveur SMTP - * - * NONE = pas de chiffrement - * SSL = connexion SSL native - * TLS = connexion TLS native (le plus sécurisé) - * STARTTLS = utilisation de STARTTLS (moyennement sécurisé) - * - * Défaut : STARTTLS - */ - -const SMTP_SECURITY = 'STARTTLS'; - -/** - * Nom du serveur utilisé dans le HELO SMTP - * - * Si NULL, alors le nom renseigné comme SERVER_NAME (premier nom du virtual host Apache) - * sera utilisé. - * - * Defaut : NULL - * - * @var null|string - */ - -// const SMTP_HELO_HOSTNAME = '__DOMAIN__'; - -/** - * Adresse e-mail destinée à recevoir les erreurs de mail - * (adresses invalides etc.) — Return-Path / MAIL FROM - * - * Si laissé NULL, alors l'adresse e-mail de l'association sera utilisée. - * En cas d'hébergement de plusieurs associations, il est conseillé - * d'utiliser une adresse par association. - * - * Voir la documentation de configuration sur des exemples de scripts - * permettant de traiter les mails reçus à cette adresse. - * - * Si renseigné, cette adresse sera utilisée également comme "MAIL FROM" - * lors de la session avec le serveur SMTP. - * - * Défaut : null - */ - -const MAIL_RETURN_PATH = '__APP__@__DOMAIN__'; - - -/** - * Adresse e-mail expéditrice des messages (Sender) - * - * Si vous envoyez des mails pour plusieurs associations, il est souhaitable - * de forcer l'adresse d'expéditeur des messages pour passer les règles SPF et DKIM. - * - * Dans ce cas l'adresse de l'association sera indiquée en "Reply-To", et - * l'adresse contenue dans MAIL_SENDER sera dans le From. - * - * Si laissé NULL, c'est l'adresse de l'association indiquée dans la configuration - * qui sera utilisée. - * - * Défaut : null - */ - -const MAIL_SENDER = '__APP__@__DOMAIN__'; diff --git a/scripts/upgrade b/scripts/upgrade index c6db790..e8b1511 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,6 +33,14 @@ if [ -z "${smtp_host:-}" ]; then user_conf="$data_dir/data/config.local.user.php" if [ -f $user_conf ]; then smtp_host=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_HOST) + smtp_port=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PORT) + smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER) + smtp_password=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PASSWORD) + smtp_security=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SECURITY) + mail_return_path=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_RETURN_PATH) + mail_sender=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SENDER) + sed -i s@const SMTP_@//const SMTP_/@g $user_conf + sed -i s@const MAIL_@//const MAIL_/@g $user_conf else smtp_host=$domain smtp_port=25 From 1044239437ea942f567b721b51ed021e6e97fc1c Mon Sep 17 00:00:00 2001 From: rodinux Date: Fri, 16 Aug 2024 19:37:11 +0200 Subject: [PATCH 06/39] synntax sed --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e8b1511..2490c80 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,8 +39,8 @@ if [ -z "${smtp_host:-}" ]; then smtp_security=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SECURITY) mail_return_path=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_RETURN_PATH) mail_sender=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SENDER) - sed -i s@const SMTP_@//const SMTP_/@g $user_conf - sed -i s@const MAIL_@//const MAIL_/@g $user_conf + sed -i "s@const SMTP_@//const SMTP_/@g" $user_conf + sed -i "s@const MAIL_@//const MAIL_/@g" $user_conf else smtp_host=$domain smtp_port=25 From 53feed73f65adde825c045f3302678598725d952 Mon Sep 17 00:00:00 2001 From: rodinux Date: Fri, 16 Aug 2024 20:05:17 +0200 Subject: [PATCH 07/39] try repalce vs sed --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2490c80..b383b6b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,8 +39,8 @@ if [ -z "${smtp_host:-}" ]; then smtp_security=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SECURITY) mail_return_path=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_RETURN_PATH) mail_sender=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SENDER) - sed -i "s@const SMTP_@//const SMTP_/@g" $user_conf - sed -i "s@const MAIL_@//const MAIL_/@g" $user_conf + ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf + ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else smtp_host=$domain smtp_port=25 From f43f587576afc03f66dfcd44115d66202abe08ce Mon Sep 17 00:00:00 2001 From: rodinux Date: Fri, 16 Aug 2024 23:12:49 +0200 Subject: [PATCH 08/39] try debug YN_NULL --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index b383b6b..c40a6c3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,7 +38,7 @@ if [ -z "${smtp_host:-}" ]; then smtp_password=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PASSWORD) smtp_security=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SECURITY) mail_return_path=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_RETURN_PATH) - mail_sender=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SENDER) + mail_sender=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_SENDER) ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else From 81119932545d4604c6c3c727aeea96853f7ace09 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sat, 17 Aug 2024 00:10:40 +0200 Subject: [PATCH 09/39] quote ahhha --- config_panel.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_panel.toml b/config_panel.toml index 3bab3d6..978c3ea 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -47,7 +47,7 @@ name.fr = "Configuration SMTP" choices.NONE = "NONE, pas de chiffrement" choices.SSL = "SSL, connexion SSL native" choices.TLS = "TLS, connexion TLS native (le plus sécurisé)" - choices.STARTTLS = SARTTLS, utilisation de STARTTLS (moyennement sécurisé)" + choices.STARTTLS = "STARTTLS, utilisation de STARTTLS (moyennement sécurisé)" bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php" [main.smtp.mail_return_path] From a5200eb49f19af07f861b0e76f781a2b9184d763 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sat, 17 Aug 2024 00:13:29 +0200 Subject: [PATCH 10/39] quote ahhha akka --- config_panel.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_panel.toml b/config_panel.toml index 978c3ea..fa89e91 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -51,7 +51,7 @@ name.fr = "Configuration SMTP" bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php" [main.smtp.mail_return_path] - ask = "Adresse e-mail destinée à recevoir les erreurs de mail, si renseigné, cette adresse sera utilisée également comme "MAIL FROM" lors de la session avec le serveur SMTP." + ask = "Adresse e-mail destinée à recevoir les erreurs de mail, si renseigné, cette adresse sera utilisée également comme MAIL FROM lors de la session avec le serveur SMTP" type = "string" bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php" From 2a72438e846e78e8dea91c8982bfdfa24bed26f1 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sat, 17 Aug 2024 00:15:52 +0200 Subject: [PATCH 11/39] quote ahhha akka --- config_panel.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_panel.toml b/config_panel.toml index fa89e91..ee04d66 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -51,7 +51,7 @@ name.fr = "Configuration SMTP" bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php" [main.smtp.mail_return_path] - ask = "Adresse e-mail destinée à recevoir les erreurs de mail, si renseigné, cette adresse sera utilisée également comme MAIL FROM lors de la session avec le serveur SMTP" + ask = "Adresse e-mail destinée à recevoir les erreurs de mail" type = "string" bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php" From f6d58358efa7f45f4a278d203833dc2221c9d24e Mon Sep 17 00:00:00 2001 From: rodinux Date: Sat, 17 Aug 2024 17:51:35 +0200 Subject: [PATCH 12/39] add in config panel avalaibity to disable emails --- conf/config.local.php | 2 +- config_panel.toml | 19 ++++++++++++------- scripts/install | 1 + scripts/upgrade | 3 +++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/conf/config.local.php b/conf/config.local.php index dc66944..141b25b 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -498,7 +498,7 @@ const USE_CRON = true; * @var bool */ -//const DISABLE_EMAIL = false; +const DISABLE_EMAIL = __DISABLE_EMAIL__; /** diff --git a/config_panel.toml b/config_panel.toml index ee04d66..95b839f 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -20,29 +20,34 @@ name.fr = "Configuration SMTP" optional = false + [main.smtp.disable_email] + ask.fr = "Désactiver l'envoi des mails (non par défaut)" + type = "boolean" + bind = "DISABLE_EMAIL:__INSTALL_DIR__/config.local.php" + [main.smtp.smtp_host] - ask = "Host" + ask.fr = "Serveur SMTP" type = "string" bind = "SMTP_HOST:__INSTALL_DIR__/config.local.php" [main.smtp.smtp_port] - ask = "Port" + ask.fr = "Port" min = 25 type = "number" bind = "SMTP_PORT:__INSTALL_DIR__/config.local.php" [main.smtp.smtp_user] - ask = "User" + ask.fr = "Nom d'utilisateur" type = "string" bind = "SMTP_USER:__INSTALL_DIR__/config.local.php" [main.smtp.smtp_password] - ask = "Password" + ask.fr = "Mot de passe" type = "password" bind = "SMTP_PASSWORD:__INSTALL_DIR__/config.local.php" [main.smtp.smtp_security] - ask = "Security" + ask.fr = "Sécurité de la connexion" type = "string" choices.NONE = "NONE, pas de chiffrement" choices.SSL = "SSL, connexion SSL native" @@ -51,11 +56,11 @@ name.fr = "Configuration SMTP" bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php" [main.smtp.mail_return_path] - ask = "Adresse e-mail destinée à recevoir les erreurs de mail" + ask.fr = "Adresse e-mail destinée à recevoir les erreurs de mail" type = "string" bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php" [main.smtp.mail_sender] - ask = "Adresse e-mail expéditrice des messages" + ask.fr = "Adresse e-mail expéditrice des messages" type = "string" bind = "MAIL_SENDER:__INSTALL_DIR__/config.local.php" diff --git a/scripts/install b/scripts/install index 2dd438d..7ff9024 100644 --- a/scripts/install +++ b/scripts/install @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key +ynh_app_setting_set --app=$app --key=smtp_disable_email --value=0 ynh_app_setting_set --app=$app --key=smtp_host --value=$domain ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app diff --git a/scripts/upgrade b/scripts/upgrade index c40a6c3..54c25ce 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,6 +32,7 @@ fi if [ -z "${smtp_host:-}" ]; then user_conf="$data_dir/data/config.local.user.php" if [ -f $user_conf ]; then + disable_email=$(ynh_read_var_in_file --file=$user_conf --key=DISABLE_EMAIL) smtp_host=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_HOST) smtp_port=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PORT) smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER) @@ -42,6 +43,7 @@ if [ -z "${smtp_host:-}" ]; then ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else + disable_email=0 smtp_host=$domain smtp_port=25 smtp_user=$app @@ -50,6 +52,7 @@ if [ -z "${smtp_host:-}" ]; then mail_return_path=$app@$domain mail_sender=$app@$domain fi + ynh_app_setting_set --app=$app --key=disable_email --value=$disable_email ynh_app_setting_set --app=$app --key=smtp_host --value=$smtp_host ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user From 1cb2f561f73b4e9a244068c6e15498c040fbe8a9 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sat, 17 Aug 2024 18:04:09 +0200 Subject: [PATCH 13/39] add in config panel avalaibity to disable emails bug boolean --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 7ff9024..3a781f1 100644 --- a/scripts/install +++ b/scripts/install @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key -ynh_app_setting_set --app=$app --key=smtp_disable_email --value=0 +ynh_app_setting_set --app=$app --key=smtp_disable_email --value=true ynh_app_setting_set --app=$app --key=smtp_host --value=$domain ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app diff --git a/scripts/upgrade b/scripts/upgrade index 54c25ce..06fed7d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,7 +43,7 @@ if [ -z "${smtp_host:-}" ]; then ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else - disable_email=0 + disable_email=true smtp_host=$domain smtp_port=25 smtp_user=$app From 37c8a7118b21af7c8d5ae31269968b3c81b2458e Mon Sep 17 00:00:00 2001 From: rodinux Date: Sat, 17 Aug 2024 18:08:41 +0200 Subject: [PATCH 14/39] add in config panel avalaibity to disable emails bug boolean --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 3a781f1..0627ab9 100644 --- a/scripts/install +++ b/scripts/install @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key -ynh_app_setting_set --app=$app --key=smtp_disable_email --value=true +ynh_app_setting_set --app=$app --key=smtp_disable_email --value=no ynh_app_setting_set --app=$app --key=smtp_host --value=$domain ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app diff --git a/scripts/upgrade b/scripts/upgrade index 06fed7d..965b543 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,7 +43,7 @@ if [ -z "${smtp_host:-}" ]; then ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else - disable_email=true + disable_email=no smtp_host=$domain smtp_port=25 smtp_user=$app From 344fe4a8b42535183409b1c44c01997e3f2702ef Mon Sep 17 00:00:00 2001 From: rodinux Date: Sat, 17 Aug 2024 18:13:32 +0200 Subject: [PATCH 15/39] add in config panel avalaibity to disable emails bug boolean --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 0627ab9..7ff9024 100644 --- a/scripts/install +++ b/scripts/install @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key -ynh_app_setting_set --app=$app --key=smtp_disable_email --value=no +ynh_app_setting_set --app=$app --key=smtp_disable_email --value=0 ynh_app_setting_set --app=$app --key=smtp_host --value=$domain ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app diff --git a/scripts/upgrade b/scripts/upgrade index 965b543..54c25ce 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,7 +43,7 @@ if [ -z "${smtp_host:-}" ]; then ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else - disable_email=no + disable_email=0 smtp_host=$domain smtp_port=25 smtp_user=$app From 93613d8864c8d01d0ecf07f014bf7c5d9eb6b89a Mon Sep 17 00:00:00 2001 From: rodinux Date: Sat, 17 Aug 2024 18:18:32 +0200 Subject: [PATCH 16/39] add in config panel avalaibity to disable emails bug boolean --- config_panel.toml | 4 +++- scripts/install | 2 +- scripts/upgrade | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 95b839f..4c06926 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -22,7 +22,9 @@ name.fr = "Configuration SMTP" [main.smtp.disable_email] ask.fr = "Désactiver l'envoi des mails (non par défaut)" - type = "boolean" + type = "string" + choices.false = "faux par défaut" + choices.true = "vrai, désactive l'envoi des mails" bind = "DISABLE_EMAIL:__INSTALL_DIR__/config.local.php" [main.smtp.smtp_host] diff --git a/scripts/install b/scripts/install index 7ff9024..d440571 100644 --- a/scripts/install +++ b/scripts/install @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key -ynh_app_setting_set --app=$app --key=smtp_disable_email --value=0 +ynh_app_setting_set --app=$app --key=smtp_disable_email --value=false ynh_app_setting_set --app=$app --key=smtp_host --value=$domain ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app diff --git a/scripts/upgrade b/scripts/upgrade index 54c25ce..48e8809 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,7 +43,7 @@ if [ -z "${smtp_host:-}" ]; then ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else - disable_email=0 + disable_email=false smtp_host=$domain smtp_port=25 smtp_user=$app From 1f96808ed720af3ff7081a59718d64ff1b9759dd Mon Sep 17 00:00:00 2001 From: rodinux Date: Sat, 17 Aug 2024 18:28:42 +0200 Subject: [PATCH 17/39] add in config panel avalaibity to disable emails bug boolean --- config_panel.toml | 4 +--- scripts/install | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 4c06926..95b839f 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -22,9 +22,7 @@ name.fr = "Configuration SMTP" [main.smtp.disable_email] ask.fr = "Désactiver l'envoi des mails (non par défaut)" - type = "string" - choices.false = "faux par défaut" - choices.true = "vrai, désactive l'envoi des mails" + type = "boolean" bind = "DISABLE_EMAIL:__INSTALL_DIR__/config.local.php" [main.smtp.smtp_host] diff --git a/scripts/install b/scripts/install index d440571..7ff9024 100644 --- a/scripts/install +++ b/scripts/install @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key -ynh_app_setting_set --app=$app --key=smtp_disable_email --value=false +ynh_app_setting_set --app=$app --key=smtp_disable_email --value=0 ynh_app_setting_set --app=$app --key=smtp_host --value=$domain ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app diff --git a/scripts/upgrade b/scripts/upgrade index 48e8809..54c25ce 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,7 +43,7 @@ if [ -z "${smtp_host:-}" ]; then ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else - disable_email=false + disable_email=0 smtp_host=$domain smtp_port=25 smtp_user=$app From 8cd924cb15532adaeddd49fed1df8c15824df6d2 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sat, 17 Aug 2024 18:36:00 +0200 Subject: [PATCH 18/39] forget the fonction disable email for now in config panel --- config_panel.toml | 5 ----- scripts/install | 1 - scripts/upgrade | 3 --- 3 files changed, 9 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 95b839f..4cc6df1 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -20,11 +20,6 @@ name.fr = "Configuration SMTP" optional = false - [main.smtp.disable_email] - ask.fr = "Désactiver l'envoi des mails (non par défaut)" - type = "boolean" - bind = "DISABLE_EMAIL:__INSTALL_DIR__/config.local.php" - [main.smtp.smtp_host] ask.fr = "Serveur SMTP" type = "string" diff --git a/scripts/install b/scripts/install index 7ff9024..2dd438d 100644 --- a/scripts/install +++ b/scripts/install @@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key -ynh_app_setting_set --app=$app --key=smtp_disable_email --value=0 ynh_app_setting_set --app=$app --key=smtp_host --value=$domain ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app diff --git a/scripts/upgrade b/scripts/upgrade index 54c25ce..c40a6c3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,7 +32,6 @@ fi if [ -z "${smtp_host:-}" ]; then user_conf="$data_dir/data/config.local.user.php" if [ -f $user_conf ]; then - disable_email=$(ynh_read_var_in_file --file=$user_conf --key=DISABLE_EMAIL) smtp_host=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_HOST) smtp_port=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PORT) smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER) @@ -43,7 +42,6 @@ if [ -z "${smtp_host:-}" ]; then ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else - disable_email=0 smtp_host=$domain smtp_port=25 smtp_user=$app @@ -52,7 +50,6 @@ if [ -z "${smtp_host:-}" ]; then mail_return_path=$app@$domain mail_sender=$app@$domain fi - ynh_app_setting_set --app=$app --key=disable_email --value=$disable_email ynh_app_setting_set --app=$app --key=smtp_host --value=$smtp_host ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user From 250a7f2a3c136dc1fe0428bc28ea45c8d5e5ed51 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 02:18:32 +0200 Subject: [PATCH 19/39] forget the fonction disable email for now in config panel --- conf/config.local.php | 3 +-- doc/ynh_local_curl-install-paheko | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 doc/ynh_local_curl-install-paheko diff --git a/conf/config.local.php b/conf/config.local.php index 141b25b..f629a52 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -498,8 +498,7 @@ const USE_CRON = true; * @var bool */ -const DISABLE_EMAIL = __DISABLE_EMAIL__; - +//const DISABLE_EMAIL = false; /** * Hôte du serveur SMTP, mettre à null (défaut) pour utiliser la fonction diff --git a/doc/ynh_local_curl-install-paheko b/doc/ynh_local_curl-install-paheko new file mode 100644 index 0000000..b6b70e2 --- /dev/null +++ b/doc/ynh_local_curl-install-paheko @@ -0,0 +1 @@ +ynh_local_curl https://paheko.rodinux.fr/admin/install.php --args="country=FR&name=toto&user_name=bob&user_email=bob@example.org&password=bopbidibopbopbop&password_confirmed=bopbidibopbopbop" \ No newline at end of file From cdefe7df0e2fd6a9af95a6d24d50111702351451 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 02:26:51 +0200 Subject: [PATCH 20/39] forget the fonction disable email for now in config panel --- scripts/install | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/install b/scripts/install index 2dd438d..32e3e24 100644 --- a/scripts/install +++ b/scripts/install @@ -59,6 +59,19 @@ ynh_add_config --template="config.local.php" --destination="$install_dir/config. chmod 440 "$install_dir/config.local.php" chown $app:$app "$install_dir/config.local.php" +#================================================= +# SETUP APPLICATION WITH CURL +#================================================= + +### Use these lines only if the app installation needs to be finalized through +### web forms. We generally don't want to ask the final user, +### so we're going to use curl to automatically fill the fields and submit the +### forms. + +# Installation with curl +#ynh_script_progression --message="Finalizing installation..." --weight=1 +#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" +#https://paheko.rodinux.fr/admin/install.php --args="country=FR&name=toto&user_name=bob&user_email=bob@example.org&password=bopbidibopbopbop&password_confirmed=bopbidibopbopbop" #================================================= # END OF SCRIPT #================================================= From e8581617a5f72c2aff13bcb29745933c48ae5d6a Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 02:34:02 +0200 Subject: [PATCH 21/39] syntax --- scripts/install | 4 ++-- scripts/upgrade | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 32e3e24..e1c89ad 100644 --- a/scripts/install +++ b/scripts/install @@ -17,8 +17,8 @@ ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS -ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain -ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain +ynh_app_setting_set --app=$app --key=smtp_mail_return_path --value=$app@$domain +ynh_app_setting_set --app=$app --key=smtp_mail_sender --value=$app@$domain #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/upgrade b/scripts/upgrade index c40a6c3..677f190 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,8 +55,8 @@ if [ -z "${smtp_host:-}" ]; then ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user ynh_app_setting_set --app=$app --key=smtp_password --value=$smtp_password ynh_app_setting_set --app=$app --key=smtp_security --value=$smtp_security - ynh_app_setting_set --app=$app --key=mail_return_path --value=$mail_return_path - ynh_app_setting_set --app=$app --key=mail_sender --value=$mail_sender + ynh_app_setting_set --app=$app --key=smtp_mail_return_path --value=$mail_return_path + ynh_app_setting_set --app=$app --key=smtp_mail_sender --value=$mail_sender fi #================================================= From 717a065ca199e4fd20d4ae938b9bb75f1412e5a3 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 12:32:50 +0200 Subject: [PATCH 22/39] debug values --- scripts/install | 4 ++-- scripts/upgrade | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index e1c89ad..32e3e24 100644 --- a/scripts/install +++ b/scripts/install @@ -17,8 +17,8 @@ ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS -ynh_app_setting_set --app=$app --key=smtp_mail_return_path --value=$app@$domain -ynh_app_setting_set --app=$app --key=smtp_mail_sender --value=$app@$domain +ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain +ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/upgrade b/scripts/upgrade index 677f190..c40a6c3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,8 +55,8 @@ if [ -z "${smtp_host:-}" ]; then ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user ynh_app_setting_set --app=$app --key=smtp_password --value=$smtp_password ynh_app_setting_set --app=$app --key=smtp_security --value=$smtp_security - ynh_app_setting_set --app=$app --key=smtp_mail_return_path --value=$mail_return_path - ynh_app_setting_set --app=$app --key=smtp_mail_sender --value=$mail_sender + ynh_app_setting_set --app=$app --key=mail_return_path --value=$mail_return_path + ynh_app_setting_set --app=$app --key=mail_sender --value=$mail_sender fi #================================================= From 72bbaa33b440c4263ac4a8f83e419c37d5b0b97a Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 13:43:54 +0200 Subject: [PATCH 23/39] remove mail_return_path in config panel --- conf/config.local.php | 2 +- scripts/install | 1 - scripts/upgrade | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/conf/config.local.php b/conf/config.local.php index f629a52..3dd05e8 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -583,7 +583,7 @@ const SMTP_SECURITY = '__SMTP_SECURITY__'; * Défaut : null */ -const MAIL_RETURN_PATH = '__MAIL_RETURN_PATH__'; +//const MAIL_RETURN_PATH = '__MAIL_RETURN_PATH__'; /** diff --git a/scripts/install b/scripts/install index 32e3e24..7cbaeb6 100644 --- a/scripts/install +++ b/scripts/install @@ -17,7 +17,6 @@ ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS -ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c40a6c3..75714b5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,7 +37,6 @@ if [ -z "${smtp_host:-}" ]; then smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER) smtp_password=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PASSWORD) smtp_security=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SECURITY) - mail_return_path=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_RETURN_PATH) mail_sender=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_SENDER) ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf @@ -55,7 +54,6 @@ if [ -z "${smtp_host:-}" ]; then ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user ynh_app_setting_set --app=$app --key=smtp_password --value=$smtp_password ynh_app_setting_set --app=$app --key=smtp_security --value=$smtp_security - ynh_app_setting_set --app=$app --key=mail_return_path --value=$mail_return_path ynh_app_setting_set --app=$app --key=mail_sender --value=$mail_sender fi From 957cb435d7dcc3caf815a0e5e136b4e845635de3 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 13:46:57 +0200 Subject: [PATCH 24/39] remove mail_return_path in config panel --- config_panel.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 4cc6df1..0225bb7 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -50,11 +50,6 @@ name.fr = "Configuration SMTP" choices.STARTTLS = "STARTTLS, utilisation de STARTTLS (moyennement sécurisé)" bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php" - [main.smtp.mail_return_path] - ask.fr = "Adresse e-mail destinée à recevoir les erreurs de mail" - type = "string" - bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php" - [main.smtp.mail_sender] ask.fr = "Adresse e-mail expéditrice des messages" type = "string" From 522195d2774792e317b169bc0ebeb02753e26cde Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 15:01:26 +0200 Subject: [PATCH 25/39] debug values --- conf/config.local.php | 2 +- scripts/install | 1 + scripts/upgrade | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/conf/config.local.php b/conf/config.local.php index 3dd05e8..f629a52 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -583,7 +583,7 @@ const SMTP_SECURITY = '__SMTP_SECURITY__'; * Défaut : null */ -//const MAIL_RETURN_PATH = '__MAIL_RETURN_PATH__'; +const MAIL_RETURN_PATH = '__MAIL_RETURN_PATH__'; /** diff --git a/scripts/install b/scripts/install index 7cbaeb6..32e3e24 100644 --- a/scripts/install +++ b/scripts/install @@ -17,6 +17,7 @@ ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS +ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 75714b5..c40a6c3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,6 +37,7 @@ if [ -z "${smtp_host:-}" ]; then smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER) smtp_password=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PASSWORD) smtp_security=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SECURITY) + mail_return_path=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_RETURN_PATH) mail_sender=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_SENDER) ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf @@ -54,6 +55,7 @@ if [ -z "${smtp_host:-}" ]; then ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user ynh_app_setting_set --app=$app --key=smtp_password --value=$smtp_password ynh_app_setting_set --app=$app --key=smtp_security --value=$smtp_security + ynh_app_setting_set --app=$app --key=mail_return_path --value=$mail_return_path ynh_app_setting_set --app=$app --key=mail_sender --value=$mail_sender fi From bf1f704014e9059798b7443974b04bd1c7a2fb55 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 15:07:55 +0200 Subject: [PATCH 26/39] debug values --- config_panel.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config_panel.toml b/config_panel.toml index 0225bb7..cc56fb7 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -54,3 +54,8 @@ name.fr = "Configuration SMTP" ask.fr = "Adresse e-mail expéditrice des messages" type = "string" bind = "MAIL_SENDER:__INSTALL_DIR__/config.local.php" + + [main.smtp.mail_return_path] + ask.fr = "Adresse e-mail destinée à recevoir les erreurs de mail" + type = "string" + bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php" From c84a856fd0b91825372eb5bc8d2d460d683c798a Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 20:38:58 +0200 Subject: [PATCH 27/39] debug values --- scripts/install | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index 32e3e24..772ec46 100644 --- a/scripts/install +++ b/scripts/install @@ -12,13 +12,6 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key -ynh_app_setting_set --app=$app --key=smtp_host --value=$domain -ynh_app_setting_set --app=$app --key=smtp_port --value=25 -ynh_app_setting_set --app=$app --key=smtp_user --value=$app -ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd -ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS -ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain -ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -34,6 +27,7 @@ chown -R $app:www-data "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= + ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM config @@ -59,6 +53,14 @@ ynh_add_config --template="config.local.php" --destination="$install_dir/config. chmod 440 "$install_dir/config.local.php" chown $app:$app "$install_dir/config.local.php" +ynh_app_setting_set --app=$app --key=smtp_host --value=$domain +ynh_app_setting_set --app=$app --key=smtp_port --value=25 +ynh_app_setting_set --app=$app --key=smtp_user --value=$app +ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd +ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS +ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain +ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain + #================================================= # SETUP APPLICATION WITH CURL #================================================= From 08cbd66de3a19fa8f7d1d72b43db052fd8574a31 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 20:45:23 +0200 Subject: [PATCH 28/39] debug values config panel --- conf/config.local.php | 3 +-- config_panel.toml | 4 ---- scripts/install | 13 ++++++------- scripts/upgrade | 3 --- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/conf/config.local.php b/conf/config.local.php index f629a52..99641b6 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -583,8 +583,7 @@ const SMTP_SECURITY = '__SMTP_SECURITY__'; * Défaut : null */ -const MAIL_RETURN_PATH = '__MAIL_RETURN_PATH__'; - +//const MAIL_RETURN_PATH = 'returns@monserveur.com'; /** * Adresse e-mail expéditrice des messages (Sender) diff --git a/config_panel.toml b/config_panel.toml index cc56fb7..7b42240 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -55,7 +55,3 @@ name.fr = "Configuration SMTP" type = "string" bind = "MAIL_SENDER:__INSTALL_DIR__/config.local.php" - [main.smtp.mail_return_path] - ask.fr = "Adresse e-mail destinée à recevoir les erreurs de mail" - type = "string" - bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php" diff --git a/scripts/install b/scripts/install index 772ec46..d3a1c28 100644 --- a/scripts/install +++ b/scripts/install @@ -12,6 +12,12 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key +ynh_app_setting_set --app=$app --key=smtp_host --value=$domain +ynh_app_setting_set --app=$app --key=smtp_port --value=25 +ynh_app_setting_set --app=$app --key=smtp_user --value=$app +ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd +ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS +ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -53,13 +59,6 @@ ynh_add_config --template="config.local.php" --destination="$install_dir/config. chmod 440 "$install_dir/config.local.php" chown $app:$app "$install_dir/config.local.php" -ynh_app_setting_set --app=$app --key=smtp_host --value=$domain -ynh_app_setting_set --app=$app --key=smtp_port --value=25 -ynh_app_setting_set --app=$app --key=smtp_user --value=$app -ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd -ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS -ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain -ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain #================================================= # SETUP APPLICATION WITH CURL diff --git a/scripts/upgrade b/scripts/upgrade index c40a6c3..63c308f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,7 +37,6 @@ if [ -z "${smtp_host:-}" ]; then smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER) smtp_password=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PASSWORD) smtp_security=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SECURITY) - mail_return_path=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_RETURN_PATH) mail_sender=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_SENDER) ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf @@ -47,7 +46,6 @@ if [ -z "${smtp_host:-}" ]; then smtp_user=$app smtp_password=$mail_pwd smtp_security=STARTTLS - mail_return_path=$app@$domain mail_sender=$app@$domain fi ynh_app_setting_set --app=$app --key=smtp_host --value=$smtp_host @@ -55,7 +53,6 @@ if [ -z "${smtp_host:-}" ]; then ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user ynh_app_setting_set --app=$app --key=smtp_password --value=$smtp_password ynh_app_setting_set --app=$app --key=smtp_security --value=$smtp_security - ynh_app_setting_set --app=$app --key=mail_return_path --value=$mail_return_path ynh_app_setting_set --app=$app --key=mail_sender --value=$mail_sender fi From 6bf6262d96cf606a61d26419ad9114124404fba5 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 21:10:40 +0200 Subject: [PATCH 29/39] debug values config panel removing all mail values, only smtp --- conf/config.local.php | 2 +- config_panel.toml | 5 ----- scripts/install | 1 - scripts/upgrade | 4 ---- 4 files changed, 1 insertion(+), 11 deletions(-) diff --git a/conf/config.local.php b/conf/config.local.php index 99641b6..767fafb 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -600,7 +600,7 @@ const SMTP_SECURITY = '__SMTP_SECURITY__'; * Défaut : null */ -const MAIL_SENDER = '__MAIL_SENDER__'; +//const MAIL_SENDER = 'associations@monserveur.com'; /** * Mot de passe pour l'accès à l'API permettant de gérer les mails d'erreur diff --git a/config_panel.toml b/config_panel.toml index 7b42240..7b50b28 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -50,8 +50,3 @@ name.fr = "Configuration SMTP" choices.STARTTLS = "STARTTLS, utilisation de STARTTLS (moyennement sécurisé)" bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php" - [main.smtp.mail_sender] - ask.fr = "Adresse e-mail expéditrice des messages" - type = "string" - bind = "MAIL_SENDER:__INSTALL_DIR__/config.local.php" - diff --git a/scripts/install b/scripts/install index d3a1c28..713bc13 100644 --- a/scripts/install +++ b/scripts/install @@ -17,7 +17,6 @@ ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS -ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/upgrade b/scripts/upgrade index 63c308f..dad0a11 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,23 +37,19 @@ if [ -z "${smtp_host:-}" ]; then smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER) smtp_password=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PASSWORD) smtp_security=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SECURITY) - mail_sender=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_SENDER) ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf - ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else smtp_host=$domain smtp_port=25 smtp_user=$app smtp_password=$mail_pwd smtp_security=STARTTLS - mail_sender=$app@$domain fi ynh_app_setting_set --app=$app --key=smtp_host --value=$smtp_host ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user ynh_app_setting_set --app=$app --key=smtp_password --value=$smtp_password ynh_app_setting_set --app=$app --key=smtp_security --value=$smtp_security - ynh_app_setting_set --app=$app --key=mail_sender --value=$mail_sender fi #================================================= From f3759c350384466003bc28bea88b77da6c2de4c3 Mon Sep 17 00:00:00 2001 From: rodinux Date: Sun, 18 Aug 2024 21:20:45 +0200 Subject: [PATCH 30/39] come back to first test where upgrade works, but not install --- conf/config.local.php | 4 ++-- config_panel.toml | 10 ++++++++++ scripts/install | 4 ++-- scripts/upgrade | 7 +++++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/conf/config.local.php b/conf/config.local.php index 767fafb..fb91b3c 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -583,7 +583,7 @@ const SMTP_SECURITY = '__SMTP_SECURITY__'; * Défaut : null */ -//const MAIL_RETURN_PATH = 'returns@monserveur.com'; +const MAIL_RETURN_PATH = '__MAIL_RETURN_PATH__'; /** * Adresse e-mail expéditrice des messages (Sender) @@ -600,7 +600,7 @@ const SMTP_SECURITY = '__SMTP_SECURITY__'; * Défaut : null */ -//const MAIL_SENDER = 'associations@monserveur.com'; +const MAIL_SENDER = '__MAIL_SENDER__'; /** * Mot de passe pour l'accès à l'API permettant de gérer les mails d'erreur diff --git a/config_panel.toml b/config_panel.toml index 7b50b28..c68fdf3 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -50,3 +50,13 @@ name.fr = "Configuration SMTP" choices.STARTTLS = "STARTTLS, utilisation de STARTTLS (moyennement sécurisé)" bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php" + [main.smtp.mail_sender] + ask.fr = "Adresse e-mail expéditrice des messages" + type = "string" + bind = "MAIL_SENDER:__INSTALL_DIR__/config.local.php" + + [main.smtp.mail_return_path] + ask.fr = "Adresse e-mail expéditrice des messages" + type = "string" + bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php" + diff --git a/scripts/install b/scripts/install index 713bc13..32e3e24 100644 --- a/scripts/install +++ b/scripts/install @@ -17,6 +17,8 @@ ynh_app_setting_set --app=$app --key=smtp_port --value=25 ynh_app_setting_set --app=$app --key=smtp_user --value=$app ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS +ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain +ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -32,7 +34,6 @@ chown -R $app:www-data "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= - ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM config @@ -58,7 +59,6 @@ ynh_add_config --template="config.local.php" --destination="$install_dir/config. chmod 440 "$install_dir/config.local.php" chown $app:$app "$install_dir/config.local.php" - #================================================= # SETUP APPLICATION WITH CURL #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index dad0a11..c40a6c3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,19 +37,26 @@ if [ -z "${smtp_host:-}" ]; then smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER) smtp_password=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PASSWORD) smtp_security=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_SECURITY) + mail_return_path=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_RETURN_PATH) + mail_sender=$(ynh_read_var_in_file --file=$user_conf --key=MAIL_SENDER) ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf + ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf else smtp_host=$domain smtp_port=25 smtp_user=$app smtp_password=$mail_pwd smtp_security=STARTTLS + mail_return_path=$app@$domain + mail_sender=$app@$domain fi ynh_app_setting_set --app=$app --key=smtp_host --value=$smtp_host ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user ynh_app_setting_set --app=$app --key=smtp_password --value=$smtp_password ynh_app_setting_set --app=$app --key=smtp_security --value=$smtp_security + ynh_app_setting_set --app=$app --key=mail_return_path --value=$mail_return_path + ynh_app_setting_set --app=$app --key=mail_sender --value=$mail_sender fi #================================================= From b42a88558820dacea2c7ae6874fd7c298eeb3d70 Mon Sep 17 00:00:00 2001 From: rodinux Date: Mon, 19 Aug 2024 00:51:23 +0200 Subject: [PATCH 31/39] try debug cinfig panel install --- scripts/install | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index 32e3e24..3330730 100644 --- a/scripts/install +++ b/scripts/install @@ -12,13 +12,20 @@ source /usr/share/yunohost/helpers secret_key=$(ynh_string_random --length=50) ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key -ynh_app_setting_set --app=$app --key=smtp_host --value=$domain -ynh_app_setting_set --app=$app --key=smtp_port --value=25 -ynh_app_setting_set --app=$app --key=smtp_user --value=$app -ynh_app_setting_set --app=$app --key=smtp_password --value=$mail_pwd -ynh_app_setting_set --app=$app --key=smtp_security --value=STARTTLS -ynh_app_setting_set --app=$app --key=mail_return_path --value=$app@$domain -ynh_app_setting_set --app=$app --key=mail_sender --value=$app@$domain +smtp_host=$domain +smtp_port=25 +smtp_user=$app +smtp_password=$mail_pwd +smtp_security=STARTTLS +mail_return_path=$app@$domain +mail_sender=$app@$domain +ynh_app_setting_set --app=$app --key=smtp_host --value=$smtp_host +ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port +ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user +ynh_app_setting_set --app=$app --key=smtp_password --value=$smtp_password +ynh_app_setting_set --app=$app --key=smtp_security --value=$smtp_security +ynh_app_setting_set --app=$app --key=mail_return_path --value=$mail_return_path +ynh_app_setting_set --app=$app --key=mail_sender --value=$mail_sender #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE From f0e43603b293f0dee6b61f865f3e683b55a354db Mon Sep 17 00:00:00 2001 From: rodinux Date: Mon, 19 Aug 2024 02:05:55 +0200 Subject: [PATCH 32/39] try add post-install --- manifest.toml | 27 +++++++++++++++++++++++++++ scripts/install | 16 +++++++++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 2f46f4b..f4a9d95 100644 --- a/manifest.toml +++ b/manifest.toml @@ -34,6 +34,33 @@ ram.runtime = "50M" type = "group" default = "visitors" + [install.country] + ask.fr = "Nom de l'association" + type = "string" + choices.France = "France" + choices.Belgique = "Belgique" + choices.Suisse = "Suisse" + + [install.name] + ask.fr = "Nom de l'association" + type = "string" + + [install.user_name] + ask.fr = "Nom et Prénom" + type = "string" + + [install.user_email] + ask.fr = "Adresse E-Mail" + type = "string" + + [install.password] + ask.fr="Mot de passe" + type = "password" + + [install.password_confirmed] + ask.fr="Encore le mot de passe (vérification)" + type = "password" + [resources] [resources.sources.main] url = "https://fossil.kd2.org/paheko/uv/paheko-1.3.11.tar.gz" diff --git a/scripts/install b/scripts/install index 3330730..12c8a42 100644 --- a/scripts/install +++ b/scripts/install @@ -75,9 +75,19 @@ chown $app:$app "$install_dir/config.local.php" ### so we're going to use curl to automatically fill the fields and submit the ### forms. -# Installation with curl -#ynh_script_progression --message="Finalizing installation..." --weight=1 -#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" +# Post-Installation with curl +ynh_script_progression --message="Finalizing installation..." --weight=1 + +installUrl="/var/www/paheko/www/admin/install.php?submit" + +country=$country +name=$name +user_name=$user_name +user_email=$user_email +password=$password +password_confirmed=$password_confirmed + +ynh_local_curl $installUrl "country=$country" "name=$name" "user_name=$user_name" "user_email=$user_email" "password=$password" "password_confirmed=$password_confirmed" #https://paheko.rodinux.fr/admin/install.php --args="country=FR&name=toto&user_name=bob&user_email=bob@example.org&password=bopbidibopbopbop&password_confirmed=bopbidibopbopbop" #================================================= # END OF SCRIPT From 978c4fbe8b55c5abe2c9ba52fdf6821c5c47c765 Mon Sep 17 00:00:00 2001 From: rodinux Date: Mon, 19 Aug 2024 02:09:12 +0200 Subject: [PATCH 33/39] try add post-install --- manifest.toml | 2 +- scripts/install | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index f4a9d95..6957e98 100644 --- a/manifest.toml +++ b/manifest.toml @@ -41,7 +41,7 @@ ram.runtime = "50M" choices.Belgique = "Belgique" choices.Suisse = "Suisse" - [install.name] + [install.name_association] ask.fr = "Nom de l'association" type = "string" diff --git a/scripts/install b/scripts/install index 12c8a42..b5e65eb 100644 --- a/scripts/install +++ b/scripts/install @@ -81,13 +81,13 @@ ynh_script_progression --message="Finalizing installation..." --weight=1 installUrl="/var/www/paheko/www/admin/install.php?submit" country=$country -name=$name +name_association=$name_association user_name=$user_name user_email=$user_email password=$password password_confirmed=$password_confirmed -ynh_local_curl $installUrl "country=$country" "name=$name" "user_name=$user_name" "user_email=$user_email" "password=$password" "password_confirmed=$password_confirmed" +ynh_local_curl $installUrl "country=$country" "name=$name_association" "user_name=$user_name" "user_email=$user_email" "password=$password" "password_confirmed=$password_confirmed" #https://paheko.rodinux.fr/admin/install.php --args="country=FR&name=toto&user_name=bob&user_email=bob@example.org&password=bopbidibopbopbop&password_confirmed=bopbidibopbopbop" #================================================= # END OF SCRIPT From 4fbe6ba3c16e3f5ffc8e76d5ef5ca1673ddbf2f1 Mon Sep 17 00:00:00 2001 From: rodinux Date: Mon, 19 Aug 2024 02:32:23 +0200 Subject: [PATCH 34/39] try add post-install --- scripts/install | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index b5e65eb..63ccb27 100644 --- a/scripts/install +++ b/scripts/install @@ -78,7 +78,9 @@ chown $app:$app "$install_dir/config.local.php" # Post-Installation with curl ynh_script_progression --message="Finalizing installation..." --weight=1 -installUrl="/var/www/paheko/www/admin/install.php?submit" +domain=$domain + +admin_url="/admin/install.php?submit" country=$country name_association=$name_association @@ -87,7 +89,7 @@ user_email=$user_email password=$password password_confirmed=$password_confirmed -ynh_local_curl $installUrl "country=$country" "name=$name_association" "user_name=$user_name" "user_email=$user_email" "password=$password" "password_confirmed=$password_confirmed" +ynh_local_curl $admin_url "country=$country" "name=$name_association" "user_name=$user_name" "user_email=$user_email" "password=$password" "password_confirmed=$password_confirmed" #https://paheko.rodinux.fr/admin/install.php --args="country=FR&name=toto&user_name=bob&user_email=bob@example.org&password=bopbidibopbopbop&password_confirmed=bopbidibopbopbop" #================================================= # END OF SCRIPT From a9d2d8515deb93aeb5786e9597fad18d64e62493 Mon Sep 17 00:00:00 2001 From: rodinux Date: Tue, 20 Aug 2024 00:35:50 +0200 Subject: [PATCH 35/39] keep first panel_config working --- manifest.toml | 34 +++------------------------------- scripts/install | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 42 deletions(-) diff --git a/manifest.toml b/manifest.toml index 6957e98..6a4d506 100644 --- a/manifest.toml +++ b/manifest.toml @@ -34,38 +34,10 @@ ram.runtime = "50M" type = "group" default = "visitors" - [install.country] - ask.fr = "Nom de l'association" - type = "string" - choices.France = "France" - choices.Belgique = "Belgique" - choices.Suisse = "Suisse" - - [install.name_association] - ask.fr = "Nom de l'association" - type = "string" - - [install.user_name] - ask.fr = "Nom et Prénom" - type = "string" - - [install.user_email] - ask.fr = "Adresse E-Mail" - type = "string" - - [install.password] - ask.fr="Mot de passe" - type = "password" - - [install.password_confirmed] - ask.fr="Encore le mot de passe (vérification)" - type = "password" - [resources] - [resources.sources.main] - url = "https://fossil.kd2.org/paheko/uv/paheko-1.3.11.tar.gz" - sha256 = "88624f5efdc7dc7ce779c29827d25e8a9a8ffa21793c1a8320c3705d5ac1fc31" - + [resources.sources.main] + url = "https://fossil.kd2.org/paheko/uv/paheko-1.3.11.tar.gz" + sha256 = "88624f5efdc7dc7ce779c29827d25e8a9a8ffa21793c1a8320c3705d5ac1fc31" [resources.system_user] allow_email = true diff --git a/scripts/install b/scripts/install index 63ccb27..4848bee 100644 --- a/scripts/install +++ b/scripts/install @@ -76,21 +76,20 @@ chown $app:$app "$install_dir/config.local.php" ### forms. # Post-Installation with curl -ynh_script_progression --message="Finalizing installation..." --weight=1 +# ynh_script_progression --message="Finalizing installation..." --weight=1 -domain=$domain +# domain=$domain +# admin_url="/admin/install.php" -admin_url="/admin/install.php?submit" +# country=$country +# name_association=$name_association +# user_name=$user_name +# user_email=$user_email +# password=$password +# password_confirmed=$password_confirmed -country=$country -name_association=$name_association -user_name=$user_name -user_email=$user_email -password=$password -password_confirmed=$password_confirmed +# ynh_local_curl $admin_url "country=$country" "name=$name_association" "user_name=$user_name" "user_email=$user_email" "password=$password" "password_confirmed=$password_confirmed" -ynh_local_curl $admin_url "country=$country" "name=$name_association" "user_name=$user_name" "user_email=$user_email" "password=$password" "password_confirmed=$password_confirmed" -#https://paheko.rodinux.fr/admin/install.php --args="country=FR&name=toto&user_name=bob&user_email=bob@example.org&password=bopbidibopbopbop&password_confirmed=bopbidibopbopbop" #================================================= # END OF SCRIPT #================================================= From 75bc572804e109f37dcb0fccdfa332e29571e936 Mon Sep 17 00:00:00 2001 From: rodinux Date: Tue, 20 Aug 2024 00:49:43 +0200 Subject: [PATCH 36/39] add type select for choices --- config_panel.toml | 2 +- manifest.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index c68fdf3..eb31a08 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -43,7 +43,7 @@ name.fr = "Configuration SMTP" [main.smtp.smtp_security] ask.fr = "Sécurité de la connexion" - type = "string" + type = "select" choices.NONE = "NONE, pas de chiffrement" choices.SSL = "SSL, connexion SSL native" choices.TLS = "TLS, connexion TLS native (le plus sécurisé)" diff --git a/manifest.toml b/manifest.toml index 6a4d506..5404b50 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Paheko" description.en = "Association management software" description.fr = "Logiciel de gestion d'association" -version = "1.3.11~ynh2" +version = "1.3.11~ynh3" maintainers = ["rodinux"] From 73983c3a23f15af4f5668cabae3578014f696fb6 Mon Sep 17 00:00:00 2001 From: rodinux Date: Wed, 28 Aug 2024 16:47:41 +0200 Subject: [PATCH 37/39] comment for now next last install step adding post-install in paheko on next release 1.3.12 --- scripts/install | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index 4848bee..a2d42f6 100644 --- a/scripts/install +++ b/scripts/install @@ -67,20 +67,14 @@ chmod 440 "$install_dir/config.local.php" chown $app:$app "$install_dir/config.local.php" #================================================= -# SETUP APPLICATION WITH CURL +# SETUP APPLICATION #================================================= -### Use these lines only if the app installation needs to be finalized through -### web forms. We generally don't want to ask the final user, -### so we're going to use curl to automatically fill the fields and submit the -### forms. +### Waiting for new script which will be integrated in version 1.3.12 see https://fossil.kd2.org/paheko/wiki?name=Ligne+de+commande -# Post-Installation with curl +# Post-Installation # ynh_script_progression --message="Finalizing installation..." --weight=1 -# domain=$domain -# admin_url="/admin/install.php" - # country=$country # name_association=$name_association # user_name=$user_name @@ -88,7 +82,7 @@ chown $app:$app "$install_dir/config.local.php" # password=$password # password_confirmed=$password_confirmed -# ynh_local_curl $admin_url "country=$country" "name=$name_association" "user_name=$user_name" "user_email=$user_email" "password=$password" "password_confirmed=$password_confirmed" +# ynh_exec_as $app paheko init --country $country --orgname $name_association --name=${user_name} --email=${$user_email} --password ${password} #================================================= # END OF SCRIPT From 72d4414723d2c797361c1ac4444ff1ba3a2ed349 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 28 Aug 2024 14:47:54 +0000 Subject: [PATCH 38/39] Auto-update READMEs --- README.md | 2 +- README_es.md | 2 +- README_eu.md | 2 +- README_fr.md | 2 +- README_gl.md | 2 +- README_id.md | 2 +- README_ru.md | 2 +- README_zh_Hans.md | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d168a81..92c2163 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ It shall NOT be edited by hand. Paheko (a word from the Māori language meaning "to cooperate", illustrating the purpose of the software: to improve together the daily management of an association) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members. -**Shipped version:** 1.3.11~ynh2 +**Shipped version:** 1.3.11~ynh3 **Demo:** diff --git a/README_es.md b/README_es.md index 6436f3f..ba60e61 100644 --- a/README_es.md +++ b/README_es.md @@ -19,7 +19,7 @@ No se debe editar a mano. Paheko (a word from the Māori language meaning "to cooperate", illustrating the purpose of the software: to improve together the daily management of an association) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members. -**Versión actual:** 1.3.11~ynh2 +**Versión actual:** 1.3.11~ynh3 **Demo:** diff --git a/README_eu.md b/README_eu.md index 8c3ab57..ed328f2 100644 --- a/README_eu.md +++ b/README_eu.md @@ -19,7 +19,7 @@ EZ editatu eskuz. Paheko (a word from the Māori language meaning "to cooperate", illustrating the purpose of the software: to improve together the daily management of an association) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members. -**Paketatutako bertsioa:** 1.3.11~ynh2 +**Paketatutako bertsioa:** 1.3.11~ynh3 **Demoa:** diff --git a/README_fr.md b/README_fr.md index a7b172b..7e997d9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Il NE doit PAS être modifié à la main. Paheko (mot de la langue Māori qui signifie « coopérer », illustrant le but du logiciel : améliorer ensemble le quotidien de la gestion d'une association) est un logiciel de gestion associative. Il est l'outil de prédilection pour gérer une association, un club sportif, une ONG, etc. Il est conçu pour répondre aux besoins d'une structure de petite à moyenne taille : gestion des adhérents, comptabilité, site web, prise de notes en réunion, archivage et partage des documents de fonctionnement de l'association, discussion entre adhérents. -**Version incluse :** 1.3.11~ynh2 +**Version incluse :** 1.3.11~ynh3 **Démo :** diff --git a/README_gl.md b/README_gl.md index f6b7a6d..db71438 100644 --- a/README_gl.md +++ b/README_gl.md @@ -19,7 +19,7 @@ NON debe editarse manualmente. Paheko (a word from the Māori language meaning "to cooperate", illustrating the purpose of the software: to improve together the daily management of an association) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members. -**Versión proporcionada:** 1.3.11~ynh2 +**Versión proporcionada:** 1.3.11~ynh3 **Demo:** diff --git a/README_id.md b/README_id.md index 8caa35e..a179dee 100644 --- a/README_id.md +++ b/README_id.md @@ -19,7 +19,7 @@ Ini TIDAK boleh diedit dengan tangan. Paheko (a word from the Māori language meaning "to cooperate", illustrating the purpose of the software: to improve together the daily management of an association) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members. -**Versi terkirim:** 1.3.11~ynh2 +**Versi terkirim:** 1.3.11~ynh3 **Demo:** diff --git a/README_ru.md b/README_ru.md index 5201e1e..fb0f713 100644 --- a/README_ru.md +++ b/README_ru.md @@ -19,7 +19,7 @@ Paheko (a word from the Māori language meaning "to cooperate", illustrating the purpose of the software: to improve together the daily management of an association) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members. -**Поставляемая версия:** 1.3.11~ynh2 +**Поставляемая версия:** 1.3.11~ynh3 **Демо-версия:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 4f9f53d..522e8b1 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -19,7 +19,7 @@ Paheko (a word from the Māori language meaning "to cooperate", illustrating the purpose of the software: to improve together the daily management of an association) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members. -**分发版本:** 1.3.11~ynh2 +**分发版本:** 1.3.11~ynh3 **演示:** From 6d087f9062e6f0fb30b295ed385d0a4b1bbd2dc4 Mon Sep 17 00:00:00 2001 From: rodinux Date: Tue, 3 Sep 2024 09:25:12 +0200 Subject: [PATCH 39/39] panel-config ready and waiting for next release to add post-install --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 5404b50..6a4d506 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Paheko" description.en = "Association management software" description.fr = "Logiciel de gestion d'association" -version = "1.3.11~ynh3" +version = "1.3.11~ynh2" maintainers = ["rodinux"]