traxxx/assets/js/router.js

280 lines
4.8 KiB
JavaScript
Raw Normal View History

import { createRouter, createWebHistory } from 'vue-router';
import Home from '../components/home/home.vue';
2021-03-13 03:26:24 +00:00
import Login from '../components/auth/login.vue';
import Signup from '../components/auth/signup.vue';
import User from '../components/users/user.vue';
2020-09-08 00:20:15 +00:00
import Release from '../components/releases/release.vue';
2020-06-27 02:50:13 +00:00
import Entity from '../components/entities/entity.vue';
import Networks from '../components/networks/networks.vue';
import Actor from '../components/actors/actor.vue';
import Actors from '../components/actors/actors.vue';
import Movies from '../components/releases/movies.vue';
2021-05-08 22:23:10 +00:00
import Notifications from '../components/notifications/notifications.vue';
import Tag from '../components/tags/tag.vue';
import Tags from '../components/tags/tags.vue';
import Stash from '../components/stashes/stash.vue';
2020-02-26 00:15:50 +00:00
import Search from '../components/search/search.vue';
2020-08-15 17:04:33 +00:00
import Stats from '../components/stats/stats.vue';
import NotFound from '../components/errors/404.vue';
const routes = [
{
path: '/',
2021-03-13 03:26:24 +00:00
name: 'home',
redirect: {
name: 'updates',
2020-05-22 02:32:16 +00:00
params: {
2020-05-26 23:40:10 +00:00
range: 'latest',
2020-06-27 02:50:13 +00:00
tags: 'all',
pageNumber: 1,
2020-05-22 02:32:16 +00:00
},
},
},
2021-03-13 03:26:24 +00:00
{
path: '/login',
name: 'login',
component: Login,
},
{
path: '/signup',
2021-03-16 01:31:23 +00:00
name: 'signup',
2021-03-13 03:26:24 +00:00
component: Signup,
},
{
path: '/user/:username',
name: 'user',
component: User,
},
{
path: '/updates',
redirect: {
name: 'updates',
params: {
range: 'latest',
pageNumber: 1,
},
},
},
{
path: '/updates/:range/:pageNumber',
component: Home,
name: 'updates',
},
{
path: '/scene/:releaseId/:releaseSlug?',
2020-09-08 00:20:15 +00:00
component: Release,
name: 'scene',
},
{
2020-09-08 00:20:15 +00:00
path: '/movie/:releaseId/:releaseSlug?',
component: Release,
name: 'movie',
},
2022-03-26 16:40:20 +00:00
{
path: '/serie/:releaseId/:releaseSlug?',
component: Release,
name: 'serie',
},
{
path: '/actor/:actorId/:actorSlug',
name: 'actor',
redirect: (from) => ({
name: 'actorRange',
params: {
...from.params,
range: 'latest',
2020-05-26 23:40:10 +00:00
pageNumber: 1,
},
}),
},
{
path: '/actor/:actorId/:actorSlug/:range/:pageNumber',
component: Actor,
name: 'actorRange',
},
2021-03-06 23:01:02 +00:00
{
path: '/director/:actorId/:actorSlug',
name: 'director',
redirect: (from) => ({
2021-03-06 23:01:02 +00:00
name: 'directorRange',
params: {
...from.params,
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/director/:actorId/:actorSlug',
component: Actor,
name: 'directorRange',
},
{
2020-06-27 02:50:13 +00:00
path: '/channel/:entitySlug',
redirect: (from) => ({
2020-06-27 02:50:13 +00:00
name: 'channel',
params: {
...from.params,
range: 'latest',
2020-05-26 23:40:10 +00:00
pageNumber: 1,
},
}),
},
{
path: '/channel/:entitySlug/:range/:pageNumber',
2020-06-27 02:50:13 +00:00
component: Entity,
name: 'channel',
},
{
2020-06-27 02:50:13 +00:00
path: '/network/:entitySlug',
redirect: (from) => ({
2020-06-27 02:50:13 +00:00
name: 'network',
params: {
...from.params,
range: 'latest',
2020-05-26 02:11:29 +00:00
pageNumber: 1,
},
}),
},
{
path: '/network/:entitySlug/:range/:pageNumber',
2020-06-27 02:50:13 +00:00
component: Entity,
name: 'network',
},
2020-06-30 22:25:27 +00:00
{
path: '/studio/:entitySlug',
redirect: (from) => ({
2020-06-30 22:25:27 +00:00
name: 'studio',
params: {
...from.params,
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/studio/:entitySlug/:range/:pageNumber',
component: Entity,
name: 'studio',
},
{
path: '/tag/:tagSlug',
redirect: (from) => ({
2020-05-29 20:43:03 +00:00
name: 'tag',
params: {
...from.params,
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/tag/:tagSlug/:range/:pageNumber',
component: Tag,
2020-05-29 20:43:03 +00:00
name: 'tag',
},
{
path: '/actors',
redirect: (from) => ({
2020-05-29 20:43:03 +00:00
name: 'actors',
params: {
...from.params,
2020-08-02 01:51:52 +00:00
gender: 'all',
2020-06-27 02:50:13 +00:00
tags: 'all',
2020-05-29 20:43:03 +00:00
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/actors/:gender?/:pageNumber',
component: Actors,
name: 'actors',
},
{
path: '/channels',
component: Networks,
name: 'channels',
},
2020-07-25 01:44:19 +00:00
{
path: '/movies',
component: Movies,
redirect: {
name: 'movies',
params: {
range: 'latest',
pageNumber: 1,
},
},
},
{
path: '/movies/:range/:pageNumber',
component: Movies,
2020-07-25 01:44:19 +00:00
name: 'movies',
},
{
path: '/tags',
component: Tags,
name: 'tags',
},
2021-05-08 22:23:10 +00:00
{
path: '/notifications',
redirect: {
name: 'notifications',
params: {
pageNumber: 1,
},
},
},
{
path: '/notifications/:pageNumber',
component: Notifications,
name: 'notifications',
},
{
2023-06-08 02:23:54 +00:00
path: '/stash/:username/:stashSlug',
redirect: (from) => ({
name: 'stash',
params: {
...from.params,
range: 'scenes',
pageNumber: 1,
},
}),
},
{
2023-06-08 02:23:54 +00:00
path: '/stash/:username/:stashSlug/:range/:pageNumber',
component: Stash,
name: 'stash',
},
{
path: '/search',
component: Search,
name: 'search',
},
2020-08-15 17:04:33 +00:00
{
path: '/stats',
component: Stats,
name: 'stats',
},
{
2020-09-10 01:17:19 +00:00
path: '/not-found',
name: 'not-found',
component: NotFound,
},
2020-09-10 01:17:19 +00:00
{
path: '/:catchAll(.*)',
2020-09-10 01:17:19 +00:00
redirect: {
name: 'not-found',
},
},
];
const router = createRouter({
history: createWebHistory(),
routes,
});
export default router;