From 8cd7a9a96fa5c1247a4869f70767c59b242e3a68 Mon Sep 17 00:00:00 2001 From: Oksamies Date: Thu, 22 Aug 2024 14:19:01 +0300 Subject: [PATCH] Add api urls for ts-scanners --- django/thunderstore/api/urls.py | 3 ++- django/thunderstore/plugins/base.py | 4 ++++ django/thunderstore/plugins/registry.py | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/django/thunderstore/api/urls.py b/django/thunderstore/api/urls.py index d005dc434..a054f6458 100644 --- a/django/thunderstore/api/urls.py +++ b/django/thunderstore/api/urls.py @@ -30,6 +30,7 @@ UserDeleteAPIView, UserLinkedAccountDisconnectAPIView, ) +from thunderstore.plugins.registry import plugin_registry cyberstorm_urls = [ path( @@ -172,4 +173,4 @@ EditTeamMemberAPIView.as_view(), name="cyberstorm.team.members.edit", ), -] +] + plugin_registry.get_api_urls() diff --git a/django/thunderstore/plugins/base.py b/django/thunderstore/plugins/base.py index d072920e0..90865b6ea 100644 --- a/django/thunderstore/plugins/base.py +++ b/django/thunderstore/plugins/base.py @@ -30,6 +30,10 @@ def get_legacy_package_urls(cls) -> List[URLPattern]: def get_new_package_urls(cls) -> List[URLPattern]: return [] + @classmethod + def get_api_urls(cls) -> List[URLPattern]: + return [] + @classmethod def get_package_tabs( cls, diff --git a/django/thunderstore/plugins/registry.py b/django/thunderstore/plugins/registry.py index 82c6bd7e9..315c2b83b 100644 --- a/django/thunderstore/plugins/registry.py +++ b/django/thunderstore/plugins/registry.py @@ -44,6 +44,9 @@ def get_legacy_package_urls(self) -> List[URLPattern]: def get_new_package_urls(self) -> List[URLPattern]: return list(itertools.chain(*(x.get_new_package_urls() for x in self.plugins))) + def get_api_urls(self) -> List[URLPattern]: + return list(itertools.chain(*(x.get_api_urls() for x in self.plugins))) + def get_package_tabs( self, user: "UserType", listing: "PackageListing" ) -> Dict[str, "PartialTab"]: