2015-12-13 04:42:28 +00:00
|
|
|
<?php
|
|
|
|
|
2017-08-25 00:31:55 +00:00
|
|
|
use Illuminate\Http\Request;
|
2021-10-08 16:23:45 +00:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2017-08-25 00:31:55 +00:00
|
|
|
|
2020-12-22 20:11:22 +00:00
|
|
|
Route::group(['namespace' => 'API'], static function (): void {
|
2018-12-09 21:24:43 +00:00
|
|
|
Route::post('me', 'AuthController@login')->name('auth.login');
|
2016-05-30 05:50:59 +00:00
|
|
|
Route::delete('me', 'AuthController@logout');
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2020-12-22 20:11:22 +00:00
|
|
|
Route::group(['middleware' => 'auth'], static function (): void {
|
|
|
|
Route::get('/ping', static function (): void {
|
2020-04-26 19:09:43 +00:00
|
|
|
// Only acting as a ping service.
|
2015-12-30 04:14:47 +00:00
|
|
|
});
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2020-12-22 20:11:22 +00:00
|
|
|
Route::post('broadcasting/auth', static function (Request $request) {
|
2018-09-16 12:23:39 +00:00
|
|
|
$pusher = new Pusher\Pusher(
|
2017-08-25 00:31:55 +00:00
|
|
|
config('broadcasting.connections.pusher.key'),
|
|
|
|
config('broadcasting.connections.pusher.secret'),
|
|
|
|
config('broadcasting.connections.pusher.app_id'),
|
|
|
|
[
|
|
|
|
'cluster' => config('broadcasting.connections.pusher.options.cluster'),
|
|
|
|
'encrypted' => true,
|
|
|
|
]
|
|
|
|
);
|
2017-08-25 00:39:03 +00:00
|
|
|
|
2017-08-25 00:31:55 +00:00
|
|
|
return $pusher->socket_auth($request->channel_name, $request->socket_id);
|
2018-12-09 21:24:43 +00:00
|
|
|
})->name('broadcasting.auth');
|
2017-08-25 00:31:55 +00:00
|
|
|
|
2015-12-30 04:14:47 +00:00
|
|
|
Route::get('data', 'DataController@index');
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2016-05-30 05:50:59 +00:00
|
|
|
Route::post('settings', 'SettingController@store');
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2020-09-13 22:04:07 +00:00
|
|
|
Route::post('{song}/scrobble', 'ScrobbleController@store');
|
2016-03-05 09:01:12 +00:00
|
|
|
Route::put('songs', 'SongController@update');
|
|
|
|
|
2020-06-07 20:43:04 +00:00
|
|
|
Route::resource('upload', 'UploadController');
|
|
|
|
|
2016-06-02 17:53:26 +00:00
|
|
|
// Interaction routes
|
2017-08-06 09:43:59 +00:00
|
|
|
Route::post('interaction/play', 'Interaction\PlayCountController@store');
|
|
|
|
Route::post('interaction/like', 'Interaction\LikeController@store');
|
|
|
|
Route::post('interaction/batch/like', 'Interaction\BatchLikeController@store');
|
|
|
|
Route::post('interaction/batch/unlike', 'Interaction\BatchLikeController@destroy');
|
2018-10-20 21:46:12 +00:00
|
|
|
Route::get('interaction/recently-played/{count?}', 'Interaction\RecentlyPlayedController@index')->where([
|
|
|
|
'count' => '\d+',
|
|
|
|
]);
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2016-06-02 17:53:26 +00:00
|
|
|
// Playlist routes
|
2018-12-09 21:24:43 +00:00
|
|
|
Route::resource('playlist', 'PlaylistController')->only(['index', 'store', 'update', 'destroy']);
|
2015-12-30 04:14:47 +00:00
|
|
|
Route::put('playlist/{playlist}/sync', 'PlaylistController@sync')->where(['playlist' => '\d+']);
|
2017-12-02 16:05:40 +00:00
|
|
|
Route::get('playlist/{playlist}/songs', 'PlaylistController@getSongs')->where(['playlist' => '\d+']);
|
2015-12-30 04:14:47 +00:00
|
|
|
|
2016-06-02 17:53:26 +00:00
|
|
|
// User and user profile routes
|
2015-12-30 04:14:47 +00:00
|
|
|
Route::resource('user', 'UserController', ['only' => ['store', 'update', 'destroy']]);
|
2017-08-27 15:53:17 +00:00
|
|
|
Route::get('me', 'ProfileController@show');
|
2016-05-30 05:50:59 +00:00
|
|
|
Route::put('me', 'ProfileController@update');
|
2015-12-30 04:14:47 +00:00
|
|
|
|
2016-06-02 17:53:26 +00:00
|
|
|
// Last.fm-related routes
|
2016-01-26 06:32:29 +00:00
|
|
|
Route::post('lastfm/session-key', 'LastfmController@setSessionKey');
|
2018-12-09 21:24:43 +00:00
|
|
|
Route::delete('lastfm/disconnect', 'LastfmController@disconnect')->name('lastfm.disconnect');
|
2016-06-02 17:53:26 +00:00
|
|
|
|
2016-07-14 08:47:50 +00:00
|
|
|
// YouTube-related routes
|
|
|
|
if (YouTube::enabled()) {
|
|
|
|
Route::get('youtube/search/song/{song}', 'YouTubeController@searchVideosRelatedToSong');
|
|
|
|
}
|
|
|
|
|
2016-06-05 04:37:03 +00:00
|
|
|
// Info routes
|
2020-12-22 20:11:22 +00:00
|
|
|
Route::group(['namespace' => 'MediaInformation'], static function (): void {
|
2018-08-18 13:19:40 +00:00
|
|
|
Route::get('album/{album}/info', 'AlbumController@show');
|
|
|
|
Route::get('artist/{artist}/info', 'ArtistController@show');
|
2018-12-09 21:24:43 +00:00
|
|
|
Route::get('{song}/info', 'SongController@show')->name('song.show.deprecated'); // backward compat
|
2018-08-18 13:19:40 +00:00
|
|
|
Route::get('song/{song}/info', 'SongController@show');
|
|
|
|
});
|
2016-12-11 13:08:30 +00:00
|
|
|
|
2020-04-26 19:09:43 +00:00
|
|
|
// Cover/image upload routes
|
|
|
|
Route::put('album/{album}/cover', 'AlbumCoverController@update');
|
|
|
|
Route::put('artist/{artist}/image', 'ArtistImageController@update');
|
|
|
|
|
2021-05-21 17:14:00 +00:00
|
|
|
Route::get('album/{album}/thumbnail', 'AlbumThumbnailController@show');
|
2020-12-24 12:41:18 +00:00
|
|
|
|
|
|
|
Route::group(['namespace' => 'Search', 'prefix' => 'search'], static function (): void {
|
|
|
|
Route::get('/', 'ExcerptSearchController@index');
|
2020-12-24 22:35:39 +00:00
|
|
|
Route::get('songs', 'SongSearchController@index');
|
2020-12-24 12:41:18 +00:00
|
|
|
});
|
2015-12-30 04:14:47 +00:00
|
|
|
});
|
2016-06-13 09:04:42 +00:00
|
|
|
|
2020-12-22 20:11:22 +00:00
|
|
|
Route::group([
|
|
|
|
'middleware' => 'os.auth',
|
|
|
|
'prefix' => 'os',
|
|
|
|
'namespace' => 'ObjectStorage',
|
|
|
|
], static function (): void {
|
|
|
|
Route::group(['prefix' => 's3', 'namespace' => 'S3'], static function (): void {
|
2018-12-09 21:24:43 +00:00
|
|
|
Route::post('song', 'SongController@put')->name('s3.song.put'); // we follow AWS's convention here.
|
|
|
|
Route::delete('song', 'SongController@remove')->name('s3.song.remove'); // and here.
|
2016-06-13 09:04:42 +00:00
|
|
|
});
|
|
|
|
});
|
2015-12-13 04:42:28 +00:00
|
|
|
});
|