2015-12-13 12:42:28 +08:00
|
|
|
<?php
|
|
|
|
|
2015-12-27 20:29:03 +07:00
|
|
|
Route::get('/', function () {
|
2015-12-29 08:16:36 +07:00
|
|
|
return view('index');
|
2015-12-13 12:42:28 +08:00
|
|
|
});
|
|
|
|
|
2016-01-17 10:45:59 +08:00
|
|
|
// Some backward compatibilities.
|
|
|
|
Route::get('/♫', function () {
|
|
|
|
return redirect('/');
|
|
|
|
});
|
|
|
|
|
2015-12-30 11:14:47 +07:00
|
|
|
Route::group(['prefix' => 'api', 'namespace' => 'API'], function () {
|
2016-05-30 13:50:59 +08:00
|
|
|
Route::post('me', 'AuthController@login');
|
|
|
|
Route::delete('me', 'AuthController@logout');
|
2015-12-13 12:42:28 +08:00
|
|
|
|
2015-12-30 11:14:47 +07:00
|
|
|
Route::group(['middleware' => 'jwt.auth'], function () {
|
|
|
|
Route::get('/', function () {
|
2016-01-17 10:45:59 +08:00
|
|
|
// Just acting as a ping service.
|
2015-12-30 11:14:47 +07:00
|
|
|
});
|
2015-12-13 12:42:28 +08:00
|
|
|
|
2015-12-30 11:14:47 +07:00
|
|
|
Route::get('data', 'DataController@index');
|
2015-12-13 12:42:28 +08:00
|
|
|
|
2016-05-30 13:50:59 +08:00
|
|
|
Route::post('settings', 'SettingController@store');
|
2015-12-13 12:42:28 +08:00
|
|
|
|
2016-05-21 11:38:16 -04:00
|
|
|
Route::get('{song}/play/{transcode?}/{bitrate?}', 'SongController@play');
|
2016-05-30 13:50:59 +08:00
|
|
|
Route::post('{song}/scrobble/{timestamp}', 'ScrobbleController@store')->where([
|
2015-12-30 11:14:47 +07:00
|
|
|
'timestamp' => '\d+',
|
|
|
|
]);
|
2016-05-30 13:50:59 +08:00
|
|
|
Route::get('{song}/info', 'SongController@show');
|
2016-03-05 17:01:12 +08:00
|
|
|
Route::put('songs', 'SongController@update');
|
|
|
|
|
2015-12-30 11:14:47 +07:00
|
|
|
Route::post('interaction/play', 'InteractionController@play');
|
|
|
|
Route::post('interaction/like', 'InteractionController@like');
|
|
|
|
Route::post('interaction/batch/like', 'InteractionController@batchLike');
|
|
|
|
Route::post('interaction/batch/unlike', 'InteractionController@batchUnlike');
|
2015-12-13 12:42:28 +08:00
|
|
|
|
2016-01-25 18:37:14 +08:00
|
|
|
Route::resource('playlist', 'PlaylistController');
|
2015-12-30 11:14:47 +07:00
|
|
|
Route::put('playlist/{playlist}/sync', 'PlaylistController@sync')->where(['playlist' => '\d+']);
|
|
|
|
|
|
|
|
Route::resource('user', 'UserController', ['only' => ['store', 'update', 'destroy']]);
|
2016-05-30 13:50:59 +08:00
|
|
|
Route::put('me', 'ProfileController@update');
|
2015-12-30 11:14:47 +07:00
|
|
|
|
2016-02-01 09:58:31 +08:00
|
|
|
Route::get('lastfm/connect', 'LastfmController@connect');
|
2016-01-26 14:32:29 +08:00
|
|
|
Route::post('lastfm/session-key', 'LastfmController@setSessionKey');
|
|
|
|
|
2015-12-30 11:14:47 +07:00
|
|
|
Route::get('lastfm/callback', [
|
|
|
|
'as' => 'lastfm.callback',
|
|
|
|
'uses' => 'LastfmController@callback',
|
|
|
|
]);
|
|
|
|
Route::delete('lastfm/disconnect', 'LastfmController@disconnect');
|
|
|
|
});
|
2015-12-13 12:42:28 +08:00
|
|
|
});
|