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