(self, request, pk)
| 996 | responses={200: PluginRepoSerializer, 404: inline_serializer(name="RepoRefreshNotFound", fields={"error": serializers.CharField()}), 502: inline_serializer(name="RepoRefreshError", fields={"error": serializers.CharField()})}, |
| 997 | ) |
| 998 | def post(self, request, pk): |
| 999 | try: |
| 1000 | repo = PluginRepo.objects.get(pk=pk) |
| 1001 | except PluginRepo.DoesNotExist: |
| 1002 | return Response( |
| 1003 | {"error": "Repo not found"}, status=status.HTTP_404_NOT_FOUND |
| 1004 | ) |
| 1005 | try: |
| 1006 | key_text = repo.public_key if not repo.is_official else None |
| 1007 | data, verified = _fetch_manifest(repo.url, public_key_text=key_text) |
| 1008 | except Exception as e: |
| 1009 | logger.exception("Manifest fetch failed for %s", repo.url) |
| 1010 | return Response( |
| 1011 | {"error": "Failed to fetch manifest. Check the URL and try again."}, |
| 1012 | status=status.HTTP_502_BAD_GATEWAY, |
| 1013 | ) |
| 1014 | err = _save_fetched_manifest_to_repo(repo, data, verified) |
| 1015 | if err: |
| 1016 | return Response({"error": err}, status=status.HTTP_400_BAD_REQUEST) |
| 1017 | _unmanage_dropped_slugs(repo, data) |
| 1018 | _invalidate_plugin_detail_cache(repo.id, data) |
| 1019 | return Response(PluginRepoSerializer(repo).data) |
| 1020 | |
| 1021 | |
| 1022 | class AvailablePluginsAPIView(PluginAuthMixin, APIView): |
nothing calls this directly
no test coverage detected