Skip to content

Commit

Permalink
coin changes (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
blurpesec authored and MrLuit committed May 2, 2019
1 parent d2ace75 commit dd1ab71
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/classes/scam.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default class Scam implements Entry {
description?: string;
addresses?: string[];
reporter?: string;
coin?: string;
ip?: string;
abusereport?: string;
nameservers: string[];
Expand All @@ -43,7 +42,6 @@ export default class Scam implements Entry {
if (this.path || this.url) {
this.path = scamData.path || '/*';
}
this.coin = scamData.coin;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/models/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default interface Entry {
description?: string;
addresses?: string[];
reporter?: string;
coin?: string;
severity?: number;
featured?: boolean;
domain?: string;
Expand Down
19 changes: 10 additions & 9 deletions src/utils/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const db = new sqlite3.Database('cache.db');

export const init = async (): Promise<void> => {
await this.run(
'CREATE TABLE IF NOT EXISTS entries (id TEXT, name TEXT, type TEXT, url TEXT, hostname TEXT, featured INTEGER, path TEXT, category TEXT, subcategory TEXT, description TEXT, reporter TEXT, coin TEXT, ip TEXT, severity INTEGER, statusCode INTEGER, status TEXT, updated INTEGER, PRIMARY KEY(id))'
'CREATE TABLE IF NOT EXISTS entries (id TEXT, name TEXT, type TEXT, url TEXT, hostname TEXT, featured INTEGER, path TEXT, category TEXT, subcategory TEXT, description TEXT, reporter TEXT, ip TEXT, severity INTEGER, statusCode INTEGER, status TEXT, updated INTEGER, PRIMARY KEY(id))'
);
await this.run(
'CREATE TABLE IF NOT EXISTS addresses (address TEXT, entry TEXT, PRIMARY KEY(address,entry))'
'CREATE TABLE IF NOT EXISTS addresses (address TEXT, entry TEXT, coin TEXT, PRIMARY KEY(address,entry))'
);
await this.run(
'CREATE TABLE IF NOT EXISTS nameservers (nameserver TEXT, entry TEXT, PRIMARY KEY(nameserver,entry))'
Expand Down Expand Up @@ -105,7 +105,7 @@ export const readEntries = async (): Promise<void> => {
await Promise.all(
scams.map(async entry => {
await run(
"INSERT INTO entries(id,name,type,url,hostname,featured,path,category,subcategory,description,reporter,coin,severity,updated) VALUES ($id,$name,'scam',$url,$hostname,0,$path,$category,$subcategory,$description,$reporter,$coin,$severity,0) ON CONFLICT(id) DO UPDATE SET path=$path,category=$category,subcategory=$subcategory,description=$description,reporter=$reporter,coin=$coin,severity=$severity WHERE id=$id",
"INSERT INTO entries(id,name,type,url,hostname,featured,path,category,subcategory,description,reporter,severity,updated) VALUES ($id,$name,'scam',$url,$hostname,0,$path,$category,$subcategory,$description,$reporter,$severity,0) ON CONFLICT(id) DO UPDATE SET path=$path,category=$category,subcategory=$subcategory,description=$description,reporter=$reporter,severity=$severity WHERE id=$id",
{
$id: entry.getID(),
$name: entry.getHostname(),
Expand All @@ -116,7 +116,6 @@ export const readEntries = async (): Promise<void> => {
$subcategory: entry.subcategory,
$description: entry.description,
$reporter: entry.reporter,
$coin: entry.coin,
$severity: entry.severity
}
);
Expand All @@ -135,8 +134,9 @@ export const readEntries = async (): Promise<void> => {
);
await Promise.all(
(entry.addresses || []).map(async address => {
await run('INSERT OR IGNORE INTO addresses VALUES (?,?)', [
await run('INSERT OR IGNORE INTO addresses VALUES (?,?,?)', [
address,
entry.coin,
entry.getID()
]);
})
Expand Down Expand Up @@ -196,8 +196,9 @@ export const readEntries = async (): Promise<void> => {
);
await Promise.all(
(entry.addresses || []).map(async address => {
await run('INSERT OR IGNORE INTO addresses VALUES (?,?)', [
await run('INSERT OR IGNORE INTO addresses VALUES (?,?,?)', [
address,
entry.coin,
getID(entry.name)
]);
})
Expand Down Expand Up @@ -234,7 +235,7 @@ export const readEntries = async (): Promise<void> => {
await Promise.all(
etherscamdbscams.map(async entry => {
await run(
"INSERT INTO entries(id,name,type,url,hostname,featured,path,category,subcategory,description,reporter,coin,severity,updated) VALUES ($id,$name,'scam',$url,$hostname,0,$path,$category,$subcategory,$description,$reporter,$coin,$severity,0) ON CONFLICT(id) DO UPDATE SET path=$path,category=$category,subcategory=$subcategory,description=$description,reporter=$reporter,coin=$coin,severity=$severity WHERE id=$id",
"INSERT INTO entries(id,name,type,url,hostname,featured,path,category,subcategory,description,reporter,severity,updated) VALUES ($id,$name,'scam',$url,$hostname,0,$path,$category,$subcategory,$description,$reporter,$severity,0) ON CONFLICT(id) DO UPDATE SET path=$path,category=$category,subcategory=$subcategory,description=$description,reporter=$reporter,severity=$severity WHERE id=$id",
{
$id: entry.getID(),
$name: entry.getHostname(),
Expand All @@ -245,7 +246,6 @@ export const readEntries = async (): Promise<void> => {
$subcategory: entry.subcategory,
$description: entry.description,
$reporter: entry.reporter,
$coin: entry.coin,
$severity: entry.severity
}
);
Expand All @@ -264,8 +264,9 @@ export const readEntries = async (): Promise<void> => {
);
await Promise.all(
(entry.addresses || []).map(async address => {
await run('INSERT OR IGNORE INTO addresses VALUES (?,?)', [
await run('INSERT OR IGNORE INTO addresses VALUES (?,?,?)', [
address,
entry.coin,
entry.getID()
]);
})
Expand Down

0 comments on commit dd1ab71

Please sign in to comment.