Merge branch 'fix-page-accessible-without-login' into 'master'
Fix page accessible without login See merge request framasoft/mobilizon!645
This commit is contained in:
commit
c3bada8428
|
@ -13,7 +13,7 @@ export const discussionRoutes: RouteConfig[] = [
|
||||||
component: () =>
|
component: () =>
|
||||||
import(/* webpackChunkName: "DiscussionsList" */ "@/views/Discussions/DiscussionsList.vue"),
|
import(/* webpackChunkName: "DiscussionsList" */ "@/views/Discussions/DiscussionsList.vue"),
|
||||||
props: true,
|
props: true,
|
||||||
meta: { requiredAuth: false },
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/@:preferredUsername/discussions/new",
|
path: "/@:preferredUsername/discussions/new",
|
||||||
|
@ -29,6 +29,6 @@ export const discussionRoutes: RouteConfig[] = [
|
||||||
component: () =>
|
component: () =>
|
||||||
import(/* webpackChunkName: "Discussion" */ "@/views/Discussions/Discussion.vue"),
|
import(/* webpackChunkName: "Discussion" */ "@/views/Discussions/Discussion.vue"),
|
||||||
props: true,
|
props: true,
|
||||||
meta: { requiredAuth: false },
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -83,12 +83,14 @@ export const groupsRoutes: RouteConfig[] = [
|
||||||
component: () => import("@/views/Posts/Edit.vue"),
|
component: () => import("@/views/Posts/Edit.vue"),
|
||||||
props: true,
|
props: true,
|
||||||
name: GroupsRouteName.POST_CREATE,
|
name: GroupsRouteName.POST_CREATE,
|
||||||
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/p/:slug/edit",
|
path: "/p/:slug/edit",
|
||||||
component: () => import("@/views/Posts/Edit.vue"),
|
component: () => import("@/views/Posts/Edit.vue"),
|
||||||
props: (route: Route) => ({ ...route.params, ...{ isUpdate: true } }),
|
props: (route: Route) => ({ ...route.params, ...{ isUpdate: true } }),
|
||||||
name: GroupsRouteName.POST_EDIT,
|
name: GroupsRouteName.POST_EDIT,
|
||||||
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/p/:slug",
|
path: "/p/:slug",
|
||||||
|
|
|
@ -40,6 +40,7 @@ export const settingsRoutes: RouteConfig[] = [
|
||||||
path: "account",
|
path: "account",
|
||||||
name: SettingsRouteName.ACCOUNT_SETTINGS,
|
name: SettingsRouteName.ACCOUNT_SETTINGS,
|
||||||
redirect: { name: SettingsRouteName.ACCOUNT_SETTINGS_GENERAL },
|
redirect: { name: SettingsRouteName.ACCOUNT_SETTINGS_GENERAL },
|
||||||
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "account/general",
|
path: "account/general",
|
||||||
|
@ -69,6 +70,7 @@ export const settingsRoutes: RouteConfig[] = [
|
||||||
path: "admin",
|
path: "admin",
|
||||||
name: SettingsRouteName.ADMIN,
|
name: SettingsRouteName.ADMIN,
|
||||||
redirect: { name: SettingsRouteName.ADMIN_DASHBOARD },
|
redirect: { name: SettingsRouteName.ADMIN_DASHBOARD },
|
||||||
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "admin/dashboard",
|
path: "admin/dashboard",
|
||||||
|
@ -136,27 +138,30 @@ export const settingsRoutes: RouteConfig[] = [
|
||||||
name: SettingsRouteName.RELAYS,
|
name: SettingsRouteName.RELAYS,
|
||||||
redirect: { name: SettingsRouteName.RELAY_FOLLOWINGS },
|
redirect: { name: SettingsRouteName.RELAY_FOLLOWINGS },
|
||||||
component: () => import(/* webpackChunkName: "Follows" */ "@/views/Admin/Follows.vue"),
|
component: () => import(/* webpackChunkName: "Follows" */ "@/views/Admin/Follows.vue"),
|
||||||
|
meta: { requiredAuth: true },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "followings",
|
path: "followings",
|
||||||
name: SettingsRouteName.RELAY_FOLLOWINGS,
|
name: SettingsRouteName.RELAY_FOLLOWINGS,
|
||||||
component: () =>
|
component: () =>
|
||||||
import(/* webpackChunkName: "Followings" */ "@/components/Admin/Followings.vue"),
|
import(/* webpackChunkName: "Followings" */ "@/components/Admin/Followings.vue"),
|
||||||
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "followers",
|
path: "followers",
|
||||||
name: SettingsRouteName.RELAY_FOLLOWERS,
|
name: SettingsRouteName.RELAY_FOLLOWERS,
|
||||||
component: () =>
|
component: () =>
|
||||||
import(/* webpackChunkName: "Followers" */ "@/components/Admin/Followers.vue"),
|
import(/* webpackChunkName: "Followers" */ "@/components/Admin/Followers.vue"),
|
||||||
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
props: true,
|
props: true,
|
||||||
meta: { requiredAuth: true },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/moderation",
|
path: "/moderation",
|
||||||
name: SettingsRouteName.MODERATION,
|
name: SettingsRouteName.MODERATION,
|
||||||
redirect: { name: SettingsRouteName.REPORTS },
|
redirect: { name: SettingsRouteName.REPORTS },
|
||||||
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/moderation/reports/:filter?",
|
path: "/moderation/reports/:filter?",
|
||||||
|
@ -185,6 +190,7 @@ export const settingsRoutes: RouteConfig[] = [
|
||||||
path: "/identity",
|
path: "/identity",
|
||||||
name: SettingsRouteName.IDENTITIES,
|
name: SettingsRouteName.IDENTITIES,
|
||||||
redirect: { name: SettingsRouteName.UPDATE_IDENTITY },
|
redirect: { name: SettingsRouteName.UPDATE_IDENTITY },
|
||||||
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/identity/create",
|
path: "/identity/create",
|
||||||
|
@ -194,6 +200,7 @@ export const settingsRoutes: RouteConfig[] = [
|
||||||
/* webpackChunkName: "EditIdentity" */ "@/views/Account/children/EditIdentity.vue"
|
/* webpackChunkName: "EditIdentity" */ "@/views/Account/children/EditIdentity.vue"
|
||||||
),
|
),
|
||||||
props: (route) => ({ identityName: route.params.identityName, isUpdate: false }),
|
props: (route) => ({ identityName: route.params.identityName, isUpdate: false }),
|
||||||
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/identity/update/:identityName?",
|
path: "/identity/update/:identityName?",
|
||||||
|
@ -203,6 +210,7 @@ export const settingsRoutes: RouteConfig[] = [
|
||||||
/* webpackChunkName: "EditIdentity" */ "@/views/Account/children/EditIdentity.vue"
|
/* webpackChunkName: "EditIdentity" */ "@/views/Account/children/EditIdentity.vue"
|
||||||
),
|
),
|
||||||
props: (route) => ({ identityName: route.params.identityName, isUpdate: true }),
|
props: (route) => ({ identityName: route.params.identityName, isUpdate: true }),
|
||||||
|
meta: { requiredAuth: true },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,12 +27,10 @@ import RouteName from "../router/name";
|
||||||
skip() {
|
skip() {
|
||||||
try {
|
try {
|
||||||
const url = this.$route.query.url as string;
|
const url = this.$route.query.url as string;
|
||||||
new URL(url);
|
const uri = new URL(url);
|
||||||
return false;
|
return !(uri instanceof URL);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof TypeError) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async result({ data }) {
|
async result({ data }) {
|
||||||
|
@ -42,7 +40,7 @@ import RouteName from "../router/name";
|
||||||
data.searchEvents.elements.length > 0
|
data.searchEvents.elements.length > 0
|
||||||
) {
|
) {
|
||||||
const event = data.searchEvents.elements[0];
|
const event = data.searchEvents.elements[0];
|
||||||
return await this.$router.replace({
|
await this.$router.replace({
|
||||||
name: RouteName.EVENT,
|
name: RouteName.EVENT,
|
||||||
params: { uuid: event.uuid },
|
params: { uuid: event.uuid },
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue