*(global): update trackers db
This commit is contained in:
parent
76be272787
commit
6faf2ce931
File diff suppressed because it is too large
Load Diff
|
@ -44,16 +44,36 @@ async function runScript() {
|
||||||
whotracksme.categories[row.id] = row.name;
|
whotracksme.categories[row.id] = row.name;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const companies = {};
|
||||||
|
db.each("SELECT * FROM companies", function (err, row) {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
companies[row.id] = {
|
||||||
|
"id": row.id,
|
||||||
|
"name": row.name,
|
||||||
|
"website_url": row.website_url
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
db.each("SELECT * FROM trackers", function (err, row) {
|
db.each("SELECT * FROM trackers", function (err, row) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const company = companies[row.company_id];
|
||||||
|
let url = row.website_url;
|
||||||
|
if (!url && company) {
|
||||||
|
url = company.website_url;
|
||||||
|
}
|
||||||
|
|
||||||
whotracksme.trackers[row.id] = {
|
whotracksme.trackers[row.id] = {
|
||||||
"name": row.name,
|
"name": row.name,
|
||||||
"categoryId": row.category_id,
|
"categoryId": row.category_id,
|
||||||
"url": row.website_url
|
"url": url,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue