diff --git a/share/config_domain.toml b/share/config_domain.toml index 7189003d3..fd12d4506 100644 --- a/share/config_domain.toml +++ b/share/config_domain.toml @@ -107,7 +107,6 @@ i18n = "domain_config" style = "success" visible = "issuer != 'letsencrypt'" enabled = "acme_eligible || cert_no_checks" - args = ["cert_no_checks"] [cert.cert.cert_renew] ask = "Renew Let's Encrypt certificate" diff --git a/src/app.py b/src/app.py index 81557978b..c57cf038e 100644 --- a/src/app.py +++ b/src/app.py @@ -1539,7 +1539,7 @@ ynh_app_config_run $1 if ret != 0: if action == "show": raise YunohostError("app_config_unable_to_read") - elif action == "show": + elif action == "apply": raise YunohostError("app_config_unable_to_apply") else: raise YunohostError("app_action_failed", action=action) diff --git a/src/utils/config.py b/src/utils/config.py index 0ab5fc2ba..4291e133e 100644 --- a/src/utils/config.py +++ b/src/utils/config.py @@ -49,6 +49,7 @@ from yunohost.log import OperationLogger logger = getActionLogger("yunohost.config") CONFIG_PANEL_VERSION_SUPPORTED = 1.0 + # Those js-like evaluate functions are used to eval safely visible attributes # The goal is to evaluate in the same way than js simple-evaluate # https://github.com/shepherdwind/simple-evaluate @@ -675,6 +676,11 @@ class ConfigPanel: for panel, section, obj in self._iterate(["panel", "section"]): + if section and section.get("visible") and not evaluate_simple_js_expression( + section["visible"], context=self.new_values + ): + continue + # Ugly hack to skip action section ... except when when explicitly running actions if not for_action: if section and section["is_action_section"]: @@ -878,7 +884,8 @@ class Question: text_for_user_input_in_cli = self._format_text_for_user_input_in_cli() if self.readonly: Moulinette.display(text_for_user_input_in_cli) - return {} + self.value = self.values[self.name] = self.current_value + return self.values elif self.value is None: self._prompt(text_for_user_input_in_cli) @@ -1459,13 +1466,6 @@ class FileQuestion(Question): class ButtonQuestion(Question): argument_type = "button" - #def __init__( - # self, question, context: Mapping[str, Any] = {}, hooks: Dict[str, Callable] = {} - #): - # super().__init__(question, context, hooks) - - - ARGUMENTS_TYPE_PARSERS = { "string": StringQuestion,