Skip to content

Commit 4d239f9

Browse files
committed
chore: extractor upgrade
1 parent 80bbf8d commit 4d239f9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class WebComponentsExtractor
55
{
66
private const PREFIXED_PATH = '/plugins/dynamix.my.servers/unraid-components/';
77
private const RICH_COMPONENTS_ENTRY = 'unraid-components.client.mjs';
8+
private const RICH_COMPONENTS_ENTRY_JS = 'unraid-components.client.js';
89
private const UI_ENTRY = 'src/register.ts';
910
private const UI_STYLES_ENTRY = 'style.css';
1011

@@ -47,7 +48,16 @@ private function getRichComponentsFile(): string
4748
$subfolder = $this->getRelativePath($manifestPath);
4849

4950
foreach ($manifest as $key => $value) {
50-
if (strpos($key, self::RICH_COMPONENTS_ENTRY) !== false && isset($value["file"])) {
51+
// Skip timestamp entries
52+
if ($key === 'ts' || !is_array($value)) {
53+
continue;
54+
}
55+
56+
// Check for both old format (direct key match) and new format (path-based key)
57+
$matchesMjs = strpos($key, self::RICH_COMPONENTS_ENTRY) !== false;
58+
$matchesJs = strpos($key, self::RICH_COMPONENTS_ENTRY_JS) !== false;
59+
60+
if (($matchesMjs || $matchesJs) && isset($value["file"])) {
5161
return ($subfolder ? $subfolder . '/' : '') . $value["file"];
5262
}
5363
}
@@ -59,7 +69,7 @@ private function getRichComponentsScript(): string
5969
{
6070
$jsFile = $this->getRichComponentsFile();
6171
if (empty($jsFile)) {
62-
return '<script>console.error("%cNo matching key containing \'' . self::RICH_COMPONENTS_ENTRY . '\' found.", "font-weight: bold; color: white; background-color: red");</script>';
72+
return '<script>console.error("%cNo matching key containing \'' . self::RICH_COMPONENTS_ENTRY . '\' or \'' . self::RICH_COMPONENTS_ENTRY_JS . '\' found.", "font-weight: bold; color: white; background-color: red");</script>';
6373
}
6474
return '<script src="' . $this->getAssetPath($jsFile) . '"></script>';
6575
}

0 commit comments

Comments
 (0)