Merge pull request #5055 from mempool/mononaut/custom-build-html

Update custom sv html
This commit is contained in:
wiz 2024-05-10 04:22:15 +09:00 committed by GitHub
commit dcdb9361e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 19 deletions

View File

@ -10,6 +10,7 @@ let settings = [];
let configContent = {};
let gitCommitHash = '';
let packetJsonVersion = '';
let customConfig;
try {
const rawConfig = fs.readFileSync(CONFIG_FILE_NAME);
@ -23,7 +24,13 @@ try {
}
}
const indexFilePath = configContent.BASE_MODULE ? 'src/index.' + configContent.BASE_MODULE + '.html' : 'src/index.mempool.html';
if (configContent && configContent.CUSTOMIZATION) {
customConfig = readConfig(configContent.CUSTOMIZATION);
}
const baseModuleName = configContent.BASE_MODULE || 'mempool';
const customBuildName = (customConfig && configContent.enterprise) ? ('.' + configContent.enterprise) : '';
const indexFilePath = 'src/index.' + baseModuleName + customBuildName + '.html';
try {
fs.copyFileSync(indexFilePath, 'src/index.html');
@ -111,20 +118,14 @@ writeConfigTemplate(GENERATED_TEMPLATE_CONFIG_FILE_NAME, newConfigTemplate);
const currentConfig = readConfig(GENERATED_CONFIG_FILE_NAME);
let customConfigJs = '';
if (configContent && configContent.CUSTOMIZATION) {
const customConfig = readConfig(configContent.CUSTOMIZATION);
if (customConfig) {
console.log(`Customizing frontend using ${configContent.CUSTOMIZATION}`);
customConfigJs = `(function (window) {
window.__env = window.__env || {};
window.__env.customize = ${customConfig};
}((typeof global !== 'undefined') ? global : this));
`;
} else {
throw new Error('Failed to load customization file');
}
if (customConfig) {
console.log(`Customizing frontend using ${configContent.CUSTOMIZATION}`);
customConfigJs = `(function (window) {
window.__env = window.__env || {};
window.__env.customize = ${customConfig};
}((typeof global !== 'undefined') ? global : this));
`;
}
writeConfig(GENERATED_CUSTOMIZATION_FILE_NAME, customConfigJs);
if (currentConfig && currentConfig === newConfig) {

View File

@ -3,22 +3,22 @@
<head>
<meta charset="utf-8">
<title>Bitcoin Office - Explorer</title>
<title>National Bitcoin Office of El Salvador</title>
<script src="/resources/config.js"></script>
<script src="/resources/customize.js"></script>
<base href="/">
<meta name="description" content="Explore the full Bitcoin ecosystem with The Mempool Open Source Project®. See the real-time status of your transactions, get network info, and more." />
<meta name="description" content="The National Bitcoin Office (ONBTC) of El Salvador under President @nayibbukele" />
<meta property="og:image" content="https://mempool.space/resources/onbtc/onbtc-preview.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="2000" />
<meta property="og:image:height" content="1000" />
<meta property="og:description" content="Explore the full Bitcoin ecosystem with The Mempool Open Source Project®. See the real-time status of your transactions, get network info, and more." />
<meta property="og:description" content="The National Bitcoin Office (ONBTC) of El Salvador under President @nayibbukele" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@mempool">
<meta name="twitter:creator" content="@mempool">
<meta name="twitter:title" content="Oficina Nacional del Bitcoin - Bitcoin Explorer">
<meta name="twitter:description" content="Explore the full Bitcoin ecosystem with The Mempool Open Source Project®. See the real-time status of your transactions, get network info, and more." />
<meta name="twitter:title" content="National Bitcoin Office of El Salvador">
<meta name="twitter:description" content="The National Bitcoin Office (ONBTC) of El Salvador under President @nayibbukele" />
<meta name="twitter:image" content="https://mempool.space/resources/onbtc/onbtc-preview.jpg" />
<meta name="twitter:domain" content="bitcoin.gob.sv">