* reverts 824cda7e88
* chore: added tldts
* chore: remove tldts
This commit is contained in:
parent
f30e960a0a
commit
a6b822fe22
@ -36,7 +36,6 @@
|
|||||||
"@polkadot/util-crypto": "^13.5.3",
|
"@polkadot/util-crypto": "^13.5.3",
|
||||||
"eventemitter3": "^5.0.1",
|
"eventemitter3": "^5.0.1",
|
||||||
"rxjs": "^7.8.1",
|
"rxjs": "^7.8.1",
|
||||||
"tldts": "^7.0.8",
|
|
||||||
"tslib": "^2.8.1"
|
"tslib": "^2.8.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import type { AuthResponse } from './State.js';
|
|||||||
import type State from './State.js';
|
import type State from './State.js';
|
||||||
|
|
||||||
import { combineLatest, type Subscription } from 'rxjs';
|
import { combineLatest, type Subscription } from 'rxjs';
|
||||||
import { parse } from 'tldts';
|
|
||||||
|
|
||||||
import { checkIfDenied } from '@polkadot/phishing';
|
import { checkIfDenied } from '@polkadot/phishing';
|
||||||
import { keyring } from '@polkadot/ui-keyring';
|
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 || '<unknown>'; // Only use the hostname
|
|
||||||
} catch {
|
|
||||||
from = '<unknown>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return from;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async redirectIfPhishing (url: string): Promise<boolean> {
|
private async redirectIfPhishing (url: string): Promise<boolean> {
|
||||||
const isInDenyList = await checkIfDenied(url);
|
const isInDenyList = await checkIfDenied(url);
|
||||||
|
|
||||||
@ -246,9 +229,7 @@ export default class Tabs {
|
|||||||
|
|
||||||
public async handle<TMessageType extends MessageTypes> (id: string, type: TMessageType, request: RequestTypes[TMessageType], url: string, port?: chrome.runtime.Port): Promise<ResponseTypes[keyof ResponseTypes]> {
|
public async handle<TMessageType extends MessageTypes> (id: string, type: TMessageType, request: RequestTypes[TMessageType], url: string, port?: chrome.runtime.Port): Promise<ResponseTypes[keyof ResponseTypes]> {
|
||||||
if (type === 'pub(phishing.redirectIfDenied)') {
|
if (type === 'pub(phishing.redirectIfDenied)') {
|
||||||
const parsedUrl = this.parseUrl(url);
|
return this.redirectIfPhishing(url);
|
||||||
|
|
||||||
return this.redirectIfPhishing(parsedUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type !== 'pub(authorize.tab)') {
|
if (type !== 'pub(authorize.tab)') {
|
||||||
|
|||||||
@ -31,7 +31,6 @@ export default function handler<TMessageType extends MessageTypes> ({ id, messag
|
|||||||
const from = isExtension
|
const from = isExtension
|
||||||
? 'extension'
|
? 'extension'
|
||||||
: sender?.url || sender?.tab?.url || '<unknown>';
|
: sender?.url || sender?.tab?.url || '<unknown>';
|
||||||
|
|
||||||
const source = `${from}: ${id}: ${message}`;
|
const source = `${from}: ${id}: ${message}`;
|
||||||
|
|
||||||
console.log(` [in] ${source}`); // :: ${JSON.stringify(request)}`);
|
console.log(` [in] ${source}`); // :: ${JSON.stringify(request)}`);
|
||||||
|
|||||||
@ -1079,7 +1079,6 @@ __metadata:
|
|||||||
"@polkadot/util-crypto": "npm:^13.5.3"
|
"@polkadot/util-crypto": "npm:^13.5.3"
|
||||||
eventemitter3: "npm:^5.0.1"
|
eventemitter3: "npm:^5.0.1"
|
||||||
rxjs: "npm:^7.8.1"
|
rxjs: "npm:^7.8.1"
|
||||||
tldts: "npm:^7.0.8"
|
|
||||||
tslib: "npm:^2.8.1"
|
tslib: "npm:^2.8.1"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user