diff --git a/share/config_domain.toml b/share/config_domain.toml index ebab2d066..dd099efce 100644 --- a/share/config_domain.toml +++ b/share/config_domain.toml @@ -8,6 +8,10 @@ name = "Features" # Only available for "topest" domains name = "Portal" + [feature.portal.enable_public_apps_page] + type = "boolean" + default = false + [feature.portal.show_other_domains_apps] type = "boolean" default = false @@ -52,7 +56,6 @@ name = "Features" type = "app" filter = "is_webapp" default = "_none" - add_yunohost_portal_to_choices = true [feature.mail] name = "Email" diff --git a/src/app.py b/src/app.py index 1d88d5380..1bd100ebe 100644 --- a/src/app.py +++ b/src/app.py @@ -1657,9 +1657,7 @@ def app_ssowatconf(): for domain in domains: default_app = _get_raw_domain_settings(domain).get("default_app") - if default_app == "_yunohost_portal_with_public_apps": - redirected_urls[domain + "/"] = domain_portal_dict[domain] - elif default_app not in ["_none", None] and _is_installed(default_app): + if default_app not in ["_none", None] and _is_installed(default_app): app_settings = _get_app_settings(default_app) app_domain = app_settings["domain"] app_path = app_settings["path"] @@ -1667,6 +1665,8 @@ def app_ssowatconf(): # Prevent infinite redirect loop... if domain + "/" != app_domain + app_path: redirected_urls[domain + "/"] = app_domain + app_path + elif bool(_get_raw_domain_settings(domain).get("enable_public_apps_page", False)): + redirected_urls[domain + "/"] = domain_portal_dict[domain] # Will organize apps by portal domain portal_domains_apps = {domain: {} for domain in portal_domains} diff --git a/src/domain.py b/src/domain.py index 0d9342487..9986b7b48 100644 --- a/src/domain.py +++ b/src/domain.py @@ -778,7 +778,7 @@ def _get_DomainConfigPanel(): form.custom_css = "" portal_options = [ - "default_app", + "enable_public_apps_page", "show_other_domains_apps", "portal_title", "portal_logo", @@ -832,7 +832,7 @@ def _get_DomainConfigPanel(): super()._apply(form, previous_settings, exclude={"recovery_password"}) # Reload ssowat if default app changed - if "default_app" in next_settings: + if "default_app" in next_settings or "enable_public_apps_page" in next_settings: from yunohost.app import app_ssowatconf app_ssowatconf() diff --git a/src/portal.py b/src/portal.py index dbd47ac05..2e664d76c 100644 --- a/src/portal.py +++ b/src/portal.py @@ -81,9 +81,7 @@ def _get_portal_settings( if portal_settings_path.exists(): settings.update(read_json(str(portal_settings_path))) # Portal may be public (no login required) - settings["public"] = ( - settings.pop("default_app", None) == "_yunohost_portal_with_public_apps" - ) + settings["public"] = bool(settings.pop("enable_public_apps_page", False)) # First clear apps since it may contains private apps apps: dict[str, Any] = settings.pop("apps", {}) diff --git a/src/utils/form.py b/src/utils/form.py index f02a4bd21..2b8d634a0 100644 --- a/src/utils/form.py +++ b/src/utils/form.py @@ -1672,7 +1672,6 @@ class AppOption(BaseChoicesOption): type: Literal[OptionType.app] = OptionType.app filter: Union[JSExpression, None] = None - add_yunohost_portal_to_choices: bool = False choices: Union[dict[str, str], None] @validator("choices", pre=True, always=True) @@ -1692,10 +1691,6 @@ class AppOption(BaseChoicesOption): ] value = {"_none": "---"} - - if values.get("add_yunohost_portal_to_choices", False): - value["_yunohost_portal_with_public_apps"] = "YunoHost's portal with public apps" - value.update( { app["id"]: f"{app['label']} ({app.get('domain_path', app['id'])})"