mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-06-13 07:01:12 +00:00
Add tsconfig.base (#800)
* Add tsconfig.base * Remove unused package * yarn * Adjust paths
This commit is contained in:
@@ -5,11 +5,12 @@ import fs from 'fs';
|
||||
|
||||
import { decodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
import ourAddrList from '../../../address.json';
|
||||
import { fetchWithTimeout } from './fetch';
|
||||
|
||||
const TICKS = '```';
|
||||
|
||||
const ourAddrList = JSON.parse(fs.readFileSync('address.json', 'utf-8')) as Record<string, string[]>;
|
||||
|
||||
function fetch (url: string): Promise<Response> {
|
||||
return fetchWithTimeout(url, 5000);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import { load as yamlParse } from 'js-yaml';
|
||||
|
||||
import { fetch } from '@polkadot/x-fetch';
|
||||
|
||||
import ourSiteList from '../../../all.json';
|
||||
|
||||
interface CryptoScamEntry {
|
||||
addresses: Record<string, string[]>;
|
||||
category: string;
|
||||
@@ -24,6 +22,8 @@ interface EthPhishing {
|
||||
|
||||
const TICKS = '```';
|
||||
|
||||
const ourSiteList = JSON.parse(fs.readFileSync('all.json', 'utf-8')) as { allow: string[]; deny: string[] };
|
||||
|
||||
function assertAndLog (check: boolean, site: string, missing: unknown): void {
|
||||
if (!check) {
|
||||
process.env.CI_LOG && fs.appendFileSync('./.github/crosscheck.md', `
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
// Copyright 2020-2021 @polkadot/phishing authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import fs from 'fs';
|
||||
|
||||
import { decodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
import addresses from '../../../address.json';
|
||||
import allowed from '../../../known.json';
|
||||
import { checkAddress, checkIfDenied } from '.';
|
||||
|
||||
const addresses = JSON.parse(fs.readFileSync('address.json', 'utf-8')) as Record<string, string[]>;
|
||||
const allowed = JSON.parse(fs.readFileSync('known.json', 'utf-8')) as Record<string, string[]>;
|
||||
|
||||
describe('checkIfDenied', (): void => {
|
||||
it('returns false when host is not listed', async (): Promise<void> => {
|
||||
expect(
|
||||
@@ -74,7 +77,7 @@ describe('checkAddress', (): void => {
|
||||
describe('check additions', (): void => {
|
||||
it('has no malformed addresses', (): void => {
|
||||
const invalids = Object
|
||||
.entries(addresses as Record<string, string[]>)
|
||||
.entries(addresses)
|
||||
.map(([url, addrs]): [string, string[]] => {
|
||||
return [url, addrs.filter((a) => {
|
||||
try {
|
||||
@@ -95,10 +98,10 @@ describe('check additions', (): void => {
|
||||
|
||||
it('has no entries on the known addresses list', (): void => {
|
||||
const added = Object
|
||||
.values(addresses as Record<string, string[]>)
|
||||
.values(addresses)
|
||||
.reduce<string[]>((all, addrs) => all.concat(addrs), []);
|
||||
const dupes = Object
|
||||
.entries(allowed as Record<string, string[]>)
|
||||
.entries(allowed)
|
||||
.reduce<[string, string][]>((all, [site, addrs]) => all.concat(addrs.map((a) => [site, a])), [])
|
||||
.filter(([, a]) => added.includes(a));
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/phishing/issues",
|
||||
"contributors": [],
|
||||
"description": "Dummy",
|
||||
"homepage": "https://github.com/polkadot-js/phishing/tree/master/packages/unused#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/phishing-unused",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"directory": "packages/unused",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/phishing.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"version": "0.6.530",
|
||||
"main": "index.js"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// Copyright 2020-2021 @polkadot/phishing authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export interface Dummy {
|
||||
dummy: string;
|
||||
}
|
||||
|
||||
export default function dummy (): void {
|
||||
console.error('unused');
|
||||
}
|
||||
Reference in New Issue
Block a user