You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wiki/frontend/src/router/routes.js

137 lines
5.7 KiB

import { usePageStore } from '@/stores/page'
const routes = [
{
path: '/login',
component: () => import('@/layouts/AuthLayout.vue'),
children: [{ path: '', component: () => import('@/pages/Login.vue') }]
},
{
path: '/a/:alias',
component: () => import('@/layouts/MainLayout.vue'),
beforeEnter: async (to, from) => {
const pageStore = usePageStore()
try {
const pathPath = await pageStore.pageAlias(to.params.alias)
return `/${pathPath}`
} catch (err) {
return '/_error/notfound'
}
}
},
{
path: '/_profile',
component: () => import('@/layouts/ProfileLayout.vue'),
children: [
{ path: '', redirect: '/_profile/info' },
{ path: 'info', component: () => import('@/pages/ProfileInfo.vue') },
{ path: 'avatar', component: () => import('@/pages/ProfileAvatar.vue') },
{ path: 'auth', component: () => import('@/pages/ProfileAuth.vue') },
{ path: 'groups', component: () => import('@/pages/ProfileGroups.vue') }
]
},
{
path: '/_inbox',
component: () => import('@/layouts/InboxLayout.vue'),
children: [
{ path: '', redirect: '/_inbox/messages' },
{ path: 'messages', component: () => import('@/pages/InboxMessages.vue') },
{ path: 'watching', component: () => import('@/pages/InboxWatching.vue') },
/*
The submission being reviewed is in the URL, so a review can be linked to -- which is what a
notification about one will have to do. Optional, since the same screen without it is the
queue.
*/
{ path: 'review/:submissionId?', component: () => import('@/pages/InboxReview.vue') }
]
},
{
path: '/_search',
component: () => import('@/pages/Search.vue')
},
/*
The public profile of one user. `/_user` is shared with the server, which serves avatars at
`/_user/<id>/avatar` -- both `backend/index.ts` and the dev proxy in `frontend/vite.config.js`
split the segment the same way, so this route only ever sees the profile half.
*/
{
path: '/_user/:userId',
component: () => import('@/pages/UserProfile.vue')
},
{
path: '/_admin',
component: () => import('@/layouts/AdminLayout.vue'),
children: [
{ path: '', redirect: '/_admin/dashboard' },
{ path: 'dashboard', component: () => import('@/pages/AdminDashboard.vue') },
{ path: 'sites', component: () => import('@/pages/AdminSites.vue') },
// -> Site
{ path: ':siteid/general', component: () => import('@/pages/AdminGeneral.vue') },
{ path: ':siteid/approvals', component: () => import('@/pages/AdminApprovals.vue') },
{ path: ':siteid/blocks', component: () => import('@/pages/AdminBlocks.vue') },
{ path: ':siteid/editors', component: () => import('@/pages/AdminEditors.vue') },
{ path: ':siteid/locale', component: () => import('@/pages/AdminLocale.vue') },
{ path: ':siteid/login', component: () => import('@/pages/AdminLogin.vue') },
{ path: ':siteid/navigation', component: () => import('@/pages/AdminNavigation.vue') },
{ path: ':siteid/storage/:id?', component: () => import('@/pages/AdminStorage.vue') },
{ path: ':siteid/theme', component: () => import('@/pages/AdminTheme.vue') },
// -> Users
{ path: 'auth', component: () => import('@/pages/AdminAuth.vue') },
{ path: 'groups/:id?/:section?', component: () => import('@/pages/AdminGroups.vue') },
{ path: 'users/:id?/:section?', component: () => import('@/pages/AdminUsers.vue') },
// -> System
{ path: 'api', component: () => import('@/pages/AdminApi.vue') },
{ path: 'extensions', component: () => import('@/pages/AdminExtensions.vue') },
{ path: 'icons', component: () => import('@/pages/AdminIcons.vue') },
{ path: 'instances', component: () => import('@/pages/AdminInstances.vue') },
{ path: 'mail', component: () => import('@/pages/AdminMail.vue') },
{ path: 'mcp', component: () => import('@/pages/AdminMcp.vue') },
{ path: 'metrics', component: () => import('@/pages/AdminMetrics.vue') },
{ path: 'rendering', component: () => import('@/pages/AdminRendering.vue') },
{ path: 'scheduler', component: () => import('@/pages/AdminScheduler.vue') },
{ path: 'search', component: () => import('@/pages/AdminSearch.vue') },
{ path: 'security', component: () => import('@/pages/AdminSecurity.vue') },
{ path: 'system', component: () => import('@/pages/AdminSystem.vue') },
{ path: 'terminal', component: () => import('@/pages/AdminTerminal.vue') },
{ path: 'utilities', component: () => import('@/pages/AdminUtilities.vue') },
{ path: 'webhooks', component: () => import('@/pages/AdminWebhooks.vue') },
{ path: 'flags', component: () => import('@/pages/AdminFlags.vue') }
]
},
{
path: '/_error/:action?',
component: () => import('@/pages/ErrorGeneric.vue')
},
// {
// path: '/_unknown-site',
// component: () => import('../pages/UnknownSite.vue')
// },
// --------------------------------
// CREATE
// --------------------------------
{
path: '/_create/:editor?',
component: () => import('../layouts/MainLayout.vue'),
children: [{ path: '', component: () => import('../pages/Index.vue') }]
},
// --------------------------------
// EDIT
// --------------------------------
{
path: '/_edit/:pagePath?',
component: () => import('../layouts/MainLayout.vue'),
children: [{ path: '', component: () => import('../pages/Index.vue') }]
},
// -----------------------
// STANDARD PAGE CATCH-ALL
// -----------------------
{
path: '/:catchAll(.*)*',
component: () => import('../layouts/MainLayout.vue'),
children: [{ path: '', component: () => import('../pages/Index.vue') }]
}
]
export default routes