mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 14:37:59 +01:00
Added accel redirect support
This commit is contained in:
parent
1a2cfb9104
commit
aea643d9ba
2 changed files with 16 additions and 2 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|
||||||
|
'sendfile' => false,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Application Debug Mode
|
| Application Debug Mode
|
||||||
|
|
|
@ -75,7 +75,13 @@
|
||||||
ResourceLogItem::logItem('track', $id, ResourceLogItem::PLAY, $format['index']);
|
ResourceLogItem::logItem('track', $id, ResourceLogItem::PLAY, $format['index']);
|
||||||
|
|
||||||
$response = Response::make('', 200);
|
$response = Response::make('', 200);
|
||||||
|
|
||||||
|
if (App::config('app.sendfile')) {
|
||||||
$response->header('X-Sendfile', $track->getFileFor('MP3'));
|
$response->header('X-Sendfile', $track->getFileFor('MP3'));
|
||||||
|
} else {
|
||||||
|
$response->header('X-Accel-Redirect', $track->getFileFor('MP3'));
|
||||||
|
}
|
||||||
|
|
||||||
$response->header('Content-Disposition', 'filename="' . $track->getFilenameFor('MP3') . '"');
|
$response->header('Content-Disposition', 'filename="' . $track->getFilenameFor('MP3') . '"');
|
||||||
$response->header('Content-Type', $format['mime_type']);
|
$response->header('Content-Type', $format['mime_type']);
|
||||||
|
|
||||||
|
@ -104,7 +110,13 @@
|
||||||
ResourceLogItem::logItem('track', $id, ResourceLogItem::DOWNLOAD, $format['index']);
|
ResourceLogItem::logItem('track', $id, ResourceLogItem::DOWNLOAD, $format['index']);
|
||||||
|
|
||||||
$response = Response::make('', 200);
|
$response = Response::make('', 200);
|
||||||
$response->header('X-Sendfile', $track->getFileFor($formatName));
|
|
||||||
|
if (App::config('app.sendfile')) {
|
||||||
|
$response->header('X-Sendfile', $track->getFileFor('MP3'));
|
||||||
|
} else {
|
||||||
|
$response->header('X-Accel-Redirect', $track->getFileFor('MP3'));
|
||||||
|
}
|
||||||
|
|
||||||
$response->header('Content-Disposition', 'attachment; filename="' . $track->getDownloadFilenameFor($formatName) . '"');
|
$response->header('Content-Disposition', 'attachment; filename="' . $track->getDownloadFilenameFor($formatName) . '"');
|
||||||
$response->header('Content-Type', $format['mime_type']);
|
$response->header('Content-Type', $format['mime_type']);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue