mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-10 11:00:22 +00:00
config: Fix showing the value of the default home page
Closes: #2314. Tests: - On a fresh testing container, verify that the file /etc/apache2/conf-available/freedombox-apache-homepage.conf is not present. Visit the config app and notice that home page shows as 'Apache Default'. - Apply the patch and refresh the page. The page now shows 'FreedomBox Service (Plinth)' as the home page. - Functional tests work. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
9597654ca8
commit
f394beb2ef
@ -105,6 +105,12 @@ def get_hostname():
|
||||
|
||||
def home_page_url2scid(url):
|
||||
"""Return the shortcut ID of the given home page url."""
|
||||
# url is None when the freedombox-apache-homepage configuration file does
|
||||
# not exist. In this case, the default redirect in /plinth from the shipped
|
||||
# configuration file is effective.
|
||||
if url is None:
|
||||
return 'plinth'
|
||||
|
||||
if url in ('/plinth/', '/plinth', 'plinth'):
|
||||
return 'plinth'
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ def test_domainname_field():
|
||||
def test_homepage_mapping():
|
||||
"""Basic tests for homepage functions."""
|
||||
func = home_page_url2scid
|
||||
assert func(None) is None
|
||||
assert func(None) == 'plinth'
|
||||
assert func('/unknown/url') is None
|
||||
assert func('/plinth/') == 'plinth'
|
||||
assert func('/plinth') == 'plinth'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user