2019-04-03 09:36:41 +13:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2019-04-23 11:07:39 +12:00
|
|
|
from django.urls import path, include
|
2019-05-01 15:13:21 +12:00
|
|
|
from django.views import static
|
2021-02-16 22:16:24 +13:00
|
|
|
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
2019-04-23 11:07:39 +12:00
|
|
|
from django.conf import settings
|
2019-05-01 15:13:21 +12:00
|
|
|
from django.views.generic.base import RedirectView
|
2019-04-17 21:42:21 +12:00
|
|
|
|
2021-10-04 06:12:03 +13:00
|
|
|
from core.views import HomepageView, SnapshotView, PublicIndexView, AddView, HealthCheckView
|
2019-04-23 11:07:39 +12:00
|
|
|
|
2024-01-04 13:11:27 +13:00
|
|
|
# print('DEBUG', settings.DEBUG)
|
2023-12-20 06:58:15 +13:00
|
|
|
|
2019-04-03 09:36:41 +13:00
|
|
|
urlpatterns = [
|
2021-01-30 23:35:07 +13:00
|
|
|
path('public/', PublicIndexView.as_view(), name='public-index'),
|
|
|
|
|
2021-02-18 12:25:47 +13:00
|
|
|
path('robots.txt', static.serve, {'document_root': settings.STATICFILES_DIRS[0], 'path': 'robots.txt'}),
|
|
|
|
path('favicon.ico', static.serve, {'document_root': settings.STATICFILES_DIRS[0], 'path': 'favicon.ico'}),
|
2019-05-01 15:13:21 +12:00
|
|
|
|
2020-11-23 20:04:39 +13:00
|
|
|
path('docs/', RedirectView.as_view(url='https://github.com/ArchiveBox/ArchiveBox/wiki'), name='Docs'),
|
2020-07-28 15:56:35 +12:00
|
|
|
|
2019-05-01 15:13:21 +12:00
|
|
|
path('archive/', RedirectView.as_view(url='/')),
|
2021-02-18 20:38:30 +13:00
|
|
|
path('archive/<path:path>', SnapshotView.as_view(), name='Snapshot'),
|
2024-02-09 02:54:34 +13:00
|
|
|
path('web/<path:path>', SnapshotView.as_view()), # support archive.org-style URLs
|
2020-09-18 02:08:20 +12:00
|
|
|
|
2024-01-18 02:14:43 +13:00
|
|
|
path('plugins/replaywebpage/', include('plugins.replaywebpage.urls')),
|
|
|
|
# ... dynamic load these someday if there are more of them
|
|
|
|
|
2020-09-18 02:08:20 +12:00
|
|
|
path('admin/core/snapshot/add/', RedirectView.as_view(url='/add/')),
|
2021-01-30 23:35:07 +13:00
|
|
|
path('add/', AddView.as_view(), name='add'),
|
2021-10-04 06:12:03 +13:00
|
|
|
|
2019-05-03 11:15:16 +12:00
|
|
|
path('accounts/login/', RedirectView.as_view(url='/admin/login/')),
|
|
|
|
path('accounts/logout/', RedirectView.as_view(url='/admin/logout/')),
|
|
|
|
|
2020-06-30 21:56:17 +12:00
|
|
|
|
2019-04-23 11:07:39 +12:00
|
|
|
path('accounts/', include('django.contrib.auth.urls')),
|
2024-01-04 13:11:27 +13:00
|
|
|
path('admin/', admin.site.urls),
|
|
|
|
|
2021-10-04 06:12:03 +13:00
|
|
|
path('health/', HealthCheckView.as_view(), name='healthcheck'),
|
2023-09-14 21:41:27 +12:00
|
|
|
path('error/', lambda _: 1/0),
|
|
|
|
|
|
|
|
# path('jet_api/', include('jet_django.urls')), Enable to use https://www.jetadmin.io/integrations/django
|
2021-10-04 06:12:03 +13:00
|
|
|
|
2020-06-30 21:56:17 +12:00
|
|
|
path('index.html', RedirectView.as_view(url='/')),
|
|
|
|
path('index.json', static.serve, {'document_root': settings.OUTPUT_DIR, 'path': 'index.json'}),
|
2021-01-30 23:35:17 +13:00
|
|
|
path('', HomepageView.as_view(), name='Home'),
|
2019-04-03 09:36:41 +13:00
|
|
|
]
|
2021-02-16 22:16:24 +13:00
|
|
|
urlpatterns += staticfiles_urlpatterns()
|
2021-01-30 23:35:17 +13:00
|
|
|
|
2021-02-16 20:50:05 +13:00
|
|
|
if settings.DEBUG_TOOLBAR:
|
|
|
|
import debug_toolbar
|
|
|
|
urlpatterns += [
|
|
|
|
path('__debug__/', include(debug_toolbar.urls)),
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# # Proposed FUTURE URLs spec
|
|
|
|
# path('', HomepageView)
|
|
|
|
# path('/add', AddView)
|
|
|
|
# path('/public', PublicIndexView)
|
|
|
|
# path('/snapshot/:slug', SnapshotView)
|
|
|
|
|
|
|
|
# path('/admin', admin.site.urls)
|
|
|
|
# path('/accounts', django.contrib.auth.urls)
|
|
|
|
|
|
|
|
# # Prposed REST API spec
|
|
|
|
# # :slugs can be uuid, short_uuid, or any of the unique index_fields
|
|
|
|
# path('api/v1/'),
|
|
|
|
# path('api/v1/core/' [GET])
|
|
|
|
# path('api/v1/core/snapshot/', [GET, POST, PUT]),
|
|
|
|
# path('api/v1/core/snapshot/:slug', [GET, PATCH, DELETE]),
|
|
|
|
# path('api/v1/core/archiveresult', [GET, POST, PUT]),
|
|
|
|
# path('api/v1/core/archiveresult/:slug', [GET, PATCH, DELETE]),
|
|
|
|
# path('api/v1/core/tag/', [GET, POST, PUT]),
|
|
|
|
# path('api/v1/core/tag/:slug', [GET, PATCH, DELETE]),
|
|
|
|
|
|
|
|
# path('api/v1/cli/', [GET])
|
|
|
|
# path('api/v1/cli/{add,list,config,...}', [POST]), # pass query as kwargs directly to `run_subcommand` and return stdout, stderr, exitcode
|
|
|
|
|
|
|
|
# path('api/v1/extractors/', [GET])
|
|
|
|
# path('api/v1/extractors/:extractor/', [GET]),
|
|
|
|
# path('api/v1/extractors/:extractor/:func', [GET, POST]), # pass query as args directly to chosen function
|
|
|
|
|
|
|
|
# future, just an idea:
|
|
|
|
# path('api/v1/scheduler/', [GET])
|
|
|
|
# path('api/v1/scheduler/task/', [GET, POST, PUT]),
|
|
|
|
# path('api/v1/scheduler/task/:slug', [GET, PATCH, DELETE]),
|