Skip to content

Commit 806bde1

Browse files
phishing 0.25.13
1 parent 121d3cb commit 806bde1

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## master
44

5+
- phishing 0.25.13
56
- api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 16.2.2
67
- hw-{ledger, ledger-transports}, keyring, networks, util, util-crypto, x-{bigint, fetch, global, randomvalues, textdecoder, textencoder, ws} 13.5.2
78
- api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 16.2.1

phishing/bundle.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
import type { AddressList, HostList } from './types.ts';
33

4+
import { parse } from 'https://esm.sh/[email protected]';
5+
46
import { u8aEq } from 'https://deno.land/x/polkadot/util/mod.ts';
57
import { decodeAddress } from 'https://deno.land/x/polkadot/util-crypto/mod.ts';
68

@@ -33,21 +35,26 @@ const cacheAddr: CacheAddrList = {
3335
const cacheHost: Record<string, CacheHostList> = {};
3436

3537
function splitHostParts (host: string): string[] {
36-
return host
37-
// split domain
38+
const parsed = parse(host, { allowPrivateDomains: true });
39+
40+
if (!parsed.hostname) {
41+
return [];
42+
}
43+
44+
return parsed.hostname
45+
.replace(/\.$/, '') // remove trailing dot
3846
.split('.')
39-
// reverse order
4047
.reverse();
4148
}
4249

4350
function extractHostParts (host: string): string[] {
44-
return splitHostParts(
45-
host
46-
// remove protocol
47-
.replace(/https:\/\/|http:\/\/|wss:\/\/|ws:\/\//, '')
48-
// get the domain-only part
49-
.split('/')[0]
50-
);
51+
const parsed = parse(host, { allowPrivateDomains: true });
52+
53+
if (!parsed.hostname) {
54+
return [];
55+
}
56+
57+
return splitHostParts(parsed.hostname);
5158
}
5259

5360
async function retrieveAddrCache (allowCached = true): Promise<CacheAddrList> {

phishing/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/phishing', path: new URL(import.meta.url).pathname, type: 'deno', version: '0.25.12' };
3+
export const packageInfo = { name: '@polkadot/phishing', path: new URL(import.meta.url).pathname, type: 'deno', version: '0.25.13' };

0 commit comments

Comments
 (0)