From 65820c0ff8dc8b4bcb395466e014b3e7fa5fcf2d Mon Sep 17 00:00:00 2001 From: Martial BE Date: Tue, 2 Apr 2024 14:45:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20limit=20jump=20links?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/views/Jump/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/views/Jump/index.js b/web/src/views/Jump/index.js index c5f1baf5..c050f7c4 100644 --- a/web/src/views/Jump/index.js +++ b/web/src/views/Jump/index.js @@ -3,11 +3,11 @@ import { useLocation } from 'react-router-dom'; export default function Jump() { const location = useLocation(); - useEffect(() => { const params = new URLSearchParams(location.search); const jump = params.get('url'); - if (jump) { + const allowedUrls = ['opencat://', 'ama://']; + if (jump && allowedUrls.some((url) => jump.startsWith(url))) { window.location.href = jump; } }, [location]);