2022-10-08 10:54:25 +00:00
|
|
|
import { eventBus } from '@/utils'
|
|
|
|
import { Route } from '@/router'
|
|
|
|
import { userStore } from '@/stores'
|
2024-01-11 19:26:38 +00:00
|
|
|
import { localStorageService } from '@/services'
|
2022-10-08 10:54:25 +00:00
|
|
|
|
|
|
|
export const routes: Route[] = [
|
|
|
|
{
|
|
|
|
path: '/home',
|
|
|
|
screen: 'Home'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/404',
|
|
|
|
screen: '404'
|
|
|
|
},
|
2022-10-08 11:57:54 +00:00
|
|
|
{
|
|
|
|
path: '/queue',
|
|
|
|
screen: 'Queue'
|
|
|
|
},
|
2022-10-08 10:54:25 +00:00
|
|
|
{
|
|
|
|
path: '/songs',
|
|
|
|
screen: 'Songs'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/albums',
|
|
|
|
screen: 'Albums'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/artists',
|
|
|
|
screen: 'Artists'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/favorites',
|
|
|
|
screen: 'Favorites'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/recently-played',
|
|
|
|
screen: 'RecentlyPlayed'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/search',
|
|
|
|
screen: 'Search.Excerpt'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/search/songs',
|
|
|
|
screen: 'Search.Songs'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/upload',
|
|
|
|
screen: 'Upload',
|
2023-08-20 22:35:58 +00:00
|
|
|
onResolve: () => userStore.current?.is_admin
|
2022-10-08 10:54:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/settings',
|
|
|
|
screen: 'Settings',
|
2023-08-20 22:35:58 +00:00
|
|
|
onResolve: () => userStore.current?.is_admin
|
2022-10-08 10:54:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/users',
|
|
|
|
screen: 'Users',
|
2023-08-20 22:35:58 +00:00
|
|
|
onResolve: () => userStore.current?.is_admin
|
2022-10-08 10:54:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/youtube',
|
|
|
|
screen: 'YouTube'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/profile',
|
|
|
|
screen: 'Profile'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'visualizer',
|
|
|
|
screen: 'Visualizer'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/album/(?<id>\\d+)',
|
|
|
|
screen: 'Album'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/artist/(?<id>\\d+)',
|
|
|
|
screen: 'Artist'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/playlist/(?<id>\\d+)',
|
|
|
|
screen: 'Playlist'
|
|
|
|
},
|
2022-10-21 20:06:43 +00:00
|
|
|
{
|
|
|
|
path: '/genres',
|
|
|
|
screen: 'Genres'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/genres/(?<name>\.+)',
|
|
|
|
screen: 'Genre'
|
|
|
|
},
|
2022-11-06 17:09:06 +00:00
|
|
|
{
|
|
|
|
path: '/visualizer',
|
|
|
|
screen: 'Visualizer'
|
|
|
|
},
|
2022-10-08 10:54:25 +00:00
|
|
|
{
|
|
|
|
path: '/song/(?<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})',
|
|
|
|
screen: 'Queue',
|
2022-10-08 11:57:54 +00:00
|
|
|
redirect: () => 'queue',
|
2024-01-11 19:26:38 +00:00
|
|
|
onResolve: params => {
|
|
|
|
localStorageService.set('song-to-queue', params.id)
|
|
|
|
return true
|
|
|
|
}
|
2023-08-20 22:35:58 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/invitation/accept/(?<token>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})',
|
|
|
|
screen: 'Invitation.Accept'
|
2022-10-08 10:54:25 +00:00
|
|
|
}
|
|
|
|
]
|