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

@@ -8,6 +8,8 @@ use Illuminate\Http\Client\ConnectionException;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
class FileServersService {
@@ -69,15 +71,38 @@ class FileServersService {
* @param EntryFile $file
* @return string
*/
public function getDownloadFileUrl( EntryFile $file ): string
public function getDownloadFileUrl( EntryFile $file, bool $countDownload = true ): string
{
$serverKey = $this->getEntryFileServerKey( $file );
$url = $this->servers[$serverKey]['download'] ?? "#";
if( $url === "#" )
return $url;
return $url . "&" . http_build_query( [ 'filename' => $file->filename, 'filepath' => $file->filepath ] );
$args = [ 'filename' => $file->filename, 'filepath' => $file->filepath ];
if( !$countDownload )
$args['count_download'] = false;
return $url . "&" . http_build_query( $args );
}
public function getArchiveExplorerUrl( EntryFile $file ): ?string
{
if( !Str::endsWith( $file->filename, ['zip', 'rar', '7z'] ) )
return null;
$serverKey = $this->getEntryFileServerKey( $file );
$url = $this->servers[$serverKey]['file_explorer'] ?? "#";
if( $url === "#" )
return null;
$args = [ 'filename' => $file->filename, 'filepath' => $file->filepath,
'zeus' => $this->generateZeusToken(\Auth::user()->user_id ?? 0, $this->servers[$serverKey]['base_url'], 'Fileexplorer')
];
return $url . "&" . http_build_query( $args );
}
/**
@@ -137,11 +162,13 @@ class FileServersService {
foreach( $this->servers as $serverKey => $server ){
$response = Http::withHeaders([])
$token = $this->generateZeusToken( $userId, $server['base_url'], "Deletefile" );
$response = Http::asForm()->withHeaders([])
->post( $server['delete_file'], [
'filepath' => $filePath,
'filename' => $fileName,
'zeus' => $this->generateZeusToken( $userId, $server['base_url'], "Deletefile" ),
'zeus' => $token,
]);
if (!$response->successful()) {