🐛 fix: limit jump links

This commit is contained in:
Martial BE 2024-04-02 14:45:51 +08:00
parent 49c6e5de2f
commit 65820c0ff8
No known key found for this signature in database
GPG Key ID: D06C32DF0EDB9084

View File

@ -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]);