mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 22:47:59 +01:00
commit
e030bf2591
32 changed files with 98 additions and 98 deletions
|
@ -88,7 +88,7 @@ class CreateCommentCommand extends CommandBase
|
||||||
if ($this->_type == 'playlist') {
|
if ($this->_type == 'playlist') {
|
||||||
$column = 'playlist_id';
|
$column = 'playlist_id';
|
||||||
} else {
|
} else {
|
||||||
App::abort(500);
|
abort(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ class CreateCommentCommand extends CommandBase
|
||||||
} elseif ($this->_type === 'user') {
|
} elseif ($this->_type === 'user') {
|
||||||
$entity = User::find($this->_id);
|
$entity = User::find($this->_id);
|
||||||
} else {
|
} else {
|
||||||
App::abort(400, 'This comment is being added to an invalid entity!');
|
abort(400, 'This comment is being added to an invalid entity!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$entity->comment_count = Comment::where($column, $this->_id)->count();
|
$entity->comment_count = Comment::where($column, $this->_id)->count();
|
||||||
|
|
|
@ -278,7 +278,7 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
}
|
}
|
||||||
|
|
||||||
// write temporary image file
|
// write temporary image file
|
||||||
$tmpPath = Config::get('ponyfm.files_directory').'/tmp';
|
$tmpPath = config('ponyfm.files_directory').'/tmp';
|
||||||
|
|
||||||
$filename = $file->getFilename().".cover.${extension}";
|
$filename = $file->getFilename().".cover.${extension}";
|
||||||
$imageFilePath = "${tmpPath}/${filename}";
|
$imageFilePath = "${tmpPath}/${filename}";
|
||||||
|
|
|
@ -134,15 +134,15 @@ class UploadTrackCommand extends CommandBase
|
||||||
}
|
}
|
||||||
$this->_track->ensureDirectoryExists();
|
$this->_track->ensureDirectoryExists();
|
||||||
|
|
||||||
if (! is_dir(Config::get('ponyfm.files_directory').'/tmp')) {
|
if (! is_dir(config('ponyfm.files_directory').'/tmp')) {
|
||||||
mkdir(Config::get('ponyfm.files_directory').'/tmp', 0755, true);
|
mkdir(config('ponyfm.files_directory').'/tmp', 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! is_dir(Config::get('ponyfm.files_directory').'/queued-tracks')) {
|
if (! is_dir(config('ponyfm.files_directory').'/queued-tracks')) {
|
||||||
mkdir(Config::get('ponyfm.files_directory').'/queued-tracks', 0755, true);
|
mkdir(config('ponyfm.files_directory').'/queued-tracks', 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$trackFile = $trackFile->move(Config::get('ponyfm.files_directory').'/queued-tracks', $this->_track->id.'v'.$this->_version);
|
$trackFile = $trackFile->move(config('ponyfm.files_directory').'/queued-tracks', $this->_track->id.'v'.$this->_version);
|
||||||
|
|
||||||
$input = Request::all();
|
$input = Request::all();
|
||||||
$input['track'] = $trackFile;
|
$input['track'] = $trackFile;
|
||||||
|
|
|
@ -77,8 +77,8 @@ class FixMLPMAImages extends Command
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$mlpmaPath = Config::get('ponyfm.files_directory').'/mlpma';
|
$mlpmaPath = config('ponyfm.files_directory').'/mlpma';
|
||||||
$tmpPath = Config::get('ponyfm.files_directory').'/tmp';
|
$tmpPath = config('ponyfm.files_directory').'/tmp';
|
||||||
|
|
||||||
$this->comment('Enumerating MLP Music Archive source files...');
|
$this->comment('Enumerating MLP Music Archive source files...');
|
||||||
$files = File::allFiles($mlpmaPath);
|
$files = File::allFiles($mlpmaPath);
|
||||||
|
|
|
@ -86,7 +86,7 @@ class ImportEQBeats extends Command
|
||||||
pcntl_signal(SIGINT, [$this, 'handleInterrupt']);
|
pcntl_signal(SIGINT, [$this, 'handleInterrupt']);
|
||||||
|
|
||||||
$archivePath = $this->argument('archiveFolder');
|
$archivePath = $this->argument('archiveFolder');
|
||||||
$tmpPath = Config::get('ponyfm.files_directory').'/tmp';
|
$tmpPath = config('ponyfm.files_directory').'/tmp';
|
||||||
|
|
||||||
if (! File::exists($tmpPath)) {
|
if (! File::exists($tmpPath)) {
|
||||||
File::makeDirectory($tmpPath);
|
File::makeDirectory($tmpPath);
|
||||||
|
|
|
@ -399,6 +399,6 @@ class MigrateOldData extends Command
|
||||||
{
|
{
|
||||||
$dir = (string) (floor($id / 100) * 100);
|
$dir = (string) (floor($id / 100) * 100);
|
||||||
|
|
||||||
return \Config::get('ponyfm.files_directory').'/'.$type.'/'.$dir;
|
return config('ponyfm.files_directory').'/'.$type.'/'.$dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,16 +28,16 @@ class AccountController extends Controller
|
||||||
{
|
{
|
||||||
public function getIndex()
|
public function getIndex()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRegister()
|
public function getRegister()
|
||||||
{
|
{
|
||||||
return Redirect::to(Config::get('poniverse.urls')['register']);
|
return redirect(config('poniverse.urls')['register']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNotifications()
|
public function getNotifications()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,36 +26,36 @@ class AdminController extends Controller
|
||||||
{
|
{
|
||||||
public function getIndex()
|
public function getIndex()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGenres()
|
public function getGenres()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTracks()
|
public function getTracks()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShowSongs()
|
public function getShowSongs()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUsers()
|
public function getUsers()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getClassifierQueue()
|
public function getClassifierQueue()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAnnouncements()
|
public function getAnnouncements()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,28 +32,28 @@ class AlbumsController extends Controller
|
||||||
{
|
{
|
||||||
public function getIndex()
|
public function getIndex()
|
||||||
{
|
{
|
||||||
return View::make('albums.index');
|
return view('albums.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShow($id, $slug)
|
public function getShow($id, $slug)
|
||||||
{
|
{
|
||||||
$album = Album::find($id);
|
$album = Album::find($id);
|
||||||
if (! $album) {
|
if (! $album) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($album->slug != $slug) {
|
if ($album->slug != $slug) {
|
||||||
return Redirect::action('AlbumsController@getAlbum', [$id, $album->slug]);
|
return Redirect::action('AlbumsController@getAlbum', [$id, $album->slug]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::make('albums.show');
|
return view('albums.show');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShortlink($id)
|
public function getShortlink($id)
|
||||||
{
|
{
|
||||||
$album = Album::find($id);
|
$album = Album::find($id);
|
||||||
if (! $album) {
|
if (! $album) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::action('AlbumsController@getShow', [$id, $album->slug]);
|
return Redirect::action('AlbumsController@getShow', [$id, $album->slug]);
|
||||||
|
@ -63,7 +63,7 @@ class AlbumsController extends Controller
|
||||||
{
|
{
|
||||||
$album = Album::with('tracks', 'tracks.trackFiles', 'user')->find($id);
|
$album = Album::with('tracks', 'tracks.trackFiles', 'user')->find($id);
|
||||||
if (! $album) {
|
if (! $album) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$format = null;
|
$format = null;
|
||||||
|
@ -78,11 +78,11 @@ class AlbumsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($format == null) {
|
if ($format == null) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $album->hasLosslessTracks() && in_array($formatName, Track::$LosslessFormats)) {
|
if (! $album->hasLosslessTracks() && in_array($formatName, Track::$LosslessFormats)) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceLogItem::logItem('album', $id, ResourceLogItem::DOWNLOAD, $format['index']);
|
ResourceLogItem::logItem('album', $id, ResourceLogItem::DOWNLOAD, $format['index']);
|
||||||
|
|
|
@ -72,7 +72,7 @@ class AlbumsController extends ApiControllerBase
|
||||||
->find($id);
|
->find($id);
|
||||||
|
|
||||||
if (! $album) {
|
if (! $album) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Request::get('log')) {
|
if (Request::get('log')) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ArtistsController extends ApiControllerBase
|
||||||
{
|
{
|
||||||
$user = User::where('slug', $slug)->whereNull('disabled_at')->first();
|
$user = User::where('slug', $slug)->whereNull('disabled_at')->first();
|
||||||
if (! $user) {
|
if (! $user) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$favs = Favourite::where('user_id', $user->id)
|
$favs = Favourite::where('user_id', $user->id)
|
||||||
|
@ -88,7 +88,7 @@ class ArtistsController extends ApiControllerBase
|
||||||
{
|
{
|
||||||
$user = User::where('slug', $slug)->whereNull('disabled_at')->first();
|
$user = User::where('slug', $slug)->whereNull('disabled_at')->first();
|
||||||
if (! $user) {
|
if (! $user) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = Track::summary()
|
$query = Track::summary()
|
||||||
|
@ -137,7 +137,7 @@ class ArtistsController extends ApiControllerBase
|
||||||
])
|
])
|
||||||
->first();
|
->first();
|
||||||
if (! $user) {
|
if (! $user) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$trackQuery = Track::summary()
|
$trackQuery = Track::summary()
|
||||||
|
|
|
@ -50,7 +50,7 @@ class CommentsController extends ApiControllerBase
|
||||||
if ($type == 'playlist') {
|
if ($type == 'playlist') {
|
||||||
$column = 'playlist_id';
|
$column = 'playlist_id';
|
||||||
} else {
|
} else {
|
||||||
App::abort(500);
|
abort(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ class PlaylistsController extends ApiControllerBase
|
||||||
'comments.user',
|
'comments.user',
|
||||||
])->userDetails()->find($id);
|
])->userDetails()->find($id);
|
||||||
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
||||||
App::abort('404');
|
abort('404');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Request::get('log')) {
|
if (Request::get('log')) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ class ArtistsController extends Controller
|
||||||
{
|
{
|
||||||
public function getIndex()
|
public function getIndex()
|
||||||
{
|
{
|
||||||
return View::make('artists.index');
|
return view('artists.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFavourites($slug)
|
public function getFavourites($slug)
|
||||||
|
@ -56,12 +56,12 @@ class ArtistsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->disabled_at) {
|
if ($user->disabled_at) {
|
||||||
App::abort('404');
|
abort('404');
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::make('artists.profile');
|
return view('artists.profile');
|
||||||
} else {
|
} else {
|
||||||
App::abort('404');
|
abort('404');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class ArtistsController extends Controller
|
||||||
{
|
{
|
||||||
$user = User::find($id);
|
$user = User::find($id);
|
||||||
if (! $user || $user->disabled_at !== null) {
|
if (! $user || $user->disabled_at !== null) {
|
||||||
App::abort('404');
|
abort('404');
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::action('ArtistsController@getProfile', [$user->slug]);
|
return Redirect::action('ArtistsController@getProfile', [$user->slug]);
|
||||||
|
|
|
@ -44,20 +44,20 @@ class AuthController extends Controller
|
||||||
public function getLogin()
|
public function getLogin()
|
||||||
{
|
{
|
||||||
if (Auth::guest()) {
|
if (Auth::guest()) {
|
||||||
return Redirect::to(
|
return redirect(
|
||||||
$this->poniverse
|
$this->poniverse
|
||||||
->getOAuthProvider(['redirectUri' => action('AuthController@getOAuth')])
|
->getOAuthProvider(['redirectUri' => action('AuthController@getOAuth')])
|
||||||
->getAuthorizationUrl());
|
->getAuthorizationUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::to('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postLogout()
|
public function postLogout()
|
||||||
{
|
{
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
|
|
||||||
return Redirect::to('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOAuth()
|
public function getOAuth()
|
||||||
|
@ -74,7 +74,7 @@ class AuthController extends Controller
|
||||||
} catch (IdentityProviderException $e) {
|
} catch (IdentityProviderException $e) {
|
||||||
Log::error($e);
|
Log::error($e);
|
||||||
|
|
||||||
return Redirect::to('/')->with(
|
return redirect('/')->with(
|
||||||
'message',
|
'message',
|
||||||
'Unfortunately we are having problems attempting to log you in at the moment. Please try again at a later time.'
|
'Unfortunately we are having problems attempting to log you in at the moment. Please try again at a later time.'
|
||||||
);
|
);
|
||||||
|
@ -161,6 +161,6 @@ class AuthController extends Controller
|
||||||
{
|
{
|
||||||
Auth::login($user, $rememberMe);
|
Auth::login($user, $rememberMe);
|
||||||
|
|
||||||
return Redirect::to('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,16 +26,16 @@ class ContentController extends Controller
|
||||||
{
|
{
|
||||||
public function getTracks()
|
public function getTracks()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAlbums()
|
public function getAlbums()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPlaylist()
|
public function getPlaylist()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,6 @@ class HomeController extends Controller
|
||||||
{
|
{
|
||||||
public function getIndex()
|
public function getIndex()
|
||||||
{
|
{
|
||||||
return View::make('home.index');
|
return view('home.index');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,24 +33,24 @@ class ImagesController extends Controller
|
||||||
$coverType = Image::getImageTypeFromName($type);
|
$coverType = Image::getImageTypeFromName($type);
|
||||||
|
|
||||||
if ($coverType == null) {
|
if ($coverType == null) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$image = Image::find($id);
|
$image = Image::find($id);
|
||||||
if (! $image) {
|
if (! $image) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = Response::make('', 200);
|
$response = response('', 200);
|
||||||
$filename = $image->getFile($coverType['id']);
|
$filename = $image->getFile($coverType['id']);
|
||||||
|
|
||||||
if (! is_file($filename)) {
|
if (! is_file($filename)) {
|
||||||
$redirect = url('/images/icons/profile_'.Image::$ImageTypes[$coverType['id']]['name'].'.png');
|
$redirect = url('/images/icons/profile_'.Image::$ImageTypes[$coverType['id']]['name'].'.png');
|
||||||
|
|
||||||
return Redirect::to($redirect);
|
return redirect($redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::get('app.sendfile')) {
|
if (config('app.sendfile')) {
|
||||||
$response->header('X-Sendfile', $filename);
|
$response->header('X-Sendfile', $filename);
|
||||||
} else {
|
} else {
|
||||||
$response->header('X-Accel-Redirect', $filename);
|
$response->header('X-Accel-Redirect', $filename);
|
||||||
|
|
|
@ -68,6 +68,6 @@ class NotificationsController extends Controller
|
||||||
|
|
||||||
public function getEmailUnsubscribePage()
|
public function getEmailUnsubscribePage()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,28 +33,28 @@ class PlaylistsController extends Controller
|
||||||
{
|
{
|
||||||
public function getIndex()
|
public function getIndex()
|
||||||
{
|
{
|
||||||
return View::make('playlists.index');
|
return view('playlists.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPlaylist($id, $slug)
|
public function getPlaylist($id, $slug)
|
||||||
{
|
{
|
||||||
$playlist = Playlist::find($id);
|
$playlist = Playlist::find($id);
|
||||||
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($playlist->slug != $slug) {
|
if ($playlist->slug != $slug) {
|
||||||
return Redirect::action('PlaylistsController@getPlaylist', [$id, $playlist->slug]);
|
return Redirect::action('PlaylistsController@getPlaylist', [$id, $playlist->slug]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::make('playlists.show');
|
return view('playlists.show');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShortlink($id)
|
public function getShortlink($id)
|
||||||
{
|
{
|
||||||
$playlist = Playlist::find($id);
|
$playlist = Playlist::find($id);
|
||||||
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::action('PlaylistsController@getPlaylist', [$id, $playlist->slug]);
|
return Redirect::action('PlaylistsController@getPlaylist', [$id, $playlist->slug]);
|
||||||
|
@ -64,7 +64,7 @@ class PlaylistsController extends Controller
|
||||||
{
|
{
|
||||||
$playlist = Playlist::with('tracks', 'tracks.trackFiles', 'user', 'tracks.album')->find($id);
|
$playlist = Playlist::with('tracks', 'tracks.trackFiles', 'user', 'tracks.album')->find($id);
|
||||||
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$format = null;
|
$format = null;
|
||||||
|
@ -79,11 +79,11 @@ class PlaylistsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($format == null) {
|
if ($format == null) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $playlist->hasLosslessTracks() && in_array($formatName, Track::$LosslessFormats)) {
|
if (! $playlist->hasLosslessTracks() && in_array($formatName, Track::$LosslessFormats)) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceLogItem::logItem('playlist', $id, ResourceLogItem::DOWNLOAD, $format['index']);
|
ResourceLogItem::logItem('playlist', $id, ResourceLogItem::DOWNLOAD, $format['index']);
|
||||||
|
|
|
@ -26,6 +26,6 @@ class StatsController extends Controller
|
||||||
{
|
{
|
||||||
public function getIndex()
|
public function getIndex()
|
||||||
{
|
{
|
||||||
return View::make('tracks.stats');
|
return view('tracks.stats');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class TracksController extends Controller
|
||||||
{
|
{
|
||||||
public function getIndex()
|
public function getIndex()
|
||||||
{
|
{
|
||||||
return View::make('tracks.index');
|
return view('tracks.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEmbed($id)
|
public function getEmbed($id)
|
||||||
|
@ -51,7 +51,7 @@ class TracksController extends Controller
|
||||||
)->first();
|
)->first();
|
||||||
|
|
||||||
if (! $track || ! $track->canView(Auth::user())) {
|
if (! $track || ! $track->canView(Auth::user())) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$userData = [
|
$userData = [
|
||||||
|
@ -75,13 +75,13 @@ class TracksController extends Controller
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::make('tracks.embed', ['track' => $track, 'user' => $userData]);
|
return view('tracks.embed', ['track' => $track, 'user' => $userData]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOembed(Request $request)
|
public function getOembed(Request $request)
|
||||||
{
|
{
|
||||||
if (! $request->filled('url')) {
|
if (! $request->filled('url')) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$parsedUrl = parse_url($request->input('url'));
|
$parsedUrl = parse_url($request->input('url'));
|
||||||
|
@ -94,7 +94,7 @@ class TracksController extends Controller
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (! $track || ! $track->canView(Auth::user())) {
|
if (! $track || ! $track->canView(Auth::user())) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = [
|
$output = [
|
||||||
|
@ -117,14 +117,14 @@ class TracksController extends Controller
|
||||||
{
|
{
|
||||||
$track = Track::find($id);
|
$track = Track::find($id);
|
||||||
if (! $track || ! $track->canView(Auth::user())) {
|
if (! $track || ! $track->canView(Auth::user())) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($track->slug != $slug) {
|
if ($track->slug != $slug) {
|
||||||
return Redirect::action('TracksController@getTrack', [$id, $track->slug]);
|
return Redirect::action('TracksController@getTrack', [$id, $track->slug]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::make('tracks.show', ['track' => $track]);
|
return view('tracks.show', ['track' => $track]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEdit($id, $slug)
|
public function getEdit($id, $slug)
|
||||||
|
@ -136,7 +136,7 @@ class TracksController extends Controller
|
||||||
{
|
{
|
||||||
$track = Track::find($id);
|
$track = Track::find($id);
|
||||||
if (! $track || ! $track->canView(Auth::user())) {
|
if (! $track || ! $track->canView(Auth::user())) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::action('TracksController@getTrack', [$id, $track->slug]);
|
return Redirect::action('TracksController@getTrack', [$id, $track->slug]);
|
||||||
|
@ -146,21 +146,21 @@ class TracksController extends Controller
|
||||||
{
|
{
|
||||||
$track = Track::find($id);
|
$track = Track::find($id);
|
||||||
if (! $track || ! $track->canView(Auth::user())) {
|
if (! $track || ! $track->canView(Auth::user())) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$trackFile = TrackFile::findOrFailByExtension($track->id, $extension);
|
$trackFile = TrackFile::findOrFailByExtension($track->id, $extension);
|
||||||
|
|
||||||
$response = Response::make('', 200);
|
$response = response('', 200);
|
||||||
$filename = $trackFile->getFile();
|
$filename = $trackFile->getFile();
|
||||||
|
|
||||||
if (! file_exists($filename)) {
|
if (! file_exists($filename)) {
|
||||||
App::abort(418);
|
abort(418);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceLogItem::logItem('track', $id, ResourceLogItem::PLAY, $trackFile->getFormat()['index']);
|
ResourceLogItem::logItem('track', $id, ResourceLogItem::PLAY, $trackFile->getFormat()['index']);
|
||||||
|
|
||||||
if (Config::get('app.sendfile')) {
|
if (config('app.sendfile')) {
|
||||||
$response->header('X-Sendfile', $filename);
|
$response->header('X-Sendfile', $filename);
|
||||||
} else {
|
} else {
|
||||||
$response->header('X-Accel-Redirect', $filename);
|
$response->header('X-Accel-Redirect', $filename);
|
||||||
|
@ -183,16 +183,16 @@ class TracksController extends Controller
|
||||||
{
|
{
|
||||||
$track = Track::find($id);
|
$track = Track::find($id);
|
||||||
if (! $track || ! $track->canView(Auth::user())) {
|
if (! $track || ! $track->canView(Auth::user())) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$trackFile = TrackFile::findOrFailByExtension($track->id, $extension);
|
$trackFile = TrackFile::findOrFailByExtension($track->id, $extension);
|
||||||
ResourceLogItem::logItem('track', $id, ResourceLogItem::DOWNLOAD, $trackFile->getFormat()['index']);
|
ResourceLogItem::logItem('track', $id, ResourceLogItem::DOWNLOAD, $trackFile->getFormat()['index']);
|
||||||
|
|
||||||
$response = Response::make('', 200);
|
$response = response('', 200);
|
||||||
$filename = $trackFile->getFile();
|
$filename = $trackFile->getFile();
|
||||||
|
|
||||||
if (Config::get('app.sendfile')) {
|
if (config('app.sendfile')) {
|
||||||
$response->header('X-Sendfile', $filename);
|
$response->header('X-Sendfile', $filename);
|
||||||
$response->header(
|
$response->header(
|
||||||
'Content-Disposition',
|
'Content-Disposition',
|
||||||
|
|
|
@ -26,6 +26,6 @@ class UploaderController extends Controller
|
||||||
{
|
{
|
||||||
public function getIndex()
|
public function getIndex()
|
||||||
{
|
{
|
||||||
return View::make('shared.null');
|
return view('shared.null');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ class EncodeTrackFile extends Job implements ShouldQueue
|
||||||
|
|
||||||
// Insert the expiration time for cached tracks
|
// Insert the expiration time for cached tracks
|
||||||
if ($this->isExpirable && $this->trackFile->is_cacheable) {
|
if ($this->isExpirable && $this->trackFile->is_cacheable) {
|
||||||
$this->trackFile->expires_at = Carbon::now()->addMinutes(Config::get('ponyfm.track_file_cache_duration'));
|
$this->trackFile->expires_at = Carbon::now()->addMinutes(config('ponyfm.track_file_cache_duration'));
|
||||||
$this->trackFile->save();
|
$this->trackFile->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,14 +32,14 @@ class Assets
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($scripts as $filename) {
|
foreach ($scripts as $filename) {
|
||||||
if (Config::get('app.debug') && $filename !== 'templates.js') {
|
if (config('app.debug') && $filename !== 'templates.js') {
|
||||||
$scriptTags .= "<script src='http://localhost:61999/build/scripts/{$filename}'></script>";
|
$scriptTags .= "<script src='http://localhost:61999/build/scripts/{$filename}'></script>";
|
||||||
} else {
|
} else {
|
||||||
$scriptTags .= "<script src='/build/scripts/{$filename}?".filemtime(public_path("build/scripts/{$filename}"))."'></script>";
|
$scriptTags .= "<script src='/build/scripts/{$filename}?".filemtime(public_path("build/scripts/{$filename}"))."'></script>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::get('app.debug')) {
|
if (config('app.debug')) {
|
||||||
$scriptTags .= '<script src="http://localhost:61999/webpack-dev-server.js"></script>';
|
$scriptTags .= '<script src="http://localhost:61999/webpack-dev-server.js"></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class Assets
|
||||||
|
|
||||||
public static function styleIncludes($area = 'app')
|
public static function styleIncludes($area = 'app')
|
||||||
{
|
{
|
||||||
if (! Config::get('app.debug')) {
|
if (! config('app.debug')) {
|
||||||
return '<script>document.write(\'<link rel="stylesheet" href="build/styles/'.$area.'.css?'.
|
return '<script>document.write(\'<link rel="stylesheet" href="build/styles/'.$area.'.css?'.
|
||||||
filemtime(public_path("/build/styles/${area}.css"))
|
filemtime(public_path("/build/styles/${area}.css"))
|
||||||
.'" />\');</script>';
|
.'" />\');</script>';
|
||||||
|
|
|
@ -15,7 +15,7 @@ class File extends \Illuminate\Support\Facades\File
|
||||||
$name = basename($path);
|
$name = basename($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = Response::make(static::get($path));
|
$response = response(static::get($path));
|
||||||
|
|
||||||
$response->header('Content-Type', $mime);
|
$response->header('Content-Type', $mime);
|
||||||
$response->header('Content-Disposition', 'inline; filename="'.$name.'"');
|
$response->header('Content-Disposition', 'inline; filename="'.$name.'"');
|
||||||
|
|
|
@ -39,9 +39,9 @@ class NativeDriver extends AbstractDriver
|
||||||
*/
|
*/
|
||||||
private function pushNotifications(Activity $activity, $recipients)
|
private function pushNotifications(Activity $activity, $recipients)
|
||||||
{
|
{
|
||||||
if (Config::get('ponyfm.gcm_key') != 'default') {
|
if (config('ponyfm.gcm_key') != 'default') {
|
||||||
$apiKeys = [
|
$apiKeys = [
|
||||||
'GCM' => Config::get('ponyfm.gcm_key'),
|
'GCM' => config('ponyfm.gcm_key'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$webPush = new WebPush($apiKeys);
|
$webPush = new WebPush($apiKeys);
|
||||||
|
|
|
@ -302,7 +302,7 @@ class Album extends Model implements Searchable, Commentable, Favouritable
|
||||||
{
|
{
|
||||||
$dir = (string) (floor($this->id / 100) * 100);
|
$dir = (string) (floor($this->id / 100) * 100);
|
||||||
|
|
||||||
return \Config::get('ponyfm.files_directory').'/tracks/'.$dir;
|
return config('ponyfm.files_directory').'/tracks/'.$dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDates()
|
public function getDates()
|
||||||
|
|
|
@ -190,7 +190,7 @@ class Image extends Model
|
||||||
{
|
{
|
||||||
$dir = (string) (floor($this->id / 100) * 100);
|
$dir = (string) (floor($this->id / 100) * 100);
|
||||||
|
|
||||||
return Config::get('ponyfm.files_directory').'/images/'.$dir;
|
return config('ponyfm.files_directory').'/images/'.$dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ensureDirectoryExists()
|
public function ensureDirectoryExists()
|
||||||
|
|
|
@ -607,8 +607,8 @@ class Track extends Model implements Searchable, Commentable, Favouritable
|
||||||
],
|
],
|
||||||
'streams' => [
|
'streams' => [
|
||||||
'mp3' => $track->getStreamUrl('MP3'),
|
'mp3' => $track->getStreamUrl('MP3'),
|
||||||
'aac' => (! Config::get('app.debug') || is_file($track->getFileFor('AAC'))) ? $track->getStreamUrl('AAC') : null,
|
'aac' => (! config('app.debug') || is_file($track->getFileFor('AAC'))) ? $track->getStreamUrl('AAC') : null,
|
||||||
'ogg' => (Config::get('app.debug') || is_file($track->getFileFor('OGG Vorbis'))) ? $track->getStreamUrl('OGG Vorbis') : null,
|
'ogg' => (config('app.debug') || is_file($track->getFileFor('OGG Vorbis'))) ? $track->getStreamUrl('OGG Vorbis') : null,
|
||||||
],
|
],
|
||||||
'user_data' => $userData,
|
'user_data' => $userData,
|
||||||
'permissions' => [
|
'permissions' => [
|
||||||
|
@ -963,7 +963,7 @@ class Track extends Model implements Searchable, Commentable, Favouritable
|
||||||
{
|
{
|
||||||
$dir = (string) (floor($this->id / 100) * 100);
|
$dir = (string) (floor($this->id / 100) * 100);
|
||||||
|
|
||||||
return \Config::get('ponyfm.files_directory').'/tracks/'.$dir;
|
return config('ponyfm.files_directory').'/tracks/'.$dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDates()
|
public function getDates()
|
||||||
|
@ -1037,7 +1037,7 @@ class Track extends Model implements Searchable, Commentable, Favouritable
|
||||||
*/
|
*/
|
||||||
public function getTemporarySourceFileForVersion(int $version):string
|
public function getTemporarySourceFileForVersion(int $version):string
|
||||||
{
|
{
|
||||||
return Config::get('ponyfm.files_directory').'/queued-tracks/'.$this->id.'v'.$version;
|
return config('ponyfm.files_directory').'/queued-tracks/'.$this->id.'v'.$version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -96,7 +96,7 @@ class TrackFile extends Model
|
||||||
{
|
{
|
||||||
$track = Track::find($trackId);
|
$track = Track::find($trackId);
|
||||||
if (! $track) {
|
if (! $track) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the extension's format
|
// find the extension's format
|
||||||
|
@ -108,7 +108,7 @@ class TrackFile extends Model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($requestedFormatName === null) {
|
if ($requestedFormatName === null) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$trackFile = static::
|
$trackFile = static::
|
||||||
|
@ -119,7 +119,7 @@ class TrackFile extends Model
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($trackFile === null) {
|
if ($trackFile === null) {
|
||||||
App::abort(404);
|
abort(404);
|
||||||
} else {
|
} else {
|
||||||
return $trackFile;
|
return $trackFile;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ class TrackFile extends Model
|
||||||
{
|
{
|
||||||
$dir = (string) (floor($this->track_id / 100) * 100);
|
$dir = (string) (floor($this->track_id / 100) * 100);
|
||||||
|
|
||||||
return \Config::get('ponyfm.files_directory').'/tracks/'.$dir;
|
return config('ponyfm.files_directory').'/tracks/'.$dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFile()
|
public function getFile()
|
||||||
|
|
|
@ -62,7 +62,7 @@ trait IndexedInElasticsearchTrait
|
||||||
private function getElasticsearchParameters(bool $includeBody = true)
|
private function getElasticsearchParameters(bool $includeBody = true)
|
||||||
{
|
{
|
||||||
$parameters = [
|
$parameters = [
|
||||||
'index' => Config::get('ponyfm.elasticsearch_index'),
|
'index' => config('ponyfm.elasticsearch_index'),
|
||||||
'type' => $this->elasticsearchType,
|
'type' => $this->elasticsearchType,
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
];
|
];
|
||||||
|
@ -95,7 +95,7 @@ trait IndexedInElasticsearchTrait
|
||||||
*/
|
*/
|
||||||
public function updateElasticsearchEntry()
|
public function updateElasticsearchEntry()
|
||||||
{
|
{
|
||||||
$job = (new UpdateSearchIndexForEntity($this))->onQueue(Config::get('ponyfm.indexing_queue'));
|
$job = (new UpdateSearchIndexForEntity($this))->onQueue(config('ponyfm.indexing_queue'));
|
||||||
$this->dispatch($job);
|
$this->dispatch($job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue