diff --git a/src/routes/admin.js b/src/routes/admin.js index 43c427dab9..3134e8d9ae 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -5,57 +5,57 @@ const helpers = require('./helpers'); module.exports = function (app, name, middleware, controllers) { const middlewares = [middleware.pluginHooks]; - helpers.setupAdminPageRoute(app, `/${name}`, middleware, middlewares, controllers.admin.routeIndex); + helpers.setupAdminPageRoute(app, `/${name}`, middlewares, controllers.admin.routeIndex); - helpers.setupAdminPageRoute(app, `/${name}/dashboard`, middleware, middlewares, controllers.admin.dashboard.get); - helpers.setupAdminPageRoute(app, `/${name}/dashboard/logins`, middleware, middlewares, controllers.admin.dashboard.getLogins); - helpers.setupAdminPageRoute(app, `/${name}/dashboard/users`, middleware, middlewares, controllers.admin.dashboard.getUsers); - helpers.setupAdminPageRoute(app, `/${name}/dashboard/topics`, middleware, middlewares, controllers.admin.dashboard.getTopics); - helpers.setupAdminPageRoute(app, `/${name}/dashboard/searches`, middleware, middlewares, controllers.admin.dashboard.getSearches); + helpers.setupAdminPageRoute(app, `/${name}/dashboard`, middlewares, controllers.admin.dashboard.get); + helpers.setupAdminPageRoute(app, `/${name}/dashboard/logins`, middlewares, controllers.admin.dashboard.getLogins); + helpers.setupAdminPageRoute(app, `/${name}/dashboard/users`, middlewares, controllers.admin.dashboard.getUsers); + helpers.setupAdminPageRoute(app, `/${name}/dashboard/topics`, middlewares, controllers.admin.dashboard.getTopics); + helpers.setupAdminPageRoute(app, `/${name}/dashboard/searches`, middlewares, controllers.admin.dashboard.getSearches); - helpers.setupAdminPageRoute(app, `/${name}/manage/categories`, middleware, middlewares, controllers.admin.categories.getAll); - helpers.setupAdminPageRoute(app, `/${name}/manage/categories/:category_id`, middleware, middlewares, controllers.admin.categories.get); - helpers.setupAdminPageRoute(app, `/${name}/manage/categories/:category_id/analytics`, middleware, middlewares, controllers.admin.categories.getAnalytics); + helpers.setupAdminPageRoute(app, `/${name}/manage/categories`, middlewares, controllers.admin.categories.getAll); + helpers.setupAdminPageRoute(app, `/${name}/manage/categories/:category_id`, middlewares, controllers.admin.categories.get); + helpers.setupAdminPageRoute(app, `/${name}/manage/categories/:category_id/analytics`, middlewares, controllers.admin.categories.getAnalytics); - helpers.setupAdminPageRoute(app, `/${name}/manage/privileges/:cid?`, middleware, middlewares, controllers.admin.privileges.get); - helpers.setupAdminPageRoute(app, `/${name}/manage/tags`, middleware, middlewares, controllers.admin.tags.get); + helpers.setupAdminPageRoute(app, `/${name}/manage/privileges/:cid?`, middlewares, controllers.admin.privileges.get); + helpers.setupAdminPageRoute(app, `/${name}/manage/tags`, middlewares, controllers.admin.tags.get); - helpers.setupAdminPageRoute(app, `/${name}/manage/users`, middleware, middlewares, controllers.admin.users.index); - helpers.setupAdminPageRoute(app, `/${name}/manage/registration`, middleware, middlewares, controllers.admin.users.registrationQueue); + helpers.setupAdminPageRoute(app, `/${name}/manage/users`, middlewares, controllers.admin.users.index); + helpers.setupAdminPageRoute(app, `/${name}/manage/registration`, middlewares, controllers.admin.users.registrationQueue); - helpers.setupAdminPageRoute(app, `/${name}/manage/admins-mods`, middleware, middlewares, controllers.admin.adminsMods.get); + helpers.setupAdminPageRoute(app, `/${name}/manage/admins-mods`, middlewares, controllers.admin.adminsMods.get); - helpers.setupAdminPageRoute(app, `/${name}/manage/groups`, middleware, middlewares, controllers.admin.groups.list); - helpers.setupAdminPageRoute(app, `/${name}/manage/groups/:name`, middleware, middlewares, controllers.admin.groups.get); + helpers.setupAdminPageRoute(app, `/${name}/manage/groups`, middlewares, controllers.admin.groups.list); + helpers.setupAdminPageRoute(app, `/${name}/manage/groups/:name`, middlewares, controllers.admin.groups.get); - helpers.setupAdminPageRoute(app, `/${name}/manage/uploads`, middleware, middlewares, controllers.admin.uploads.get); - helpers.setupAdminPageRoute(app, `/${name}/manage/digest`, middleware, middlewares, controllers.admin.digest.get); + helpers.setupAdminPageRoute(app, `/${name}/manage/uploads`, middlewares, controllers.admin.uploads.get); + helpers.setupAdminPageRoute(app, `/${name}/manage/digest`, middlewares, controllers.admin.digest.get); - helpers.setupAdminPageRoute(app, `/${name}/settings/email`, middleware, middlewares, controllers.admin.settings.email); - helpers.setupAdminPageRoute(app, `/${name}/settings/user`, middleware, middlewares, controllers.admin.settings.user); - helpers.setupAdminPageRoute(app, `/${name}/settings/post`, middleware, middlewares, controllers.admin.settings.post); - helpers.setupAdminPageRoute(app, `/${name}/settings/languages`, middleware, middlewares, controllers.admin.settings.languages); - helpers.setupAdminPageRoute(app, `/${name}/settings/navigation`, middleware, middlewares, controllers.admin.settings.navigation); - helpers.setupAdminPageRoute(app, `/${name}/settings/homepage`, middleware, middlewares, controllers.admin.settings.homepage); - helpers.setupAdminPageRoute(app, `/${name}/settings/social`, middleware, middlewares, controllers.admin.settings.social); - helpers.setupAdminPageRoute(app, `/${name}/settings/:term?`, middleware, middlewares, controllers.admin.settings.get); + helpers.setupAdminPageRoute(app, `/${name}/settings/email`, middlewares, controllers.admin.settings.email); + helpers.setupAdminPageRoute(app, `/${name}/settings/user`, middlewares, controllers.admin.settings.user); + helpers.setupAdminPageRoute(app, `/${name}/settings/post`, middlewares, controllers.admin.settings.post); + helpers.setupAdminPageRoute(app, `/${name}/settings/languages`, middlewares, controllers.admin.settings.languages); + helpers.setupAdminPageRoute(app, `/${name}/settings/navigation`, middlewares, controllers.admin.settings.navigation); + helpers.setupAdminPageRoute(app, `/${name}/settings/homepage`, middlewares, controllers.admin.settings.homepage); + helpers.setupAdminPageRoute(app, `/${name}/settings/social`, middlewares, controllers.admin.settings.social); + helpers.setupAdminPageRoute(app, `/${name}/settings/:term?`, middlewares, controllers.admin.settings.get); - helpers.setupAdminPageRoute(app, `/${name}/appearance/:term?`, middleware, middlewares, controllers.admin.appearance.get); + helpers.setupAdminPageRoute(app, `/${name}/appearance/:term?`, middlewares, controllers.admin.appearance.get); - helpers.setupAdminPageRoute(app, `/${name}/extend/plugins`, middleware, middlewares, controllers.admin.plugins.get); - helpers.setupAdminPageRoute(app, `/${name}/extend/widgets`, middleware, middlewares, controllers.admin.extend.widgets.get); - helpers.setupAdminPageRoute(app, `/${name}/extend/rewards`, middleware, middlewares, controllers.admin.extend.rewards.get); + helpers.setupAdminPageRoute(app, `/${name}/extend/plugins`, middlewares, controllers.admin.plugins.get); + helpers.setupAdminPageRoute(app, `/${name}/extend/widgets`, middlewares, controllers.admin.extend.widgets.get); + helpers.setupAdminPageRoute(app, `/${name}/extend/rewards`, middlewares, controllers.admin.extend.rewards.get); - helpers.setupAdminPageRoute(app, `/${name}/advanced/database`, middleware, middlewares, controllers.admin.database.get); - helpers.setupAdminPageRoute(app, `/${name}/advanced/events`, middleware, middlewares, controllers.admin.events.get); - helpers.setupAdminPageRoute(app, `/${name}/advanced/hooks`, middleware, middlewares, controllers.admin.hooks.get); - helpers.setupAdminPageRoute(app, `/${name}/advanced/logs`, middleware, middlewares, controllers.admin.logs.get); - helpers.setupAdminPageRoute(app, `/${name}/advanced/errors`, middleware, middlewares, controllers.admin.errors.get); - helpers.setupAdminPageRoute(app, `/${name}/advanced/errors/export`, middleware, middlewares, controllers.admin.errors.export); - helpers.setupAdminPageRoute(app, `/${name}/advanced/cache`, middleware, middlewares, controllers.admin.cache.get); + helpers.setupAdminPageRoute(app, `/${name}/advanced/database`, middlewares, controllers.admin.database.get); + helpers.setupAdminPageRoute(app, `/${name}/advanced/events`, middlewares, controllers.admin.events.get); + helpers.setupAdminPageRoute(app, `/${name}/advanced/hooks`, middlewares, controllers.admin.hooks.get); + helpers.setupAdminPageRoute(app, `/${name}/advanced/logs`, middlewares, controllers.admin.logs.get); + helpers.setupAdminPageRoute(app, `/${name}/advanced/errors`, middlewares, controllers.admin.errors.get); + helpers.setupAdminPageRoute(app, `/${name}/advanced/errors/export`, middlewares, controllers.admin.errors.export); + helpers.setupAdminPageRoute(app, `/${name}/advanced/cache`, middlewares, controllers.admin.cache.get); - helpers.setupAdminPageRoute(app, `/${name}/development/logger`, middleware, middlewares, controllers.admin.logger.get); - helpers.setupAdminPageRoute(app, `/${name}/development/info`, middleware, middlewares, controllers.admin.info.get); + helpers.setupAdminPageRoute(app, `/${name}/development/logger`, middlewares, controllers.admin.logger.get); + helpers.setupAdminPageRoute(app, `/${name}/development/info`, middlewares, controllers.admin.info.get); apiRoutes(app, name, middleware, controllers); }; diff --git a/src/routes/helpers.js b/src/routes/helpers.js index 62eec31f07..6d0976f8d5 100644 --- a/src/routes/helpers.js +++ b/src/routes/helpers.js @@ -40,7 +40,7 @@ helpers.setupAdminPageRoute = function (...args) { const middlewares = args.length > 3 ? args[args.length - 2] : []; const controller = args[args.length - 1]; if (args.length === 5) { - winston.warn('[helpers.setupAdminPageRoute] passing middleware as third param is deprecated'); + winston.warn(`[helpers.setupAdminPageRoute(${name})] passing \`middleware\` as the third param is deprecated, it can now be safely removed`); } router.get(name, middleware.admin.buildHeader, middlewares, helpers.tryRoute(controller)); router.get(`/api${name}`, middlewares, helpers.tryRoute(controller)); diff --git a/src/routes/index.js b/src/routes/index.js index d0b987d837..557380315d 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -28,36 +28,36 @@ const _mounts = { _mounts.main = (app, middleware, controllers) => { const loginRegisterMiddleware = [middleware.redirectToAccountIfLoggedIn]; - setupPageRoute(app, '/login', middleware, loginRegisterMiddleware, controllers.login); - setupPageRoute(app, '/register', middleware, loginRegisterMiddleware, controllers.register); - setupPageRoute(app, '/register/complete', middleware, [], controllers.registerInterstitial); - setupPageRoute(app, '/compose', middleware, [], controllers.composer.get); - setupPageRoute(app, '/confirm/:code', middleware, [], controllers.confirmEmail); - setupPageRoute(app, '/outgoing', middleware, [], controllers.outgoing); - setupPageRoute(app, '/search', middleware, [], controllers.search.search); - setupPageRoute(app, '/reset/:code?', middleware, [middleware.delayLoading], controllers.reset); - setupPageRoute(app, '/tos', middleware, [], controllers.termsOfUse); - - setupPageRoute(app, '/email/unsubscribe/:token', middleware, [], controllers.accounts.settings.unsubscribe); + setupPageRoute(app, '/login', loginRegisterMiddleware, controllers.login); + setupPageRoute(app, '/register', loginRegisterMiddleware, controllers.register); + setupPageRoute(app, '/register/complete', [], controllers.registerInterstitial); + setupPageRoute(app, '/compose', [], controllers.composer.get); + setupPageRoute(app, '/confirm/:code', [], controllers.confirmEmail); + setupPageRoute(app, '/outgoing', [], controllers.outgoing); + setupPageRoute(app, '/search', [], controllers.search.search); + setupPageRoute(app, '/reset/:code?', [middleware.delayLoading], controllers.reset); + setupPageRoute(app, '/tos', [], controllers.termsOfUse); + + setupPageRoute(app, '/email/unsubscribe/:token', [], controllers.accounts.settings.unsubscribe); app.post('/email/unsubscribe/:token', controllers.accounts.settings.unsubscribePost); app.post('/compose', middleware.applyCSRF, controllers.composer.post); }; _mounts.mod = (app, middleware, controllers) => { - setupPageRoute(app, '/flags', middleware, [], controllers.mods.flags.list); - setupPageRoute(app, '/flags/:flagId', middleware, [], controllers.mods.flags.detail); - setupPageRoute(app, '/post-queue/:id?', middleware, [], controllers.mods.postQueue); + setupPageRoute(app, '/flags', [], controllers.mods.flags.list); + setupPageRoute(app, '/flags/:flagId', [], controllers.mods.flags.detail); + setupPageRoute(app, '/post-queue/:id?', [], controllers.mods.postQueue); }; _mounts.globalMod = (app, middleware, controllers) => { - setupPageRoute(app, '/ip-blacklist', middleware, [], controllers.globalMods.ipBlacklist); - setupPageRoute(app, '/registration-queue', middleware, [], controllers.globalMods.registrationQueue); + setupPageRoute(app, '/ip-blacklist', [], controllers.globalMods.ipBlacklist); + setupPageRoute(app, '/registration-queue', [], controllers.globalMods.registrationQueue); }; _mounts.topic = (app, name, middleware, controllers) => { - setupPageRoute(app, `/${name}/:topic_id/:slug/:post_index?`, middleware, [], controllers.topics.get); - setupPageRoute(app, `/${name}/:topic_id/:slug?`, middleware, [], controllers.topics.get); + setupPageRoute(app, `/${name}/:topic_id/:slug/:post_index?`, [], controllers.topics.get); + setupPageRoute(app, `/${name}/:topic_id/:slug?`, [], controllers.topics.get); }; _mounts.post = (app, name, middleware, controllers) => { @@ -72,33 +72,33 @@ _mounts.post = (app, name, middleware, controllers) => { }; _mounts.tags = (app, name, middleware, controllers) => { - setupPageRoute(app, `/${name}/:tag`, middleware, [middleware.privateTagListing], controllers.tags.getTag); - setupPageRoute(app, `/${name}`, middleware, [middleware.privateTagListing], controllers.tags.getTags); + setupPageRoute(app, `/${name}/:tag`, [middleware.privateTagListing], controllers.tags.getTag); + setupPageRoute(app, `/${name}`, [middleware.privateTagListing], controllers.tags.getTags); }; _mounts.category = (app, name, middleware, controllers) => { - setupPageRoute(app, '/categories', middleware, [], controllers.categories.list); - setupPageRoute(app, '/popular', middleware, [], controllers.popular.get); - setupPageRoute(app, '/recent', middleware, [], controllers.recent.get); - setupPageRoute(app, '/top', middleware, [], controllers.top.get); - setupPageRoute(app, '/unread', middleware, [middleware.ensureLoggedIn], controllers.unread.get); - - setupPageRoute(app, `/${name}/:category_id/:slug/:topic_index`, middleware, [], controllers.category.get); - setupPageRoute(app, `/${name}/:category_id/:slug?`, middleware, [], controllers.category.get); + setupPageRoute(app, '/categories', [], controllers.categories.list); + setupPageRoute(app, '/popular', [], controllers.popular.get); + setupPageRoute(app, '/recent', [], controllers.recent.get); + setupPageRoute(app, '/top', [], controllers.top.get); + setupPageRoute(app, '/unread', [middleware.ensureLoggedIn], controllers.unread.get); + + setupPageRoute(app, `/${name}/:category_id/:slug/:topic_index`, [], controllers.category.get); + setupPageRoute(app, `/${name}/:category_id/:slug?`, [], controllers.category.get); }; _mounts.users = (app, name, middleware, controllers) => { const middlewares = [middleware.canViewUsers]; - setupPageRoute(app, `/${name}`, middleware, middlewares, controllers.users.index); + setupPageRoute(app, `/${name}`, middlewares, controllers.users.index); }; _mounts.groups = (app, name, middleware, controllers) => { const middlewares = [middleware.canViewGroups]; - setupPageRoute(app, `/${name}`, middleware, middlewares, controllers.groups.list); - setupPageRoute(app, `/${name}/:slug`, middleware, middlewares, controllers.groups.details); - setupPageRoute(app, `/${name}/:slug/members`, middleware, middlewares, controllers.groups.members); + setupPageRoute(app, `/${name}`, middlewares, controllers.groups.list); + setupPageRoute(app, `/${name}/:slug`, middlewares, controllers.groups.details); + setupPageRoute(app, `/${name}/:slug/members`, middlewares, controllers.groups.members); }; module.exports = async function (app, middleware) { @@ -139,7 +139,7 @@ module.exports = async function (app, middleware) { router.use('/', controllers.home.rewrite); // homepage handled by `action:homepage.get:[route]` - setupPageRoute(router, '/', middleware, [], controllers.home.pluginHook); + setupPageRoute(router, '/', [], controllers.home.pluginHook); await plugins.reloadRoutes({ router: router }); await authRoutes.reloadRoutes({ router: router }); diff --git a/src/routes/user.js b/src/routes/user.js index 937997eba5..b6fd28d21d 100644 --- a/src/routes/user.js +++ b/src/routes/user.js @@ -13,41 +13,41 @@ module.exports = function (app, name, middleware, controllers) { middleware.checkAccountPermissions, ]; - setupPageRoute(app, '/me', middleware, [], middleware.redirectMeToUserslug); - setupPageRoute(app, '/me/*', middleware, [], middleware.redirectMeToUserslug); - setupPageRoute(app, '/uid/:uid*', middleware, [], middleware.redirectUidToUserslug); - - setupPageRoute(app, `/${name}/:userslug`, middleware, middlewares, controllers.accounts.profile.get); - setupPageRoute(app, `/${name}/:userslug/following`, middleware, middlewares, controllers.accounts.follow.getFollowing); - setupPageRoute(app, `/${name}/:userslug/followers`, middleware, middlewares, controllers.accounts.follow.getFollowers); - - setupPageRoute(app, `/${name}/:userslug/posts`, middleware, middlewares, controllers.accounts.posts.getPosts); - setupPageRoute(app, `/${name}/:userslug/topics`, middleware, middlewares, controllers.accounts.posts.getTopics); - setupPageRoute(app, `/${name}/:userslug/best`, middleware, middlewares, controllers.accounts.posts.getBestPosts); - setupPageRoute(app, `/${name}/:userslug/controversial`, middleware, middlewares, controllers.accounts.posts.getControversialPosts); - setupPageRoute(app, `/${name}/:userslug/groups`, middleware, middlewares, controllers.accounts.groups.get); - - setupPageRoute(app, `/${name}/:userslug/categories`, middleware, accountMiddlewares, controllers.accounts.categories.get); - setupPageRoute(app, `/${name}/:userslug/bookmarks`, middleware, accountMiddlewares, controllers.accounts.posts.getBookmarks); - setupPageRoute(app, `/${name}/:userslug/watched`, middleware, accountMiddlewares, controllers.accounts.posts.getWatchedTopics); - setupPageRoute(app, `/${name}/:userslug/ignored`, middleware, accountMiddlewares, controllers.accounts.posts.getIgnoredTopics); - setupPageRoute(app, `/${name}/:userslug/upvoted`, middleware, accountMiddlewares, controllers.accounts.posts.getUpVotedPosts); - setupPageRoute(app, `/${name}/:userslug/downvoted`, middleware, accountMiddlewares, controllers.accounts.posts.getDownVotedPosts); - setupPageRoute(app, `/${name}/:userslug/edit`, middleware, accountMiddlewares, controllers.accounts.edit.get); - setupPageRoute(app, `/${name}/:userslug/edit/username`, middleware, accountMiddlewares, controllers.accounts.edit.username); - setupPageRoute(app, `/${name}/:userslug/edit/email`, middleware, accountMiddlewares, controllers.accounts.edit.email); - setupPageRoute(app, `/${name}/:userslug/edit/password`, middleware, accountMiddlewares, controllers.accounts.edit.password); + setupPageRoute(app, '/me', [], middleware.redirectMeToUserslug); + setupPageRoute(app, '/me/*', [], middleware.redirectMeToUserslug); + setupPageRoute(app, '/uid/:uid*', [], middleware.redirectUidToUserslug); + + setupPageRoute(app, `/${name}/:userslug`, middlewares, controllers.accounts.profile.get); + setupPageRoute(app, `/${name}/:userslug/following`, middlewares, controllers.accounts.follow.getFollowing); + setupPageRoute(app, `/${name}/:userslug/followers`, middlewares, controllers.accounts.follow.getFollowers); + + setupPageRoute(app, `/${name}/:userslug/posts`, middlewares, controllers.accounts.posts.getPosts); + setupPageRoute(app, `/${name}/:userslug/topics`, middlewares, controllers.accounts.posts.getTopics); + setupPageRoute(app, `/${name}/:userslug/best`, middlewares, controllers.accounts.posts.getBestPosts); + setupPageRoute(app, `/${name}/:userslug/controversial`, middlewares, controllers.accounts.posts.getControversialPosts); + setupPageRoute(app, `/${name}/:userslug/groups`, middlewares, controllers.accounts.groups.get); + + setupPageRoute(app, `/${name}/:userslug/categories`, accountMiddlewares, controllers.accounts.categories.get); + setupPageRoute(app, `/${name}/:userslug/bookmarks`, accountMiddlewares, controllers.accounts.posts.getBookmarks); + setupPageRoute(app, `/${name}/:userslug/watched`, accountMiddlewares, controllers.accounts.posts.getWatchedTopics); + setupPageRoute(app, `/${name}/:userslug/ignored`, accountMiddlewares, controllers.accounts.posts.getIgnoredTopics); + setupPageRoute(app, `/${name}/:userslug/upvoted`, accountMiddlewares, controllers.accounts.posts.getUpVotedPosts); + setupPageRoute(app, `/${name}/:userslug/downvoted`, accountMiddlewares, controllers.accounts.posts.getDownVotedPosts); + setupPageRoute(app, `/${name}/:userslug/edit`, accountMiddlewares, controllers.accounts.edit.get); + setupPageRoute(app, `/${name}/:userslug/edit/username`, accountMiddlewares, controllers.accounts.edit.username); + setupPageRoute(app, `/${name}/:userslug/edit/email`, accountMiddlewares, controllers.accounts.edit.email); + setupPageRoute(app, `/${name}/:userslug/edit/password`, accountMiddlewares, controllers.accounts.edit.password); app.use('/.well-known/change-password', (req, res) => { res.redirect('/me/edit/password'); }); - setupPageRoute(app, `/${name}/:userslug/info`, middleware, accountMiddlewares, controllers.accounts.info.get); - setupPageRoute(app, `/${name}/:userslug/settings`, middleware, accountMiddlewares, controllers.accounts.settings.get); - setupPageRoute(app, `/${name}/:userslug/uploads`, middleware, accountMiddlewares, controllers.accounts.uploads.get); - setupPageRoute(app, `/${name}/:userslug/consent`, middleware, accountMiddlewares, controllers.accounts.consent.get); - setupPageRoute(app, `/${name}/:userslug/blocks`, middleware, accountMiddlewares, controllers.accounts.blocks.getBlocks); - setupPageRoute(app, `/${name}/:userslug/sessions`, middleware, accountMiddlewares, controllers.accounts.sessions.get); - - setupPageRoute(app, '/notifications', middleware, [middleware.ensureLoggedIn], controllers.accounts.notifications.get); - setupPageRoute(app, `/${name}/:userslug/chats/:roomid?`, middleware, middlewares, controllers.accounts.chats.get); - setupPageRoute(app, '/chats/:roomid?', middleware, [middleware.ensureLoggedIn], controllers.accounts.chats.redirectToChat); + setupPageRoute(app, `/${name}/:userslug/info`, accountMiddlewares, controllers.accounts.info.get); + setupPageRoute(app, `/${name}/:userslug/settings`, accountMiddlewares, controllers.accounts.settings.get); + setupPageRoute(app, `/${name}/:userslug/uploads`, accountMiddlewares, controllers.accounts.uploads.get); + setupPageRoute(app, `/${name}/:userslug/consent`, accountMiddlewares, controllers.accounts.consent.get); + setupPageRoute(app, `/${name}/:userslug/blocks`, accountMiddlewares, controllers.accounts.blocks.getBlocks); + setupPageRoute(app, `/${name}/:userslug/sessions`, accountMiddlewares, controllers.accounts.sessions.get); + + setupPageRoute(app, '/notifications', [middleware.ensureLoggedIn], controllers.accounts.notifications.get); + setupPageRoute(app, `/${name}/:userslug/chats/:roomid?`, middlewares, controllers.accounts.chats.get); + setupPageRoute(app, '/chats/:roomid?', [middleware.ensureLoggedIn], controllers.accounts.chats.redirectToChat); };