Skip to content

Commit

Permalink
fix!(server): remove API v1 system endpoint
Browse files Browse the repository at this point in the history
This change also raises the minimum required shippy version to 2.27.0,
since that's the first version to use the v2 API endpoint.
  • Loading branch information
ericswpark committed Dec 12, 2023
1 parent 0a2db23 commit cef919c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 30 deletions.
6 changes: 3 additions & 3 deletions server/api/tests/shippy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from api.views import v1_maintainers_login, v1_system_info
from api.views import v1_maintainers_login, v2_system_info
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
Expand Down Expand Up @@ -27,10 +27,10 @@ def setUp(self):
# Add dummy user to mock device bullhead
Device.objects.get(codename="bullhead").maintainers.add(self.user)

def test_v1_system_info(self):
def test_v2_system_info(self):
request = self.factory.get("/api/v1/system/info/")
request.user = AnonymousUser()
response = v1_system_info(request)
response = v2_system_info(request)

self.assertEqual(response.status_code, 200)
self.assertEqual(response.data["version"], settings.SHIPPER_VERSION)
Expand Down
2 changes: 0 additions & 2 deletions server/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
v1_maintainers_login,
v1_maintainers_token_check,
v1_maintainers_upload_filename_regex_pattern,
v1_system_info,
V2DownloadBuildCounter,
v2_system_info,
)
Expand Down Expand Up @@ -106,7 +105,6 @@
name="latest_maintainers_build_enabled_status_modify",
),
path("v2/system/info/", v2_system_info, name="v2_system_info"),
path("v1/system/info/", v1_system_info, name="v1_system_info"),
path("v1/maintainers/login/", v1_maintainers_login, name="v1_maintainers_login"),
path(
"v1/maintainers/token_check/",
Expand Down
2 changes: 0 additions & 2 deletions server/api/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
v1_maintainers_login,
v1_maintainers_token_check,
v1_maintainers_upload_filename_regex_pattern,
v1_system_info,
v2_system_info,
)
from .statistics import (
Expand All @@ -32,7 +31,6 @@
"v1_maintainers_login",
"v1_maintainers_token_check",
"v1_maintainers_upload_filename_regex_pattern",
"v1_system_info",
"v2_system_info",
"V2DownloadBuildCounter",
"v1_download_count_day",
Expand Down
22 changes: 0 additions & 22 deletions server/api/views/shippy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import html
import json

from constance import config
from django.conf import settings
Expand Down Expand Up @@ -156,27 +155,6 @@ def v1_maintainers_login(request):
)


@csrf_exempt
@api_view(["GET"])
@permission_classes((AllowAny,))
def v1_system_info(_):
"""
Returns shipper system information
:return: the current shipper system information
"""
variants = {v.codename: v.description for v in Variant.objects.all()}
return Response(
{
"version": settings.SHIPPER_VERSION,
"shippy_compat_version": settings.SHIPPER_SHIPPY_COMPAT_VERSION,
"shippy_upload_checksum_type": settings.DRF_CHUNKED_UPLOAD_CHECKSUM,
"shippy_allowed_versions": config.SHIPPER_ALLOWED_VERSIONS_TO_UPLOAD,
"shippy_upload_variants": json.dumps(variants),
}
)


@csrf_exempt
@api_view(["GET"])
@permission_classes((AllowAny,))
Expand Down
2 changes: 1 addition & 1 deletion server/shippy_compat_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.0
2.27.0

0 comments on commit cef919c

Please sign in to comment.