diff --git a/docker/Dockerfile b/docker/Dockerfile index 31d5139d..1f805a34 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,7 +18,7 @@ RUN if ! [ -z "$DISABLE_TRANSLATE" ] && [ "$DISABLE_TRANSLATE" != "yes" ] && [ " fi # install translate/minify modules if need too -RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral && npm install html-minifier jsdom minify-js; fi +RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral && npm install html-minifier jsdom; fi # first extractall if need too RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js extractall; fi diff --git a/meshcentral.js b/meshcentral.js index 914d2190..f2973b6a 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -4143,7 +4143,7 @@ function mainStart() { else if (config.settings.xmongodb != null) { modules.push('mongojs@3.1.0'); } // Add MongoJS, old driver. if (nodemailer || ((config.smtp != null) && (config.smtp.name != 'console')) || (config.sendmail != null)) { modules.push('nodemailer@6.9.8'); } // Add SMTP support if (sendgrid || (config.sendgrid != null)) { modules.push('@sendgrid/mail'); } // Add SendGrid support - if ((args.translate || args.dev) && (Number(process.version.match(/^v(\d+\.\d+)/)[1]) >= 16)) { modules.push('jsdom@22.1.0'); modules.push('esprima@4.0.1'); modules.push('minify-js@0.0.4'); modules.push('html-minifier@4.0.0'); } // Translation support + if ((args.translate || args.dev) && (Number(process.version.match(/^v(\d+\.\d+)/)[1]) >= 16)) { modules.push('jsdom@22.1.0'); modules.push('esprima@4.0.1'); modules.push('html-minifier@4.0.0'); } // Translation support if (typeof config.settings.crowdsec == 'object') { modules.push('@crowdsec/express-bouncer@0.1.0'); } // Add CrowdSec bounser module (https://www.npmjs.com/package/@crowdsec/express-bouncer) if (typeof config.settings.autobackup == 'object') { diff --git a/translate/translate.js b/translate/translate.js index 276a9e60..2c05ab6d 100644 --- a/translate/translate.js +++ b/translate/translate.js @@ -140,7 +140,7 @@ if (directRun && (NodeJSVer >= 12)) { // Get things setup jsdom = require('jsdom'); esprima = require('esprima'); // https://www.npmjs.com/package/esprima - if (minifyLib == 1) { minify = require('minify-js'); } + if (minifyLib == 1) { log("minify-js is no longer used, please switch to \"html-minifier\""); process.exit(); return; } if (minifyLib == 2) { minify = require('html-minifier').minify; } // https://www.npmjs.com/package/html-minifier switch (op) { @@ -157,8 +157,8 @@ if (directRun && (NodeJSVer >= 12)) { if (directRun) { setup(); } function setup() { - var libs = ['jsdom@22.1.0', 'esprima@4.0.1', 'minify-js@0.0.4']; - if (minifyLib == 1) { libs.push('minify-js@0.0.4'); } + var libs = ['jsdom@22.1.0', 'esprima@4.0.1']; + if (minifyLib == 1) { log("minify-js is no longer used, please switch to \"html-minifier\""); process.exit(); return; } if (minifyLib == 2) { libs.push('html-minifier@4.0.0'); } InstallModules(libs, start); } @@ -169,7 +169,7 @@ function startEx(argv) { // Load dependencies jsdom = require('jsdom'); esprima = require('esprima'); // https://www.npmjs.com/package/esprima - if (minifyLib == 1) { minify = require('minify-js'); } + if (minifyLib == 1) { log("minify-js is no longer used, please switch to \"html-minifier\""); process.exit(); return; } if (minifyLib == 2) { minify = require('html-minifier').minify; } // https://www.npmjs.com/package/html-minifier var command = null; @@ -490,6 +490,8 @@ function startEx(argv) { outnamemin = (outname.substring(0, outname.length - 5) + '-min.html'); } else if (outname.endsWith('.htm')) { outnamemin = (outname.substring(0, outname.length - 4) + '-min.htm'); + } else if (outname.endsWith('.js')) { + outnamemin = (outname.substring(0, outname.length - 3) + '-min.js'); } else { outnamemin = (outname, outname + '.min'); }