mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
Merge branch 'master' into develop
This commit is contained in:
@@ -173,7 +173,10 @@ module.exports = function (grunt) {
|
||||
winston.error(err.stack);
|
||||
}
|
||||
if (worker) {
|
||||
worker.send({ compiling: compiling });
|
||||
worker.send({
|
||||
compiling: compiling,
|
||||
livereload: true, // Send livereload event via Socket.IO for instant browser refresh
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -103,7 +103,7 @@ build_forum() {
|
||||
local config="$1"
|
||||
local start_build="$2"
|
||||
local package_hash=$(md5sum install/package.json | head -c 32)
|
||||
if [ "$package_hash" = "$(cat $CONFIG_DIR/install_hash.md5 || true)" ]; then
|
||||
if [ "$package_hash" != "$(cat $CONFIG_DIR/install_hash.md5 || true)" ]; then
|
||||
echo "package.json was updated. Upgrading..."
|
||||
/usr/src/app/nodebb upgrade --config="$config" || {
|
||||
echo "Failed to build NodeBB. Exiting..."
|
||||
|
||||
@@ -260,10 +260,6 @@ uploadsController.uploadMaskableIcon = async function (req, res, next) {
|
||||
}
|
||||
};
|
||||
|
||||
uploadsController.uploadLogo = async function (req, res, next) {
|
||||
await upload('site-logo', req, res, next);
|
||||
};
|
||||
|
||||
uploadsController.uploadFile = async function (req, res, next) {
|
||||
const uploadedFile = req.files[0];
|
||||
let params;
|
||||
@@ -287,6 +283,10 @@ uploadsController.uploadFile = async function (req, res, next) {
|
||||
}
|
||||
};
|
||||
|
||||
uploadsController.uploadLogo = async function (req, res, next) {
|
||||
await upload('site-logo', req, res, next);
|
||||
};
|
||||
|
||||
uploadsController.uploadDefaultAvatar = async function (req, res, next) {
|
||||
await upload('avatar-default', req, res, next);
|
||||
};
|
||||
@@ -298,6 +298,10 @@ uploadsController.uploadOgImage = async function (req, res, next) {
|
||||
async function upload(name, req, res, next) {
|
||||
const uploadedFile = req.files[0];
|
||||
|
||||
if (uploadedFile.path.endsWith('.svg')) {
|
||||
await sanitizeSvg(uploadedFile.path);
|
||||
}
|
||||
|
||||
await validateUpload(uploadedFile, allowedImageTypes);
|
||||
const filename = name + path.extname(uploadedFile.name);
|
||||
await uploadImage(filename, 'system', uploadedFile, req, res, next);
|
||||
|
||||
25
src/start.js
25
src/start.js
@@ -107,13 +107,24 @@ function addProcessHandlers() {
|
||||
shutdown(1);
|
||||
});
|
||||
process.on('message', (msg) => {
|
||||
if (msg && Array.isArray(msg.compiling)) {
|
||||
if (msg.compiling.includes('tpl')) {
|
||||
const benchpressjs = require('benchpressjs');
|
||||
benchpressjs.flush();
|
||||
} else if (msg.compiling.includes('lang')) {
|
||||
const translator = require('./translator');
|
||||
translator.flush();
|
||||
if (msg) {
|
||||
if (Array.isArray(msg.compiling)) {
|
||||
if (msg.compiling.includes('tpl')) {
|
||||
const benchpressjs = require('benchpressjs');
|
||||
benchpressjs.flush();
|
||||
} else if (msg.compiling.includes('lang')) {
|
||||
const translator = require('./translator');
|
||||
translator.flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.livereload) {
|
||||
// Send livereload event to all connected clients via Socket.IO
|
||||
const websockets = require('./socket.io');
|
||||
if (websockets.server) {
|
||||
websockets.server.emit('event:livereload');
|
||||
winston.info('[livereload] Sent reload event to all clients');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user