mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-06-15 17:11:02 +00:00
Add tsconfig.base (#800)
* Add tsconfig.base * Remove unused package * yarn * Adjust paths
This commit is contained in:
@@ -23,6 +23,7 @@ lerna-debug.log*
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
package-lock.json
|
package-lock.json
|
||||||
report.*.json
|
report.*.json
|
||||||
|
tsconfig.*buildinfo
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
NOTES.md
|
NOTES.md
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ import fs from 'fs';
|
|||||||
|
|
||||||
import { decodeAddress } from '@polkadot/util-crypto';
|
import { decodeAddress } from '@polkadot/util-crypto';
|
||||||
|
|
||||||
import ourAddrList from '../../../address.json';
|
|
||||||
import { fetchWithTimeout } from './fetch';
|
import { fetchWithTimeout } from './fetch';
|
||||||
|
|
||||||
const TICKS = '```';
|
const TICKS = '```';
|
||||||
|
|
||||||
|
const ourAddrList = JSON.parse(fs.readFileSync('address.json', 'utf-8')) as Record<string, string[]>;
|
||||||
|
|
||||||
function fetch (url: string): Promise<Response> {
|
function fetch (url: string): Promise<Response> {
|
||||||
return fetchWithTimeout(url, 5000);
|
return fetchWithTimeout(url, 5000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import { load as yamlParse } from 'js-yaml';
|
|||||||
|
|
||||||
import { fetch } from '@polkadot/x-fetch';
|
import { fetch } from '@polkadot/x-fetch';
|
||||||
|
|
||||||
import ourSiteList from '../../../all.json';
|
|
||||||
|
|
||||||
interface CryptoScamEntry {
|
interface CryptoScamEntry {
|
||||||
addresses: Record<string, string[]>;
|
addresses: Record<string, string[]>;
|
||||||
category: string;
|
category: string;
|
||||||
@@ -24,6 +22,8 @@ interface EthPhishing {
|
|||||||
|
|
||||||
const TICKS = '```';
|
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 {
|
function assertAndLog (check: boolean, site: string, missing: unknown): void {
|
||||||
if (!check) {
|
if (!check) {
|
||||||
process.env.CI_LOG && fs.appendFileSync('./.github/crosscheck.md', `
|
process.env.CI_LOG && fs.appendFileSync('./.github/crosscheck.md', `
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
// Copyright 2020-2021 @polkadot/phishing authors & contributors
|
// Copyright 2020-2021 @polkadot/phishing authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
import { decodeAddress } from '@polkadot/util-crypto';
|
import { decodeAddress } from '@polkadot/util-crypto';
|
||||||
|
|
||||||
import addresses from '../../../address.json';
|
|
||||||
import allowed from '../../../known.json';
|
|
||||||
import { checkAddress, checkIfDenied } from '.';
|
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 => {
|
describe('checkIfDenied', (): void => {
|
||||||
it('returns false when host is not listed', async (): Promise<void> => {
|
it('returns false when host is not listed', async (): Promise<void> => {
|
||||||
expect(
|
expect(
|
||||||
@@ -74,7 +77,7 @@ describe('checkAddress', (): void => {
|
|||||||
describe('check additions', (): void => {
|
describe('check additions', (): void => {
|
||||||
it('has no malformed addresses', (): void => {
|
it('has no malformed addresses', (): void => {
|
||||||
const invalids = Object
|
const invalids = Object
|
||||||
.entries(addresses as Record<string, string[]>)
|
.entries(addresses)
|
||||||
.map(([url, addrs]): [string, string[]] => {
|
.map(([url, addrs]): [string, string[]] => {
|
||||||
return [url, addrs.filter((a) => {
|
return [url, addrs.filter((a) => {
|
||||||
try {
|
try {
|
||||||
@@ -95,10 +98,10 @@ describe('check additions', (): void => {
|
|||||||
|
|
||||||
it('has no entries on the known addresses list', (): void => {
|
it('has no entries on the known addresses list', (): void => {
|
||||||
const added = Object
|
const added = Object
|
||||||
.values(addresses as Record<string, string[]>)
|
.values(addresses)
|
||||||
.reduce<string[]>((all, addrs) => all.concat(addrs), []);
|
.reduce<string[]>((all, addrs) => all.concat(addrs), []);
|
||||||
const dupes = Object
|
const dupes = Object
|
||||||
.entries(allowed as Record<string, string[]>)
|
.entries(allowed)
|
||||||
.reduce<[string, string][]>((all, [site, addrs]) => all.concat(addrs.map((a) => [site, a])), [])
|
.reduce<[string, string][]>((all, [site, addrs]) => all.concat(addrs.map((a) => [site, a])), [])
|
||||||
.filter(([, a]) => added.includes(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');
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"extends": "@polkadot/dev/config/tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"paths": {
|
||||||
|
"@polkadot/phishing": ["phishing/src"],
|
||||||
|
"@polkadot/phishing/*": ["phishing/src/*"]
|
||||||
|
},
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"typeRoots": [
|
||||||
|
"./node_modules/@types"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-12
@@ -1,20 +1,10 @@
|
|||||||
{
|
{
|
||||||
"extends": "@polkadot/dev/config/tsconfig.json",
|
"extends": "./tsconfig.base.json",
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"build/**/*",
|
"build/**/*",
|
||||||
"**/build/**/*"
|
"**/build/**/*"
|
||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": "./packages"
|
||||||
"paths":
|
|
||||||
{
|
|
||||||
"@polkadot/phishing": ["packages/phishing/src"],
|
|
||||||
"@polkadot/phishing/*": ["packages/phishing/src/*"]
|
|
||||||
},
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"typeRoots": [
|
|
||||||
"./node_modules/@types"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1967,12 +1967,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@polkadot/phishing-unused@workspace:packages/unused":
|
|
||||||
version: 0.0.0-use.local
|
|
||||||
resolution: "@polkadot/phishing-unused@workspace:packages/unused"
|
|
||||||
languageName: unknown
|
|
||||||
linkType: soft
|
|
||||||
|
|
||||||
"@polkadot/phishing@workspace:packages/phishing":
|
"@polkadot/phishing@workspace:packages/phishing":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@polkadot/phishing@workspace:packages/phishing"
|
resolution: "@polkadot/phishing@workspace:packages/phishing"
|
||||||
|
|||||||
Reference in New Issue
Block a user