61 lines
2.1 KiB
PHP
61 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)
|
|
));
|
|
|
|
$assetVersion = static function (string $relativePath): string {
|
|
$fullPath = __DIR__ . '/' . ltrim($relativePath, '/');
|
|
$mtime = is_file($fullPath) ? filemtime($fullPath) : false;
|
|
|
|
return $mtime === false ? '0' : (string) $mtime;
|
|
};
|
|
|
|
return [
|
|
'app_id' => 'fx-rates',
|
|
'title' => (string) ($manifest['title'] ?? 'Waehrungs-Checker'),
|
|
'icon' => 'FX',
|
|
'entry_route' => '/apps/fx-rates',
|
|
'window_mode' => 'window',
|
|
'content_mode' => 'native-module',
|
|
'default_width' => 1120,
|
|
'default_height' => 760,
|
|
'supports_widget' => true,
|
|
'supports_tray' => true,
|
|
'module_name' => 'finance',
|
|
'summary' => (string) ($manifest['description'] ?? 'Waehrungskurse, Verlauf, API und Desktop-Widget fuer manuelle Aktualisierung.'),
|
|
'native_module' => [
|
|
'initializer' => 'initFxRatesApp',
|
|
'options' => [
|
|
'apiBase' => '/api/fx-rates/index.php?path=v1',
|
|
'activeView' => 'overview',
|
|
'sections' => $sections,
|
|
],
|
|
'assets' => [
|
|
'styles' => [
|
|
['href' => '/module-assets/index.php?module=fx-rates&path=assets/css/app.css&v=' . rawurlencode($assetVersion('assets/css/app.css'))],
|
|
],
|
|
'scripts' => [
|
|
['src' => '/module-assets/index.php?module=fx-rates&path=assets/js/app.js&v=' . rawurlencode($assetVersion('assets/js/app.js'))],
|
|
],
|
|
],
|
|
],
|
|
];
|