2018-04-28 12:20:07 +00:00
|
|
|
<?php
|
2018-11-11 16:02:50 +00:00
|
|
|
// Auth routes
|
|
|
|
$app->group('', function () {
|
2018-11-19 18:04:43 +00:00
|
|
|
$this->get('/home[/page/{page}]', \App\Controllers\DashboardController::class . ':home')->setName('home');
|
2018-04-28 12:20:07 +00:00
|
|
|
|
2018-11-11 16:02:50 +00:00
|
|
|
$this->group('', function () {
|
2019-01-13 20:27:10 +00:00
|
|
|
$this->get('/home/switchView', \App\Controllers\DashboardController::class . ':switchView')->setName('switchView');
|
2019-01-24 20:48:22 +00:00
|
|
|
|
2019-01-13 20:27:10 +00:00
|
|
|
$this->get('/system/deleteOrphanFiles', \App\Controllers\AdminController::class . ':deleteOrphanFiles')->setName('system.deleteOrphanFiles');
|
2019-01-24 20:48:22 +00:00
|
|
|
|
2019-01-13 20:27:10 +00:00
|
|
|
$this->get('/system/themes', \App\Controllers\ThemeController::class . ':getThemes')->setName('theme');
|
|
|
|
$this->post('/system/theme/apply', \App\Controllers\ThemeController::class . ':applyTheme')->setName('theme.apply');
|
2019-01-24 20:48:22 +00:00
|
|
|
|
2019-08-20 12:56:41 +00:00
|
|
|
$this->post('/system/lang/apply', \App\Controllers\AdminController::class . ':applyLang')->setName('lang.apply');
|
|
|
|
|
2019-01-24 20:48:22 +00:00
|
|
|
$this->post('/system/upgrade', \App\Controllers\UpgradeController::class . ':upgrade')->setName('system.upgrade');
|
|
|
|
$this->get('/system/checkForUpdates', \App\Controllers\UpgradeController::class . ':checkForUpdates')->setName('system.checkForUpdates');
|
|
|
|
|
2019-01-13 20:27:10 +00:00
|
|
|
$this->get('/system', \App\Controllers\AdminController::class . ':system')->setName('system');
|
|
|
|
|
2018-11-19 18:04:43 +00:00
|
|
|
$this->get('/users[/page/{page}]', \App\Controllers\UserController::class . ':index')->setName('user.index');
|
2019-01-13 20:27:10 +00:00
|
|
|
})->add(\App\Middleware\AdminMiddleware::class);
|
|
|
|
|
|
|
|
$this->group('/user', function () {
|
|
|
|
|
|
|
|
$this->get('/create', \App\Controllers\UserController::class . ':create')->setName('user.create');
|
|
|
|
$this->post('/create', \App\Controllers\UserController::class . ':store')->setName('user.store');
|
|
|
|
$this->get('/{id}/edit', \App\Controllers\UserController::class . ':edit')->setName('user.edit');
|
|
|
|
$this->post('/{id}', \App\Controllers\UserController::class . ':update')->setName('user.update');
|
|
|
|
$this->get('/{id}/delete', \App\Controllers\UserController::class . ':delete')->setName('user.delete');
|
2018-11-11 16:02:50 +00:00
|
|
|
})->add(\App\Middleware\AdminMiddleware::class);
|
2018-04-28 12:20:07 +00:00
|
|
|
|
2018-11-19 18:04:43 +00:00
|
|
|
$this->get('/profile', \App\Controllers\UserController::class . ':profile')->setName('profile');
|
|
|
|
$this->post('/profile/{id}', \App\Controllers\UserController::class . ':profileEdit')->setName('profile.update');
|
|
|
|
$this->post('/user/{id}/refreshToken', \App\Controllers\UserController::class . ':refreshToken')->setName('refreshToken');
|
|
|
|
$this->get('/user/{id}/config/sharex', \App\Controllers\UserController::class . ':getShareXconfigFile')->setName('config.sharex');
|
2018-11-29 09:10:59 +00:00
|
|
|
$this->get('/user/{id}/config/script', \App\Controllers\UserController::class . ':getUploaderScriptFile')->setName('config.script');
|
2018-04-28 12:20:07 +00:00
|
|
|
|
2018-11-19 18:04:43 +00:00
|
|
|
$this->post('/upload/{id}/publish', \App\Controllers\UploadController::class . ':togglePublish')->setName('upload.publish');
|
|
|
|
$this->post('/upload/{id}/unpublish', \App\Controllers\UploadController::class . ':togglePublish')->setName('upload.unpublish');
|
|
|
|
$this->get('/upload/{id}/raw', \App\Controllers\UploadController::class . ':getRawById')->add(\App\Middleware\AdminMiddleware::class)->setName('upload.raw');
|
|
|
|
$this->post('/upload/{id}/delete', \App\Controllers\UploadController::class . ':delete')->setName('upload.delete');
|
2018-04-28 12:20:07 +00:00
|
|
|
|
2019-01-31 10:48:39 +00:00
|
|
|
})->add(App\Middleware\CheckForMaintenanceMiddleware::class)->add(\App\Middleware\AuthMiddleware::class);
|
2018-11-11 16:02:50 +00:00
|
|
|
|
2018-11-19 18:04:43 +00:00
|
|
|
$app->get('/', \App\Controllers\DashboardController::class . ':redirects')->setName('root');
|
|
|
|
$app->get('/login', \App\Controllers\LoginController::class . ':show')->setName('login.show');
|
|
|
|
$app->post('/login', \App\Controllers\LoginController::class . ':login')->setName('login');
|
|
|
|
$app->map(['GET', 'POST'], '/logout', \App\Controllers\LoginController::class . ':logout')->setName('logout');
|
2018-11-11 16:02:50 +00:00
|
|
|
|
2018-11-19 18:04:43 +00:00
|
|
|
$app->post('/upload', \App\Controllers\UploadController::class . ':upload')->setName('upload');
|
2018-11-11 16:02:50 +00:00
|
|
|
|
2018-11-19 18:04:43 +00:00
|
|
|
$app->get('/{userCode}/{mediaCode}', \App\Controllers\UploadController::class . ':show')->setName('public');
|
2019-01-31 10:48:39 +00:00
|
|
|
$app->get('/{userCode}/{mediaCode}/delete/{token}', \App\Controllers\UploadController::class . ':show')->setName('public.delete.show')->add(\App\Middleware\CheckForMaintenanceMiddleware::class);;
|
|
|
|
$app->post('/{userCode}/{mediaCode}/delete/{token}', \App\Controllers\UploadController::class . ':deleteByToken')->setName('public.delete')->add(\App\Middleware\CheckForMaintenanceMiddleware::class);;
|
2019-01-10 22:22:19 +00:00
|
|
|
$app->get('/{userCode}/{mediaCode}/raw', \App\Controllers\UploadController::class . ':showRaw')->setName('public.raw')->setOutputBuffering(false);
|
|
|
|
$app->get('/{userCode}/{mediaCode}/download', \App\Controllers\UploadController::class . ':download')->setName('public.download')->setOutputBuffering(false);
|