From 2d875c9611a79c06fc1ede024d79cd5034dccb15 Mon Sep 17 00:00:00 2001 From: weizong song Date: Sun, 7 Jun 2026 09:50:18 +0800 Subject: [PATCH] fix: stop forwarding public source query --- src/router/index.ts | 22 ++++++---------------- src/views/ParticipantLandingView.vue | 10 ++-------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 30aa127..86ebe09 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -15,21 +15,15 @@ import './admin/routeMeta' const MainLayout = () => import('../layouts/MainLayout.vue') -function sourceQueryFrom(to: { query?: Record }): { src: string } | undefined { - const src = typeof to.query?.src === 'string' ? to.query.src.trim() : '' - return /^[A-Za-z0-9_-]{2,64}$/.test(src) ? { src } : undefined -} - -function participantRootRedirect(to?: { query?: Record }) { +function participantRootRedirect() { const t = localStorage.getItem(TOKEN_KEY) const s = localStorage.getItem(PARTICIPANT_COMPETITION_SLUG_KEY) - const query = to ? sourceQueryFrom(to) : undefined if (s) { return t - ? { name: 'participant-apply', params: { slug: s }, query, replace: true as const } - : { name: 'participant-login', params: { slug: s }, query, replace: true as const } + ? { name: 'participant-apply', params: { slug: s }, replace: true as const } + : { name: 'participant-login', params: { slug: s }, replace: true as const } } - return { path: '/c', query, replace: true as const } + return { path: '/c', replace: true as const } } const router = createRouter({ @@ -179,13 +173,9 @@ router.beforeEach(async (to) => { if (to.matched.some((r) => r.meta.requiresAuth) && !participantToken) { const slug = to.params.slug != null ? String(to.params.slug) : '' if (slug) { - return { - name: 'participant-login', - params: { slug }, - query: { redirect: to.fullPath, ...sourceQueryFrom(to) }, - } + return { name: 'participant-login', params: { slug }, query: { redirect: to.fullPath } } } - return { path: '/c', query: { redirect: to.fullPath, ...sourceQueryFrom(to) } } + return { path: '/c', query: { redirect: to.fullPath } } } if (to.meta.guestOnly && participantToken) { diff --git a/src/views/ParticipantLandingView.vue b/src/views/ParticipantLandingView.vue index d0589e3..8f83632 100644 --- a/src/views/ParticipantLandingView.vue +++ b/src/views/ParticipantLandingView.vue @@ -1,9 +1,8 @@