diff --git a/src/classes/scam.class.ts b/src/classes/scam.class.ts index 31b016d..d70115a 100644 --- a/src/classes/scam.class.ts +++ b/src/classes/scam.class.ts @@ -17,7 +17,6 @@ export default class Scam implements Entry { description?: string; addresses?: string[]; reporter?: string; - coin?: string; ip?: string; abusereport?: string; nameservers: string[]; @@ -43,7 +42,6 @@ export default class Scam implements Entry { if (this.path || this.url) { this.path = scamData.path || '/*'; } - this.coin = scamData.coin; } } diff --git a/src/models/entry.ts b/src/models/entry.ts index 8329119..6b6a907 100644 --- a/src/models/entry.ts +++ b/src/models/entry.ts @@ -8,7 +8,6 @@ export default interface Entry { description?: string; addresses?: string[]; reporter?: string; - coin?: string; severity?: number; featured?: boolean; domain?: string; diff --git a/src/utils/db.ts b/src/utils/db.ts index 61fe58b..e23b70f 100644 --- a/src/utils/db.ts +++ b/src/utils/db.ts @@ -21,10 +21,10 @@ const db = new sqlite3.Database('cache.db'); export const init = async (): Promise => { 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))' @@ -105,7 +105,7 @@ export const readEntries = async (): Promise => { 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(), @@ -116,7 +116,6 @@ export const readEntries = async (): Promise => { $subcategory: entry.subcategory, $description: entry.description, $reporter: entry.reporter, - $coin: entry.coin, $severity: entry.severity } ); @@ -135,8 +134,9 @@ export const readEntries = async (): Promise => { ); 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() ]); }) @@ -196,8 +196,9 @@ export const readEntries = async (): Promise => { ); 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) ]); }) @@ -234,7 +235,7 @@ export const readEntries = async (): Promise => { 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(), @@ -245,7 +246,6 @@ export const readEntries = async (): Promise => { $subcategory: entry.subcategory, $description: entry.description, $reporter: entry.reporter, - $coin: entry.coin, $severity: entry.severity } ); @@ -264,8 +264,9 @@ export const readEntries = async (): Promise => { ); 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() ]); })