koel/app/Http/routes.php

48 lines
1.7 KiB
PHP
Raw Normal View History

2015-12-13 04:42:28 +00:00
<?php
2015-12-27 13:29:03 +00:00
Route::get('login', 'Auth\AuthController@getLogin');
Route::post('login', 'Auth\AuthController@postLogin');
Route::get('logout', 'Auth\AuthController@getLogout');
2015-12-13 04:42:28 +00:00
2015-12-27 13:29:03 +00:00
Route::get('/', function () {
2015-12-13 04:42:28 +00:00
return redirect('/♫');
});
2015-12-27 13:29:03 +00:00
Route::get('♫', ['middleware' => 'auth', function () {
2015-12-13 04:42:28 +00:00
return view('index');
}]);
Route::group(['prefix' => 'api', 'middleware' => 'auth', 'namespace' => 'API'], function () {
2015-12-27 13:29:03 +00:00
Route::get('/', function () {
2015-12-13 04:42:28 +00:00
// Just acting as a ping service.
});
2015-12-27 13:29:03 +00:00
Route::get('data', 'DataController@index');
2015-12-13 04:42:28 +00:00
2015-12-27 13:29:03 +00:00
Route::post('settings', 'SettingController@save');
2015-12-13 04:42:28 +00:00
2015-12-27 13:29:03 +00:00
Route::get('{song}/play', 'SongController@play');
Route::get('{song}/info', 'SongController@getInfo');
Route::post('{song}/scrobble/{timestamp}', 'SongController@scrobble')->where([
2015-12-20 12:17:35 +00:00
'timestamp' => '\d+',
]);
2015-12-13 04:42:28 +00:00
2015-12-27 13:29:03 +00: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 04:42:28 +00:00
2015-12-27 13:29:03 +00:00
Route::resource('playlist', 'PlaylistController', ['only' => ['store', 'update', 'destroy']]);
Route::put('playlist/{playlist}/sync', 'PlaylistController@sync')->where(['playlist' => '\d+']);
2015-12-13 04:42:28 +00:00
2015-12-27 13:29:03 +00:00
Route::resource('user', 'UserController', ['only' => ['store', 'update', 'destroy']]);
Route::put('me', 'UserController@updateProfile');
2015-12-20 12:17:35 +00:00
2015-12-27 13:29:03 +00:00
Route::get('lastfm/connect', 'LastfmController@connect');
Route::get('lastfm/callback', [
2015-12-20 12:17:35 +00:00
'as' => 'lastfm.callback',
'uses' => 'LastfmController@callback',
]);
2015-12-27 13:29:03 +00:00
Route::delete('lastfm/disconnect', 'LastfmController@disconnect');
2015-12-13 04:42:28 +00:00
});