mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-07-24 17:05:41 +00:00
Retrieve new meta structure (#776)
* Retrieve new meta structure * Adjust * Var declaration
This commit is contained in:
+23
-7
@@ -89,7 +89,7 @@
|
|||||||
let hue = Math.floor(Math.random() * 359);
|
let hue = Math.floor(Math.random() * 359);
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
let navTo = '';
|
let navTo = '';
|
||||||
let metaJson;
|
let metaJson = [];
|
||||||
let addrJson;
|
let addrJson;
|
||||||
let urlStatus;
|
let urlStatus;
|
||||||
let balances = [];
|
let balances = [];
|
||||||
@@ -191,10 +191,11 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillSites () {
|
function fillSites (items = metaJson) {
|
||||||
|
if (navTo === 'sites') {
|
||||||
let prevMonth = '';
|
let prevMonth = '';
|
||||||
let countIndex = -1;
|
let countIndex = -1;
|
||||||
const count = metaJson.reduce((count, { date }) => {
|
const count = items.reduce((count, { date }) => {
|
||||||
const thisMonth = date.split('-').slice(0, 2).join('-');
|
const thisMonth = date.split('-').slice(0, 2).join('-');
|
||||||
|
|
||||||
if (thisMonth !== prevMonth) {
|
if (thisMonth !== prevMonth) {
|
||||||
@@ -209,7 +210,7 @@
|
|||||||
|
|
||||||
prevMonth = '';
|
prevMonth = '';
|
||||||
|
|
||||||
metaJson.forEach(({ date, url }, index) => {
|
items.forEach(({ date, url }, index) => {
|
||||||
const thisMonth = date.split('-').slice(0, 2).join('-');
|
const thisMonth = date.split('-').slice(0, 2).join('-');
|
||||||
|
|
||||||
if (thisMonth !== prevMonth) {
|
if (thisMonth !== prevMonth) {
|
||||||
@@ -225,6 +226,9 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.getElementById('btn-sites').innerText = `Sites (${metaJson.length})`;
|
||||||
|
}
|
||||||
|
|
||||||
function fillTable (newNav) {
|
function fillTable (newNav) {
|
||||||
if (newNav !== navTo) {
|
if (newNav !== navTo) {
|
||||||
if (navTo) {
|
if (navTo) {
|
||||||
@@ -291,9 +295,10 @@
|
|||||||
draw();
|
draw();
|
||||||
|
|
||||||
const from = window.location.protocol === 'file:' ? 'https://polkadot.js.org/phishing/' : '';
|
const from = window.location.protocol === 'file:' ? 'https://polkadot.js.org/phishing/' : '';
|
||||||
const [addrBody, metaBody] = await Promise.all(['address', 'urlmeta'].map((j) => fetchTimeout(`${from}${j}.json`)));
|
const [addrBody, metaBody] = await Promise.all(['address', 'meta/index'].map((j) => fetchTimeout(`${from}${j}.json`)));
|
||||||
|
let metaMonths;
|
||||||
|
|
||||||
[addrJson, metaJson] = await Promise.all([addrBody.json(), metaBody.json()]);
|
[addrJson, metaMonths] = await Promise.all([addrBody.json(), metaBody.json()]);
|
||||||
|
|
||||||
const addresses = Object
|
const addresses = Object
|
||||||
.values(addrJson)
|
.values(addrJson)
|
||||||
@@ -311,11 +316,22 @@
|
|||||||
search.addEventListener('input', onSearch);
|
search.addEventListener('input', onSearch);
|
||||||
search.style.display = 'block';
|
search.style.display = 'block';
|
||||||
|
|
||||||
document.getElementById('btn-sites').innerText = `Sites (${metaJson.length})`;
|
|
||||||
document.getElementById('btn-addresses').innerText = `Addresses (${Object.values(addrJson).reduce((count, addrs) => count + addrs.length, 0)})`;
|
document.getElementById('btn-addresses').innerText = `Addresses (${Object.values(addrJson).reduce((count, addrs) => count + addrs.length, 0)})`;
|
||||||
|
document.getElementById('btn-sites').innerText = `Sites (0)`;
|
||||||
document.getElementById('buttons').style.display = 'block';
|
document.getElementById('buttons').style.display = 'block';
|
||||||
|
|
||||||
fillTable('sites');
|
fillTable('sites');
|
||||||
|
|
||||||
|
for (const month of metaMonths) {
|
||||||
|
const response = await fetchTimeout(`${from}meta/${month}.json`);
|
||||||
|
const items = await response.json();
|
||||||
|
|
||||||
|
for (const item of items) {
|
||||||
|
metaJson.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
fillSites(items);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|||||||
-7458
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user