Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Talisman hostname check for portal url #1117

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions apps/extension/src/core/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,19 @@ const enable = async (origin: string): Promise<Injected> => {
return new TalismanInjected(messageService.sendMessage) as Injected
}

export const isTalismanHostname = (hostname: string | undefined) =>
hostname === TALISMAN_WEB_APP_DOMAIN ||
(DEBUG && hostname?.endsWith(".talisman.pages.dev")) ||
(DEBUG && ["localhost", "127.0.0.1"].includes(hostname ?? ""))
export const isTalismanHostname = (url: string | undefined) => {
if (!url) return false
try {
const hostname = new URL(url).hostname
return (
hostname === TALISMAN_WEB_APP_DOMAIN ||
(DEBUG && hostname?.endsWith(".talisman.pages.dev")) ||
(DEBUG && ["localhost", "127.0.0.1"].includes(hostname))
)
} catch (e) {
return false
}
}

function inject() {
// inject substrate wallet provider
Expand Down
1 change: 0 additions & 1 deletion apps/extension/src/ui/apps/popup/pages/Connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ export const Connect: FC<{ className?: string }> = ({ className }) => {
<button
type="button"
className="text-body-secondary hover:text-grey-300"
text-body-secondary
onClick={handleConnectAllClick}
>
{t("Connect All")}
Expand Down