From b4dea7930aa61d192b7faef29559b1a9d48c9507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 17 Feb 2018 14:01:54 -0500 Subject: [PATCH 01/23] up spam-be-gone --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 0a05ec9ffb..357bbeeff3 100644 --- a/install/package.json +++ b/install/package.json @@ -67,7 +67,7 @@ "nodebb-plugin-markdown": "8.3.0", "nodebb-plugin-mentions": "2.2.3", "nodebb-plugin-soundpack-default": "1.0.0", - "nodebb-plugin-spam-be-gone": "0.5.2", + "nodebb-plugin-spam-be-gone": "0.5.3", "nodebb-rewards-essentials": "0.0.11", "nodebb-theme-lavender": "5.0.3", "nodebb-theme-persona": "7.2.23", From 225af93b9e3be3eb4e00cd542ca4d5a0ba574e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 17 Feb 2018 14:34:56 -0500 Subject: [PATCH 02/23] closes #6329 --- src/navigation/admin.js | 16 +++----- src/navigation/index.js | 3 -- src/topics/bookmarks.js | 2 +- src/upgrades/1.7.6/flatten_navigation_data.js | 38 +++++++++++++++++++ 4 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 src/upgrades/1.7.6/flatten_navigation_data.js diff --git a/src/navigation/admin.js b/src/navigation/admin.js index cf854a80a4..8bab6d4219 100644 --- a/src/navigation/admin.js +++ b/src/navigation/admin.js @@ -15,17 +15,13 @@ pubsub.on('admin:navigation:save', function () { admin.save = function (data, callback) { var order = Object.keys(data); - var items = data.map(function (item, idx) { - var data = {}; - + var items = data.map(function (item) { for (var i in item) { - if (item.hasOwnProperty(i)) { - item[i] = typeof item[i] === 'string' ? translator.escape(item[i]) : item[i]; + if (item.hasOwnProperty(i) && typeof item[i] === 'string' && (i === 'title' || i === 'text')) { + item[i] = translator.escape(item[i]); } } - - data[idx] = item; - return JSON.stringify(data); + return JSON.stringify(item); }); admin.cache = null; @@ -53,8 +49,8 @@ admin.get = function (callback) { db.getSortedSetRange('navigation:enabled', 0, -1, next); }, function (data, next) { - data = data.map(function (item, idx) { - return JSON.parse(item)[idx]; + data = data.map(function (item) { + return JSON.parse(item); }); next(null, data); diff --git a/src/navigation/index.js b/src/navigation/index.js index 0712ce79f5..65628fda1c 100644 --- a/src/navigation/index.js +++ b/src/navigation/index.js @@ -38,6 +38,3 @@ navigation.get = function (callback) { }, ], callback); }; - - -module.exports = navigation; diff --git a/src/topics/bookmarks.js b/src/topics/bookmarks.js index d1782b6713..6952474ff6 100644 --- a/src/topics/bookmarks.js +++ b/src/topics/bookmarks.js @@ -30,7 +30,7 @@ module.exports = function (Topics) { }; Topics.getTopicBookmarks = function (tid, callback) { - db.getSortedSetRangeWithScores(['tid:' + tid + ':bookmarks'], 0, -1, callback); + db.getSortedSetRangeWithScores('tid:' + tid + ':bookmarks', 0, -1, callback); }; Topics.updateTopicBookmarks = function (tid, pids, callback) { diff --git a/src/upgrades/1.7.6/flatten_navigation_data.js b/src/upgrades/1.7.6/flatten_navigation_data.js new file mode 100644 index 0000000000..9fd0901274 --- /dev/null +++ b/src/upgrades/1.7.6/flatten_navigation_data.js @@ -0,0 +1,38 @@ +'use strict'; + +var async = require('async'); +var db = require('../../database'); + +module.exports = { + name: 'Flatten navigation data', + timestamp: Date.UTC(2018, 1, 17), + method: function (callback) { + async.waterfall([ + function (next) { + db.getSortedSetRangeWithScores('navigation:enabled', 0, -1, next); + }, + function (data, next) { + var order = []; + var items = []; + data.forEach(function (item) { + var navItem = JSON.parse(item.value); + var keys = Object.keys(navItem); + if (keys.length && parseInt(keys[0], 10) >= 0) { + navItem = navItem[keys[0]]; + } + order.push(item.score); + items.push(JSON.stringify(navItem)); + }); + + async.series([ + function (next) { + db.delete('navigation:enabled', next); + }, + function (next) { + db.sortedSetAdd('navigation:enabled', order, items, next); + }, + ], next); + }, + ], callback); + }, +}; From 0f2103dadf3cb2f1522c95d8c8533ab5c9a5eb38 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 17 Feb 2018 21:31:54 -0500 Subject: [PATCH 03/23] bumping mentions @barisusakli --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 357bbeeff3..07e8f48126 100644 --- a/install/package.json +++ b/install/package.json @@ -64,7 +64,7 @@ "nodebb-plugin-dbsearch": "2.0.9", "nodebb-plugin-emoji": "^2.1.0", "nodebb-plugin-emoji-android": "2.0.0", - "nodebb-plugin-markdown": "8.3.0", + "nodebb-plugin-markdown": "8.3.1", "nodebb-plugin-mentions": "2.2.3", "nodebb-plugin-soundpack-default": "1.0.0", "nodebb-plugin-spam-be-gone": "0.5.3", From 6e45d12a83bd7d1e1ce7d76fe8a92704042cff0e Mon Sep 17 00:00:00 2001 From: Andrew Rodrigues Date: Sun, 18 Feb 2018 01:11:33 -0500 Subject: [PATCH 04/23] bump composer --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 07e8f48126..4dc137a479 100644 --- a/install/package.json +++ b/install/package.json @@ -60,7 +60,7 @@ "morgan": "^1.9.0", "mousetrap": "^1.6.1", "nconf": "^0.9.1", - "nodebb-plugin-composer-default": "6.0.13", + "nodebb-plugin-composer-default": "6.0.14", "nodebb-plugin-dbsearch": "2.0.9", "nodebb-plugin-emoji": "^2.1.0", "nodebb-plugin-emoji-android": "2.0.0", From 9034424369bc677458937d0ff7b5cb80af48684a Mon Sep 17 00:00:00 2001 From: "Misty (Bot)" Date: Sun, 18 Feb 2018 09:24:40 +0000 Subject: [PATCH 05/23] Latest translations and fallbacks --- public/language/ru/notifications.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/language/ru/notifications.json b/public/language/ru/notifications.json index a4c9b74119..abccf0fe81 100644 --- a/public/language/ru/notifications.json +++ b/public/language/ru/notifications.json @@ -9,10 +9,10 @@ "continue_to": "Перейти на %1", "return_to": "Вернуться к %1", "new_notification": "Новое уведомление", - "new_notification_from": "You have a new Notification from %1", + "new_notification_from": "У Вас есть новые сообщения от %1", "you_have_unread_notifications": "У вас есть непрочитанные уведомления.", "all": "Все", - "topics": "Topics", + "topics": "Темы", "replies": "Ответы", "chat": "Чаты", "follows": "Следят", @@ -29,8 +29,8 @@ "user_flagged_post_in": "Участник %1 пометил сообщение в %2", "user_flagged_post_in_dual": "Участники %1 и %2 пометили ваше сообщение в %3", "user_flagged_post_in_multiple": "Участник %1 и %2 других пометили ваше сообщение %3", - "user_flagged_user": "%1 flagged a user profile (%2)", - "user_flagged_user_dual": "%1 and %2 flagged a user profile (%3)", + "user_flagged_user": "Участник %1 отметили профиль пользователя (%3)", + "user_flagged_user_dual": "Участник %1 и %2отметили профиль пользователя (%3)", "user_flagged_user_multiple": "%1 and %2 others flagged a user profile (%3)", "user_posted_to": "Участник %1 ответил на запись: %2", "user_posted_to_dual": "Участники %1 и %2 ответили на вашу запись: %3", From e36657d48c2e3c1924cc43b9d14767899a380e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 19 Feb 2018 11:17:15 -0500 Subject: [PATCH 06/23] add tpl path to error messages --- src/middleware/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/middleware/index.js b/src/middleware/index.js index b1e065b3fd..2f995f7b5d 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -211,7 +211,7 @@ middleware.templatesOnDemand = function (req, res, next) { if (!filePath.endsWith('.js')) { return next(); } - + var tplPath = filePath.replace(/\.js$/, '.tpl'); if (workingCache[filePath]) { workingCache[filePath].push(next); return; @@ -234,11 +234,11 @@ middleware.templatesOnDemand = function (req, res, next) { } workingCache[filePath] = [next]; - fs.readFile(filePath.replace(/\.js$/, '.tpl'), 'utf8', cb); + fs.readFile(tplPath, 'utf8', cb); }, function (source, cb) { if (!source) { - return cb(new Error('[[error:templatesOnDemand.source-template-empty]]')); + return cb(new Error('[[error:templatesOnDemand.source-template-empty, ' + tplPath + ']]')); } Benchpress.precompile({ source: source, @@ -247,7 +247,7 @@ middleware.templatesOnDemand = function (req, res, next) { }, function (compiled, cb) { if (!compiled) { - return cb(new Error('[[error:templatesOnDemand.compiled-template-empty]]')); + return cb(new Error('[[error:templatesOnDemand.compiled-template-empty, ' + tplPath + ']]')); } fs.writeFile(filePath, compiled, cb); }, From c707e984231aaa27955f4f5eb80e3b77f8635e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 19 Feb 2018 11:45:06 -0500 Subject: [PATCH 07/23] closes #6331 --- src/middleware/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/middleware/index.js b/src/middleware/index.js index 2f995f7b5d..f6bee01a53 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -237,9 +237,6 @@ middleware.templatesOnDemand = function (req, res, next) { fs.readFile(tplPath, 'utf8', cb); }, function (source, cb) { - if (!source) { - return cb(new Error('[[error:templatesOnDemand.source-template-empty, ' + tplPath + ']]')); - } Benchpress.precompile({ source: source, minify: global.env !== 'development', From 2796cff3dc82dc1896d096ca99d877e01e0382d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 19 Feb 2018 17:31:04 -0500 Subject: [PATCH 08/23] up benchpress --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 4dc137a479..bbb50e76d6 100644 --- a/install/package.json +++ b/install/package.json @@ -21,7 +21,7 @@ "async": "2.6.0", "autoprefixer": "7.2.4", "bcryptjs": "2.4.3", - "benchpressjs": "^1.2.0", + "benchpressjs": "^1.2.1", "body-parser": "^1.18.2", "bootstrap": "^3.3.7", "chart.js": "^2.7.1", From 7bdd2144e0fde6e6a641dee83e0f214c72189422 Mon Sep 17 00:00:00 2001 From: "Misty (Bot)" Date: Tue, 20 Feb 2018 09:25:02 +0000 Subject: [PATCH 09/23] Latest translations and fallbacks --- public/language/uk/admin/appearance/customise.json | 14 +++++++------- public/language/uk/admin/general/homepage.json | 2 +- public/language/uk/user.json | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/public/language/uk/admin/appearance/customise.json b/public/language/uk/admin/appearance/customise.json index b85d6c8ecf..359ea3d50f 100644 --- a/public/language/uk/admin/appearance/customise.json +++ b/public/language/uk/admin/appearance/customise.json @@ -1,14 +1,14 @@ { - "custom-css": "Custom CSS/LESS", - "custom-css.description": "Enter your own CSS/LESS declarations here, which will be applied after all other styles.", - "custom-css.enable": "Enable Custom CSS/LESS", + "custom-css": "Користувацькі CSS/LESS", + "custom-css.description": "Введіть свої власні CSS/LESS тут, які будуть застосовані після всіх інших стилів.", + "custom-css.enable": "Увімкнути користувацькі CSS/LESS", - "custom-js": "Custom Javascript", - "custom-js.description": "Enter your own javascript here. It will be executed after the page is loaded completely.", - "custom-js.enable": "Enable Custom Javascript", + "custom-js": "Користувацький Javascript", + "custom-js.description": "Введіть свій власний код javascript тут. Він буде виконаний після повного завантаження сторінки.", + "custom-js.enable": "Увімкнути користувацький Javascript", "custom-header": "Користувацький заголовок", - "custom-header.description": "Enter custom HTML here (ex. Meta Tags, etc.), which will be appended to the <head> section of your forum's markup. Script tags are allowed, but are discouraged, as the Custom Javascript tab is available.", + "custom-header.description": "Введіть свій користувацький HTML тут (наприклад, Meta Теги тощо), який буде додано до <head> розділу розмітки вашого форуму. Теги скриптів допускаються, але вони не рекомендуються, оскільки доступна вкладка Користувацькі Javascript.", "custom-header.enable": "Увімкнути користувацький заголовок", "custom-css.livereload": "Увімкнути Автоматичне Оновлення", diff --git a/public/language/uk/admin/general/homepage.json b/public/language/uk/admin/general/homepage.json index a5e028490b..f0b146ca8f 100644 --- a/public/language/uk/admin/general/homepage.json +++ b/public/language/uk/admin/general/homepage.json @@ -4,5 +4,5 @@ "home-page-route": "Шлях головної сторінки", "custom-route": "Користувацький шлях", "allow-user-home-pages": "Дозволити користувачам власні сторінки", - "home-page-title": "Title of the home page (default \"Home\")" + "home-page-title": "Назва домашньої сторінки (за замовчуванням \"Домашня сторінка\")" } \ No newline at end of file diff --git a/public/language/uk/user.json b/public/language/uk/user.json index eabe845183..c07eeb52f4 100644 --- a/public/language/uk/user.json +++ b/public/language/uk/user.json @@ -25,7 +25,7 @@ "reputation": "Репутація", "bookmarks": "Закладки", "watched": "Переглянуті", - "ignored": "Ignored", + "ignored": "Ігнорується", "followers": "Відстежувачі", "following": "Відстежувані", "aboutme": "Про мене", @@ -85,7 +85,7 @@ "has_no_posts": "Цей користувач ще ніколи нічого не постив.", "has_no_topics": "Цей користувач ще ніколи не створював нових тем.", "has_no_watched_topics": "Цей користувач ще ніколи не переглядав жодної теми.", - "has_no_ignored_topics": "This user hasn't ignored any topics yet.", + "has_no_ignored_topics": "Цей користувач ще не проігнорував будь-які теми.", "has_no_upvoted_posts": "Цей користувач ще не голосував за жоден з постів.", "has_no_downvoted_posts": "Цей користувач ще не голосував проти жодного поста.", "has_no_voted_posts": "У цього користувача немає постів за котрі хтось голосував", @@ -105,7 +105,7 @@ "upvote-notif-freq.all": "All Upvotes", "upvote-notif-freq.everyTen": "Every Ten Upvotes", "upvote-notif-freq.logarithmic": "On 10, 100, 1000...", - "upvote-notif-freq.disabled": "Disabled", + "upvote-notif-freq.disabled": "Вимкнено", "browsing": "Налаштування перегляду", "open_links_in_new_tab": "Відкривати зовнішні посилання у новій вкладці", "enable_topic_searching": "Увімкнути пошук у темах", @@ -126,9 +126,9 @@ "sso.title": "Сервіси єдиного входу", "sso.associated": "Зв'язані з", "sso.not-associated": "Натисніть тут, щоб зв'язати з", - "sso.dissociate": "Dissociate", - "sso.dissociate-confirm-title": "Confirm Dissociation", - "sso.dissociate-confirm": "Are you sure you wish to dissociate your account from %1?", + "sso.dissociate": "Від'єднати", + "sso.dissociate-confirm-title": "Підтвердьте від'єднання", + "sso.dissociate-confirm": "Ви впевнені, що хочете відв'єднати свій обліковий запис від %1?", "info.latest-flags": "Останні скарги", "info.no-flags": "Не знайдено постів зі скаргами", "info.ban-history": "Історія банів", From b9d410d6123bfcb1e1550ef68840baf085b0567e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 20 Feb 2018 12:52:59 -0500 Subject: [PATCH 10/23] closes #6332 --- src/user/digest.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/user/digest.js b/src/user/digest.js index b1562aab3f..876e1b7a07 100644 --- a/src/user/digest.js +++ b/src/user/digest.js @@ -106,14 +106,14 @@ Digest.send = function (data, callback) { function (next) { async.parallel({ notifications: async.apply(user.notifications.getDailyUnread, userObj.uid), - popular: async.apply(topics.getPopularTopics, data.interval, userObj.uid, 0, 9), + topics: async.apply(getTermTopics, data.interval, userObj.uid, 0, 9), }, next); }, function (data, next) { var notifications = data.notifications.filter(Boolean); // If there are no notifications and no new topics, don't bother sending a digest - if (!notifications.length && !data.popular.topics.length) { + if (!notifications.length && !data.topics.length) { return next(); } @@ -124,7 +124,7 @@ Digest.send = function (data, callback) { }); // Fix relative paths in topic data - data.popular.topics = data.popular.topics.map(function (topicObj) { + data.topics = data.topics.map(function (topicObj) { var user = topicObj.hasOwnProperty('teaser') && topicObj.teaser !== undefined ? topicObj.teaser.user : topicObj.user; if (user && user.picture && utils.isRelativeUrl(user.picture)) { user.picture = nconf.get('base_url') + user.picture; @@ -138,7 +138,7 @@ Digest.send = function (data, callback) { username: userObj.username, userslug: userObj.userslug, notifications: notifications, - recent: data.popular.topics, + recent: data.topics, interval: data.interval, showUnsubscribe: true, }, function (err) { @@ -154,4 +154,22 @@ Digest.send = function (data, callback) { ], function (err) { callback(err, emailsSent); }); + + function getTermTopics(term, uid, start, stop, callback) { + async.waterfall([ + function (next) { + topics.getPopularTopics(term, uid, start, stop, next); + }, + function (data, next) { + if (!data.topics.length) { + topics.getLatestTopics(uid, start, stop, term, next); + } else { + next(null, data); + } + }, + function (data, next) { + next(null, data.topics); + }, + ], callback); + } }; From 9a1f722a0540f382bf83809419d03ca8e096a163 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 20 Feb 2018 14:51:41 -0500 Subject: [PATCH 11/23] appending X-Upstream-Hostname header in dev mode --- src/middleware/headers.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/middleware/headers.js b/src/middleware/headers.js index eb11ff8718..035608eab6 100644 --- a/src/middleware/headers.js +++ b/src/middleware/headers.js @@ -1,5 +1,7 @@ 'use strict'; +var os = require('os'); + var meta = require('../meta'); module.exports = function (middleware) { @@ -15,6 +17,10 @@ module.exports = function (middleware) { headers['Access-Control-Allow-Origin'] = encodeURI(meta.config['access-control-allow-origin']); } + if (process.env.NODE_ENV === 'development') { + headers['X-Upstream-Hostname'] = os.hostname(); + } + for (var key in headers) { if (headers.hasOwnProperty(key) && headers[key]) { res.setHeader(key, headers[key]); From a4a961639d06430ed1036dc97bc647f29a68e786 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 20 Feb 2018 15:32:44 -0500 Subject: [PATCH 12/23] only triggering forum updated messaging if hostname matches, fixes #6333 --- public/src/app.js | 2 +- public/src/sockets.js | 4 ++++ src/socket.io/index.js | 2 ++ src/webserver.js | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/public/src/app.js b/public/src/app.js index 8a2dd19c18..080063cc89 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -75,7 +75,7 @@ app.cacheBuster = null; socket.removeAllListeners('event:nodebb.ready'); socket.on('event:nodebb.ready', function (data) { - if (!app.cacheBuster || app.cacheBuster !== data['cache-buster']) { + if ((data.hostname === app.upstreamHost) && (!app.cacheBuster || app.cacheBuster !== data['cache-buster'])) { app.cacheBuster = data['cache-buster']; app.alert({ diff --git a/public/src/sockets.js b/public/src/sockets.js index 6b11f49e4f..1aaf02ca53 100644 --- a/public/src/sockets.js +++ b/public/src/sockets.js @@ -34,6 +34,10 @@ app.isConnected = false; } }); + socket.on('setHostname', function (hostname) { + app.upstreamHost = hostname; + }); + socket.on('event:banned', onEventBanned); socket.on('event:alert', app.alert); diff --git a/src/socket.io/index.js b/src/socket.io/index.js index 2e897d0c4c..c22f96154f 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -1,5 +1,6 @@ 'use strict'; +var os = require('os'); var async = require('async'); var nconf = require('nconf'); var winston = require('winston'); @@ -84,6 +85,7 @@ function onConnect(socket) { socket.join('sess_' + socket.request.signedCookies[nconf.get('sessionKey')]); io.sockets.sockets[socket.id].emit('checkSession', socket.uid); + io.sockets.sockets[socket.id].emit('setHostname', os.hostname()); } function onMessage(socket, payload) { diff --git a/src/webserver.js b/src/webserver.js index 57904f8dd0..c4c97fd058 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -3,6 +3,7 @@ var fs = require('fs'); var path = require('path'); +var os = require('os'); var nconf = require('nconf'); var express = require('express'); var app = express(); @@ -72,6 +73,7 @@ module.exports.listen = function (callback) { require('./socket.io').server.emit('event:nodebb.ready', { 'cache-buster': meta.config['cache-buster'], + hostname: os.hostname(), }); plugins.fireHook('action:nodebb.ready'); From 7edc58b727781ac6a1097ebe4b8789f4afcfc02d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 20 Feb 2018 16:11:07 -0500 Subject: [PATCH 13/23] stricter Referrer-Policy to reduce unintended information leakage --- src/middleware/headers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/middleware/headers.js b/src/middleware/headers.js index 035608eab6..d63f163d7c 100644 --- a/src/middleware/headers.js +++ b/src/middleware/headers.js @@ -11,6 +11,7 @@ module.exports = function (middleware) { 'X-Frame-Options': meta.config['allow-from-uri'] ? 'ALLOW-FROM ' + encodeURI(meta.config['allow-from-uri']) : 'SAMEORIGIN', 'Access-Control-Allow-Methods': encodeURI(meta.config['access-control-allow-methods'] || ''), 'Access-Control-Allow-Headers': encodeURI(meta.config['access-control-allow-headers'] || ''), + 'Referrer-Policy': 'strict-origin-when-cross-origin', // consider using helmet? }; if (meta.config['access-control-allow-origin']) { From 964fd20213429bc6ce8225e620d739386b3fde1f Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 20 Feb 2018 16:42:13 -0500 Subject: [PATCH 14/23] removed addNoReferrer usage as it is done server-side now --- public/src/utils.js | 14 -------------- public/src/widgets.js | 1 - 2 files changed, 15 deletions(-) diff --git a/public/src/utils.js b/public/src/utils.js index 77c90c4fd9..7443a0ff8a 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -553,20 +553,6 @@ return str.toString().replace(escapeChars, replaceChar); }, - addNoReferrer: function (containerEl) { - containerEl.find('a').attr('rel', function (idx, value) { - value = value ? value.split(' ') : []; - - ['noopener', 'noreferrer'].forEach(function (property) { - if (value.indexOf(property) === -1) { - value.push(property); - } - }); - - return value.join(' '); - }); - }, - isAndroidBrowser: function () { // http://stackoverflow.com/questions/9286355/how-to-detect-only-the-native-android-browser var nua = navigator.userAgent; diff --git a/public/src/widgets.js b/public/src/widgets.js index 8123e18103..badc55c892 100644 --- a/public/src/widgets.js +++ b/public/src/widgets.js @@ -58,7 +58,6 @@ title: $(this).attr('title'), }); }); - utils.addNoReferrer(widgetAreas); $(window).trigger('action:widgets.loaded', {}); callback(); }; From 12fdd7bb6338ab75eb9fd68361b05f1e8b8774fd Mon Sep 17 00:00:00 2001 From: "Misty (Bot)" Date: Wed, 21 Feb 2018 09:25:23 +0000 Subject: [PATCH 15/23] Latest translations and fallbacks --- public/language/ru/notifications.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/language/ru/notifications.json b/public/language/ru/notifications.json index abccf0fe81..6ee7b75b4d 100644 --- a/public/language/ru/notifications.json +++ b/public/language/ru/notifications.json @@ -41,18 +41,18 @@ "user_started_following_you_multiple": "Участник %1 и %2 других подписались на вас.", "new_register": "Посетитель %1 отправил запрос на регистрацию.", "new_register_multiple": "В очереди %1 заявок на регистрацию.", - "flag_assigned_to_you": "Flag %1 has been assigned to you", - "post_awaiting_review": "Post awaiting review", + "flag_assigned_to_you": "Метка%1 была вам назначена", + "post_awaiting_review": "Сообщение ожидающее рассмотрения", "email-confirmed": "Электронная почта подтверждена", "email-confirmed-message": "Спасибо за подтверждение адреса электронной почты. Ваша учётная запись активирована. Добро пожаловать на наш сайт!", "email-confirm-error-message": "Ошибка проверки адреса электронной почты. Возможно, введён неправильно код подтверждения, либо у него истёк срок действия.", "email-confirm-sent": "Письмо с проверочным кодом отправлено на ваш электронный адрес", - "none": "None", - "notification_only": "Notification Only", - "email_only": "Email Only", - "notification_and_email": "Notification & Email", - "notificationType_upvote": "When someone upvotes your post", - "notificationType_new-topic": "When someone you follow posts a topic", + "none": "Пусто", + "notification_only": "Только уведомление", + "email_only": "Только электронная почта", + "notification_and_email": "Уведомление & Электронная почта", + "notificationType_upvote": "Когда кто-то проголосовал за ваше сообщение", + "notificationType_new-topic": "Отслеживать сообщения в вашей теме", "notificationType_new-reply": "When a new reply is posted in a topic you are watching", "notificationType_follow": "When someone starts following you", "notificationType_new-chat": "When you receive a chat message", From 264893a71bdc7a131fb72b2d54665f7bdb4daca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 21 Feb 2018 08:41:14 -0500 Subject: [PATCH 16/23] closes #6336 --- public/src/admin/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/admin/settings.js b/public/src/admin/settings.js index 803a3f923c..f42584e6d0 100644 --- a/public/src/admin/settings.js +++ b/public/src/admin/settings.js @@ -143,7 +143,7 @@ define('admin/settings', ['uploader'], function (uploader) { if (ajaxify.currentPage === 'admin/general/sounds') { ajaxify.refresh(); } else { - $('#' + uploadBtn.attr('data-target')).val([image, Date.now()].join('?v=')); + $('#' + uploadBtn.attr('data-target')).val(image); } }); }); From 52678621f97f45917977bc6fa26df790eb48685d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 21 Feb 2018 11:06:00 -0500 Subject: [PATCH 17/23] revising minimum password strength to be 1 instead of 0 --- src/controllers/accounts/edit.js | 2 +- src/controllers/index.js | 2 +- .../1.7.6/update_min_pass_strength.js | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/upgrades/1.7.6/update_min_pass_strength.js diff --git a/src/controllers/accounts/edit.js b/src/controllers/accounts/edit.js index 5e40b83ef2..08f5edfaf3 100644 --- a/src/controllers/accounts/edit.js +++ b/src/controllers/accounts/edit.js @@ -89,7 +89,7 @@ function renderRoute(name, req, res, next) { if (name === 'password') { userData.minimumPasswordLength = parseInt(meta.config.minimumPasswordLength, 10); - userData.minimumPasswordStrength = parseInt(meta.config.minimumPasswordStrength || 0, 10); + userData.minimumPasswordStrength = parseInt(meta.config.minimumPasswordStrength || 1, 10); } userData.title = '[[pages:account/edit/' + name + ', ' + userData.username + ']]'; diff --git a/src/controllers/index.js b/src/controllers/index.js index f6bfc322f4..665be289c6 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -166,7 +166,7 @@ Controllers.register = function (req, res, next) { data.minimumUsernameLength = parseInt(meta.config.minimumUsernameLength, 10); data.maximumUsernameLength = parseInt(meta.config.maximumUsernameLength, 10); data.minimumPasswordLength = parseInt(meta.config.minimumPasswordLength, 10); - data.minimumPasswordStrength = parseInt(meta.config.minimumPasswordStrength || 0, 10); + data.minimumPasswordStrength = parseInt(meta.config.minimumPasswordStrength || 1, 10); data.termsOfUse = termsOfUse.postData.content; data.breadcrumbs = helpers.buildBreadcrumbs([{ text: '[[register:register]]', diff --git a/src/upgrades/1.7.6/update_min_pass_strength.js b/src/upgrades/1.7.6/update_min_pass_strength.js new file mode 100644 index 0000000000..c051d1d72e --- /dev/null +++ b/src/upgrades/1.7.6/update_min_pass_strength.js @@ -0,0 +1,22 @@ +'use strict'; + +var db = require('../../database'); + +var async = require('async'); + +module.exports = { + name: 'Revising minimum password strength to 1 (from 0)', + timestamp: Date.UTC(2017, 1, 21), + method: function (callback) { + async.waterfall([ + async.apply(db.getObjectField.bind(db), 'config', 'minimumPasswordStrength'), + function (strength, next) { + if (!strength) { + return db.setObjectField('config', 'minimumPasswordStrength', 1, next); + } + + setImmediate(next); + }, + ], callback); + }, +}; From a0dfc43cc4ef8d83dd69d054611b29217f2cdeb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 21 Feb 2018 11:49:53 -0500 Subject: [PATCH 18/23] up composer --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index bbb50e76d6..82f349de5e 100644 --- a/install/package.json +++ b/install/package.json @@ -60,7 +60,7 @@ "morgan": "^1.9.0", "mousetrap": "^1.6.1", "nconf": "^0.9.1", - "nodebb-plugin-composer-default": "6.0.14", + "nodebb-plugin-composer-default": "6.0.15", "nodebb-plugin-dbsearch": "2.0.9", "nodebb-plugin-emoji": "^2.1.0", "nodebb-plugin-emoji-android": "2.0.0", From c7b73b4e4134e568786a020c7e850cd4c98bdc5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 21 Feb 2018 12:52:26 -0500 Subject: [PATCH 19/23] closes #6337 --- src/controllers/admin/plugins.js | 13 ++++++++++--- src/views/admin/extend/plugins.tpl | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/controllers/admin/plugins.js b/src/controllers/admin/plugins.js index b04458edae..b5863e7c9e 100644 --- a/src/controllers/admin/plugins.js +++ b/src/controllers/admin/plugins.js @@ -33,11 +33,18 @@ pluginsController.get = function (req, res, next) { var compatiblePkgNames = payload.compatible.map(function (pkgData) { return pkgData.name; }); + var installedPlugins = payload.compatible.filter(function (plugin) { + return plugin && plugin.installed; + }); + var activePlugins = payload.all.filter(function (plugin) { + return plugin && plugin.installed && plugin.active; + }); res.render('admin/extend/plugins', { - installed: payload.compatible.filter(function (plugin) { - return plugin.installed; - }), + installed: installedPlugins, + installedCount: installedPlugins.length, + activeCount: activePlugins.length, + inactiveCount: Math.max(0, installedPlugins.length - activePlugins.length), upgradeCount: payload.compatible.reduce(function (count, current) { if (current.installed && current.outdated) { count += 1; diff --git a/src/views/admin/extend/plugins.tpl b/src/views/admin/extend/plugins.tpl index 7afffd5e08..cbf44febf8 100644 --- a/src/views/admin/extend/plugins.tpl +++ b/src/views/admin/extend/plugins.tpl @@ -1,7 +1,16 @@