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 <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2019-02-18 13:45:23 +05:30 committed by James Valleroy
parent 8bc34f84c3
commit bedc5ff96d
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 8 additions and 2 deletions

View File

@ -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():

View File

@ -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 = [