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

@@ -77,9 +77,11 @@ class FileServerController extends Controller {
abort(404);
}
if( !EntryHelpers::fileAlreadyDownloaded($file) ) {
EntryHelpers::markFileAsDownloaded($file);
$file->increaseDownloadCount();
if($request->input('count_download', true)) {
if (!EntryHelpers::fileAlreadyDownloaded($file)) {
EntryHelpers::markFileAsDownloaded($file);
$file->increaseDownloadCount();
}
}
return redirect( $this->fs->getDownloadFileUrl( $file) );

View File

@@ -12,13 +12,12 @@ class ToolsController extends Controller
public function patcher()
{
return view('tools.patcher');
}
public function directPatch( Request $request, int $entryId, EntryFile $file )
{
if( $file->entry_id != $entryId ) {
if( $file->entry_id != $entryId || $file->state === 'private' ) {
abort(404);
}
@@ -38,22 +37,28 @@ class ToolsController extends Controller
public function play( Request $request, int $entryId, EntryFile $file )
{
if( $file->entry_id != $entryId ) {
if( $file->entry_id != $entryId || $file->state === 'private' ) {
abort(404);
}
$service = app(FileServersService::class);
$patches = [
'file' => $service->getDownloadFileUrl( $file ),
'name' => $file->entry->title,
'outputName' => $file->filename
];
$emuConfig = [
'core' => $file->playOnlineSetting?->core,
'threads' => $file->playOnlineSetting?->threads,
];
if( $file->entry->type === 'homebrew' ){
$filePath = $service->getDownloadFileUrl( $file );
return view('tools.play-homebrew', compact('filePath', 'emuConfig'));
}
$patches = [
'file' => $service->getDownloadFileUrl( $file ),
'name' => $file->entry->title,
'outputName' => $file->filename
];
return view('tools.play', compact('patches', 'emuConfig'));
}
}