From a6b822fe22583763fd19c452f372a5fb555066f5 Mon Sep 17 00:00:00 2001 From: Arjun Porwal <65214523+ap211unitech@users.noreply.github.com> Date: Tue, 8 Jul 2025 22:10:33 +0530 Subject: [PATCH] Reverts #1560 (#1573) * reverts 824cda7e881350d61aed0423a34c1d011bf2b115 * chore: added tldts * chore: remove tldts --- packages/extension-base/package.json | 1 - .../src/background/handlers/Tabs.ts | 21 +------------------ .../src/background/handlers/index.ts | 1 - yarn.lock | 1 - 4 files changed, 1 insertion(+), 23 deletions(-) diff --git a/packages/extension-base/package.json b/packages/extension-base/package.json index 9359c101..57b50c70 100644 --- a/packages/extension-base/package.json +++ b/packages/extension-base/package.json @@ -36,7 +36,6 @@ "@polkadot/util-crypto": "^13.5.3", "eventemitter3": "^5.0.1", "rxjs": "^7.8.1", - "tldts": "^7.0.8", "tslib": "^2.8.1" }, "devDependencies": { diff --git a/packages/extension-base/src/background/handlers/Tabs.ts b/packages/extension-base/src/background/handlers/Tabs.ts index 7b8e9dc6..dbddf7cd 100644 --- a/packages/extension-base/src/background/handlers/Tabs.ts +++ b/packages/extension-base/src/background/handlers/Tabs.ts @@ -13,7 +13,6 @@ import type { AuthResponse } from './State.js'; import type State from './State.js'; import { combineLatest, type Subscription } from 'rxjs'; -import { parse } from 'tldts'; import { checkIfDenied } from '@polkadot/phishing'; import { keyring } from '@polkadot/ui-keyring'; @@ -216,22 +215,6 @@ export default class Tabs { }); } - private parseUrl (rawUrl: string): string { - let from = 'extension'; - - if (rawUrl) { - try { - const { hostname } = parse(rawUrl); - - from = hostname || ''; // Only use the hostname - } catch { - from = ''; - } - } - - return from; - } - private async redirectIfPhishing (url: string): Promise { const isInDenyList = await checkIfDenied(url); @@ -246,9 +229,7 @@ export default class Tabs { public async handle (id: string, type: TMessageType, request: RequestTypes[TMessageType], url: string, port?: chrome.runtime.Port): Promise { if (type === 'pub(phishing.redirectIfDenied)') { - const parsedUrl = this.parseUrl(url); - - return this.redirectIfPhishing(parsedUrl); + return this.redirectIfPhishing(url); } if (type !== 'pub(authorize.tab)') { diff --git a/packages/extension-base/src/background/handlers/index.ts b/packages/extension-base/src/background/handlers/index.ts index dd3ab33e..8980d479 100644 --- a/packages/extension-base/src/background/handlers/index.ts +++ b/packages/extension-base/src/background/handlers/index.ts @@ -31,7 +31,6 @@ export default function handler ({ id, messag const from = isExtension ? 'extension' : sender?.url || sender?.tab?.url || ''; - const source = `${from}: ${id}: ${message}`; console.log(` [in] ${source}`); // :: ${JSON.stringify(request)}`); diff --git a/yarn.lock b/yarn.lock index beb71fda..3e1c5ed1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1079,7 +1079,6 @@ __metadata: "@polkadot/util-crypto": "npm:^13.5.3" eventemitter3: "npm:^5.0.1" rxjs: "npm:^7.8.1" - tldts: "npm:^7.0.8" tslib: "npm:^2.8.1" languageName: unknown linkType: soft