Added Download file, play for homebrews and ZIP explorer.

This commit is contained in:
2026-06-16 18:35:01 +02:00
parent 7e1e26f20b
commit 279160c1cb
12 changed files with 215 additions and 24 deletions

View File

@@ -63,8 +63,10 @@ class SubmissionsService {
if( $files === [] )
return [];
$service = app(FileServersService::class);
return array_map(
function( string $uuid ) {
function( string $uuid ) use ($service) {
$file = EntryFile::where('file_uuid', $uuid)->first();
if( $file )
@@ -78,6 +80,9 @@ class SubmissionsService {
'error' => null,
'uuid' => $uuid,
'state' => $file->state,
'file_explorer' => $service->getArchiveExplorerUrl($file),
'file_explorer_files' => null,
'download_url' => $service->getDownloadFileUrl($file, false),
'can_be_online_patched' => EntryHelpers::enableOnlinePatcherBasedOnExtension($file['filename']),
'meta_online_patcher' => $file->online_patcher,
'meta_secondary_online_patcher' => $file->secondary_online_patcher,
@@ -98,6 +103,9 @@ class SubmissionsService {
'error' => null,
'uuid' => $uuid,
'state' => $file['state'],
'file_explorer' => null,
'file_explorer_files' => null,
'download_url' => null,
'can_be_online_patched' => EntryHelpers::enableOnlinePatcherBasedOnExtension($file['filename']),
'meta_online_patcher' => false,
'meta_secondary_online_patcher' => false,
@@ -707,10 +715,10 @@ class SubmissionsService {
$needDeletion = array_diff( $existingUuids, $requestUuids );
if( !empty( $needDeletion ) ){
$userId = \Auth::user()->user_id;
EntryFile::where('entry_id', $entryId)->whereIn('file_uuid', $needDeletion)->get()->each( function ( $f ) use ( $userId ) {
EntryFile::where('entry_id', $entryId)->whereIn('file_uuid', $needDeletion)->whereNot('state', 'archived')->get()->each( function ( $f ) use ( $userId ) {
DeleteFile::dispatch( $f->filepath, $f->filename, $userId);
});
EntryFile::where('entry_id', $entryId)->whereIn('file_uuid', $needDeletion)->delete();
EntryFile::where('entry_id', $entryId)->whereIn('file_uuid', $needDeletion)->whereNot('state', 'archived')->delete();
}
$needAddition = array_diff( $requestUuids, $existingUuids );