FreedomBox/plinth/urls.py
Sunil Mohan Adapa 2764c58c53
views: Add a separate page for adding new apps
- It avoids confusion with two separate app sections in a single page. The
sections/pages can be better titled.

- In future, we can style the apps page (with more status display) differently
from apps-add page (with more search and featured apps).

- Move page specific parts into individual pages instead of in the common
template cards.html.

- Add special message when there are no apps enabled and when there are no more
apps to enable.

- Drop show_disabled flag in cards template that is not needed anymore.

Tests:

- Unit tests work.

- Functional tests work on bepasty when starting with uninstalled, disabled, or
enabled states.

- Apps page shows special message when there are no apps enabled. It is
centered.

- Apps page shows 'Add new app' button with icon. Clicking it takes us to
apps-add page.

- Apps page does not have disabled apps list (even hidden).

- Disabled and uninstalled apps are not shown on apps page.

- Apps-add page shows special message when there are no more apps to be
installed or enabled (test by altering view code to have empty list of apps).

- Apps-add page shows list of apps that are disabled or uninstalled but not
enabled apps. It shows a title 'Add New App'.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2026-08-17 19:18:51 -04:00

57 lines
2.4 KiB
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Django URLconf file containing all urls
"""
from captcha import views as cviews
from django.urls import include, path, re_path
from oauth2_provider import urls as oauth2_urls
from stronghold.decorators import public
from . import views
system_urlpatterns = [
re_path(r'^sys/$', views.system_index, name='visibility'),
re_path(r'^sys/$', views.system_index, name='data'),
re_path(r'^sys/$', views.system_index, name='system'),
re_path(r'^sys/$', views.system_index, name='security'),
re_path(r'^sys/$', views.system_index, name='administration'),
]
urlpatterns = [
re_path(r'^$', views.index, name='index'),
re_path(r'^status/$', views.status, name='status'),
re_path(r'^language-selection/$',
public(views.LanguageSelectionView.as_view()),
name='language-selection'),
re_path(r'^apps/$', views.AppsView.as_view(), name='apps'),
re_path(r'^apps/add/$', views.AppsAddView.as_view(), name='apps-add'),
re_path(r'^sys/$', views.system_index, name='system'),
re_path(r'', include((system_urlpatterns, 'system'))),
re_path(r'^uninstall/(?P<app_id>[1-9a-z\-_]+)/$',
views.UninstallView.as_view(), name='uninstall'),
re_path(r'^is-available/(?P<app_id>[1-9a-z\-_]+)/$',
views.is_available_view, name='is-available'),
re_path(r'^rerun-setup/(?P<app_id>[1-9a-z\-_]+)/$', views.rerun_setup_view,
name='rerun-setup'),
re_path(r'^logs/(?P<app_id>[1-9a-z\-_]+)/$', views.AppLogsView.as_view(),
name='logs'),
# captcha urls are public
re_path(r'^captcha/image/(?P<key>\w+)/$', public(cviews.captcha_image),
name='captcha-image', kwargs={'scale': 1}),
re_path(r'^captcha/image/(?P<key>\w+)@2/$', public(cviews.captcha_image),
name='captcha-image-2x', kwargs={'scale': 2}),
re_path(r'^captcha/audio/(?P<key>\w+)/$', public(cviews.captcha_audio),
name='captcha-audio'),
re_path(r'^captcha/refresh/$', public(cviews.captcha_refresh),
name='captcha-refresh'),
# Notifications
re_path(r'^notification/(?P<id>[A-Za-z0-9-=]+)/dismiss/$',
views.notification_dismiss, name='notification_dismiss'),
# OpenID Provider related URLs. They need to be under 'oauth2_provider:'
# namespace otherwise .well-known/openid-configuration will fail.
path('o/', include(oauth2_urls)),
]