Merge branch 'master' into develop

This commit is contained in:
Barış Soner Uşaklı
2025-09-13 17:40:49 -04:00
7 changed files with 32 additions and 14 deletions

View File

@@ -106,10 +106,10 @@
"nodebb-plugin-spam-be-gone": "2.3.2", "nodebb-plugin-spam-be-gone": "2.3.2",
"nodebb-plugin-web-push": "0.7.5", "nodebb-plugin-web-push": "0.7.5",
"nodebb-rewards-essentials": "1.0.2", "nodebb-rewards-essentials": "1.0.2",
"nodebb-theme-harmony": "2.1.18", "nodebb-theme-harmony": "2.1.19",
"nodebb-theme-lavender": "7.1.19", "nodebb-theme-lavender": "7.1.19",
"nodebb-theme-peace": "2.2.48", "nodebb-theme-peace": "2.2.48",
"nodebb-theme-persona": "14.1.12", "nodebb-theme-persona": "14.1.13",
"nodebb-widget-essentials": "7.0.40", "nodebb-widget-essentials": "7.0.40",
"nodemailer": "7.0.6", "nodemailer": "7.0.6",
"nprogress": "0.2.0", "nprogress": "0.2.0",

View File

@@ -53,7 +53,7 @@ define('topicList', [
handleBack.init(function (after, handleBackCallback) { handleBack.init(function (after, handleBackCallback) {
loadTopicsCallback(after, 1, function (data, loadCallback) { loadTopicsCallback(after, 1, function (data, loadCallback) {
onTopicsLoaded(templateName, data.topics, ajaxify.data.showSelect, 1, function () { onTopicsLoaded(templateName, data, ajaxify.data.showSelect, 1, function () {
handleBackCallback(); handleBackCallback();
loadCallback(); loadCallback();
}); });
@@ -166,7 +166,7 @@ define('topicList', [
} }
loadTopicsCallback(after, direction, function (data, done) { loadTopicsCallback(after, direction, function (data, done) {
onTopicsLoaded(templateName, data.topics, ajaxify.data.showSelect, direction, done); onTopicsLoaded(templateName, data, ajaxify.data.showSelect, direction, done);
}); });
}; };
@@ -187,7 +187,8 @@ define('topicList', [
}); });
} }
function onTopicsLoaded(templateName, topics, showSelect, direction, callback) { function onTopicsLoaded(templateName, data, showSelect, direction, callback) {
let { topics } = data;
if (!topics || !topics.length) { if (!topics || !topics.length) {
$('#load-more-btn').hide(); $('#load-more-btn').hide();
return callback(); return callback();
@@ -212,6 +213,7 @@ define('topicList', [
const tplData = { const tplData = {
topics: topics, topics: topics,
showSelect: showSelect, showSelect: showSelect,
'reputation:disabled': data['reputation:disabled'],
template: { template: {
name: templateName, name: templateName,
}, },

View File

@@ -79,6 +79,7 @@ recentController.getData = async function (req, url, sort) {
data.selectedTag = tagData.selectedTag; data.selectedTag = tagData.selectedTag;
data.selectedTags = tagData.selectedTags; data.selectedTags = tagData.selectedTags;
data['feeds:disableRSS'] = meta.config['feeds:disableRSS'] || 0; data['feeds:disableRSS'] = meta.config['feeds:disableRSS'] || 0;
data['reputation:disabled'] = meta.config['reputation:disabled'];
if (!meta.config['feeds:disableRSS']) { if (!meta.config['feeds:disableRSS']) {
data.rssFeedUrl = `${relative_path}/${url}.rss`; data.rssFeedUrl = `${relative_path}/${url}.rss`;
if (req.loggedIn) { if (req.loggedIn) {

View File

@@ -69,10 +69,6 @@ connection.connect = async function (options) {
}).catch((err) => { }).catch((err) => {
winston.error('Error connecting to Redis:', err); winston.error('Error connecting to Redis:', err);
}); });
if (options.password) {
cxn.auth({ password: options.password });
}
}); });
}; };

View File

@@ -145,12 +145,18 @@ middleware.logApiUsage = async function logApiUsage(req, res, next) {
}; };
middleware.routeTouchIcon = function routeTouchIcon(req, res) { middleware.routeTouchIcon = function routeTouchIcon(req, res) {
if (meta.config['brand:touchIcon'] && validator.isURL(meta.config['brand:touchIcon'])) { const brandTouchIcon = meta.config['brand:touchIcon'];
return res.redirect(meta.config['brand:touchIcon']); if (brandTouchIcon && validator.isURL(brandTouchIcon)) {
return res.redirect(brandTouchIcon);
} }
let iconPath = ''; let iconPath = '';
if (meta.config['brand:touchIcon']) { if (brandTouchIcon) {
iconPath = path.join(nconf.get('upload_path'), meta.config['brand:touchIcon'].replace(/assets\/uploads/, '')); const uploadPath = nconf.get('upload_path');
iconPath = path.join(uploadPath, brandTouchIcon.replace(/assets\/uploads/, ''));
if (!iconPath.startsWith(uploadPath)) {
return res.status(404).send('Not found');
}
} else { } else {
iconPath = path.join(nconf.get('base_dir'), 'public/images/touch/512.png'); iconPath = path.join(nconf.get('base_dir'), 'public/images/touch/512.png');
} }

View File

@@ -227,6 +227,9 @@ function setupHelmet(app) {
function setupFavicon(app) { function setupFavicon(app) {
let faviconPath = meta.config['brand:favicon'] || 'favicon.ico'; let faviconPath = meta.config['brand:favicon'] || 'favicon.ico';
faviconPath = path.join(nconf.get('base_dir'), 'public', faviconPath.replace(/assets\/uploads/, 'uploads')); faviconPath = path.join(nconf.get('base_dir'), 'public', faviconPath.replace(/assets\/uploads/, 'uploads'));
if (!faviconPath.startsWith(nconf.get('upload_path'))) {
faviconPath = path.join(nconf.get('base_dir'), 'public', 'favicon.ico');
}
if (file.existsSync(faviconPath)) { if (file.existsSync(faviconPath)) {
app.use(nconf.get('relative_path'), favicon(faviconPath)); app.use(nconf.get('relative_path'), favicon(faviconPath));
} }

View File

@@ -6,8 +6,8 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const util = require('util'); const util = require('util');
const request = require('../src/request');
const db = require('./mocks/databasemock'); const db = require('./mocks/databasemock');
const request = require('../src/request');
const api = require('../src/api'); const api = require('../src/api');
const categories = require('../src/categories'); const categories = require('../src/categories');
const topics = require('../src/topics'); const topics = require('../src/topics');
@@ -692,6 +692,16 @@ describe('Controllers', () => {
assert(body); assert(body);
}); });
it('should 404 if brand:touchIcon is not valid', async () => {
const oldValue = meta.config['brand:touchIcon'];
meta.config['brand:touchIcon'] = '../../not/valid';
const { response, body } = await request.get(`${nconf.get('url')}/apple-touch-icon`);
assert.strictEqual(response.statusCode, 404);
assert.strictEqual(body, 'Not found');
meta.config['brand:touchIcon'] = oldValue;
});
it('should error if guests do not have search privilege', async () => { it('should error if guests do not have search privilege', async () => {
const { response, body } = await request.get(`${nconf.get('url')}/api/users?query=bar&section=sort-posts`); const { response, body } = await request.get(`${nconf.get('url')}/api/users?query=bar&section=sort-posts`);