added ModPacks support

This commit is contained in:
2026-08-04 20:23:32 -05:00
parent ef7147ca83
commit 50a70bfe31
4 changed files with 227 additions and 29 deletions
+6 -4
View File
@@ -638,6 +638,8 @@ def _reparse_version(version):
version.animation_manifest = read_animation_manifest(path) or {}
version.models_manifest = read_models_manifest(path) or {}
version.logical_manifest = read_logical_manifest(path) or {}
manifest = parse_mods_manifest(path, release.file.original_filename)
version.mods_manifest = manifest if manifest.get('files') else {}
fmt, desc = read_pack_mcmeta(path)
if fmt is not None:
version.pack_format = fmt
@@ -673,8 +675,8 @@ def _finalize_version(project, version_name, changelog, temp_uploads, actor):
temp.status = 'used'
temp.save(update_fields=['status'])
is_zip = (index.original_filename or '').lower().endswith('.zip')
if not is_zip:
is_archive = (index.original_filename or '').lower().endswith(('.zip', '.mrpack'))
if not is_archive:
continue
path = _stored_path(index)
@@ -780,7 +782,7 @@ def project_create(request):
version_files,
request.user,
)
if missing_animation_id:
if missing_animation_id and project.category == 'non_pack':
messages.warning(request, ANIMATION_API_WARNING)
for temp in TempUpload.objects.filter(
@@ -935,7 +937,7 @@ def version_upload(request, slug):
version_files,
request.user,
)
if missing_animation_id:
if missing_animation_id and project.category == 'non_pack':
messages.warning(request, ANIMATION_API_WARNING)
messages.success(request, f'Version {form.cleaned_data["version_name"]} uploaded.')
return redirect('library:project_detail', slug=project.slug)