gitweb: Fix enable auth webserver component on app init

* Fixes the gitweb app initalization when there are no public
repositories and the apache2 configuration gitweb-freedombox-auth has
not been enabled before (this may happen when the git repositories or
apache2 configuration has been modified outside the plinth web UI).
* Fix comment in the gitweb-freedombox-auth.conf apache2 configuration
file.

Fixes #1928

Tests performed:
* The gitweb app unit and functional tests pass.
* Configured all gitweb repositories as private. Stopped the plinth
service. Disabled the apache2 configuration gitweb-freedombox-auth.
Then starting the plinth service succeeds and gitweb-freedombox-auth
configuration gets enabled.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
Veiko Aasa authored and Joseph Nuthalapati committed 2020-08-22 12:25:24 +05:30
1 parent 699266fdc1
commit eb7454d3b7
5 files changed
+48 -43

No files matched your search

+3 -3
View File
@@ -28,7 +28,7 @@ class GitwebAppView(views.AppView):
def get_context_data(self, *args, **kwargs):
"""Add repositories to the context data."""
context = super().get_context_data(*args, **kwargs)
repos = gitweb.app.get_repo_list()
repos = gitweb.get_repo_list()
context['repos'] = repos
context['cloning'] = any('clone_progress' in repo for repo in repos)
context['refresh_page_sec'] = 3 if context['cloning'] else None
@@ -92,7 +92,7 @@ class EditRepoView(SuccessMessageMixin, FormView):
def get_initial(self):
"""Load information about repository being edited."""
name = self.kwargs['name']
for repo in gitweb.app.get_repo_list():
for repo in gitweb.get_repo_list():
if repo['name'] == name and 'clone_progress' not in repo:
break
else:
@@ -126,7 +126,7 @@ def delete(request, name):
On GET, display a confirmation page.
On POST, delete the repository.
"""
for repo in gitweb.app.get_repo_list():
for repo in gitweb.get_repo_list():
if repo['name'] == name and 'clone_progress' not in repo:
break
else: