combo/combo/apps/pwa/urls.py

60 lines
2.1 KiB
Python

# combo - content management system
# Copyright (C) 2015-2018 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf.urls import include, url
from combo.urls_utils import decorated_includes, manager_required
from .manager_views import (
ManagerAddNavigationEntry,
ManagerDeleteNavigationEntry,
ManagerEditNavigationEntry,
ManagerHomeView,
manager_navigation_order,
)
from .views import (
manifest_json,
offline_page,
service_worker_js,
service_worker_registration_js,
subscribe_push,
)
pwa_manager_urls = [
url('^$', ManagerHomeView.as_view(), name='pwa-manager-homepage'),
url('^navigation/add/$', ManagerAddNavigationEntry.as_view(), name='pwa-manager-navigation-add'),
url(
'^navigation/edit/(?P<pk>\w+)/$',
ManagerEditNavigationEntry.as_view(),
name='pwa-manager-navigation-edit',
),
url(
'^navigation/delete/(?P<pk>\w+)/$',
ManagerDeleteNavigationEntry.as_view(),
name='pwa-manager-navigation-delete',
),
url('^navigation/order/$', manager_navigation_order, name='pwa-manager-navigation-order'),
]
urlpatterns = [
url('^manifest.json$', manifest_json),
url('^service-worker.js$', service_worker_js),
url('^service-worker-registration.js$', service_worker_registration_js),
url('^api/pwa/push/subscribe$', subscribe_push, name='pwa-subscribe-push'),
url('^__pwa__/offline/$', offline_page),
url(r'^manage/pwa/', decorated_includes(manager_required, include(pwa_manager_urls))),
]