mirror of
https://github.com/mempool/mempool.git
synced 2025-01-01 03:04:27 +01:00
Merge pull request #1233 from nymkappa/feature/add-mining-pool-logos
sync-assets: Download pool logos from github
This commit is contained in:
commit
b232a9b6c2
1
frontend/.gitignore
vendored
1
frontend/.gitignore
vendored
@ -53,6 +53,7 @@ src/resources/assets.minimal.json
|
|||||||
src/resources/assets-testnet.json
|
src/resources/assets-testnet.json
|
||||||
src/resources/assets-testnet.minimal.json
|
src/resources/assets-testnet.minimal.json
|
||||||
src/resources/pools.json
|
src/resources/pools.json
|
||||||
|
src/resources/mining-pools/*
|
||||||
|
|
||||||
# environment config
|
# environment config
|
||||||
mempool-frontend-config.json
|
mempool-frontend-config.json
|
||||||
|
@ -33,6 +33,35 @@ function download(filename, url) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function downloadMiningPoolLogos() {
|
||||||
|
const options = {
|
||||||
|
host: 'api.github.com',
|
||||||
|
path: '/repos/mempool/mining-pools/contents/',
|
||||||
|
method: 'GET',
|
||||||
|
headers: {'user-agent': 'node.js'}
|
||||||
|
};
|
||||||
|
|
||||||
|
https.get(options, (response) => {
|
||||||
|
let chunks_of_data = [];
|
||||||
|
|
||||||
|
response.on('data', (fragments) => {
|
||||||
|
chunks_of_data.push(fragments);
|
||||||
|
});
|
||||||
|
|
||||||
|
response.on('end', () => {
|
||||||
|
let response_body = Buffer.concat(chunks_of_data);
|
||||||
|
const poolLogos = JSON.parse(response_body.toString());
|
||||||
|
for (const poolLogo of poolLogos) {
|
||||||
|
download(`${PATH}/mining-pools/${poolLogo.name}`, poolLogo.download_url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
response.on('error', (error) => {
|
||||||
|
throw new Error(error);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const poolsJsonUrl = 'https://raw.githubusercontent.com/btccom/Blockchain-Known-Pools/master/pools.json';
|
const poolsJsonUrl = 'https://raw.githubusercontent.com/btccom/Blockchain-Known-Pools/master/pools.json';
|
||||||
let assetsJsonUrl = 'https://raw.githubusercontent.com/mempool/asset_registry_db/master/index.json';
|
let assetsJsonUrl = 'https://raw.githubusercontent.com/mempool/asset_registry_db/master/index.json';
|
||||||
let assetsMinimalJsonUrl = 'https://raw.githubusercontent.com/mempool/asset_registry_db/master/index.minimal.json';
|
let assetsMinimalJsonUrl = 'https://raw.githubusercontent.com/mempool/asset_registry_db/master/index.minimal.json';
|
||||||
@ -55,4 +84,5 @@ console.log('Downloading testnet assets');
|
|||||||
download(PATH + 'assets-testnet.json', testnetAssetsJsonUrl);
|
download(PATH + 'assets-testnet.json', testnetAssetsJsonUrl);
|
||||||
console.log('Downloading testnet assets minimal');
|
console.log('Downloading testnet assets minimal');
|
||||||
download(PATH + 'assets-testnet.minimal.json', testnetAssetsMinimalJsonUrl);
|
download(PATH + 'assets-testnet.minimal.json', testnetAssetsMinimalJsonUrl);
|
||||||
|
console.log('Downloading mining pool logos');
|
||||||
|
downloadMiningPoolLogos();
|
||||||
|
Loading…
Reference in New Issue
Block a user