diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2021-12-02 00:08:08 +0100 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2022-01-08 10:11:58 +0100 |
commit | b664aad7abdca5327684b1218ac78fa172f8acb3 (patch) | |
tree | 0c1b04c2f8d3cf9b68d82e430f4754ff523a5f71 /lib | |
parent | 8ee7c20e4d634f85a9b481b4a829cc65e277bc69 (diff) | |
download | nextcloud-server-b664aad7abdca5327684b1218ac78fa172f8acb3.tar.gz nextcloud-server-b664aad7abdca5327684b1218ac78fa172f8acb3.zip |
Move bundles to /dist
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 2 | ||||
-rw-r--r-- | lib/private/Template/JSResourceLocator.php | 19 | ||||
-rw-r--r-- | lib/private/TemplateLayout.php | 4 | ||||
-rw-r--r-- | lib/private/legacy/OC_Template.php | 10 |
4 files changed, 19 insertions, 16 deletions
diff --git a/lib/base.php b/lib/base.php index 75459fc6b42..91544c949c2 100644 --- a/lib/base.php +++ b/lib/base.php @@ -292,7 +292,7 @@ class OC { // render error page $template = new OC_Template('', 'update.user', 'guest'); - OC_Util::addScript('dist/maintenance'); + OC_Util::addScript('maintenance'); OC_Util::addStyle('core', 'guest'); $template->printPage(); die(); diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php index 3f6b2b49e10..1017b8c3a06 100644 --- a/lib/private/Template/JSResourceLocator.php +++ b/lib/private/Template/JSResourceLocator.php @@ -48,11 +48,14 @@ class JSResourceLocator extends ResourceLocator { return; } + // Extracting the appId and the script file name + $app = substr($script, 0, strpos($script, '/')); + $scriptName = basename($script); + if (strpos($script, '/l10n/') !== false) { // For language files we try to load them all, so themes can overwrite // single l10n strings without having to translate all of them. $found = 0; - $found += $this->appendIfExist($this->serverroot, 'core/'.$script.'.js'); $found += $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$script.'.js'); $found += $this->appendIfExist($this->serverroot, $script.'.js'); $found += $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js'); @@ -65,16 +68,16 @@ class JSResourceLocator extends ResourceLocator { } elseif ($this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js') || $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js') || $this->appendIfExist($this->serverroot, $script.'.js') + || $this->appendIfExist($this->serverroot, "dist/$app-$scriptName.js") || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script.'.json') || $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$script.'.js') || $this->appendIfExist($this->serverroot, 'core/'.$script.'.js') + || $this->appendIfExist($this->serverroot, "dist/core-$scriptName.js") || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, 'core/'.$script.'.json') ) { return; } - $app = substr($script, 0, strpos($script, '/')); - $script = substr($script, strpos($script, '/') + 1); $app_path = \OC_App::getAppPath($app); $app_url = \OC_App::getAppWebPath($app); @@ -86,21 +89,21 @@ class JSResourceLocator extends ResourceLocator { } // missing translations files fill be ignored - if (strpos($script, 'l10n/') === 0) { - $this->appendIfExist($app_path, $script . '.js', $app_url); + if (strpos($scriptName, 'l10n/') === 0) { + $this->appendIfExist($app_path, $scriptName . '.js', $app_url); return; } if ($app_path === false && $app_url === false) { $this->logger->error('Could not find resource {resource} to load', [ - 'resource' => $app . '/' . $script . '.js', + 'resource' => $app . '/' . $scriptName . '.js', 'app' => 'jsresourceloader', ]); return; } - if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) { - $this->append($app_path, $script . '.js', $app_url); + if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $scriptName.'.json', $app)) { + $this->append($app_path, $scriptName . '.js', $app_url); } } diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 317862ff386..f5109c678fd 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -96,7 +96,7 @@ class TemplateLayout extends \OC_Template { $this->initialState->provideInitialState('core', 'active-app', $this->navigationManager->getActiveEntry()); $this->initialState->provideInitialState('unified-search', 'limit-default', SearchQuery::LIMIT_DEFAULT); - Util::addScript('core', 'dist/unified-search', 'core'); + Util::addScript('core', 'unified-search', 'core'); // Add navigation entry $this->assign('application', ''); @@ -209,7 +209,7 @@ class TemplateLayout extends \OC_Template { } // Add the js files - $jsFiles = self::findJavascriptFiles(array_merge(\OC_Util::$scripts, Util::getScripts())); + $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts); $this->assign('jsfiles', []); if ($this->config->getSystemValue('installed', false) && $renderAs != TemplateResponse::RENDER_AS_ERROR) { // this is on purpose outside of the if statement below so that the initial state is prefilled (done in the getConfig() call) diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php index 9dfdb87e5ee..61fc82dacbb 100644 --- a/lib/private/legacy/OC_Template.php +++ b/lib/private/legacy/OC_Template.php @@ -106,7 +106,7 @@ class OC_Template extends \OC\Template\Base { //meaning the last script/style in this list will be loaded first if (\OC::$server->getSystemConfig()->getValue('installed', false) && $renderAs !== TemplateResponse::RENDER_AS_ERROR && !\OCP\Util::needUpgrade()) { if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') { - OC_Util::addScript('backgroundjobs', null, true); + OC_Util::addScript('core', 'backgroundjobs', true); } } OC_Util::addStyle('css-variables', null, true); @@ -114,11 +114,11 @@ class OC_Template extends \OC\Template\Base { OC_Util::addTranslations('core', null, true); if (\OC::$server->getSystemConfig()->getValue('installed', false) && !\OCP\Util::needUpgrade()) { - OC_Util::addScript('merged-template-prepend', null, true); - OC_Util::addScript('dist/files_client', null, true); - OC_Util::addScript('dist/files_fileinfo', null, true); + OC_Util::addScript('core', 'merged-template-prepend', true); + OC_Util::addScript('core', 'files_client', true); + OC_Util::addScript('core', 'files_fileinfo', true); } - OC_Util::addScript('core', 'dist/main', true); + OC_Util::addScript('core', 'main', true); self::$initTemplateEngineFirstRun = false; } |