33 lines
1.6 KiB
PHP
33 lines
1.6 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once dirname(__DIR__) . '/bootstrap.php';
|
|
|
|
$moduleConfig = require dirname(__DIR__) . '/config/module.php';
|
|
$defaultProjectKey = (string) ($moduleConfig['default_project_key'] ?? 'doge-main');
|
|
$fxConfig = (array) ($moduleConfig['fx'] ?? []);
|
|
$fxProvider = (string) ($fxConfig['provider'] ?? 'currencyapi');
|
|
$fxBaseUrl = rtrim((string) ($fxConfig['url'] ?? 'https://currencyapi.net'), '/');
|
|
$fxCurrenciesUrl = rtrim((string) ($fxConfig['currencies_url'] ?? $fxBaseUrl), '/');
|
|
$fxApiKey = (string) ($fxConfig['api_key'] ?? '');
|
|
$fxApiKeyMasked = $fxApiKey === ''
|
|
? ''
|
|
: (strlen($fxApiKey) <= 10 ? $fxApiKey : substr($fxApiKey, 0, 6) . '...' . substr($fxApiKey, -4));
|
|
$moduleCss = file_get_contents(dirname(__DIR__) . '/assets/css/app.css') ?: '';
|
|
$moduleJs = file_get_contents(dirname(__DIR__) . '/assets/js/app.js') ?: '';
|
|
$moduleJs = str_replace('</script>', '<\/script>', $moduleJs);
|
|
?>
|
|
<div class="module-host-card mining-checker-host">
|
|
<div id="mining-checker-app"
|
|
data-default-project-key="<?= e($defaultProjectKey) ?>"
|
|
data-api-base="/api/mining-checker/v1"
|
|
data-fx-provider="<?= e($fxProvider) ?>"
|
|
data-fx-url="<?= e($fxBaseUrl) ?>"
|
|
data-fx-currencies-url="<?= e($fxCurrenciesUrl) ?>"
|
|
data-fx-api-key-mask="<?= e($fxApiKeyMasked) ?>"></div>
|
|
</div>
|
|
<style><?= $moduleCss ?></style>
|
|
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
|
|
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
|
|
<script><?= $moduleJs ?></script>
|