|
1 | 1 | # Copyright: 2022, ECP, NLnet Labs and the Internet.nl contributors
|
2 | 2 | # SPDX-License-Identifier: Apache-2.0
|
3 | 3 | from django.conf import settings
|
4 |
| -from django.conf.urls import url |
| 4 | +from django.urls import path, re_path |
5 | 5 | from django.conf.urls.static import static
|
6 | 6 |
|
7 | 7 | from interface import views
|
|
17 | 17 | )
|
18 | 18 |
|
19 | 19 | urlpatterns = [
|
20 |
| - url(r"^$", views.indexpage), |
21 |
| - url(r"^statistics/(?P<start_date>[0-9]{8})/(?P<end_date>[0-9]{8})/$", stats.statistics), |
22 |
| - url(r"^copyright/$", views.copyrightpage), |
23 |
| - url(r"^faqs/$", views.faqindexpage), |
24 |
| - url(r"^faqs/report/$", views.faqreport, name="faqs_report"), |
25 |
| - url(r"^faqs/badges/$", views.faqbadges, name="faqs_badges"), |
26 |
| - url(r"^faqs/(?P<subject>[a-zA-Z0-9\-]{1,40})/$", views.faqarticlepage), |
27 |
| - url(r"^usage/$", views.indexpage), |
28 |
| - url(r"^widget-site/$", views.widgetsitepage), |
29 |
| - url(r"^widget-mail/$", views.widgetmailpage), |
30 |
| - url(r"^halloffame/$", views.hofchampionspage), |
31 |
| - url(r"^halloffame/web/$", views.hofwebpage), |
32 |
| - url(r"^halloffame/mail/$", views.hofmailpage), |
33 |
| - url(r"^test-connection/$", views.testconnectionpage), |
34 |
| - url(r"^connection/$", connection.index), |
35 |
| - url(r"^(connection|conn)/gettestid/$", connection.gettestid), |
36 |
| - url(rf"^(connection|conn)/finished/{regex_testid}$", connection.finished), |
37 |
| - url(rf"^(connection|conn)/addr-test/{regex_testid}/$", connection.addr_ipv6), |
38 |
| - url(rf"^(connection|conn)/{regex_testid}/results$", connection.results), |
39 |
| - url(r"^test-site/$", views.testsitepage), |
40 |
| - url(r"^(domain|site)/$", domain.index), |
41 |
| - url(rf"^(domain|site)/{regex_dname}/$", domain.siteprocess), |
42 |
| - url(rf"^(domain|site)/probes/{regex_dname}/$", domain.siteprobesstatus), |
43 |
| - url(rf"^(domain|site)/(?P<probename>(ipv6|tls|dnssec|appsecpriv))/{regex_dname}/$", domain.siteprobeview), |
44 |
| - url(rf"^(domain|site)/{regex_dname}/results$", domain.resultscurrent), |
45 |
| - url(r"^(domain|site)/(?P<dname>.*)/(?P<id>[0-9]+)/$", domain.resultsstored, name="webtest_results"), |
| 20 | + path("", views.indexpage), |
| 21 | + re_path(r"^statistics/(?P<start_date>[0-9]{8})/(?P<end_date>[0-9]{8})/$", stats.statistics), |
| 22 | + path("copyright/", views.copyrightpage), |
| 23 | + path("faqs/", views.faqindexpage), |
| 24 | + path("faqs/report/", views.faqreport, name="faqs_report"), |
| 25 | + path("faqs/badges/", views.faqbadges, name="faqs_badges"), |
| 26 | + re_path(r"^faqs/(?P<subject>[a-zA-Z0-9\-]{1,40})/$", views.faqarticlepage), |
| 27 | + path("usage/", views.indexpage), |
| 28 | + path("widget-site/", views.widgetsitepage), |
| 29 | + path("widget-mail/", views.widgetmailpage), |
| 30 | + path("halloffame/", views.hofchampionspage), |
| 31 | + path("halloffame/web/", views.hofwebpage), |
| 32 | + path("halloffame/mail/", views.hofmailpage), |
| 33 | + path("test-connection/", views.testconnectionpage), |
| 34 | + path("connection/", connection.index), |
| 35 | + re_path(r"^(connection|conn)/gettestid/$", connection.gettestid), |
| 36 | + re_path(rf"^(connection|conn)/finished/{regex_testid}$", connection.finished), |
| 37 | + re_path(rf"^(connection|conn)/addr-test/{regex_testid}/$", connection.addr_ipv6), |
| 38 | + re_path(rf"^(connection|conn)/{regex_testid}/results$", connection.results), |
| 39 | + path("test-site/", views.testsitepage), |
| 40 | + re_path(r"^(domain|site)/$", domain.index), |
| 41 | + re_path(rf"^(domain|site)/{regex_dname}/$", domain.siteprocess), |
| 42 | + re_path(rf"^(domain|site)/probes/{regex_dname}/$", domain.siteprobesstatus), |
| 43 | + re_path(rf"^(domain|site)/(?P<probename>(ipv6|tls|dnssec|appsecpriv))/{regex_dname}/$", domain.siteprobeview), |
| 44 | + re_path(rf"^(domain|site)/{regex_dname}/results$", domain.resultscurrent), |
| 45 | + re_path(r"^(domain|site)/(?P<dname>.*)/(?P<id>[0-9]+)/$", domain.resultsstored, name="webtest_results"), |
46 | 46 | # Non valid domain, convert to punycode and try again
|
47 | 47 | # these url()s should always be the last in the ^domain/ group
|
48 |
| - url(r"^(domain|site)/(?P<dname>.*)/$", domain.validate_domain), |
49 |
| - url(r"^(domain|site)/(?P<dname>.*)/results$", domain.validate_domain), |
50 |
| - url(r"^test-mail/$", views.testmailpage), |
51 |
| - url(r"^mail/$", mail.index), |
52 |
| - url(rf"^mail/{regex_mailaddr}/$", mail.mailprocess), |
53 |
| - url(rf"^mail/probes/{regex_dname}/$", mail.siteprobesstatus), |
54 |
| - url(rf"^mail/(?P<probename>(ipv6|auth|dnssec|tls))/{regex_mailaddr}/$", mail.mailprobeview), |
55 |
| - url(rf"^mail/{regex_mailaddr}/results$", mail.resultscurrent), |
56 |
| - url(r"^mail/(?P<dname>.*)/(?P<id>[0-9]+)/$", mail.resultsstored, name="mailtest_results"), |
| 48 | + re_path(r"^(domain|site)/(?P<dname>.*)/$", domain.validate_domain), |
| 49 | + re_path(r"^(domain|site)/(?P<dname>.*)/results$", domain.validate_domain), |
| 50 | + path("test-mail/", views.testmailpage), |
| 51 | + path("mail/", mail.index), |
| 52 | + re_path(rf"^mail/{regex_mailaddr}/$", mail.mailprocess), |
| 53 | + re_path(rf"^mail/probes/{regex_dname}/$", mail.siteprobesstatus), |
| 54 | + re_path(rf"^mail/(?P<probename>(ipv6|auth|dnssec|tls))/{regex_mailaddr}/$", mail.mailprobeview), |
| 55 | + re_path(rf"^mail/{regex_mailaddr}/results$", mail.resultscurrent), |
| 56 | + re_path(r"^mail/(?P<dname>.*)/(?P<id>[0-9]+)/$", mail.resultsstored, name="mailtest_results"), |
57 | 57 | # Non valid mail, convert to punycode and try again
|
58 | 58 | # these url()s should always be the last in the ^mail/ group
|
59 |
| - url(r"^mail/(?P<mailaddr>.*)/$", mail.validate_domain), |
60 |
| - url(r"^mail/(?P<mailaddr>.*)/results$", mail.validate_domain), |
61 |
| - url(rf"^clear/{regex_dname}/$", views.clear), |
62 |
| - url(r"^change_language/$", views.change_language, name="change_language"), |
| 59 | + re_path(r"^mail/(?P<mailaddr>.*)/$", mail.validate_domain), |
| 60 | + re_path(r"^mail/(?P<mailaddr>.*)/results$", mail.validate_domain), |
| 61 | + re_path(rf"^clear/{regex_dname}/$", views.clear), |
| 62 | + path("change_language/", views.change_language, name="change_language"), |
63 | 63 | ]
|
64 | 64 |
|
65 | 65 | if settings.INTERNETNL_BRANDING:
|
66 | 66 | urlpatterns += [
|
67 |
| - url(r"^contact/$", views.indexpage), |
68 |
| - url(r"^blogs/$", views.blogindexpage), |
69 |
| - url(r"^blogs/(?P<addr>[a-zA-Z0-9\-]{1,40})/$", views.blogarticlepage), |
70 |
| - url(r"^blogs/(?P<author>[a-zA-Z0-9\-]{1,40})/(?P<article>[a-zA-Z0-9\-]{1,80})/$", views.blogarticlepage), |
71 |
| - url(r"^news/$", views.newsindexpage), |
72 |
| - url(r"^news/(?P<article>[a-zA-Z0-9\-]{1,80})/$", views.newsarticlepage), |
73 |
| - url(r"^articles/$", views.articleindexpage), |
74 |
| - url(r"^article/$", views.articlespage), |
75 |
| - url(r"^article/(?P<article>[a-zA-Z0-9\.\-]{1,80})/$", views.articlepage), |
76 |
| - url(r"^about/$", views.aboutpage), |
77 |
| - url(r"^disclosure/$", views.disclosurepage), |
78 |
| - url(r"^privacy/$", views.privacypage), |
| 67 | + path("contact/", views.indexpage), |
| 68 | + path("blogs/", views.blogindexpage), |
| 69 | + re_path(r"^blogs/(?P<addr>[a-zA-Z0-9\-]{1,40})/$", views.blogarticlepage), |
| 70 | + re_path(r"^blogs/(?P<author>[a-zA-Z0-9\-]{1,40})/(?P<article>[a-zA-Z0-9\-]{1,80})/$", views.blogarticlepage), |
| 71 | + path("news/", views.newsindexpage), |
| 72 | + re_path(r"^news/(?P<article>[a-zA-Z0-9\-]{1,80})/$", views.newsarticlepage), |
| 73 | + path("articles/", views.articleindexpage), |
| 74 | + path("article/", views.articlespage), |
| 75 | + re_path(r"^article/(?P<article>[a-zA-Z0-9\.\-]{1,80})/$", views.articlepage), |
| 76 | + path("about/", views.aboutpage), |
| 77 | + path("disclosure/", views.disclosurepage), |
| 78 | + path("privacy/", views.privacypage), |
79 | 79 | ]
|
80 | 80 |
|
81 | 81 | # Host-urls that are accessible by host-only, which should be approachable by developers as well during
|
82 | 82 | # development (although your DNS is probably not set correctly to deal with the tests.
|
83 | 83 | # This is not enabled by default because it returns the ip address (pii) of the requester.
|
84 | 84 | if settings.DEBUG:
|
85 | 85 | urlpatterns += [
|
86 |
| - url(r"^network_ipv4/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_ipv4), |
87 |
| - url(r"^network_ipv6/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_ipv6), |
88 |
| - url(r"^network_resolver/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_resolver), |
| 86 | + re_path(r"^network_ipv4/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_ipv4), |
| 87 | + re_path(r"^network_ipv6/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_ipv6), |
| 88 | + re_path(r"^network_resolver/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_resolver), |
89 | 89 | ]
|
90 | 90 |
|
91 | 91 | if hasattr(settings, "MANUAL_HOF") and settings.MANUAL_HOF:
|
92 | 92 | for key in settings.MANUAL_HOF:
|
93 | 93 | urlpatterns += [
|
94 |
| - url(rf"^halloffame/(?P<manual_url>{key})/$", views.hofmanualpage), |
| 94 | + re_path(rf"^halloffame/(?P<manual_url>{key})/$", views.hofmanualpage), |
95 | 95 | ]
|
96 | 96 |
|
97 | 97 | if hasattr(settings, "HAS_ACCESSIBILITY_PAGE") and settings.HAS_ACCESSIBILITY_PAGE:
|
98 | 98 | urlpatterns += [
|
99 |
| - url(r"^accessibility/$", views.accessibility), |
| 99 | + path("accessibility/", views.accessibility), |
100 | 100 | ]
|
101 | 101 |
|
102 | 102 | if settings.ENABLE_BATCH is True:
|
103 | 103 | urlpatterns += [
|
104 |
| - url( |
| 104 | + re_path( |
105 | 105 | rf"^api/batch/v{BATCH_API_MAJOR_VERSION}/requests$",
|
106 | 106 | batch.endpoint_requests,
|
107 | 107 | name="batch_endpoint_requests",
|
108 | 108 | ),
|
109 |
| - url( |
| 109 | + re_path( |
110 | 110 | rf"^api/batch/v{BATCH_API_MAJOR_VERSION}/requests/{regex_testid}$",
|
111 | 111 | batch.endpoint_request,
|
112 | 112 | name="batch_endpoint_request",
|
113 | 113 | ),
|
114 |
| - url( |
| 114 | + re_path( |
115 | 115 | rf"^api/batch/v{BATCH_API_MAJOR_VERSION}/requests/{regex_testid}/results$",
|
116 | 116 | batch.endpoint_results,
|
117 | 117 | name="batch_endpoint_results",
|
118 | 118 | ),
|
119 |
| - url( |
| 119 | + re_path( |
120 | 120 | rf"^api/batch/v{BATCH_API_MAJOR_VERSION}/requests/{regex_testid}/results_technical$",
|
121 | 121 | batch.endpoint_results_technical,
|
122 | 122 | name="batch_endpoint_results_technical",
|
123 | 123 | ),
|
124 |
| - url( |
| 124 | + re_path( |
125 | 125 | rf"^api/batch/v{BATCH_API_MAJOR_VERSION}/metadata/report$",
|
126 | 126 | batch.endpoint_metadata_report,
|
127 | 127 | name="batch_endpoint_metadata_report",
|
128 | 128 | ),
|
129 |
| - url(r"^api/batch/openapi.yaml$", batch.documentation, name="batch_documentation"), |
| 129 | + re_path(r"^api/batch/openapi.yaml$", batch.documentation, name="batch_documentation"), |
130 | 130 | # The following should always be the last to catch now-invalid urls.
|
131 |
| - url(r"^api/batch/", batch.old_url, name="batch_old"), |
| 131 | + re_path(r"^api/batch/", batch.old_url, name="batch_old"), |
132 | 132 | ]
|
133 | 133 |
|
134 | 134 | # Serve static files for development, for production `whitenoise` app is used and the webserver is
|
|
0 commit comments