From 80a9783e9cbc5fe0e8f08878a464c9db6282955a Mon Sep 17 00:00:00 2001 From: Mononaut Date: Wed, 3 Dec 2025 03:24:12 +0000 Subject: [PATCH] update autobuild script --- production/mempool-build-custom.js | 41 ++++++++++++++++-------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/production/mempool-build-custom.js b/production/mempool-build-custom.js index 205e46e83..7b7aa6d69 100644 --- a/production/mempool-build-custom.js +++ b/production/mempool-build-custom.js @@ -8,19 +8,14 @@ const defaultConfig = { "name": "mempool", "title": "mempool", "site_id": 5, + "header_img": "/resources/mempool/mempool-header.png", + "footer_img": "/resources/mempool/mempool-footer.png" }, "meta": { "title": "mempool - Bitcoin Explorer", "description": "Explore the full Bitcoin ecosystem with The Mempool Open Source Project®. See the real-time status of your transactions, get network info, and more.", + previewFallbackImg: "/resources/mempool/mempool-preview.jpg" }, - "unfurls": { - "preview": { - "src": "https://mempool.space/resources/previews/mempool-space-preview.jpg", - "type": "image/jpeg", - "width": "2000", - "height": "1000" - } - } } function deepMerge(target, source) { @@ -53,17 +48,17 @@ function substitute(indexhtml, config) { // substitute meta tags newhtml = newhtml.replace(/\<\!\-\- META \-\-\>.*\<\!\-\- END META \-\-\>/gis, ` - - - - + + + + - + `); @@ -87,6 +82,9 @@ async function run() { const servicesHost = process.argv[2] || 'http://localhost:9000'; const mempoolDir = process.argv[3] || '../frontend/dist/mempool/browser'; + console.log('connecting to services host at', servicesHost); + console.log('writing files to mempool directory at ', mempoolDir); + console.log('fetching list of custom builds'); const customBuilds = await (await fetch(`${servicesHost}/api/v1/internal/enterprise/dashboard/list`)).json(); @@ -96,15 +94,20 @@ async function run() { return addDefaultsToConfig(await (await fetch(`${servicesHost}/api/v1/internal/enterprise/dashboard/${build}`)).json()); })); - + const browserDir = mempoolDir; + const locales = fs.readdirSync(browserDir) + .filter(file => fs.statSync(`${browserDir}/${file}`).isDirectory()) + .filter(file => fs.existsSync(`${browserDir}/${file}/index.html`)); + + if (locales.length === 0) { + console.log(`no locales found in browser directory - are you sure "${browserDir}" is the correct path?`); + return; + } + // for each custom build config: let i = 0; for (const config of customConfigs) { console.log(`generating ${config.enterprise} build (${i + 1}/${customConfigs.length})`); - const browserDir = mempoolDir; - const locales = fs.readdirSync(browserDir) - .filter(file => fs.statSync(`${browserDir}/${file}`).isDirectory()) - .filter(file => fs.existsSync(`${browserDir}/${file}/index.html`)); // Process each locale's index.html for (const locale of locales) { @@ -127,4 +130,4 @@ async function run() { console.log('finished updating custom builds'); } -run(); +run(); \ No newline at end of file