This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/routes.php

257 lines
12 KiB
PHP
Raw Normal View History

2016-01-30 00:18:23 +00:00
<?php
/*
* Router paths
*/
// Define namespace
namespace Sakura;
2016-01-30 13:25:18 +00:00
use Phroute\Phroute\Exception\HttpRouteNotFoundException;
2016-04-25 02:01:14 +00:00
// Maintenance check
2016-11-04 17:51:11 +00:00
Router::filter('maintenance', function () {
2016-07-26 17:29:53 +00:00
if (config('general.maintenance')) {
2016-08-07 14:10:27 +00:00
CurrentSession::stop();
2016-04-25 02:01:14 +00:00
http_response_code(503);
return view('errors/503');
2016-04-25 02:01:14 +00:00
}
});
2016-11-04 17:51:11 +00:00
Router::group(['before' => 'maintenance'], function () {
2016-04-25 02:01:14 +00:00
// Meta pages
2016-11-04 17:51:11 +00:00
Router::get('/', 'MetaController@index', 'main.index');
Router::get('/search', 'MetaController@search', 'main.search');
2016-04-25 02:01:14 +00:00
2016-07-31 01:32:37 +00:00
// Link compatibility layer, prolly remove this in like a year
2016-11-04 17:51:11 +00:00
Router::get('/r/{id}', function ($id) {
2016-12-08 19:35:39 +00:00
return redirect("/p/{$id}");
2016-07-31 01:32:37 +00:00
});
2016-11-04 17:51:11 +00:00
Router::get('/p/{id}', function ($id) {
2016-07-31 01:32:37 +00:00
$resolve = [
'terms' => 'info.terms',
'contact' => 'info.contact',
'rules' => 'info.rules',
'welcome' => 'info.welcome',
//'profileapi' => 'api.manage.index',
2016-12-04 16:57:35 +00:00
//'chat' => 'chat.redirect',
//'irc' => 'chat.irc',
2016-07-31 01:32:37 +00:00
'feedback' => 'forums.index',
2016-07-31 19:36:13 +00:00
'mcp' => 'manage.index',
'mcptest' => 'manage.index',
2016-07-31 01:32:37 +00:00
//'report' => 'report.something',
2016-12-11 18:51:45 +00:00
'osu' => 'osu.leaderboard',
2016-12-08 18:45:20 +00:00
'everlastingness' => 'https://gist.github.com/fe207557385f0700d719a97b5fab647f',
'fuckingdone' => 'https://gist.github.com/4fac58c40be8a71dbfde50eca149575d',
2016-07-31 01:32:37 +00:00
];
if (!array_key_exists($id, $resolve)) {
2016-12-08 18:45:20 +00:00
throw new \Phroute\Phroute\Exception\HttpRouteNotFoundException;
2016-07-31 01:32:37 +00:00
}
$link = $resolve[$id];
2016-12-08 19:35:39 +00:00
return redirect(substr($link, 0, 4) === 'http' ? $link : route($link));
2016-07-31 01:32:37 +00:00
});
// Auth
Router::group(['prefix' => 'auth'], function () {
Router::post('/login', 'AuthController@login', 'auth.login');
Router::delete('/logout', 'AuthController@logout', 'auth.logout');
Router::get('/register', 'AuthController@register', 'auth.register');
Router::post('/register', 'AuthController@register', 'auth.register');
2016-12-09 19:46:23 +00:00
Router::get('/reset-password', 'AuthController@resetPassword', 'auth.resetpassword');
Router::post('/reset-password', 'AuthController@resetPassword', 'auth.resetpassword');
Router::get('/activate', 'AuthController@activate', 'auth.activate');
Router::post('/activate', 'AuthController@activate', 'auth.activate');
});
2016-07-31 01:32:37 +00:00
// Info
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'info'], function () {
Router::get('/terms', 'InfoController@terms', 'info.terms');
Router::get('/privacy', 'InfoController@privacy', 'info.privacy');
Router::get('/contact', 'InfoController@contact', 'info.contact');
Router::get('/rules', 'InfoController@rules', 'info.rules');
Router::get('/welcome', 'InfoController@welcome', 'info.welcome');
2016-07-31 01:32:37 +00:00
});
// Status
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'status'], function () {
Router::get('/', 'StatusController@index', 'status.index');
2016-12-09 22:28:25 +00:00
Router::get('/data', 'StatusController@data', 'status.data');
});
2016-04-25 02:01:14 +00:00
// News
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'news'], function () {
Router::get('/{category:c}?', 'NewsController@category', 'news.category');
Router::get('/post/{id:i}', 'NewsController@post', 'news.post');
2016-04-25 02:01:14 +00:00
});
2016-02-04 20:56:40 +00:00
2016-04-25 02:01:14 +00:00
// Forum
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'forum'], function () {
2016-04-25 02:01:14 +00:00
// Post
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'post'], function () {
Router::get('/{id:i}', 'Forum.PostController@find', 'forums.post');
Router::delete('/{id:i}', 'Forum.PostController@delete', 'forums.post.delete');
Router::get('/{id:i}/raw', 'Forum.PostController@raw', 'forums.post.raw');
Router::post('/{id:i}/edit', 'Forum.PostController@edit', 'forums.post.edit');
2016-04-25 02:01:14 +00:00
});
2016-03-28 14:47:43 +00:00
2016-07-30 13:48:09 +00:00
// Topic
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'topic'], function () {
Router::get('/{id:i}', 'Forum.TopicController@view', 'forums.topic');
Router::get('/{id:i}/sticky', 'Forum.TopicController@sticky', 'forums.topic.sticky');
Router::get('/{id:i}/announce', 'Forum.TopicController@announce', 'forums.topic.announce');
Router::get('/{id:i}/lock', 'Forum.TopicController@lock', 'forums.topic.lock');
Router::get('/{id:i}/delete', 'Forum.TopicController@delete', 'forums.topic.delete');
Router::get('/{id:i}/restore', 'Forum.TopicController@restore', 'forums.topic.restore');
2016-12-11 01:00:47 +00:00
Router::post('/{id:i}/move', 'Forum.TopicController@move', 'forums.topic.move');
2016-11-04 17:51:11 +00:00
Router::post('/{id:i}/reply', 'Forum.TopicController@reply', 'forums.topic.reply');
2016-04-25 02:01:14 +00:00
});
2016-03-28 14:47:43 +00:00
2016-04-25 02:01:14 +00:00
// Forum
2016-11-04 17:51:11 +00:00
Router::get('/', 'Forum.ForumController@index', 'forums.index');
2016-12-11 01:00:47 +00:00
Router::get('/move-destinations', 'Forum.ForumController@moveDestinations', 'forums.move-destinations');
2016-11-04 17:51:11 +00:00
Router::get('/{id:i}', 'Forum.ForumController@forum', 'forums.forum');
Router::get('/{id:i}/mark', 'Forum.ForumController@markRead', 'forums.mark');
Router::get('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
Router::post('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
2016-04-25 02:01:14 +00:00
});
2016-03-30 21:30:15 +00:00
2016-04-25 02:01:14 +00:00
// Members
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'members'], function () {
Router::get('/', 'UserController@members', 'members.index');
Router::get('/{rank:i}', 'UserController@members', 'members.rank');
2016-04-25 02:01:14 +00:00
});
2016-02-15 21:20:46 +00:00
2016-04-25 02:01:14 +00:00
// User
2016-12-09 19:46:23 +00:00
Router::group(['prefix' => 'user'], function () {
Router::get('/{id:i}', 'UserController@profile', 'user.profile');
Router::get('/{id}', 'UserController@resolve', 'user.profile');
Router::get('/{id:i}/report', 'UserController@report', 'user.report');
2016-09-13 22:05:03 +00:00
2016-12-09 19:46:23 +00:00
Router::get('/{id:i}/now-playing', 'UserController@nowPlaying', 'user.nowplaying');
2016-09-19 15:33:52 +00:00
2016-12-09 19:46:23 +00:00
Router::get('/{id:i}/avatar', 'FileController@avatar', 'user.avatar');
Router::post('/{id:i}/avatar', 'FileController@avatar', 'user.avatar');
Router::delete('/{id:i}/avatar', 'FileController@avatar', 'user.avatar');
2016-09-13 22:05:03 +00:00
2016-12-09 19:46:23 +00:00
Router::get('/{id:i}/background', 'FileController@background', 'user.background');
Router::post('/{id:i}/background', 'FileController@background', 'user.background');
Router::delete('/{id:i}/background', 'FileController@background', 'user.background');
2016-09-13 22:05:03 +00:00
2016-12-09 19:46:23 +00:00
Router::get('/{id:i}/header', 'FileController@header', 'user.header');
Router::post('/{id:i}/header', 'FileController@header', 'user.header');
Router::delete('/{id:i}/header', 'FileController@header', 'user.header');
});
Router::get('/u/{id}', function ($id) {
return redirect(route('user.profile', $id));
2016-04-25 02:01:14 +00:00
});
2016-01-30 13:25:18 +00:00
2016-04-25 02:01:14 +00:00
// Notifications
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'notifications'], function () {
Router::get('/', 'NotificationsController@notifications', 'notifications.get');
Router::get('/{id}/mark', 'NotificationsController@mark', 'notifications.mark');
2016-04-25 02:01:14 +00:00
});
2016-02-13 13:36:21 +00:00
2016-04-25 02:01:14 +00:00
// Comments
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'comments'], function () {
Router::post('/{category:c}/post/{reply:i}?', 'CommentsController@post', 'comments.category.post');
Router::post('/{id:i}/delete', 'CommentsController@delete', 'comments.comment.delete');
Router::post('/{id:i}/vote', 'CommentsController@vote', 'comments.comment.vote');
2016-03-25 01:31:57 +00:00
});
2016-04-25 02:01:14 +00:00
// Comments
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'friends'], function () {
Router::post('/{id:i}/add', 'FriendsController@add', 'friends.add');
Router::post('/{id:i}/remove', 'FriendsController@remove', 'friends.remove');
2016-04-25 02:01:14 +00:00
});
2016-04-25 02:01:14 +00:00
// Premium
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'support'], function () {
Router::get('/', 'PremiumController@index', 'premium.index');
Router::get('/error', 'PremiumController@error', 'premium.error');
Router::get('/handle', 'PremiumController@handle', 'premium.handle');
Router::get('/complete', 'PremiumController@complete', 'premium.complete');
Router::post('/purchase', 'PremiumController@purchase', 'premium.purchase');
});
2016-12-11 18:51:45 +00:00
// osu!
Router::group(['prefix' => 'osu'], function () {
Router::get('/leaderboard', 'OsuController@leaderboard', 'osu.leaderboard');
Router::get('/leaderboard/data', 'OsuController@leaderboardData', 'osu.leaderboard.data');
});
2016-04-25 02:01:14 +00:00
// Helpers
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'helper'], function () {
2016-04-25 02:01:14 +00:00
// BBcode
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'bbcode'], function () {
Router::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse');
});
});
2016-04-25 02:01:14 +00:00
// Settings
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'settings'], function () {
Router::get('/', function () {
2016-12-04 16:33:52 +00:00
return redirect(route('settings.account.profile'));
2016-04-25 02:01:14 +00:00
}, 'settings.index');
2016-08-02 20:35:12 +00:00
// Account section
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'account'], function () {
Router::get('/', function () {
2016-12-04 16:33:52 +00:00
return redirect(route('settings.account.profile'));
2016-04-25 02:01:14 +00:00
});
2016-11-04 17:51:11 +00:00
Router::get('/profile', 'Settings.AccountController@profile', 'settings.account.profile');
Router::post('/profile', 'Settings.AccountController@profile', 'settings.account.profile');
Router::get('/details', 'Settings.AccountController@details', 'settings.account.details');
Router::post('/details', 'Settings.AccountController@details', 'settings.account.details');
Router::get('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
Router::post('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
Router::get('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage');
Router::post('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage');
Router::get('/signature', 'Settings.AccountController@signature', 'settings.account.signature');
Router::post('/signature', 'Settings.AccountController@signature', 'settings.account.signature');
});
2016-04-25 02:01:14 +00:00
// Friends section
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'friends'], function () {
Router::get('/', function () {
2016-12-04 16:33:52 +00:00
return redirect(route('settings.account.listing'));
2016-04-25 02:01:14 +00:00
});
2016-11-04 17:51:11 +00:00
Router::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing');
Router::get('/requests', 'Settings.FriendsController@requests', 'settings.friends.requests');
});
2016-04-25 02:01:14 +00:00
// Advanced section
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'advanced'], function () {
Router::get('/', function () {
2016-12-04 16:33:52 +00:00
return redirect(route('settings.account.sessions'));
2016-04-25 02:01:14 +00:00
});
2016-11-04 17:51:11 +00:00
Router::get('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
Router::post('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
Router::get('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
Router::post('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
2016-04-25 02:01:14 +00:00
});
});
2016-07-31 19:36:13 +00:00
// Settings
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'manage'], function () {
Router::get('/', function () {
2016-12-04 16:33:52 +00:00
return redirect(route('manage.overview.index'));
2016-07-31 19:36:13 +00:00
}, 'manage.index');
// Overview section
2016-11-04 17:51:11 +00:00
Router::group(['prefix' => 'overview'], function () {
Router::get('/', function () {
2016-12-04 16:33:52 +00:00
return redirect(route('manage.overview.index'));
2016-08-02 20:35:12 +00:00
});
2016-07-31 19:36:13 +00:00
2016-11-04 17:51:11 +00:00
Router::get('/index', 'Manage.OverviewController@index', 'manage.overview.index');
Router::get('/data', 'Manage.OverviewController@data', 'manage.overview.data');
2016-07-31 19:36:13 +00:00
});
});
2016-04-25 02:01:14 +00:00
});