diff --git a/app/controllers/TracksController.php b/app/controllers/TracksController.php index cff770ae..acd365dc 100644 --- a/app/controllers/TracksController.php +++ b/app/controllers/TracksController.php @@ -9,6 +9,14 @@ return View::make('tracks.index'); } + public function getEmbed($id) { + $track = Track::find($id); + if (!$track || !$track->canView(Auth::user())) + App::abort(404); + + return View::make('tracks.embed', ['track' => $track]); + } + public function getTrack($id, $slug) { $track = Track::find($id); if (!$track || !$track->canView(Auth::user())) diff --git a/app/models/Entities/Track.php b/app/models/Entities/Track.php index 72c658d1..6c845f86 100644 --- a/app/models/Entities/Track.php +++ b/app/models/Entities/Track.php @@ -114,7 +114,7 @@ $returnValue['share'] = [ 'url' => URL::to('/t' . $track->id), - 'html' => '', + 'html' => '', 'bbcode' => '[url=' . $track->url . '][img]' . $track->getCoverUrl() . '[/img][/url]', 'twitterUrl' => 'https://platform.twitter.com/widgets/tweet_button.html?text=' . $track->title . ' by ' . $track->user->display_name . ' on Pony.fm' ]; diff --git a/app/routes.php b/app/routes.php index 2e28f1ea..bdbe18c0 100644 --- a/app/routes.php +++ b/app/routes.php @@ -22,6 +22,7 @@ Route::get('tracks/{id}-{slug}', 'TracksController@getTrack'); Route::get('t{id}', 'TracksController@getShortlink' ); + Route::get('t{id}/embed', 'TracksController@getEmbed' ); Route::get('t{id}/stream', 'TracksController@getStream' ); Route::get('t{id}/dl.{extension}', 'TracksController@getDownload' ); diff --git a/app/views/tracks/embed.blade.php b/app/views/tracks/embed.blade.php new file mode 100644 index 00000000..6ef69c7b --- /dev/null +++ b/app/views/tracks/embed.blade.php @@ -0,0 +1,78 @@ + + +
+ +