BookStack/routes/web.php

232 lines
12 KiB
PHP
Raw Permalink Normal View History

2015-07-12 15:01:42 -04:00
<?php
Route::get('/robots.txt', 'HomeController@getRobots');
// Authenticated routes...
2015-08-29 10:03:42 -04:00
Route::group(['middleware' => 'auth'], function () {
2015-08-05 15:59:39 -04:00
// Secure images routing
Route::get('/uploads/images/{path}', 'Images\ImageController@showImage')
->where('path', '.*$');
Route::group(['prefix' => 'pages'], function() {
Route::get('/recently-updated', 'PageController@showRecentlyUpdated');
});
// Shelves
Route::get('/create-shelf', 'BookshelfController@create');
Route::group(['prefix' => 'shelves'], function() {
Route::get('/', 'BookshelfController@index');
Route::post('/', 'BookshelfController@store');
Route::get('/{slug}/edit', 'BookshelfController@edit');
Route::get('/{slug}/delete', 'BookshelfController@showDelete');
Route::get('/{slug}', 'BookshelfController@show');
Route::put('/{slug}', 'BookshelfController@update');
Route::delete('/{slug}', 'BookshelfController@destroy');
Route::get('/{slug}/permissions', 'BookshelfController@showPermissions');
Route::put('/{slug}/permissions', 'BookshelfController@permissions');
Route::post('/{slug}/copy-permissions', 'BookshelfController@copyPermissions');
Route::get('/{shelfSlug}/create-book', 'BookController@create');
Route::post('/{shelfSlug}/create-book', 'BookController@store');
});
Route::get('/create-book', 'BookController@create');
2015-08-29 10:03:42 -04:00
Route::group(['prefix' => 'books'], function () {
2015-08-05 15:59:39 -04:00
2015-08-09 07:06:52 -04:00
// Books
2015-08-05 15:59:39 -04:00
Route::get('/', 'BookController@index');
Route::post('/', 'BookController@store');
Route::get('/{slug}/edit', 'BookController@edit');
Route::put('/{slug}', 'BookController@update');
Route::delete('/{id}', 'BookController@destroy');
2015-09-06 09:35:53 -04:00
Route::get('/{slug}/sort-item', 'BookController@getSortItem');
2015-08-05 15:59:39 -04:00
Route::get('/{slug}', 'BookController@show');
2019-01-31 15:37:12 -05:00
Route::get('/{bookSlug}/permissions', 'BookController@showPermissions');
Route::put('/{bookSlug}/permissions', 'BookController@permissions');
2015-08-05 15:59:39 -04:00
Route::get('/{slug}/delete', 'BookController@showDelete');
2015-09-06 09:35:53 -04:00
Route::get('/{bookSlug}/sort', 'BookController@sort');
Route::put('/{bookSlug}/sort', 'BookController@saveSort');
Route::get('/{bookSlug}/export/html', 'BookController@exportHtml');
Route::get('/{bookSlug}/export/pdf', 'BookController@exportPdf');
Route::get('/{bookSlug}/export/plaintext', 'BookController@exportPlainText');
2015-09-06 09:35:53 -04:00
2015-08-09 07:06:52 -04:00
// Pages
Route::get('/{bookSlug}/create-page', 'PageController@create');
Route::post('/{bookSlug}/create-guest-page', 'PageController@createAsGuest');
Route::get('/{bookSlug}/draft/{pageId}', 'PageController@editDraft');
Route::post('/{bookSlug}/draft/{pageId}', 'PageController@store');
2015-08-05 15:59:39 -04:00
Route::get('/{bookSlug}/page/{pageSlug}', 'PageController@show');
2016-01-20 17:13:13 -05:00
Route::get('/{bookSlug}/page/{pageSlug}/export/pdf', 'PageController@exportPdf');
Route::get('/{bookSlug}/page/{pageSlug}/export/html', 'PageController@exportHtml');
Route::get('/{bookSlug}/page/{pageSlug}/export/plaintext', 'PageController@exportPlainText');
2015-08-05 15:59:39 -04:00
Route::get('/{bookSlug}/page/{pageSlug}/edit', 'PageController@edit');
Route::get('/{bookSlug}/page/{pageSlug}/move', 'PageController@showMove');
2016-06-12 07:14:14 -04:00
Route::put('/{bookSlug}/page/{pageSlug}/move', 'PageController@move');
Route::get('/{bookSlug}/page/{pageSlug}/copy', 'PageController@showCopy');
Route::post('/{bookSlug}/page/{pageSlug}/copy', 'PageController@copy');
2015-08-05 15:59:39 -04:00
Route::get('/{bookSlug}/page/{pageSlug}/delete', 'PageController@showDelete');
Route::get('/{bookSlug}/draft/{pageId}/delete', 'PageController@showDeleteDraft');
Route::get('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@showPermissions');
Route::put('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@permissions');
2015-08-05 15:59:39 -04:00
Route::put('/{bookSlug}/page/{pageSlug}', 'PageController@update');
Route::delete('/{bookSlug}/page/{pageSlug}', 'PageController@destroy');
Route::delete('/{bookSlug}/draft/{pageId}', 'PageController@destroyDraft');
2016-01-20 17:13:13 -05:00
// Revisions
2015-08-09 07:06:52 -04:00
Route::get('/{bookSlug}/page/{pageSlug}/revisions', 'PageController@showRevisions');
Route::get('/{bookSlug}/page/{pageSlug}/revisions/{revId}', 'PageController@showRevision');
Route::get('/{bookSlug}/page/{pageSlug}/revisions/{revId}/changes', 'PageController@showRevisionChanges');
Route::put('/{bookSlug}/page/{pageSlug}/revisions/{revId}/restore', 'PageController@restoreRevision');
Route::delete('/{bookSlug}/page/{pageSlug}/revisions/{revId}/delete', 'PageController@destroyRevision');
2015-08-05 15:59:39 -04:00
2015-08-09 07:06:52 -04:00
// Chapters
2015-08-05 15:59:39 -04:00
Route::get('/{bookSlug}/chapter/{chapterSlug}/create-page', 'PageController@create');
Route::post('/{bookSlug}/chapter/{chapterSlug}/create-guest-page', 'PageController@createAsGuest');
Route::get('/{bookSlug}/create-chapter', 'ChapterController@create');
Route::post('/{bookSlug}/create-chapter', 'ChapterController@store');
2015-08-05 15:59:39 -04:00
Route::get('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@show');
Route::put('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@update');
2016-06-25 10:31:38 -04:00
Route::get('/{bookSlug}/chapter/{chapterSlug}/move', 'ChapterController@showMove');
Route::put('/{bookSlug}/chapter/{chapterSlug}/move', 'ChapterController@move');
2015-08-05 15:59:39 -04:00
Route::get('/{bookSlug}/chapter/{chapterSlug}/edit', 'ChapterController@edit');
Route::get('/{bookSlug}/chapter/{chapterSlug}/permissions', 'ChapterController@showPermissions');
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/pdf', 'ChapterController@exportPdf');
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/html', 'ChapterController@exportHtml');
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/plaintext', 'ChapterController@exportPlainText');
Route::put('/{bookSlug}/chapter/{chapterSlug}/permissions', 'ChapterController@permissions');
2015-08-05 15:59:39 -04:00
Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', 'ChapterController@showDelete');
Route::delete('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@destroy');
});
2016-02-16 16:25:11 -05:00
// User Profile routes
Route::get('/user/{userId}', 'UserController@showProfilePage');
2015-08-08 15:05:30 -04:00
// Image routes
Route::group(['prefix' => 'images'], function () {
// Gallery
Route::get('/gallery', 'Images\GalleryImageController@list');
Route::post('/gallery', 'Images\GalleryImageController@create');
// Drawio
Route::get('/drawio', 'Images\DrawioImageController@list');
Route::get('/drawio/base64/{id}', 'Images\DrawioImageController@getAsBase64');
Route::post('/drawio', 'Images\DrawioImageController@create');
// Shared gallery & draw.io endpoint
Route::get('/usage/{id}', 'Images\ImageController@usage');
Route::put('/{id}', 'Images\ImageController@update');
Route::delete('/{id}', 'Images\ImageController@destroy');
});
2015-07-12 15:01:42 -04:00
2016-11-12 09:12:26 -05:00
// Attachments routes
Route::get('/attachments/{id}', 'AttachmentController@get');
Route::post('/attachments/upload', 'AttachmentController@upload');
Route::post('/attachments/upload/{id}', 'AttachmentController@uploadUpdate');
Route::post('/attachments/link', 'AttachmentController@attachLink');
Route::put('/attachments/{id}', 'AttachmentController@update');
Route::get('/attachments/get/page/{pageId}', 'AttachmentController@listForPage');
Route::put('/attachments/sort/page/{pageId}', 'AttachmentController@sortForPage');
Route::delete('/attachments/{id}', 'AttachmentController@delete');
2016-05-06 15:33:08 -04:00
// AJAX routes
Route::put('/ajax/page/{id}/save-draft', 'PageController@saveDraft');
2016-03-12 10:52:19 -05:00
Route::get('/ajax/page/{id}', 'PageController@getPageAjax');
Route::delete('/ajax/page/{id}', 'PageController@ajaxDestroy');
// Tag routes (AJAX)
Route::group(['prefix' => 'ajax/tags'], function() {
Route::get('/get/{entityType}/{entityId}', 'TagController@getForEntity');
Route::get('/suggest/names', 'TagController@getNameSuggestions');
Route::get('/suggest/values', 'TagController@getValueSuggestions');
2016-05-06 15:33:08 -04:00
});
2016-06-12 07:14:14 -04:00
Route::get('/ajax/search/entities', 'SearchController@searchEntitiesAjax');
// Comments
Route::post('/ajax/page/{pageId}/comment', 'CommentController@savePageComment');
Route::put('/ajax/comment/{id}', 'CommentController@update');
Route::delete('/ajax/comment/{id}', 'CommentController@destroy');
2015-08-08 15:05:30 -04:00
// Links
2015-08-05 15:59:39 -04:00
Route::get('/link/{id}', 'PageController@redirectFromLink');
2015-08-08 15:05:30 -04:00
// Search
Route::get('/search', 'SearchController@search');
Route::get('/search/book/{bookId}', 'SearchController@searchBook');
Route::get('/search/chapter/{bookId}', 'SearchController@searchChapter');
Route::get('/search/entity/siblings', 'SearchController@searchSiblings');
2015-07-13 16:52:56 -04:00
Route::get('/templates', 'PageTemplateController@list');
Route::get('/templates/{templateId}', 'PageTemplateController@get');
// Other Pages
Route::get('/', 'HomeController@index');
Route::get('/home', 'HomeController@index');
Route::get('/custom-head-content', 'HomeController@customHeadContent');
2015-07-13 16:52:56 -04:00
// Settings
2016-02-16 16:25:11 -05:00
Route::group(['prefix' => 'settings'], function() {
Route::get('/', 'SettingController@index')->name('settings');
2016-02-16 16:25:11 -05:00
Route::post('/', 'SettingController@update');
// Maintenance
Route::get('/maintenance', 'SettingController@showMaintenance');
Route::delete('/maintenance/cleanup-images', 'SettingController@cleanupImages');
2016-02-16 16:25:11 -05:00
// Users
Route::get('/users', 'UserController@index');
Route::get('/users/create', 'UserController@create');
Route::get('/users/{id}/delete', 'UserController@delete');
Route::patch('/users/{id}/switch-book-view', 'UserController@switchBookView');
Route::patch('/users/{id}/switch-shelf-view', 'UserController@switchShelfView');
Route::patch('/users/{id}/change-sort/{type}', 'UserController@changeSort');
Route::patch('/users/{id}/update-expansion-preference/{key}', 'UserController@updateExpansionPreference');
2016-02-16 16:25:11 -05:00
Route::post('/users/create', 'UserController@store');
Route::get('/users/{id}', 'UserController@edit');
Route::put('/users/{id}', 'UserController@update');
Route::delete('/users/{id}', 'UserController@destroy');
// Roles
Route::get('/roles', 'PermissionController@listRoles');
Route::get('/roles/new', 'PermissionController@createRole');
Route::post('/roles/new', 'PermissionController@storeRole');
Route::get('/roles/delete/{id}', 'PermissionController@showDeleteRole');
Route::delete('/roles/delete/{id}', 'PermissionController@deleteRole');
Route::get('/roles/{id}', 'PermissionController@editRole');
Route::put('/roles/{id}', 'PermissionController@updateRole');
2016-02-16 16:25:11 -05:00
});
2015-07-12 15:01:42 -04:00
});
2015-08-05 16:16:10 -04:00
// Social auth routes
2016-11-27 14:11:15 -05:00
Route::get('/login/service/{socialDriver}', 'Auth\LoginController@getSocialLogin');
Route::get('/login/service/{socialDriver}/callback', 'Auth\RegisterController@socialCallback');
Route::get('/login/service/{socialDriver}/detach', 'Auth\RegisterController@detachSocialAccount');
Route::get('/register/service/{socialDriver}', 'Auth\RegisterController@socialRegister');
2015-09-04 15:40:36 -04:00
// Login/Logout routes
Route::get('/login', 'Auth\LoginController@getLogin');
Route::post('/login', 'Auth\LoginController@login');
Route::get('/logout', 'Auth\LoginController@logout');
Route::get('/register', 'Auth\RegisterController@getRegister');
Route::get('/register/confirm', 'Auth\ConfirmEmailController@show');
Route::get('/register/confirm/awaiting', 'Auth\ConfirmEmailController@showAwaiting');
Route::post('/register/confirm/resend', 'Auth\ConfirmEmailController@resend');
Route::get('/register/confirm/{token}', 'Auth\ConfirmEmailController@confirm');
Route::post('/register', 'Auth\RegisterController@postRegister');
2015-09-04 12:16:58 -04:00
2019-08-18 08:11:30 -04:00
// User invitation routes
Route::get('/register/invite/{token}', 'Auth\UserInviteController@showSetPassword');
Route::post('/register/invite/{token}', 'Auth\UserInviteController@setPassword');
// Password reset link request routes...
Route::get('/password/email', 'Auth\ForgotPasswordController@showLinkRequestForm');
Route::post('/password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
// Password reset routes...
Route::get('/password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
Route::post('/password/reset', 'Auth\ResetPasswordController@reset');
Route::fallback('HomeController@getNotFound');