From baaa68389b038990c4fa18dd8ed74b567ecc7d7c Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 24 Oct 2020 17:32:15 +0200 Subject: [PATCH] Fix a few routes being accessible without auth Signed-off-by: Thomas Citharel --- js/src/router/discussion.ts | 4 ++-- js/src/router/groups.ts | 2 ++ js/src/router/settings.ts | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/js/src/router/discussion.ts b/js/src/router/discussion.ts index 0fb62b373..e67d6d29d 100644 --- a/js/src/router/discussion.ts +++ b/js/src/router/discussion.ts @@ -13,7 +13,7 @@ export const discussionRoutes: RouteConfig[] = [ component: () => import(/* webpackChunkName: "DiscussionsList" */ "@/views/Discussions/DiscussionsList.vue"), props: true, - meta: { requiredAuth: false }, + meta: { requiredAuth: true }, }, { path: "/@:preferredUsername/discussions/new", @@ -29,6 +29,6 @@ export const discussionRoutes: RouteConfig[] = [ component: () => import(/* webpackChunkName: "Discussion" */ "@/views/Discussions/Discussion.vue"), props: true, - meta: { requiredAuth: false }, + meta: { requiredAuth: true }, }, ]; diff --git a/js/src/router/groups.ts b/js/src/router/groups.ts index 36b1864c6..7f633af88 100644 --- a/js/src/router/groups.ts +++ b/js/src/router/groups.ts @@ -83,12 +83,14 @@ export const groupsRoutes: RouteConfig[] = [ component: () => import("@/views/Posts/Edit.vue"), props: true, name: GroupsRouteName.POST_CREATE, + meta: { requiredAuth: true }, }, { path: "/p/:slug/edit", component: () => import("@/views/Posts/Edit.vue"), props: (route: Route) => ({ ...route.params, ...{ isUpdate: true } }), name: GroupsRouteName.POST_EDIT, + meta: { requiredAuth: true }, }, { path: "/p/:slug", diff --git a/js/src/router/settings.ts b/js/src/router/settings.ts index a2a700713..67fcabdae 100644 --- a/js/src/router/settings.ts +++ b/js/src/router/settings.ts @@ -40,6 +40,7 @@ export const settingsRoutes: RouteConfig[] = [ path: "account", name: SettingsRouteName.ACCOUNT_SETTINGS, redirect: { name: SettingsRouteName.ACCOUNT_SETTINGS_GENERAL }, + meta: { requiredAuth: true }, }, { path: "account/general", @@ -69,6 +70,7 @@ export const settingsRoutes: RouteConfig[] = [ path: "admin", name: SettingsRouteName.ADMIN, redirect: { name: SettingsRouteName.ADMIN_DASHBOARD }, + meta: { requiredAuth: true }, }, { path: "admin/dashboard", @@ -136,27 +138,30 @@ export const settingsRoutes: RouteConfig[] = [ name: SettingsRouteName.RELAYS, redirect: { name: SettingsRouteName.RELAY_FOLLOWINGS }, component: () => import(/* webpackChunkName: "Follows" */ "@/views/Admin/Follows.vue"), + meta: { requiredAuth: true }, children: [ { path: "followings", name: SettingsRouteName.RELAY_FOLLOWINGS, component: () => import(/* webpackChunkName: "Followings" */ "@/components/Admin/Followings.vue"), + meta: { requiredAuth: true }, }, { path: "followers", name: SettingsRouteName.RELAY_FOLLOWERS, component: () => import(/* webpackChunkName: "Followers" */ "@/components/Admin/Followers.vue"), + meta: { requiredAuth: true }, }, ], props: true, - meta: { requiredAuth: true }, }, { path: "/moderation", name: SettingsRouteName.MODERATION, redirect: { name: SettingsRouteName.REPORTS }, + meta: { requiredAuth: true }, }, { path: "/moderation/reports/:filter?", @@ -185,6 +190,7 @@ export const settingsRoutes: RouteConfig[] = [ path: "/identity", name: SettingsRouteName.IDENTITIES, redirect: { name: SettingsRouteName.UPDATE_IDENTITY }, + meta: { requiredAuth: true }, }, { path: "/identity/create", @@ -194,6 +200,7 @@ export const settingsRoutes: RouteConfig[] = [ /* webpackChunkName: "EditIdentity" */ "@/views/Account/children/EditIdentity.vue" ), props: (route) => ({ identityName: route.params.identityName, isUpdate: false }), + meta: { requiredAuth: true }, }, { path: "/identity/update/:identityName?", @@ -203,6 +210,7 @@ export const settingsRoutes: RouteConfig[] = [ /* webpackChunkName: "EditIdentity" */ "@/views/Account/children/EditIdentity.vue" ), props: (route) => ({ identityName: route.params.identityName, isUpdate: true }), + meta: { requiredAuth: true }, }, ], },