From bedc5ff96d201ade7847bb0d7fe3021b418087c4 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Mon, 18 Feb 2019 13:45:23 +0530 Subject: [PATCH] config: Add option to use Apache's default home page as home page This supports the use case of hosting a website on FreedomBox at Apache's web root. This makes the assumption that index.html is a file in the website. Signed-off-by: Joseph Nuthalapati Reviewed-by: James Valleroy --- plinth/modules/config/__init__.py | 6 +++++- plinth/modules/config/views.py | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plinth/modules/config/__init__.py b/plinth/modules/config/__init__.py index 4f053ae08..5a41d905e 100644 --- a/plinth/modules/config/__init__.py +++ b/plinth/modules/config/__init__.py @@ -76,7 +76,11 @@ def get_home_page(): # match this against the app_id in the entries of frontpage.get_shortcuts() # The underscore is to handle Ikiwiki app_ids - return app_path.strip('/"').replace('/', '_') + app = app_path.strip('/"').replace('/', '_') + if app == "index.html": + return "apache-default" + else: + return app def init(): diff --git a/plinth/modules/config/views.py b/plinth/modules/config/views.py index a566c82c9..d53f28083 100644 --- a/plinth/modules/config/views.py +++ b/plinth/modules/config/views.py @@ -103,10 +103,12 @@ def _apply_changes(request, old_status, new_status): messages.success(request, _('Webserver home page set')) -def change_default_app(app_id): +def change_home_page(app_id): """Changes the FreedomBox's default app to the app specified by app_id.""" if app_id == 'plinth': url = '/plinth' + elif app_id == 'apache-default': + url = '/index.html' else: shortcuts = frontpage.get_shortcuts() url = [