mirror of
https://github.com/dolphin-emu/www.git
synced 2026-01-31 01:05:23 +01:00
update: Add 'info' endpoint to request information about a Dolphin version.
This commit is contained in:
@@ -8,9 +8,14 @@ urlpatterns = [
|
||||
# /update/latest/beta/
|
||||
url(r'^latest/(?P<track>\w+)/?$', views.latest, name='update_latest'),
|
||||
|
||||
# /update/check/dev/0000000...000
|
||||
# /update/check/beta/000000...000
|
||||
# /update/check/v1/dev/0000000000000000000000000000000000000000/win
|
||||
# /update/check/v1/beta/0000000000000000000000000000000000000000/win
|
||||
url(r'^check/v(?P<updater_ver>\d+)/(?P<track>\w+)/(?P<version>[0-9a-f]{40})/?(?P<platform>[A-Za-z0-9-_]+)?$',
|
||||
views.check,
|
||||
name='update_check'),
|
||||
|
||||
# /update/info/v1/0000000000000000000000000000000000000000/win
|
||||
url(r'^info/v(?P<updater_ver>\d+)/(?P<version>[0-9a-f]{40})/?(?P<platform>[A-Za-z0-9-_]+)?$',
|
||||
views.info,
|
||||
name='update_info'),
|
||||
]
|
||||
|
||||
@@ -175,3 +175,31 @@ def _check_on_manually_maintained_track(request, track, version, old_platform, n
|
||||
return _make_up_to_date_response()
|
||||
changelog = _changelog_from_update_track(newer_versions)
|
||||
return _make_outdated_response(version, new_version, old_platform, new_platform, changelog)
|
||||
|
||||
|
||||
@cache_control(max_age=15)
|
||||
def info(request, updater_ver, version, platform):
|
||||
if updater_ver != "1":
|
||||
return _error_response(400,
|
||||
"Unsupported updater version %r" % updater_ver)
|
||||
|
||||
target_system = _UPDATE_SYSTEM_TO_ARTIFACT_NAME.get(platform)
|
||||
if target_system is None:
|
||||
return _error_response(400,
|
||||
"Unsupported platform %r" % platform)
|
||||
|
||||
try:
|
||||
version = DevVersion.objects.get(hash=version)
|
||||
except DevVersion.DoesNotExist:
|
||||
return _error_response(404, "No version %r exists" % version)
|
||||
|
||||
if version.artifacts.filter(target_system=target_system).count() == 0:
|
||||
return _error_response(404, "No version %r exists on platform %r" % (version, platform))
|
||||
|
||||
return _make_info_response(version, platform)
|
||||
|
||||
def _make_info_response(version, platform):
|
||||
return JsonResponse({
|
||||
"content-store": settings.UPDATE_CONTENT_STORE_URL,
|
||||
"info": _serialize_version(version, platform),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user