Skip to content

Commit

Permalink
pkp#9753 [main] Update jquery, jquery-ui and chart.js to address secu…
Browse files Browse the repository at this point in the history
…rity vulnerability reports (pkp#10168)

* pkp#9753 Update chartjs from v2.0.1 to v2.9.4

* pkp#9753 Upgrade jquery validation from v1.11.1 to v1.19.5

* pkp#9753 Remove components/jqueryui as a composer dependency

* pkp#9753 Manually add jquery-ui v1.13.3 to jquery plugins

* pkp#9753 Move import of jqueryui from vendors to js plugins

* pkp#9753 Remove jquery-ui local files

* pkp#9753 Add jquery-ui dependency to composer from npm

* pkp#9753 Remove jquery-validation local files

* pkp#9753 Add query-validation to composer from npm

* pkp#9753 Add missing import of Laravel Cache

* pkp#9753 Adjust tooltips configuration for chart.js

* pkp#9753 Remove chart.js local files

* pkp#9753 Remove jquery, jquery-ui and jquery-validation from composer dependencies

* pkp#9753 [main] Update paths when importing chart.js, jquery, jquery-ui and jquery-validation

* pkp#9753 Adjust chart.js config options to be compatible with v4

* pkp#9753 Update line chart options to make it like the previous design

* pkp#9753 Remove committed languages.json file
  • Loading branch information
blesildaramirez committed Aug 21, 2024
1 parent e1cec28 commit 9f03824
Show file tree
Hide file tree
Showing 56 changed files with 36 additions and 12,313 deletions.
4 changes: 2 additions & 2 deletions classes/plugins/ThemePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace PKP\plugins;

use Illuminate\Support\Facades\Cache;
use APP\core\Application;
use APP\core\Request;
use APP\facades\Repo;
Expand Down Expand Up @@ -911,10 +912,9 @@ protected function loadChartJavascript(): void
$templateMgr = TemplateManager::getManager($request);

// Register Chart.js on the frontend article view
$min = Config::getVar('general', 'enable_minified') ? '.min' : '';
$templateMgr->addJavaScript(
'chartJS',
$request->getBaseUrl() . '/lib/pkp/js/lib/Chart' . $min . '.js',
$request->getBaseUrl() . '/js/build/chart.js/chart.umd.js',
[
'contexts' => $this->getSubmissionViewContext(),
]
Expand Down
8 changes: 4 additions & 4 deletions classes/template/PKPTemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -664,10 +664,10 @@ public function registerJSLibrary(): void
// properly by our build script
$this->addJavaScript(
'jqueryValidate',
$baseUrl . '/lib/pkp/js/lib/jquery/plugins/validate/jquery.validate.min.js',
$baseUrl . '/js/build/jquery-validation/jquery.validate.min.js',
$args
);
$jqvLocalePath = 'lib/pkp/js/lib/jquery/plugins/validate/localization/messages_';
$jqvLocalePath = 'js/build/jquery-validation/localization/messages_';
foreach ($localeChecks as $localeCheck) {
if (file_exists($jqvLocalePath . $localeCheck . '.js')) {
$this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args);
Expand Down Expand Up @@ -868,15 +868,15 @@ public function setupBackendPage()
$min = Config::getVar('general', 'enable_minified') ? '.min' : '';
$this->addJavaScript(
'jquery',
$request->getBaseUrl() . '/lib/pkp/lib/vendor/components/jquery/jquery' . $min . '.js',
$request->getBaseUrl() . '/js/build/jquery/jquery' . $min . '.js',
[
'priority' => self::STYLE_SEQUENCE_CORE,
'contexts' => 'backend',
]
);
$this->addJavaScript(
'jqueryUI',
$request->getBaseUrl() . '/lib/pkp/lib/vendor/components/jqueryui/jquery-ui' . $min . '.js',
$request->getBaseUrl() . '/js/build/jquery-ui/jquery-ui' . $min . '.js',
[
'priority' => self::STYLE_SEQUENCE_CORE,
'contexts' => 'backend',
Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"require": {
"php": "^8.2",
"components/jquery": "^3.5",
"components/jqueryui": "1.*",
"composer/semver": "^3.4",
"cweagans/composer-patches": "^1.7",
"dflydev/base32-crockford": "^1.0",
Expand Down Expand Up @@ -57,7 +55,8 @@
"@weblateFilesDownload"
],
"isoFileCheck": [
"PKP\\dev\\ComposerScript::isoFileCheck" ],
"PKP\\dev\\ComposerScript::isoFileCheck"
],
"weblateFilesDownload": [
"PKP\\dev\\ComposerScript::weblateFilesDownload"
]
Expand Down
140 changes: 1 addition & 139 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9f03824

Please sign in to comment.