You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.6 KiB

10 years ago
10 years ago
10 years ago
10 years ago
  1. from urllib.parse import quote, unquote
  2. from django.urls import path, register_converter
  3. from hc.api import views
  4. class QuoteConverter:
  5. regex = "[\w%~_.-]+"
  6. def to_python(self, value):
  7. return unquote(value)
  8. def to_url(self, value):
  9. return quote(value, safe="")
  10. register_converter(QuoteConverter, "quoted")
  11. urlpatterns = [
  12. path("ping/<uuid:code>/", views.ping, name="hc-ping-slash"),
  13. path("ping/<uuid:code>", views.ping, name="hc-ping"),
  14. path("ping/<uuid:code>/fail", views.ping, {"action": "fail"}, name="hc-fail"),
  15. path("ping/<uuid:code>/start", views.ping, {"action": "start"}, name="hc-start"),
  16. path("api/v1/checks/", views.checks),
  17. path("api/v1/checks/<uuid:code>", views.update, name="hc-api-update"),
  18. path("api/v1/checks/<uuid:code>/pause", views.pause, name="hc-api-pause"),
  19. path("api/v1/notifications/<uuid:code>/bounce", views.bounce, name="hc-api-bounce"),
  20. path("api/v1/channels/", views.channels),
  21. path(
  22. "badge/<slug:badge_key>/<slug:signature>/<quoted:tag>.svg",
  23. views.badge,
  24. name="hc-badge",
  25. ),
  26. path(
  27. "badge/<slug:badge_key>/<slug:signature>.svg",
  28. views.badge,
  29. {"tag": "*"},
  30. name="hc-badge-all",
  31. ),
  32. path(
  33. "badge/<slug:badge_key>/<slug:signature>/<quoted:tag>.json",
  34. views.badge,
  35. {"format": "json"},
  36. name="hc-badge-json",
  37. ),
  38. path(
  39. "badge/<slug:badge_key>/<slug:signature>.json",
  40. views.badge,
  41. {"format": "json", "tag": "*"},
  42. name="hc-badge-json-all",
  43. ),
  44. path("api/v1/status/", views.status),
  45. ]