2020-09-21 12:25:50 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020. The Nextcloud Bookmarks contributors.
|
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
|
|
|
|
*/
|
|
|
|
|
2019-09-24 15:18:29 +00:00
|
|
|
import Vue from 'vue'
|
|
|
|
import Router from 'vue-router'
|
2020-03-25 12:19:17 +00:00
|
|
|
import { generateUrl } from '@nextcloud/router'
|
2019-07-26 18:16:37 +00:00
|
|
|
|
2021-07-24 13:48:34 +00:00
|
|
|
const ViewPrivate = () => import(/* webpackPreload: true */ './components/ViewPrivate')
|
|
|
|
const ViewPublic = () => import(/* webpackPreload: true */'./components/ViewPublic')
|
|
|
|
const ViewBookmarklet = () => import(/* webpackPreload: true */'./components/ViewBookmarklet')
|
|
|
|
|
2019-09-24 15:18:29 +00:00
|
|
|
Vue.use(Router)
|
2019-07-26 18:16:37 +00:00
|
|
|
|
2020-03-28 17:15:59 +00:00
|
|
|
export const privateRoutes = {
|
|
|
|
HOME: 'home',
|
|
|
|
RECENT: 'recent',
|
|
|
|
SEARCH: 'search',
|
|
|
|
FOLDER: 'folder',
|
2020-08-02 06:16:08 +00:00
|
|
|
BOOKMARK: 'bookmark',
|
2020-03-28 17:15:59 +00:00
|
|
|
TAGS: 'tags',
|
|
|
|
UNTAGGED: 'untagged',
|
2020-08-07 15:59:49 +00:00
|
|
|
UNAVAILABLE: 'UNAVAILABLE',
|
2020-09-11 16:57:58 +00:00
|
|
|
ARCHIVED: 'ARCHIVED',
|
2020-03-28 17:15:59 +00:00
|
|
|
BOOKMARKLET: 'bookmarklet',
|
|
|
|
}
|
|
|
|
|
|
|
|
export const publicRoutes = {
|
|
|
|
HOME: 'public.home',
|
|
|
|
RECENT: 'public.recent',
|
|
|
|
SEARCH: 'public.search',
|
|
|
|
FOLDER: 'public.folder',
|
|
|
|
TAGS: 'public.tags',
|
|
|
|
UNTAGGED: 'public.untagged',
|
|
|
|
BOOKMARKLET: 'bookmarklet',
|
|
|
|
}
|
|
|
|
|
2019-07-26 18:16:37 +00:00
|
|
|
export default new Router({
|
2019-09-24 15:18:29 +00:00
|
|
|
mode: 'history',
|
2019-08-26 14:38:25 +00:00
|
|
|
base: generateUrl('/apps/bookmarks'),
|
2019-07-26 18:16:37 +00:00
|
|
|
linkActiveClass: 'active',
|
|
|
|
routes: [
|
|
|
|
{
|
|
|
|
path: '/',
|
2020-03-28 17:15:59 +00:00
|
|
|
name: privateRoutes.HOME,
|
2019-12-10 21:33:54 +00:00
|
|
|
component: ViewPrivate,
|
2019-07-26 18:16:37 +00:00
|
|
|
},
|
2019-08-13 19:35:32 +00:00
|
|
|
{
|
|
|
|
path: '/recent',
|
2020-03-28 17:15:59 +00:00
|
|
|
name: privateRoutes.RECENT,
|
2019-12-10 21:33:54 +00:00
|
|
|
component: ViewPrivate,
|
2019-08-13 19:35:32 +00:00
|
|
|
},
|
2019-07-26 18:16:37 +00:00
|
|
|
{
|
|
|
|
path: '/search/:search',
|
2020-03-28 17:15:59 +00:00
|
|
|
name: privateRoutes.SEARCH,
|
2019-12-10 21:33:54 +00:00
|
|
|
component: ViewPrivate,
|
2019-07-26 18:16:37 +00:00
|
|
|
},
|
|
|
|
{
|
2020-08-02 06:16:08 +00:00
|
|
|
path: '/folders/:folder',
|
2020-03-28 17:15:59 +00:00
|
|
|
name: privateRoutes.FOLDER,
|
2019-12-10 21:33:54 +00:00
|
|
|
component: ViewPrivate,
|
2019-07-26 18:16:37 +00:00
|
|
|
},
|
2020-08-02 06:16:08 +00:00
|
|
|
{
|
|
|
|
path: '/bookmarks/:bookmark',
|
|
|
|
name: privateRoutes.BOOKMARK,
|
|
|
|
component: ViewPrivate,
|
|
|
|
},
|
2019-07-26 18:16:37 +00:00
|
|
|
{
|
2020-08-21 14:44:12 +00:00
|
|
|
path: '/tags/:tags?',
|
2020-03-28 17:15:59 +00:00
|
|
|
name: privateRoutes.TAGS,
|
2019-12-10 21:33:54 +00:00
|
|
|
component: ViewPrivate,
|
2019-08-04 21:49:07 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/untagged',
|
2020-03-28 17:15:59 +00:00
|
|
|
name: privateRoutes.UNTAGGED,
|
2019-12-10 21:33:54 +00:00
|
|
|
component: ViewPrivate,
|
2019-08-28 11:46:37 +00:00
|
|
|
},
|
2020-08-07 15:59:49 +00:00
|
|
|
{
|
|
|
|
path: '/unavailable',
|
|
|
|
name: privateRoutes.UNAVAILABLE,
|
|
|
|
component: ViewPrivate,
|
|
|
|
},
|
2020-09-11 16:57:58 +00:00
|
|
|
{
|
|
|
|
path: '/archived',
|
|
|
|
name: privateRoutes.ARCHIVED,
|
|
|
|
component: ViewPrivate,
|
|
|
|
},
|
2019-08-28 11:46:37 +00:00
|
|
|
{
|
|
|
|
path: '/bookmarklet',
|
2020-03-28 17:15:59 +00:00
|
|
|
name: privateRoutes.BOOKMARKLET,
|
2019-08-28 11:46:37 +00:00
|
|
|
component: ViewBookmarklet,
|
2019-12-10 21:33:54 +00:00
|
|
|
props: (route) => ({ url: route.query.url, title: route.query.title }),
|
|
|
|
},
|
2020-03-28 17:15:59 +00:00
|
|
|
{
|
|
|
|
path: '/public/:token',
|
|
|
|
name: publicRoutes.HOME,
|
|
|
|
component: ViewPublic,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/public/:token/recent',
|
|
|
|
name: publicRoutes.RECENT,
|
|
|
|
component: ViewPublic,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/public/:token/search/:search',
|
|
|
|
name: publicRoutes.SEARCH,
|
|
|
|
component: ViewPublic,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/public/:token/folder/:folder',
|
|
|
|
name: publicRoutes.FOLDER,
|
|
|
|
component: ViewPublic,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/public/:token/tags/:tags',
|
|
|
|
name: publicRoutes.TAGS,
|
|
|
|
component: ViewPublic,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/public/:token/untagged',
|
|
|
|
name: publicRoutes.UNTAGGED,
|
|
|
|
component: ViewPublic,
|
|
|
|
},
|
2019-12-10 21:33:54 +00:00
|
|
|
],
|
2019-09-24 15:18:29 +00:00
|
|
|
})
|