mining checker
This commit is contained in:
@@ -20,15 +20,27 @@ $assetVersion = static function (string $publicPath): string {
|
||||
return $mtime === false ? $publicPath : $publicPath . '?v=' . $mtime;
|
||||
};
|
||||
|
||||
$hasMiningChecker = false;
|
||||
$hasUserSelfManagement = false;
|
||||
$nativeModuleStyles = [];
|
||||
$nativeModuleScripts = [];
|
||||
foreach ($desktopPayload['apps'] as $desktopApp) {
|
||||
if (($desktopApp['app_id'] ?? null) === 'mining-checker') {
|
||||
$hasMiningChecker = true;
|
||||
$assets = is_array($desktopApp['native_module']['assets'] ?? null) ? $desktopApp['native_module']['assets'] : [];
|
||||
|
||||
foreach ((array) ($assets['styles'] ?? []) as $style) {
|
||||
if (!is_array($style) || trim((string) ($style['href'] ?? '')) === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$href = (string) $style['href'];
|
||||
$nativeModuleStyles[$href] = $style;
|
||||
}
|
||||
|
||||
if (($desktopApp['app_id'] ?? null) === 'user-self-management') {
|
||||
$hasUserSelfManagement = true;
|
||||
foreach ((array) ($assets['scripts'] ?? []) as $script) {
|
||||
if (!is_array($script) || trim((string) ($script['src'] ?? '')) === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$src = (string) $script['src'];
|
||||
$nativeModuleScripts[$src] = $script;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,15 +179,14 @@ $renderStartIcon = static function (array $profile): string {
|
||||
<?php if (!empty($skinProfile['js_path']) && $skinProfile['js_path'] !== $baseSkinProfile['js_path']): ?>
|
||||
<script src="<?= htmlspecialchars($assetVersion((string) $skinProfile['js_path']), ENT_QUOTES) ?>"></script>
|
||||
<?php endif; ?>
|
||||
<?php if ($hasMiningChecker): ?>
|
||||
<link rel="stylesheet" href="<?= htmlspecialchars($assetVersion('/assets/apps/mining-checker/app.css'), ENT_QUOTES) ?>">
|
||||
<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 src="<?= htmlspecialchars($assetVersion('/assets/apps/mining-checker/app.js'), ENT_QUOTES) ?>"></script>
|
||||
<?php endif; ?>
|
||||
<?php if ($hasUserSelfManagement): ?>
|
||||
<link rel="stylesheet" href="<?= htmlspecialchars($assetVersion('/assets/apps/user-self-management/app.css'), ENT_QUOTES) ?>">
|
||||
<script src="<?= htmlspecialchars($assetVersion('/assets/apps/user-self-management/app.js'), ENT_QUOTES) ?>"></script>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($nativeModuleStyles as $style): ?>
|
||||
<link rel="stylesheet" href="<?= htmlspecialchars((string) $style['href'], ENT_QUOTES) ?>">
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($nativeModuleScripts as $script): ?>
|
||||
<script
|
||||
<?php if (!empty($script['crossorigin'])): ?>crossorigin<?php endif; ?>
|
||||
src="<?= htmlspecialchars((string) $script['src'], ENT_QUOTES) ?>"
|
||||
></script>
|
||||
<?php endforeach; ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user