Skip to content

Commit

Permalink
feat: add warning when connecting to non ssl domain
Browse files Browse the repository at this point in the history
  • Loading branch information
pavanjoshi914 committed Dec 20, 2023
1 parent f764ded commit bd3967a
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/app/components/Enable/AlbyEnable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Container from "@components/Container";
import PublisherCard from "@components/PublisherCard";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import Alert from "~/app/components/Alert";
import ScreenHeader from "~/app/components/ScreenHeader";
import toast from "~/app/components/Toast";
import { USER_REJECTED_ERROR } from "~/common/constants";
Expand All @@ -15,6 +16,7 @@ type Props = {
};
function AlbyEnableComponent(props: Props) {
const [loading, setLoading] = useState(false);
const hasHttp = props.origin.domain.startsWith("http://");
const { t } = useTranslation("translation", {
keyPrefix: "alby_enable",
});
Expand Down Expand Up @@ -62,6 +64,14 @@ function AlbyEnableComponent(props: Props) {
isSmall={false}
/>

<div className="pt-3">
{hasHttp && (
<Alert type="warn">
{tCommon("enable.insecure_domain_warn")}
</Alert>
)}
</div>

<div className="dark:text-white pt-6">
<p className="mb-2">{tCommon("enable.allow")}</p>

Expand Down
10 changes: 10 additions & 0 deletions src/app/components/Enable/LiquidEnable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Container from "@components/Container";
import PublisherCard from "@components/PublisherCard";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import Alert from "~/app/components/Alert";
import ScreenHeader from "~/app/components/ScreenHeader";
import toast from "~/app/components/Toast";
import { USER_REJECTED_ERROR } from "~/common/constants";
Expand All @@ -15,6 +16,7 @@ type Props = {
};
function LiquidEnableComponent(props: Props) {
const [loading, setLoading] = useState(false);
const hasHttp = props.origin.domain.startsWith("http://");
const { t } = useTranslation("translation", {
keyPrefix: "liquid_enable",
});
Expand Down Expand Up @@ -62,6 +64,14 @@ function LiquidEnableComponent(props: Props) {
isSmall={false}
/>

<div className="pt-3">
{hasHttp && (
<Alert type="warn">
{tCommon("enable.insecure_domain_warn")}
</Alert>
)}
</div>

<div className="dark:text-white pt-6">
<p className="mb-2">{tCommon("enable.allow")}</p>

Expand Down
10 changes: 10 additions & 0 deletions src/app/components/Enable/NostrEnable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Container from "@components/Container";
import PublisherCard from "@components/PublisherCard";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import Alert from "~/app/components/Alert";
import ScreenHeader from "~/app/components/ScreenHeader";
import toast from "~/app/components/Toast";
import { USER_REJECTED_ERROR } from "~/common/constants";
Expand All @@ -15,6 +16,7 @@ type Props = {
};
function NostrEnableComponent(props: Props) {
const [loading, setLoading] = useState(false);
const hasHttp = props.origin.domain.startsWith("http://");
const { t } = useTranslation("translation", {
keyPrefix: "nostr_enable",
});
Expand Down Expand Up @@ -62,6 +64,14 @@ function NostrEnableComponent(props: Props) {
isSmall={false}
/>

<div className="pt-3">
{hasHttp && (
<Alert type="warn">
{tCommon("enable.insecure_domain_warn")}
</Alert>
)}
</div>

<div className="dark:text-white pt-6">
<p className="mb-2">{tCommon("enable.allow")}</p>

Expand Down
10 changes: 10 additions & 0 deletions src/app/components/Enable/WebbtcEnable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Container from "@components/Container";
import PublisherCard from "@components/PublisherCard";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import Alert from "~/app/components/Alert";
import ScreenHeader from "~/app/components/ScreenHeader";
import toast from "~/app/components/Toast";
import { USER_REJECTED_ERROR } from "~/common/constants";
Expand All @@ -15,6 +16,7 @@ type Props = {
};
function WebbtcEnableComponent(props: Props) {
const [loading, setLoading] = useState(false);
const hasHttp = props.origin.domain.startsWith("http://");
const { t } = useTranslation("translation", {
keyPrefix: "webbtc_enable",
});
Expand Down Expand Up @@ -62,6 +64,14 @@ function WebbtcEnableComponent(props: Props) {
isSmall={false}
/>

<div className="pt-3">
{hasHttp && (
<Alert type="warn">
{tCommon("enable.insecure_domain_warn")}
</Alert>
)}
</div>

<div className="dark:text-white pt-6">
<p className="mb-2">{tCommon("enable.allow")}</p>

Expand Down
10 changes: 10 additions & 0 deletions src/app/components/Enable/WeblnEnable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Container from "@components/Container";
import PublisherCard from "@components/PublisherCard";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import Alert from "~/app/components/Alert";
import ScreenHeader from "~/app/components/ScreenHeader";
import toast from "~/app/components/Toast";
import { USER_REJECTED_ERROR } from "~/common/constants";
Expand All @@ -15,6 +16,7 @@ type Props = {
};
function WeblnEnableComponent(props: Props) {
const [loading, setLoading] = useState(false);
const hasHttp = props.origin.domain.startsWith("http://");
const { t } = useTranslation("translation", {
keyPrefix: "webln_enable",
});
Expand Down Expand Up @@ -62,6 +64,14 @@ function WeblnEnableComponent(props: Props) {
isSmall={false}
/>

<div className="pt-3">
{hasHttp && (
<Alert type="warn">
{tCommon("enable.insecure_domain_warn")}
</Alert>
)}
</div>

<div className="dark:text-white pt-6">
<p className="mb-2">{tCommon("enable.allow")}</p>

Expand Down
3 changes: 2 additions & 1 deletion src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,8 @@
"allow": "Allow this website to:",
"block_added": "Added {{host}} to the blocklist, please reload the website.",
"request1": "Request approval for transactions",
"block_and_ignore": "Block and ignore {{host}}"
"block_and_ignore": "Block and ignore {{host}}",
"insecure_domain_warn": "⚠️ You are connecting to an insecure domain."
}
},
"components": {
Expand Down

0 comments on commit bd3967a

Please sign in to comment.