From 958ac2e0a553d48d5c4fdb3f74274c3a785f43e9 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Thu, 8 Jan 2026 07:49:18 +0530 Subject: [PATCH] gitweb: Fix deleting last repo disables app GitWeb requires authenticated access if there are no public repositories left. 1. Create a public repository 2. Delete the repository (i.e. delete the last/only repository) 3. GitWeb app shows as disabled, but is still usable 4. If another repository is created, the app becomes enabled again Not considering the component GitwebWebserverAuth when determining whether the app is enabled or disabled. This commit fixes the status shown in the configuration page, but keeps the authentication requirement if there are no public repositories. Signed-off-by: Joseph Nuthalapati Reviewed-by: Veiko Aasa --- plinth/modules/gitweb/__init__.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/plinth/modules/gitweb/__init__.py b/plinth/modules/gitweb/__init__.py index 00c751e7a..5412ed193 100644 --- a/plinth/modules/gitweb/__init__.py +++ b/plinth/modules/gitweb/__init__.py @@ -109,14 +109,14 @@ class GitwebApp(app_module.App): def _enable_public_access(self): """Allow Gitweb app to be accessed by anyone with access.""" - if self.auth_webserver.is_conf_enabled(): + if self.is_enabled(): self.auth_webserver.disable() self.set_shortcut_login_required(False) def _disable_public_access(self): """Allow Gitweb app to be accessed by logged-in users only.""" - if self.is_enabled() and not self.auth_webserver.is_conf_enabled(): + if self.is_enabled(): self.auth_webserver.enable() self.set_shortcut_login_required(True) @@ -137,14 +137,7 @@ class GitwebApp(app_module.App): class GitwebWebserverAuth(Webserver): """Component to handle Gitweb authentication webserver configuration.""" - def is_conf_enabled(self): - """Check whether Gitweb authentication configuration is enabled.""" - return super().is_enabled() - - def is_enabled(self): - """Return if configuration is enabled or public access is enabled.""" - repos = get_repo_list() - return have_public_repos(repos) or super().is_enabled() + is_leader = False def enable(self): """Enable apache configuration only if no public repository exists."""