Skip to content

Commit

Permalink
Bugfix/develop player bundle rename (#2838)
Browse files Browse the repository at this point in the history
* Player bundle rename & remove unused player bundle files
relates to xibosignageltd/xibo-private#884
  • Loading branch information
maurofmferrao authored Dec 23, 2024
1 parent 4390615 commit 50f2093
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 116,737 deletions.
4 changes: 2 additions & 2 deletions lib/Controller/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ public function playerBundle(Request $request, Response $response)
$params = $this->getSanitizer($request->getParams());
$isMap = $params->getCheckbox('map');
if ($isMap) {
$bundle = file_get_contents(PROJECT_ROOT . '/modules/player.bundle.min.js.map');
$bundle = file_get_contents(PROJECT_ROOT . '/modules/bundle.min.js.map');
} else {
$bundle = file_get_contents(PROJECT_ROOT . '/modules/player.bundle.min.js');
$bundle = file_get_contents(PROJECT_ROOT . '/modules/bundle.min.js');
}

$response->getBody()->write($bundle);
Expand Down
2 changes: 1 addition & 1 deletion lib/Widget/Render/WidgetHtmlRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public function decorateForPlayer(
preg_match_all('/\[\[(.*?)\]\]/', $output, $matches);
foreach ($matches[1] as $match) {
if ($match === 'PlayerBundle') {
$output = str_replace('[[PlayerBundle]]', 'player.bundle.min.js', $output);
$output = str_replace('[[PlayerBundle]]', 'bundle.min.js', $output);
} else if ($match === 'FontBundle') {
$output = str_replace('[[FontBundle]]', 'fonts.css', $output);
} else if ($match === 'ViewPortWidth') {
Expand Down
4 changes: 2 additions & 2 deletions lib/XTR/MaintenanceDailyTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ private function cacheAssets(): void
private function cachePlayerBundle(): void
{
// Output the player bundle
$bundlePath = $this->getConfig()->getSetting('LIBRARY_LOCATION') . 'assets/player.bundle.min.js';
$bundlePath = $this->getConfig()->getSetting('LIBRARY_LOCATION') . 'assets/bundle.min.js';
$bundleMd5CachePath = $bundlePath . '.md5';

copy(PROJECT_ROOT . '/modules/player.bundle.min.js', $bundlePath);
copy(PROJECT_ROOT . '/modules/bundle.min.js', $bundlePath);
file_put_contents($bundleMd5CachePath, md5_file($bundlePath));

$this->appendRunMessage(__('Player bundle cached'));
Expand Down
8 changes: 4 additions & 4 deletions lib/Xmds/Listeners/XmdsPlayerBundleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function onDependencyList(XmdsDependencyListEvent $event)

// Output the player bundle
$forceUpdate = false;
$bundlePath = $this->getConfig()->getSetting('LIBRARY_LOCATION') . 'assets/player.bundle.min.js';
$bundlePath = $this->getConfig()->getSetting('LIBRARY_LOCATION') . 'assets/bundle.min.js';
if (!file_exists($bundlePath)) {
$result = @copy(PROJECT_ROOT . '/modules/player.bundle.min.js', $bundlePath);
$result = @copy(PROJECT_ROOT . '/modules/bundle.min.js', $bundlePath);
if (!$result) {
throw new GeneralException('Unable to copy asset');
}
Expand All @@ -66,7 +66,7 @@ public function onDependencyList(XmdsDependencyListEvent $event)
$event->addDependency(
'bundle',
1,
'assets/player.bundle.min.js',
'assets/bundle.min.js',
filesize($bundlePath),
$bundleMd5,
true,
Expand All @@ -79,7 +79,7 @@ public function onDependencyRequest(XmdsDependencyRequestEvent $event)
// Can we return this type of file?
if ($event->getFileType() === 'bundle' && $event->getRealId() == 1) {
// Set the path
$event->setRelativePathToLibrary('assets/player.bundle.min.js');
$event->setRelativePathToLibrary('assets/bundle.min.js');

// No need to carry on, we've found it.
$event->stopPropagation();
Expand Down
116,723 changes: 0 additions & 116,723 deletions modules/player.bundle.min.js

This file was deleted.

1 change: 0 additions & 1 deletion modules/player.bundle.min.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions tests/Xmds/GetDependencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function testGetBundlev7($version)
foreach ($item as $file) {
if (!empty($file['@attributes'])
&& !empty($file['@attributes']['saveAs'])
&& $file['@attributes']['saveAs'] === 'player.bundle.min.js'
&& $file['@attributes']['saveAs'] === 'bundle.min.js'
) {
$size = $file['@attributes']['size'];
$type = $file['@attributes']['fileType'];
Expand Down Expand Up @@ -191,7 +191,7 @@ public function testGetBundleOld($version)
foreach ($item as $file) {
if (!empty($file['@attributes'])
&& !empty($file['@attributes']['saveAs'])
&& $file['@attributes']['saveAs'] === 'player.bundle.min.js'
&& $file['@attributes']['saveAs'] === 'bundle.min.js'
) {
$size = $file['@attributes']['size'];
$type = $file['@attributes']['type'];
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ const pageConfig = Object.assign({}, config, {

const moduleConfig = Object.assign({}, config, {
entry: {
player: './modules/src/player_bundle.js',
bundle: './modules/src/player_bundle.js',
},
output: {
path: path.resolve(__dirname, 'modules'),
filename: '[name].bundle.min.js',
filename: '[name].min.js',
},
target: ['web', 'es5'],
module: {
Expand Down

0 comments on commit 50f2093

Please sign in to comment.