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

267 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-09-11 14:25:22 +00:00
Routerv1::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-09-11 14:25:22 +00:00
Routerv1::group(['before' => 'maintenance'], function () {
2016-04-25 02:01:14 +00:00
// Meta pages
2016-09-11 14:25:22 +00:00
Routerv1::get('/', 'MetaController@index', 'main.index');
Routerv1::get('/faq', 'MetaController@faq', 'main.faq');
Routerv1::get('/search', 'MetaController@search', 'main.search');
2016-04-25 02:01:14 +00:00
// Auth
2016-09-21 18:36:49 +00:00
Routerv1::get('/login', 'AuthController@login', 'auth.login');
Routerv1::post('/login', 'AuthController@login', 'auth.login');
Routerv1::get('/register', 'AuthController@register', 'auth.register');
Routerv1::post('/register', 'AuthController@register', 'auth.register');
Routerv1::get('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword');
Routerv1::post('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword');
Routerv1::get('/reactivate', 'AuthController@reactivate', 'auth.reactivate');
Routerv1::post('/reactivate', 'AuthController@reactivate', 'auth.reactivate');
Routerv1::get('/activate', 'AuthController@activate', 'auth.activate');
Routerv1::get('/logout', 'AuthController@logout', 'auth.logout');
Routerv1::post('/logout', 'AuthController@logout', 'auth.logout');
2016-02-04 20:56:40 +00:00
2016-07-31 01:32:37 +00:00
// Link compatibility layer, prolly remove this in like a year
2016-09-11 14:25:22 +00:00
Routerv1::get('/r/{id}', function ($id) {
2016-09-21 18:36:49 +00:00
redirect("/p/{$id}");
2016-07-31 01:32:37 +00:00
});
2016-09-11 14:25:22 +00:00
Routerv1::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',
'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',
//'osu' => 'eventual link to flashii team',
'everlastingness' => 'https://i.flash.moe/18661469927746.txt',
'fuckingdone' => 'https://i.flash.moe/18671469927761.txt',
];
if (!array_key_exists($id, $resolve)) {
throw new \Phroute\Phroute\Exception\HttpRouteNotFoundException();
}
$link = $resolve[$id];
2016-09-21 18:36:49 +00:00
redirect(substr($link, 0, 4) === 'http' ? $link : route($link));
2016-07-31 01:32:37 +00:00
});
// Info
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'info'], function () {
Routerv1::get('/terms', 'InfoController@terms', 'info.terms');
Routerv1::get('/privacy', 'InfoController@privacy', 'info.privacy');
Routerv1::get('/contact', 'InfoController@contact', 'info.contact');
Routerv1::get('/rules', 'InfoController@rules', 'info.rules');
Routerv1::get('/welcome', 'InfoController@welcome', 'info.welcome');
2016-07-31 01:32:37 +00:00
});
// Status
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'status'], function () {
Routerv1::get('/', 'StatusController@index', 'status.index');
});
2016-04-25 02:01:14 +00:00
// News
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'news'], function () {
Routerv1::get('/{category:c}?', 'NewsController@category', 'news.category');
Routerv1::get('/post/{id:i}', 'NewsController@post', 'news.post');
2016-04-25 02:01:14 +00:00
});
2016-02-04 20:56:40 +00:00
// Chat
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'chat'], function () {
Routerv1::get('/redirect', 'ChatController@redirect', 'chat.redirect');
Routerv1::get('/settings', 'ChatController@settings', 'chat.settings');
Routerv1::get('/auth', 'ChatController@auth', 'chat.auth');
Routerv1::get('/resolve', 'ChatController@resolve', 'chat.resolve');
Routerv1::get('/irc', 'ChatController@irc', 'chat.irc');
});
2016-08-10 16:10:57 +00:00
// Authentication for the "old" chat
2016-09-11 14:25:22 +00:00
Routerv1::get('/web/sock-auth.php', 'ChatController@authLegacy');
2016-08-10 16:10:57 +00:00
2016-04-25 02:01:14 +00:00
// Forum
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'forum'], function () {
2016-04-25 02:01:14 +00:00
// Post
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'post'], function () {
Routerv1::get('/{id:i}', 'Forum.PostController@find', 'forums.post');
2016-09-21 18:36:49 +00:00
Routerv1::delete('/{id:i}', 'Forum.PostController@delete', 'forums.post.delete');
Routerv1::get('/{id:i}/raw', 'Forum.PostController@raw', 'forums.post.raw');
Routerv1::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-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'topic'], function () {
Routerv1::get('/{id:i}', 'Forum.TopicController@view', 'forums.topic');
Routerv1::get('/{id:i}/sticky', 'Forum.TopicController@sticky', 'forums.topic.sticky');
Routerv1::get('/{id:i}/announce', 'Forum.TopicController@announce', 'forums.topic.announce');
Routerv1::get('/{id:i}/lock', 'Forum.TopicController@lock', 'forums.topic.lock');
Routerv1::get('/{id:i}/delete', 'Forum.TopicController@delete', 'forums.topic.delete');
Routerv1::get('/{id:i}/restore', 'Forum.TopicController@restore', 'forums.topic.restore');
Routerv1::get('/{id:i}/move', 'Forum.TopicController@move', 'forums.topic.move');
Routerv1::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-09-11 14:25:22 +00:00
Routerv1::get('/', 'Forum.ForumController@index', 'forums.index');
Routerv1::get('/{id:i}', 'Forum.ForumController@forum', 'forums.forum');
2016-09-21 18:36:49 +00:00
Routerv1::get('/{id:i}/mark', 'Forum.ForumController@markRead', 'forums.mark');
Routerv1::get('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
Routerv1::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-09-21 18:36:49 +00:00
Routerv1::group(['prefix' => 'members'], function () {
2016-09-11 14:25:22 +00:00
Routerv1::get('/', 'UserController@members', 'members.index');
Routerv1::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-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'u'], function () {
Routerv1::get('/{id}', 'UserController@profile', 'user.profile');
Routerv1::get('/{id}/report', 'UserController@report', 'user.report');
2016-09-13 22:05:03 +00:00
2016-09-19 15:33:52 +00:00
Routerv1::get('/{id}/nowplaying', 'UserController@nowPlaying', 'user.nowplaying');
2016-09-13 22:05:03 +00:00
Routerv1::get('/{id}/avatar', 'FileController@avatar', 'user.avatar');
Routerv1::post('/{id}/avatar', 'FileController@avatar', 'user.avatar');
Routerv1::delete('/{id}/avatar', 'FileController@avatar', 'user.avatar');
Routerv1::get('/{id}/background', 'FileController@background', 'user.background');
Routerv1::post('/{id}/background', 'FileController@background', 'user.background');
Routerv1::delete('/{id}/background', 'FileController@background', 'user.background');
2016-09-11 14:25:22 +00:00
Routerv1::get('/{id}/header', 'FileController@header', 'user.header');
2016-09-13 22:05:03 +00:00
Routerv1::post('/{id}/header', 'FileController@header', 'user.header');
Routerv1::delete('/{id}/header', 'FileController@header', 'user.header');
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-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'notifications'], function () {
Routerv1::get('/', 'NotificationsController@notifications', 'notifications.get');
Routerv1::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-09-21 18:36:49 +00:00
Routerv1::group(['prefix' => 'comments'], function () {
2016-09-11 14:25:22 +00:00
Routerv1::post('/{category:c}/post/{reply:i}?', 'CommentsController@post', 'comments.category.post');
Routerv1::post('/{id:i}/delete', 'CommentsController@delete', 'comments.comment.delete');
Routerv1::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-09-21 18:36:49 +00:00
Routerv1::group(['prefix' => 'friends'], function () {
2016-09-11 14:25:22 +00:00
Routerv1::post('/{id:i}/add', 'FriendsController@add', 'friends.add');
Routerv1::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-09-21 18:36:49 +00:00
Routerv1::group(['prefix' => 'support'], function () {
2016-09-11 14:25:22 +00:00
Routerv1::get('/', 'PremiumController@index', 'premium.index');
Routerv1::get('/error', 'PremiumController@error', 'premium.error');
Routerv1::get('/handle', 'PremiumController@handle', 'premium.handle');
Routerv1::get('/complete', 'PremiumController@complete', 'premium.complete');
Routerv1::post('/purchase', 'PremiumController@purchase', 'premium.purchase');
});
2016-04-25 02:01:14 +00:00
// Helpers
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'helper'], function () {
2016-04-25 02:01:14 +00:00
// BBcode
2016-09-21 18:36:49 +00:00
Routerv1::group(['prefix' => 'bbcode'], function () {
2016-09-11 14:25:22 +00:00
Routerv1::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse');
});
});
2016-04-25 02:01:14 +00:00
// Settings
2016-09-21 18:36:49 +00:00
Routerv1::group(['prefix' => 'settings'], function () {
2016-09-11 14:25:22 +00:00
Routerv1::get('/', function () {
2016-09-21 18:36:49 +00:00
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-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'account'], function () {
Routerv1::get('/', function () {
2016-09-21 18:36:49 +00:00
redirect(route('settings.account.profile'));
2016-04-25 02:01:14 +00:00
});
2016-09-11 14:25:22 +00:00
Routerv1::get('/profile', 'Settings.AccountController@profile', 'settings.account.profile');
Routerv1::post('/profile', 'Settings.AccountController@profile', 'settings.account.profile');
Routerv1::get('/details', 'Settings.AccountController@details', 'settings.account.details');
Routerv1::post('/details', 'Settings.AccountController@details', 'settings.account.details');
Routerv1::get('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
Routerv1::post('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
Routerv1::get('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage');
Routerv1::post('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage');
Routerv1::get('/signature', 'Settings.AccountController@signature', 'settings.account.signature');
Routerv1::post('/signature', 'Settings.AccountController@signature', 'settings.account.signature');
});
2016-04-25 02:01:14 +00:00
// Friends section
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'friends'], function () {
Routerv1::get('/', function () {
2016-09-21 18:36:49 +00:00
redirect(route('settings.account.listing'));
2016-04-25 02:01:14 +00:00
});
2016-09-11 14:25:22 +00:00
Routerv1::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing');
Routerv1::get('/requests', 'Settings.FriendsController@requests', 'settings.friends.requests');
});
2016-04-25 02:01:14 +00:00
// Notifications section
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'notifications'], function () {
Routerv1::get('/', function () {
2016-09-21 18:36:49 +00:00
redirect(route('settings.account.history'));
2016-04-25 02:01:14 +00:00
});
2016-09-11 14:25:22 +00:00
Routerv1::get('/history', 'Settings.NotificationsController@history', 'settings.notifications.history');
});
2016-04-25 02:01:14 +00:00
// Advanced section
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'advanced'], function () {
Routerv1::get('/', function () {
2016-09-21 18:36:49 +00:00
redirect(route('settings.account.sessions'));
2016-04-25 02:01:14 +00:00
});
2016-09-11 14:25:22 +00:00
Routerv1::get('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
Routerv1::post('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
Routerv1::get('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
Routerv1::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-09-21 18:36:49 +00:00
Routerv1::group(['prefix' => 'manage'], function () {
2016-09-11 14:25:22 +00:00
Routerv1::get('/', function () {
2016-09-21 18:36:49 +00:00
redirect(route('manage.overview.index'));
2016-07-31 19:36:13 +00:00
}, 'manage.index');
// Overview section
2016-09-11 14:25:22 +00:00
Routerv1::group(['prefix' => 'overview'], function () {
Routerv1::get('/', function () {
2016-09-21 18:36:49 +00:00
redirect(route('manage.overview.index'));
2016-08-02 20:35:12 +00:00
});
2016-07-31 19:36:13 +00:00
2016-09-11 14:25:22 +00:00
Routerv1::get('/index', 'Manage.OverviewController@index', 'manage.overview.index');
Routerv1::get('/data', 'Manage.OverviewController@data', 'manage.overview.data');
2016-07-31 19:36:13 +00:00
});
});
2016-04-25 02:01:14 +00:00
});