58 lines
2.1 KiB
PHP
58 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
$manifest = [];
|
|
$manifestRaw = is_file(__DIR__ . '/module.json') ? file_get_contents(__DIR__ . '/module.json') : false;
|
|
if ($manifestRaw !== false) {
|
|
$decoded = json_decode($manifestRaw, true);
|
|
$manifest = is_array($decoded) ? $decoded : [];
|
|
}
|
|
|
|
$design = [];
|
|
$designRaw = is_file(__DIR__ . '/design.json') ? file_get_contents(__DIR__ . '/design.json') : false;
|
|
if ($designRaw !== false) {
|
|
$decoded = json_decode($designRaw, true);
|
|
$design = is_array($decoded) ? $decoded : [];
|
|
}
|
|
|
|
$sections = array_values(array_filter(
|
|
is_array($design['sections'] ?? null) ? $design['sections'] : [],
|
|
static fn (mixed $section): bool => is_array($section)
|
|
));
|
|
|
|
return [
|
|
'app_id' => 'mining-checker',
|
|
'title' => (string) ($manifest['title'] ?? 'Mining-Checker'),
|
|
'icon' => 'MC',
|
|
'entry_route' => '/apps/mining-checker',
|
|
'window_mode' => 'window',
|
|
'content_mode' => 'native-module',
|
|
'default_width' => 1180,
|
|
'default_height' => 760,
|
|
'supports_widget' => false,
|
|
'supports_tray' => true,
|
|
'module_name' => 'finance',
|
|
'summary' => (string) ($manifest['description'] ?? 'Vollstaendiger Rechner fuer Mining-Profitabilitaet, Stromkosten, ROI und Snapshot-Historie.'),
|
|
'native_module' => [
|
|
'initializer' => 'initMiningCheckerApp',
|
|
'options' => [
|
|
'apiBase' => '/api/mining-checker/index.php/v1',
|
|
'defaultProjectKey' => getenv('MINING_CHECKER_DEFAULT_PROJECT_KEY') ?: 'doge-main',
|
|
'activeView' => 'overview',
|
|
'sections' => $sections,
|
|
'moduleDebugEnabled' => false,
|
|
],
|
|
'assets' => [
|
|
'styles' => [
|
|
['href' => '/module-assets/index.php?module=mining-checker&path=assets/css/app.css'],
|
|
],
|
|
'scripts' => [
|
|
['src' => 'https://unpkg.com/react@18/umd/react.production.min.js', 'crossorigin' => true],
|
|
['src' => 'https://unpkg.com/react-dom@18/umd/react-dom.production.min.js', 'crossorigin' => true],
|
|
['src' => '/module-assets/index.php?module=mining-checker&path=assets/js/app.js'],
|
|
],
|
|
],
|
|
],
|
|
];
|