From a884c785f0d248c029993d407626a364b7d698f5 Mon Sep 17 00:00:00 2001 From: William Oldham Date: Fri, 15 Mar 2024 18:48:46 +0000 Subject: [PATCH] Remove lonelil as a redirect, Firefox didn't like --- src/tabs/PermissionGrant.tsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/tabs/PermissionGrant.tsx b/src/tabs/PermissionGrant.tsx index a8c238c..a2d0047 100644 --- a/src/tabs/PermissionGrant.tsx +++ b/src/tabs/PermissionGrant.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Button } from '~components/Button'; import { usePermission } from '~hooks/usePermission'; import { makeUrlIntoDomain } from '~utils/domains'; @@ -8,11 +10,27 @@ export default function PermissionGrant() { const { grantPermission } = usePermission(); const queryParams = new URLSearchParams(window.location.search); - const redirectUrl = queryParams.get('redirectUrl') ?? 'https://mw.lonelil.ru'; - const domain = makeUrlIntoDomain(redirectUrl); + const redirectUrl = queryParams.get('redirectUrl') ?? undefined; + const domain = redirectUrl ? makeUrlIntoDomain(redirectUrl) : undefined; + + if (!domain) { + return ( +
+
+
+

Permission

+

+ No domain found to grant permission to. +

+
+
+
+ ); + } const redirectBack = () => { chrome.tabs.getCurrent((tab) => { + if (!tab?.id) return; chrome.tabs.update(tab.id, { url: redirectUrl }); }); };